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; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 333 | }; |
| 334 | |
| 335 | /* |
| 336 | * configuration template - to be copied to the spec instance |
| 337 | */ |
| 338 | struct alc_config_preset { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 339 | struct snd_kcontrol_new *mixers[5]; /* should be identical size |
| 340 | * with spec |
| 341 | */ |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 342 | struct snd_kcontrol_new *cap_mixer; /* capture mixer */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 343 | const struct hda_verb *init_verbs[5]; |
| 344 | unsigned int num_dacs; |
| 345 | hda_nid_t *dac_nids; |
| 346 | hda_nid_t dig_out_nid; /* optional */ |
| 347 | hda_nid_t hp_nid; /* optional */ |
Wu Fengguang | b25c9da | 2009-02-06 15:02:27 +0800 | [diff] [blame] | 348 | hda_nid_t *slave_dig_outs; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 349 | unsigned int num_adc_nids; |
| 350 | hda_nid_t *adc_nids; |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 351 | hda_nid_t *capsrc_nids; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 352 | hda_nid_t dig_in_nid; |
| 353 | unsigned int num_channel_mode; |
| 354 | const struct hda_channel_mode *channel_mode; |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 355 | int need_dac_fix; |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 356 | unsigned int num_mux_defs; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 357 | const struct hda_input_mux *input_mux; |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 358 | void (*unsol_event)(struct hda_codec *, unsigned int); |
| 359 | void (*init_hook)(struct hda_codec *); |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 360 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 361 | struct hda_amp_list *loopbacks; |
| 362 | #endif |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 363 | }; |
| 364 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 365 | |
| 366 | /* |
| 367 | * input MUX handling |
| 368 | */ |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 369 | static int alc_mux_enum_info(struct snd_kcontrol *kcontrol, |
| 370 | struct snd_ctl_elem_info *uinfo) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 371 | { |
| 372 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 373 | struct alc_spec *spec = codec->spec; |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 374 | unsigned int mux_idx = snd_ctl_get_ioffidx(kcontrol, &uinfo->id); |
| 375 | if (mux_idx >= spec->num_mux_defs) |
| 376 | mux_idx = 0; |
| 377 | return snd_hda_input_mux_info(&spec->input_mux[mux_idx], uinfo); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 378 | } |
| 379 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 380 | static int alc_mux_enum_get(struct snd_kcontrol *kcontrol, |
| 381 | struct snd_ctl_elem_value *ucontrol) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 382 | { |
| 383 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 384 | struct alc_spec *spec = codec->spec; |
| 385 | unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id); |
| 386 | |
| 387 | ucontrol->value.enumerated.item[0] = spec->cur_mux[adc_idx]; |
| 388 | return 0; |
| 389 | } |
| 390 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 391 | static int alc_mux_enum_put(struct snd_kcontrol *kcontrol, |
| 392 | struct snd_ctl_elem_value *ucontrol) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 393 | { |
| 394 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 395 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | cd896c3 | 2008-11-18 12:36:33 +0100 | [diff] [blame] | 396 | const struct hda_input_mux *imux; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 397 | unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id); |
Takashi Iwai | cd896c3 | 2008-11-18 12:36:33 +0100 | [diff] [blame] | 398 | unsigned int mux_idx; |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 399 | hda_nid_t nid = spec->capsrc_nids ? |
| 400 | spec->capsrc_nids[adc_idx] : spec->adc_nids[adc_idx]; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 401 | |
Takashi Iwai | cd896c3 | 2008-11-18 12:36:33 +0100 | [diff] [blame] | 402 | mux_idx = adc_idx >= spec->num_mux_defs ? 0 : adc_idx; |
| 403 | imux = &spec->input_mux[mux_idx]; |
| 404 | |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 405 | if (spec->capture_style && |
| 406 | !(spec->capture_style == CAPT_1MUX_MIX && !adc_idx)) { |
Takashi Iwai | 54cbc9a | 2008-10-31 15:24:04 +0100 | [diff] [blame] | 407 | /* Matrix-mixer style (e.g. ALC882) */ |
| 408 | unsigned int *cur_val = &spec->cur_mux[adc_idx]; |
| 409 | unsigned int i, idx; |
| 410 | |
| 411 | idx = ucontrol->value.enumerated.item[0]; |
| 412 | if (idx >= imux->num_items) |
| 413 | idx = imux->num_items - 1; |
| 414 | if (*cur_val == idx) |
| 415 | return 0; |
| 416 | for (i = 0; i < imux->num_items; i++) { |
| 417 | unsigned int v = (i == idx) ? 0 : HDA_AMP_MUTE; |
| 418 | snd_hda_codec_amp_stereo(codec, nid, HDA_INPUT, |
| 419 | imux->items[i].index, |
| 420 | HDA_AMP_MUTE, v); |
| 421 | } |
| 422 | *cur_val = idx; |
| 423 | return 1; |
| 424 | } else { |
| 425 | /* MUX style (e.g. ALC880) */ |
Takashi Iwai | cd896c3 | 2008-11-18 12:36:33 +0100 | [diff] [blame] | 426 | return snd_hda_input_mux_put(codec, imux, ucontrol, nid, |
Takashi Iwai | 54cbc9a | 2008-10-31 15:24:04 +0100 | [diff] [blame] | 427 | &spec->cur_mux[adc_idx]); |
| 428 | } |
| 429 | } |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 430 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 431 | /* |
| 432 | * channel mode setting |
| 433 | */ |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 434 | static int alc_ch_mode_info(struct snd_kcontrol *kcontrol, |
| 435 | struct snd_ctl_elem_info *uinfo) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 436 | { |
| 437 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 438 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 439 | return snd_hda_ch_mode_info(codec, uinfo, spec->channel_mode, |
| 440 | spec->num_channel_mode); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 441 | } |
| 442 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 443 | static int alc_ch_mode_get(struct snd_kcontrol *kcontrol, |
| 444 | struct snd_ctl_elem_value *ucontrol) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 445 | { |
| 446 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 447 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 448 | return snd_hda_ch_mode_get(codec, ucontrol, spec->channel_mode, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 449 | spec->num_channel_mode, |
| 450 | spec->multiout.max_channels); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 451 | } |
| 452 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 453 | static int alc_ch_mode_put(struct snd_kcontrol *kcontrol, |
| 454 | struct snd_ctl_elem_value *ucontrol) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 455 | { |
| 456 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 457 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 458 | int err = snd_hda_ch_mode_put(codec, ucontrol, spec->channel_mode, |
| 459 | spec->num_channel_mode, |
| 460 | &spec->multiout.max_channels); |
Takashi Iwai | bd2033f | 2006-10-10 19:49:31 +0200 | [diff] [blame] | 461 | if (err >= 0 && spec->need_dac_fix) |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 462 | spec->multiout.num_dacs = spec->multiout.max_channels / 2; |
| 463 | return err; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 464 | } |
| 465 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 466 | /* |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 467 | * Control the mode of pin widget settings via the mixer. "pc" is used |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 468 | * instead of "%" to avoid consequences of accidently treating the % as |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 469 | * being part of a format specifier. Maximum allowed length of a value is |
| 470 | * 63 characters plus NULL terminator. |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 471 | * |
| 472 | * Note: some retasking pin complexes seem to ignore requests for input |
| 473 | * states other than HiZ (eg: PIN_VREFxx) and revert to HiZ if any of these |
| 474 | * are requested. Therefore order this list so that this behaviour will not |
| 475 | * cause problems when mixer clients move through the enum sequentially. |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 476 | * NIDs 0x0f and 0x10 have been observed to have this behaviour as of |
| 477 | * March 2006. |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 478 | */ |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 479 | static char *alc_pin_mode_names[] = { |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 480 | "Mic 50pc bias", "Mic 80pc bias", |
| 481 | "Line in", "Line out", "Headphone out", |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 482 | }; |
| 483 | static unsigned char alc_pin_mode_values[] = { |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 484 | PIN_VREF50, PIN_VREF80, PIN_IN, PIN_OUT, PIN_HP, |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 485 | }; |
| 486 | /* The control can present all 5 options, or it can limit the options based |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 487 | * in the pin being assumed to be exclusively an input or an output pin. In |
| 488 | * addition, "input" pins may or may not process the mic bias option |
| 489 | * depending on actual widget capability (NIDs 0x0f and 0x10 don't seem to |
| 490 | * accept requests for bias as of chip versions up to March 2006) and/or |
| 491 | * wiring in the computer. |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 492 | */ |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 493 | #define ALC_PIN_DIR_IN 0x00 |
| 494 | #define ALC_PIN_DIR_OUT 0x01 |
| 495 | #define ALC_PIN_DIR_INOUT 0x02 |
| 496 | #define ALC_PIN_DIR_IN_NOMICBIAS 0x03 |
| 497 | #define ALC_PIN_DIR_INOUT_NOMICBIAS 0x04 |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 498 | |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 499 | /* Info about the pin modes supported by the different pin direction modes. |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 500 | * For each direction the minimum and maximum values are given. |
| 501 | */ |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 502 | static signed char alc_pin_mode_dir_info[5][2] = { |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 503 | { 0, 2 }, /* ALC_PIN_DIR_IN */ |
| 504 | { 3, 4 }, /* ALC_PIN_DIR_OUT */ |
| 505 | { 0, 4 }, /* ALC_PIN_DIR_INOUT */ |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 506 | { 2, 2 }, /* ALC_PIN_DIR_IN_NOMICBIAS */ |
| 507 | { 2, 4 }, /* ALC_PIN_DIR_INOUT_NOMICBIAS */ |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 508 | }; |
| 509 | #define alc_pin_mode_min(_dir) (alc_pin_mode_dir_info[_dir][0]) |
| 510 | #define alc_pin_mode_max(_dir) (alc_pin_mode_dir_info[_dir][1]) |
| 511 | #define alc_pin_mode_n_items(_dir) \ |
| 512 | (alc_pin_mode_max(_dir)-alc_pin_mode_min(_dir)+1) |
| 513 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 514 | static int alc_pin_mode_info(struct snd_kcontrol *kcontrol, |
| 515 | struct snd_ctl_elem_info *uinfo) |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 516 | { |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 517 | unsigned int item_num = uinfo->value.enumerated.item; |
| 518 | unsigned char dir = (kcontrol->private_value >> 16) & 0xff; |
| 519 | |
| 520 | uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED; |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 521 | uinfo->count = 1; |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 522 | uinfo->value.enumerated.items = alc_pin_mode_n_items(dir); |
| 523 | |
| 524 | if (item_num<alc_pin_mode_min(dir) || item_num>alc_pin_mode_max(dir)) |
| 525 | item_num = alc_pin_mode_min(dir); |
| 526 | strcpy(uinfo->value.enumerated.name, alc_pin_mode_names[item_num]); |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 527 | return 0; |
| 528 | } |
| 529 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 530 | static int alc_pin_mode_get(struct snd_kcontrol *kcontrol, |
| 531 | struct snd_ctl_elem_value *ucontrol) |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 532 | { |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 533 | unsigned int i; |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 534 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 535 | hda_nid_t nid = kcontrol->private_value & 0xffff; |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 536 | unsigned char dir = (kcontrol->private_value >> 16) & 0xff; |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 537 | long *valp = ucontrol->value.integer.value; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 538 | unsigned int pinctl = snd_hda_codec_read(codec, nid, 0, |
| 539 | AC_VERB_GET_PIN_WIDGET_CONTROL, |
| 540 | 0x00); |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 541 | |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 542 | /* Find enumerated value for current pinctl setting */ |
| 543 | i = alc_pin_mode_min(dir); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 544 | while (alc_pin_mode_values[i] != pinctl && i <= alc_pin_mode_max(dir)) |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 545 | i++; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 546 | *valp = i <= alc_pin_mode_max(dir) ? i: alc_pin_mode_min(dir); |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 547 | return 0; |
| 548 | } |
| 549 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 550 | static int alc_pin_mode_put(struct snd_kcontrol *kcontrol, |
| 551 | struct snd_ctl_elem_value *ucontrol) |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 552 | { |
| 553 | signed int change; |
| 554 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 555 | hda_nid_t nid = kcontrol->private_value & 0xffff; |
| 556 | unsigned char dir = (kcontrol->private_value >> 16) & 0xff; |
| 557 | long val = *ucontrol->value.integer.value; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 558 | unsigned int pinctl = snd_hda_codec_read(codec, nid, 0, |
| 559 | AC_VERB_GET_PIN_WIDGET_CONTROL, |
| 560 | 0x00); |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 561 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 562 | if (val < alc_pin_mode_min(dir) || val > alc_pin_mode_max(dir)) |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 563 | val = alc_pin_mode_min(dir); |
| 564 | |
| 565 | change = pinctl != alc_pin_mode_values[val]; |
Jonathan Woithe | cdcd926 | 2006-02-28 11:36:42 +0100 | [diff] [blame] | 566 | if (change) { |
| 567 | /* Set pin mode to that requested */ |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 568 | snd_hda_codec_write_cache(codec, nid, 0, |
| 569 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 570 | alc_pin_mode_values[val]); |
Jonathan Woithe | cdcd926 | 2006-02-28 11:36:42 +0100 | [diff] [blame] | 571 | |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 572 | /* Also enable the retasking pin's input/output as required |
Jonathan Woithe | cdcd926 | 2006-02-28 11:36:42 +0100 | [diff] [blame] | 573 | * for the requested pin mode. Enum values of 2 or less are |
| 574 | * input modes. |
| 575 | * |
| 576 | * Dynamically switching the input/output buffers probably |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 577 | * reduces noise slightly (particularly on input) so we'll |
| 578 | * do it. However, having both input and output buffers |
| 579 | * enabled simultaneously doesn't seem to be problematic if |
| 580 | * this turns out to be necessary in the future. |
Jonathan Woithe | cdcd926 | 2006-02-28 11:36:42 +0100 | [diff] [blame] | 581 | */ |
| 582 | if (val <= 2) { |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 583 | snd_hda_codec_amp_stereo(codec, nid, HDA_OUTPUT, 0, |
| 584 | HDA_AMP_MUTE, HDA_AMP_MUTE); |
| 585 | snd_hda_codec_amp_stereo(codec, nid, HDA_INPUT, 0, |
| 586 | HDA_AMP_MUTE, 0); |
Jonathan Woithe | cdcd926 | 2006-02-28 11:36:42 +0100 | [diff] [blame] | 587 | } else { |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 588 | snd_hda_codec_amp_stereo(codec, nid, HDA_INPUT, 0, |
| 589 | HDA_AMP_MUTE, HDA_AMP_MUTE); |
| 590 | snd_hda_codec_amp_stereo(codec, nid, HDA_OUTPUT, 0, |
| 591 | HDA_AMP_MUTE, 0); |
Jonathan Woithe | cdcd926 | 2006-02-28 11:36:42 +0100 | [diff] [blame] | 592 | } |
| 593 | } |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 594 | return change; |
| 595 | } |
| 596 | |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 597 | #define ALC_PIN_MODE(xname, nid, dir) \ |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 598 | { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \ |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 599 | .info = alc_pin_mode_info, \ |
| 600 | .get = alc_pin_mode_get, \ |
| 601 | .put = alc_pin_mode_put, \ |
| 602 | .private_value = nid | (dir<<16) } |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 603 | |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 604 | /* A switch control for ALC260 GPIO pins. Multiple GPIOs can be ganged |
| 605 | * together using a mask with more than one bit set. This control is |
| 606 | * currently used only by the ALC260 test model. At this stage they are not |
| 607 | * needed for any "production" models. |
| 608 | */ |
| 609 | #ifdef CONFIG_SND_DEBUG |
Takashi Iwai | a5ce889 | 2007-07-23 15:42:26 +0200 | [diff] [blame] | 610 | #define alc_gpio_data_info snd_ctl_boolean_mono_info |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 611 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 612 | static int alc_gpio_data_get(struct snd_kcontrol *kcontrol, |
| 613 | struct snd_ctl_elem_value *ucontrol) |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 614 | { |
| 615 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 616 | hda_nid_t nid = kcontrol->private_value & 0xffff; |
| 617 | unsigned char mask = (kcontrol->private_value >> 16) & 0xff; |
| 618 | long *valp = ucontrol->value.integer.value; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 619 | unsigned int val = snd_hda_codec_read(codec, nid, 0, |
| 620 | AC_VERB_GET_GPIO_DATA, 0x00); |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 621 | |
| 622 | *valp = (val & mask) != 0; |
| 623 | return 0; |
| 624 | } |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 625 | static int alc_gpio_data_put(struct snd_kcontrol *kcontrol, |
| 626 | struct snd_ctl_elem_value *ucontrol) |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 627 | { |
| 628 | signed int change; |
| 629 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 630 | hda_nid_t nid = kcontrol->private_value & 0xffff; |
| 631 | unsigned char mask = (kcontrol->private_value >> 16) & 0xff; |
| 632 | long val = *ucontrol->value.integer.value; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 633 | unsigned int gpio_data = snd_hda_codec_read(codec, nid, 0, |
| 634 | AC_VERB_GET_GPIO_DATA, |
| 635 | 0x00); |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 636 | |
| 637 | /* Set/unset the masked GPIO bit(s) as needed */ |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 638 | change = (val == 0 ? 0 : mask) != (gpio_data & mask); |
| 639 | if (val == 0) |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 640 | gpio_data &= ~mask; |
| 641 | else |
| 642 | gpio_data |= mask; |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 643 | snd_hda_codec_write_cache(codec, nid, 0, |
| 644 | AC_VERB_SET_GPIO_DATA, gpio_data); |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 645 | |
| 646 | return change; |
| 647 | } |
| 648 | #define ALC_GPIO_DATA_SWITCH(xname, nid, mask) \ |
| 649 | { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \ |
| 650 | .info = alc_gpio_data_info, \ |
| 651 | .get = alc_gpio_data_get, \ |
| 652 | .put = alc_gpio_data_put, \ |
| 653 | .private_value = nid | (mask<<16) } |
| 654 | #endif /* CONFIG_SND_DEBUG */ |
| 655 | |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 656 | /* A switch control to allow the enabling of the digital IO pins on the |
| 657 | * ALC260. This is incredibly simplistic; the intention of this control is |
| 658 | * to provide something in the test model allowing digital outputs to be |
| 659 | * identified if present. If models are found which can utilise these |
| 660 | * outputs a more complete mixer control can be devised for those models if |
| 661 | * necessary. |
| 662 | */ |
| 663 | #ifdef CONFIG_SND_DEBUG |
Takashi Iwai | a5ce889 | 2007-07-23 15:42:26 +0200 | [diff] [blame] | 664 | #define alc_spdif_ctrl_info snd_ctl_boolean_mono_info |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 665 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 666 | static int alc_spdif_ctrl_get(struct snd_kcontrol *kcontrol, |
| 667 | struct snd_ctl_elem_value *ucontrol) |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 668 | { |
| 669 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 670 | hda_nid_t nid = kcontrol->private_value & 0xffff; |
| 671 | unsigned char mask = (kcontrol->private_value >> 16) & 0xff; |
| 672 | long *valp = ucontrol->value.integer.value; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 673 | unsigned int val = snd_hda_codec_read(codec, nid, 0, |
Andrew Paprocki | 3982d17 | 2007-12-19 12:13:44 +0100 | [diff] [blame] | 674 | AC_VERB_GET_DIGI_CONVERT_1, 0x00); |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 675 | |
| 676 | *valp = (val & mask) != 0; |
| 677 | return 0; |
| 678 | } |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 679 | static int alc_spdif_ctrl_put(struct snd_kcontrol *kcontrol, |
| 680 | struct snd_ctl_elem_value *ucontrol) |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 681 | { |
| 682 | signed int change; |
| 683 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 684 | hda_nid_t nid = kcontrol->private_value & 0xffff; |
| 685 | unsigned char mask = (kcontrol->private_value >> 16) & 0xff; |
| 686 | long val = *ucontrol->value.integer.value; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 687 | unsigned int ctrl_data = snd_hda_codec_read(codec, nid, 0, |
Andrew Paprocki | 3982d17 | 2007-12-19 12:13:44 +0100 | [diff] [blame] | 688 | AC_VERB_GET_DIGI_CONVERT_1, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 689 | 0x00); |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 690 | |
| 691 | /* Set/unset the masked control bit(s) as needed */ |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 692 | change = (val == 0 ? 0 : mask) != (ctrl_data & mask); |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 693 | if (val==0) |
| 694 | ctrl_data &= ~mask; |
| 695 | else |
| 696 | ctrl_data |= mask; |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 697 | snd_hda_codec_write_cache(codec, nid, 0, AC_VERB_SET_DIGI_CONVERT_1, |
| 698 | ctrl_data); |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 699 | |
| 700 | return change; |
| 701 | } |
| 702 | #define ALC_SPDIF_CTRL_SWITCH(xname, nid, mask) \ |
| 703 | { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \ |
| 704 | .info = alc_spdif_ctrl_info, \ |
| 705 | .get = alc_spdif_ctrl_get, \ |
| 706 | .put = alc_spdif_ctrl_put, \ |
| 707 | .private_value = nid | (mask<<16) } |
| 708 | #endif /* CONFIG_SND_DEBUG */ |
| 709 | |
Jonathan Woithe | f8225f6 | 2008-01-08 12:16:54 +0100 | [diff] [blame] | 710 | /* A switch control to allow the enabling EAPD digital outputs on the ALC26x. |
| 711 | * Again, this is only used in the ALC26x test models to help identify when |
| 712 | * the EAPD line must be asserted for features to work. |
| 713 | */ |
| 714 | #ifdef CONFIG_SND_DEBUG |
| 715 | #define alc_eapd_ctrl_info snd_ctl_boolean_mono_info |
| 716 | |
| 717 | static int alc_eapd_ctrl_get(struct snd_kcontrol *kcontrol, |
| 718 | struct snd_ctl_elem_value *ucontrol) |
| 719 | { |
| 720 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 721 | hda_nid_t nid = kcontrol->private_value & 0xffff; |
| 722 | unsigned char mask = (kcontrol->private_value >> 16) & 0xff; |
| 723 | long *valp = ucontrol->value.integer.value; |
| 724 | unsigned int val = snd_hda_codec_read(codec, nid, 0, |
| 725 | AC_VERB_GET_EAPD_BTLENABLE, 0x00); |
| 726 | |
| 727 | *valp = (val & mask) != 0; |
| 728 | return 0; |
| 729 | } |
| 730 | |
| 731 | static int alc_eapd_ctrl_put(struct snd_kcontrol *kcontrol, |
| 732 | struct snd_ctl_elem_value *ucontrol) |
| 733 | { |
| 734 | int change; |
| 735 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 736 | hda_nid_t nid = kcontrol->private_value & 0xffff; |
| 737 | unsigned char mask = (kcontrol->private_value >> 16) & 0xff; |
| 738 | long val = *ucontrol->value.integer.value; |
| 739 | unsigned int ctrl_data = snd_hda_codec_read(codec, nid, 0, |
| 740 | AC_VERB_GET_EAPD_BTLENABLE, |
| 741 | 0x00); |
| 742 | |
| 743 | /* Set/unset the masked control bit(s) as needed */ |
| 744 | change = (!val ? 0 : mask) != (ctrl_data & mask); |
| 745 | if (!val) |
| 746 | ctrl_data &= ~mask; |
| 747 | else |
| 748 | ctrl_data |= mask; |
| 749 | snd_hda_codec_write_cache(codec, nid, 0, AC_VERB_SET_EAPD_BTLENABLE, |
| 750 | ctrl_data); |
| 751 | |
| 752 | return change; |
| 753 | } |
| 754 | |
| 755 | #define ALC_EAPD_CTRL_SWITCH(xname, nid, mask) \ |
| 756 | { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \ |
| 757 | .info = alc_eapd_ctrl_info, \ |
| 758 | .get = alc_eapd_ctrl_get, \ |
| 759 | .put = alc_eapd_ctrl_put, \ |
| 760 | .private_value = nid | (mask<<16) } |
| 761 | #endif /* CONFIG_SND_DEBUG */ |
| 762 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 763 | /* |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 764 | */ |
| 765 | static void add_mixer(struct alc_spec *spec, struct snd_kcontrol_new *mix) |
| 766 | { |
| 767 | if (snd_BUG_ON(spec->num_mixers >= ARRAY_SIZE(spec->mixers))) |
| 768 | return; |
| 769 | spec->mixers[spec->num_mixers++] = mix; |
| 770 | } |
| 771 | |
| 772 | static void add_verb(struct alc_spec *spec, const struct hda_verb *verb) |
| 773 | { |
| 774 | if (snd_BUG_ON(spec->num_init_verbs >= ARRAY_SIZE(spec->init_verbs))) |
| 775 | return; |
| 776 | spec->init_verbs[spec->num_init_verbs++] = verb; |
| 777 | } |
| 778 | |
Takashi Iwai | daead53 | 2008-11-28 12:55:36 +0100 | [diff] [blame] | 779 | #ifdef CONFIG_PROC_FS |
| 780 | /* |
| 781 | * hook for proc |
| 782 | */ |
| 783 | static void print_realtek_coef(struct snd_info_buffer *buffer, |
| 784 | struct hda_codec *codec, hda_nid_t nid) |
| 785 | { |
| 786 | int coeff; |
| 787 | |
| 788 | if (nid != 0x20) |
| 789 | return; |
| 790 | coeff = snd_hda_codec_read(codec, nid, 0, AC_VERB_GET_PROC_COEF, 0); |
| 791 | snd_iprintf(buffer, " Processing Coefficient: 0x%02x\n", coeff); |
| 792 | coeff = snd_hda_codec_read(codec, nid, 0, |
| 793 | AC_VERB_GET_COEF_INDEX, 0); |
| 794 | snd_iprintf(buffer, " Coefficient Index: 0x%02x\n", coeff); |
| 795 | } |
| 796 | #else |
| 797 | #define print_realtek_coef NULL |
| 798 | #endif |
| 799 | |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 800 | /* |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 801 | * set up from the preset table |
| 802 | */ |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 803 | static void setup_preset(struct alc_spec *spec, |
| 804 | const struct alc_config_preset *preset) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 805 | { |
| 806 | int i; |
| 807 | |
| 808 | for (i = 0; i < ARRAY_SIZE(preset->mixers) && preset->mixers[i]; i++) |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 809 | add_mixer(spec, preset->mixers[i]); |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 810 | spec->cap_mixer = preset->cap_mixer; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 811 | for (i = 0; i < ARRAY_SIZE(preset->init_verbs) && preset->init_verbs[i]; |
| 812 | i++) |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 813 | add_verb(spec, preset->init_verbs[i]); |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 814 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 815 | spec->channel_mode = preset->channel_mode; |
| 816 | spec->num_channel_mode = preset->num_channel_mode; |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 817 | spec->need_dac_fix = preset->need_dac_fix; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 818 | |
| 819 | spec->multiout.max_channels = spec->channel_mode[0].channels; |
| 820 | |
| 821 | spec->multiout.num_dacs = preset->num_dacs; |
| 822 | spec->multiout.dac_nids = preset->dac_nids; |
| 823 | spec->multiout.dig_out_nid = preset->dig_out_nid; |
Wu Fengguang | b25c9da | 2009-02-06 15:02:27 +0800 | [diff] [blame] | 824 | spec->multiout.slave_dig_outs = preset->slave_dig_outs; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 825 | spec->multiout.hp_nid = preset->hp_nid; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 826 | |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 827 | spec->num_mux_defs = preset->num_mux_defs; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 828 | if (!spec->num_mux_defs) |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 829 | spec->num_mux_defs = 1; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 830 | spec->input_mux = preset->input_mux; |
| 831 | |
| 832 | spec->num_adc_nids = preset->num_adc_nids; |
| 833 | spec->adc_nids = preset->adc_nids; |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 834 | spec->capsrc_nids = preset->capsrc_nids; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 835 | spec->dig_in_nid = preset->dig_in_nid; |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 836 | |
| 837 | spec->unsol_event = preset->unsol_event; |
| 838 | spec->init_hook = preset->init_hook; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 839 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 840 | spec->loopback.amplist = preset->loopbacks; |
| 841 | #endif |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 842 | } |
| 843 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 844 | /* Enable GPIO mask and set output */ |
| 845 | static struct hda_verb alc_gpio1_init_verbs[] = { |
| 846 | {0x01, AC_VERB_SET_GPIO_MASK, 0x01}, |
| 847 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01}, |
| 848 | {0x01, AC_VERB_SET_GPIO_DATA, 0x01}, |
| 849 | { } |
| 850 | }; |
| 851 | |
| 852 | static struct hda_verb alc_gpio2_init_verbs[] = { |
| 853 | {0x01, AC_VERB_SET_GPIO_MASK, 0x02}, |
| 854 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x02}, |
| 855 | {0x01, AC_VERB_SET_GPIO_DATA, 0x02}, |
| 856 | { } |
| 857 | }; |
| 858 | |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 859 | static struct hda_verb alc_gpio3_init_verbs[] = { |
| 860 | {0x01, AC_VERB_SET_GPIO_MASK, 0x03}, |
| 861 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x03}, |
| 862 | {0x01, AC_VERB_SET_GPIO_DATA, 0x03}, |
| 863 | { } |
| 864 | }; |
| 865 | |
Takashi Iwai | 2c3bf9a | 2008-06-04 12:39:38 +0200 | [diff] [blame] | 866 | /* |
| 867 | * Fix hardware PLL issue |
| 868 | * On some codecs, the analog PLL gating control must be off while |
| 869 | * the default value is 1. |
| 870 | */ |
| 871 | static void alc_fix_pll(struct hda_codec *codec) |
| 872 | { |
| 873 | struct alc_spec *spec = codec->spec; |
| 874 | unsigned int val; |
| 875 | |
| 876 | if (!spec->pll_nid) |
| 877 | return; |
| 878 | snd_hda_codec_write(codec, spec->pll_nid, 0, AC_VERB_SET_COEF_INDEX, |
| 879 | spec->pll_coef_idx); |
| 880 | val = snd_hda_codec_read(codec, spec->pll_nid, 0, |
| 881 | AC_VERB_GET_PROC_COEF, 0); |
| 882 | snd_hda_codec_write(codec, spec->pll_nid, 0, AC_VERB_SET_COEF_INDEX, |
| 883 | spec->pll_coef_idx); |
| 884 | snd_hda_codec_write(codec, spec->pll_nid, 0, AC_VERB_SET_PROC_COEF, |
| 885 | val & ~(1 << spec->pll_coef_bit)); |
| 886 | } |
| 887 | |
| 888 | static void alc_fix_pll_init(struct hda_codec *codec, hda_nid_t nid, |
| 889 | unsigned int coef_idx, unsigned int coef_bit) |
| 890 | { |
| 891 | struct alc_spec *spec = codec->spec; |
| 892 | spec->pll_nid = nid; |
| 893 | spec->pll_coef_idx = coef_idx; |
| 894 | spec->pll_coef_bit = coef_bit; |
| 895 | alc_fix_pll(codec); |
| 896 | } |
| 897 | |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 898 | static void alc_sku_automute(struct hda_codec *codec) |
| 899 | { |
| 900 | struct alc_spec *spec = codec->spec; |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 901 | unsigned int present; |
| 902 | unsigned int hp_nid = spec->autocfg.hp_pins[0]; |
| 903 | unsigned int sp_nid = spec->autocfg.speaker_pins[0]; |
| 904 | |
| 905 | /* need to execute and sync at first */ |
| 906 | snd_hda_codec_read(codec, hp_nid, 0, AC_VERB_SET_PIN_SENSE, 0); |
| 907 | present = snd_hda_codec_read(codec, hp_nid, 0, |
| 908 | AC_VERB_GET_PIN_SENSE, 0); |
| 909 | spec->jack_present = (present & 0x80000000) != 0; |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 910 | snd_hda_codec_write(codec, sp_nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 911 | spec->jack_present ? 0 : PIN_OUT); |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 912 | } |
| 913 | |
Takashi Iwai | 4605b71 | 2008-10-31 14:18:24 +0100 | [diff] [blame] | 914 | #if 0 /* it's broken in some acses -- temporarily disabled */ |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 915 | static void alc_mic_automute(struct hda_codec *codec) |
| 916 | { |
| 917 | struct alc_spec *spec = codec->spec; |
| 918 | unsigned int present; |
| 919 | unsigned int mic_nid = spec->autocfg.input_pins[AUTO_PIN_MIC]; |
| 920 | unsigned int fmic_nid = spec->autocfg.input_pins[AUTO_PIN_FRONT_MIC]; |
| 921 | unsigned int mix_nid = spec->capsrc_nids[0]; |
| 922 | unsigned int capsrc_idx_mic, capsrc_idx_fmic; |
| 923 | |
| 924 | capsrc_idx_mic = mic_nid - 0x18; |
| 925 | capsrc_idx_fmic = fmic_nid - 0x18; |
| 926 | present = snd_hda_codec_read(codec, mic_nid, 0, |
| 927 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 928 | snd_hda_codec_write(codec, mix_nid, 0, AC_VERB_SET_AMP_GAIN_MUTE, |
| 929 | 0x7000 | (capsrc_idx_mic << 8) | (present ? 0 : 0x80)); |
| 930 | snd_hda_codec_write(codec, mix_nid, 0, AC_VERB_SET_AMP_GAIN_MUTE, |
| 931 | 0x7000 | (capsrc_idx_fmic << 8) | (present ? 0x80 : 0)); |
| 932 | snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, capsrc_idx_fmic, |
| 933 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
| 934 | } |
Takashi Iwai | 4605b71 | 2008-10-31 14:18:24 +0100 | [diff] [blame] | 935 | #else |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 936 | #define alc_mic_automute(codec) do {} while(0) /* NOP */ |
Takashi Iwai | 4605b71 | 2008-10-31 14:18:24 +0100 | [diff] [blame] | 937 | #endif /* disabled */ |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 938 | |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 939 | /* unsolicited event for HP jack sensing */ |
| 940 | static void alc_sku_unsol_event(struct hda_codec *codec, unsigned int res) |
| 941 | { |
| 942 | if (codec->vendor_id == 0x10ec0880) |
| 943 | res >>= 28; |
| 944 | else |
| 945 | res >>= 26; |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 946 | if (res == ALC880_HP_EVENT) |
| 947 | alc_sku_automute(codec); |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 948 | |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 949 | if (res == ALC880_MIC_EVENT) |
| 950 | alc_mic_automute(codec); |
| 951 | } |
| 952 | |
| 953 | static void alc_inithook(struct hda_codec *codec) |
| 954 | { |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 955 | alc_sku_automute(codec); |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 956 | alc_mic_automute(codec); |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 957 | } |
| 958 | |
Kailang Yang | f9423e7 | 2008-05-27 12:32:25 +0200 | [diff] [blame] | 959 | /* additional initialization for ALC888 variants */ |
| 960 | static void alc888_coef_init(struct hda_codec *codec) |
| 961 | { |
| 962 | unsigned int tmp; |
| 963 | |
| 964 | snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_COEF_INDEX, 0); |
| 965 | tmp = snd_hda_codec_read(codec, 0x20, 0, AC_VERB_GET_PROC_COEF, 0); |
| 966 | snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_COEF_INDEX, 7); |
| 967 | if ((tmp & 0xf0) == 2) |
| 968 | /* alc888S-VC */ |
| 969 | snd_hda_codec_read(codec, 0x20, 0, |
| 970 | AC_VERB_SET_PROC_COEF, 0x830); |
| 971 | else |
| 972 | /* alc888-VB */ |
| 973 | snd_hda_codec_read(codec, 0x20, 0, |
| 974 | AC_VERB_SET_PROC_COEF, 0x3030); |
| 975 | } |
| 976 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 977 | /* 32-bit subsystem ID for BIOS loading in HD Audio codec. |
| 978 | * 31 ~ 16 : Manufacture ID |
| 979 | * 15 ~ 8 : SKU ID |
| 980 | * 7 ~ 0 : Assembly ID |
| 981 | * port-A --> pin 39/41, port-E --> pin 14/15, port-D --> pin 35/36 |
| 982 | */ |
| 983 | static void alc_subsystem_id(struct hda_codec *codec, |
| 984 | unsigned int porta, unsigned int porte, |
| 985 | unsigned int portd) |
| 986 | { |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 987 | unsigned int ass, tmp, i; |
| 988 | unsigned nid; |
| 989 | struct alc_spec *spec = codec->spec; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 990 | |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 991 | ass = codec->subsystem_id & 0xffff; |
| 992 | if ((ass != codec->bus->pci->subsystem_device) && (ass & 1)) |
| 993 | goto do_sku; |
| 994 | |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 995 | /* |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 996 | * 31~30 : port conetcivity |
| 997 | * 29~21 : reserve |
| 998 | * 20 : PCBEEP input |
| 999 | * 19~16 : Check sum (15:1) |
| 1000 | * 15~1 : Custom |
| 1001 | * 0 : override |
| 1002 | */ |
| 1003 | nid = 0x1d; |
| 1004 | if (codec->vendor_id == 0x10ec0260) |
| 1005 | nid = 0x17; |
Takashi Iwai | 0e8a21b | 2009-02-20 14:13:06 +0100 | [diff] [blame] | 1006 | ass = snd_hda_codec_get_pincfg(codec, nid); |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1007 | if (!(ass & 1) && !(ass & 0x100000)) |
| 1008 | return; |
| 1009 | if ((ass >> 30) != 1) /* no physical connection */ |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 1010 | return; |
| 1011 | |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1012 | /* check sum */ |
| 1013 | tmp = 0; |
| 1014 | for (i = 1; i < 16; i++) { |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 1015 | if ((ass >> i) & 1) |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1016 | tmp++; |
| 1017 | } |
| 1018 | if (((ass >> 16) & 0xf) != tmp) |
| 1019 | return; |
| 1020 | do_sku: |
| 1021 | /* |
| 1022 | * 0 : override |
| 1023 | * 1 : Swap Jack |
| 1024 | * 2 : 0 --> Desktop, 1 --> Laptop |
| 1025 | * 3~5 : External Amplifier control |
| 1026 | * 7~6 : Reserved |
| 1027 | */ |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 1028 | tmp = (ass & 0x38) >> 3; /* external Amp control */ |
| 1029 | switch (tmp) { |
| 1030 | case 1: |
| 1031 | snd_hda_sequence_write(codec, alc_gpio1_init_verbs); |
| 1032 | break; |
| 1033 | case 3: |
| 1034 | snd_hda_sequence_write(codec, alc_gpio2_init_verbs); |
| 1035 | break; |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 1036 | case 7: |
| 1037 | snd_hda_sequence_write(codec, alc_gpio3_init_verbs); |
| 1038 | break; |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1039 | case 5: /* set EAPD output high */ |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 1040 | switch (codec->vendor_id) { |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1041 | case 0x10ec0260: |
| 1042 | snd_hda_codec_write(codec, 0x0f, 0, |
| 1043 | AC_VERB_SET_EAPD_BTLENABLE, 2); |
| 1044 | snd_hda_codec_write(codec, 0x10, 0, |
| 1045 | AC_VERB_SET_EAPD_BTLENABLE, 2); |
| 1046 | break; |
| 1047 | case 0x10ec0262: |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 1048 | case 0x10ec0267: |
| 1049 | case 0x10ec0268: |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1050 | case 0x10ec0269: |
Takashi Iwai | c6e8f2d | 2009-02-06 12:45:52 +0100 | [diff] [blame] | 1051 | case 0x10ec0272: |
Kailang Yang | f9423e7 | 2008-05-27 12:32:25 +0200 | [diff] [blame] | 1052 | case 0x10ec0660: |
| 1053 | case 0x10ec0662: |
| 1054 | case 0x10ec0663: |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1055 | case 0x10ec0862: |
Takashi Iwai | 20a3a05 | 2008-05-23 17:52:53 +0200 | [diff] [blame] | 1056 | case 0x10ec0889: |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 1057 | snd_hda_codec_write(codec, 0x14, 0, |
| 1058 | AC_VERB_SET_EAPD_BTLENABLE, 2); |
| 1059 | snd_hda_codec_write(codec, 0x15, 0, |
| 1060 | AC_VERB_SET_EAPD_BTLENABLE, 2); |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1061 | break; |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 1062 | } |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1063 | switch (codec->vendor_id) { |
| 1064 | case 0x10ec0260: |
| 1065 | snd_hda_codec_write(codec, 0x1a, 0, |
| 1066 | AC_VERB_SET_COEF_INDEX, 7); |
| 1067 | tmp = snd_hda_codec_read(codec, 0x1a, 0, |
| 1068 | AC_VERB_GET_PROC_COEF, 0); |
| 1069 | snd_hda_codec_write(codec, 0x1a, 0, |
| 1070 | AC_VERB_SET_COEF_INDEX, 7); |
| 1071 | snd_hda_codec_write(codec, 0x1a, 0, |
| 1072 | AC_VERB_SET_PROC_COEF, |
| 1073 | tmp | 0x2010); |
| 1074 | break; |
| 1075 | case 0x10ec0262: |
| 1076 | case 0x10ec0880: |
| 1077 | case 0x10ec0882: |
| 1078 | case 0x10ec0883: |
| 1079 | case 0x10ec0885: |
Takashi Iwai | 4a5a4c5 | 2009-02-06 12:46:59 +0100 | [diff] [blame] | 1080 | case 0x10ec0887: |
Takashi Iwai | 20a3a05 | 2008-05-23 17:52:53 +0200 | [diff] [blame] | 1081 | case 0x10ec0889: |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1082 | snd_hda_codec_write(codec, 0x20, 0, |
| 1083 | AC_VERB_SET_COEF_INDEX, 7); |
| 1084 | tmp = snd_hda_codec_read(codec, 0x20, 0, |
| 1085 | AC_VERB_GET_PROC_COEF, 0); |
| 1086 | snd_hda_codec_write(codec, 0x20, 0, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 1087 | AC_VERB_SET_COEF_INDEX, 7); |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1088 | snd_hda_codec_write(codec, 0x20, 0, |
| 1089 | AC_VERB_SET_PROC_COEF, |
| 1090 | tmp | 0x2010); |
| 1091 | break; |
Kailang Yang | f9423e7 | 2008-05-27 12:32:25 +0200 | [diff] [blame] | 1092 | case 0x10ec0888: |
Takashi Iwai | 1082c74 | 2008-08-22 15:24:22 +0200 | [diff] [blame] | 1093 | /*alc888_coef_init(codec);*/ /* called in alc_init() */ |
Kailang Yang | f9423e7 | 2008-05-27 12:32:25 +0200 | [diff] [blame] | 1094 | break; |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1095 | case 0x10ec0267: |
| 1096 | case 0x10ec0268: |
| 1097 | snd_hda_codec_write(codec, 0x20, 0, |
| 1098 | AC_VERB_SET_COEF_INDEX, 7); |
| 1099 | tmp = snd_hda_codec_read(codec, 0x20, 0, |
| 1100 | AC_VERB_GET_PROC_COEF, 0); |
| 1101 | snd_hda_codec_write(codec, 0x20, 0, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 1102 | AC_VERB_SET_COEF_INDEX, 7); |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1103 | snd_hda_codec_write(codec, 0x20, 0, |
| 1104 | AC_VERB_SET_PROC_COEF, |
| 1105 | tmp | 0x3000); |
| 1106 | break; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 1107 | } |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1108 | default: |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 1109 | break; |
| 1110 | } |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 1111 | |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 1112 | /* is laptop or Desktop and enable the function "Mute internal speaker |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1113 | * when the external headphone out jack is plugged" |
| 1114 | */ |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 1115 | if (!(ass & 0x8000)) |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1116 | return; |
| 1117 | /* |
| 1118 | * 10~8 : Jack location |
| 1119 | * 12~11: Headphone out -> 00: PortA, 01: PortE, 02: PortD, 03: Resvered |
| 1120 | * 14~13: Resvered |
| 1121 | * 15 : 1 --> enable the function "Mute internal speaker |
| 1122 | * when the external headphone out jack is plugged" |
| 1123 | */ |
| 1124 | if (!spec->autocfg.speaker_pins[0]) { |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 1125 | if (spec->autocfg.line_out_pins[0]) |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1126 | spec->autocfg.speaker_pins[0] = |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 1127 | spec->autocfg.line_out_pins[0]; |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1128 | else |
| 1129 | return; |
| 1130 | } |
| 1131 | |
| 1132 | if (!spec->autocfg.hp_pins[0]) { |
| 1133 | tmp = (ass >> 11) & 0x3; /* HP to chassis */ |
| 1134 | if (tmp == 0) |
| 1135 | spec->autocfg.hp_pins[0] = porta; |
| 1136 | else if (tmp == 1) |
| 1137 | spec->autocfg.hp_pins[0] = porte; |
| 1138 | else if (tmp == 2) |
| 1139 | spec->autocfg.hp_pins[0] = portd; |
| 1140 | else |
| 1141 | return; |
| 1142 | } |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 1143 | if (spec->autocfg.hp_pins[0]) |
| 1144 | snd_hda_codec_write(codec, spec->autocfg.hp_pins[0], 0, |
| 1145 | AC_VERB_SET_UNSOLICITED_ENABLE, |
| 1146 | AC_USRSP_EN | ALC880_HP_EVENT); |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1147 | |
Takashi Iwai | 4605b71 | 2008-10-31 14:18:24 +0100 | [diff] [blame] | 1148 | #if 0 /* it's broken in some acses -- temporarily disabled */ |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 1149 | if (spec->autocfg.input_pins[AUTO_PIN_MIC] && |
| 1150 | spec->autocfg.input_pins[AUTO_PIN_FRONT_MIC]) |
| 1151 | snd_hda_codec_write(codec, |
| 1152 | spec->autocfg.input_pins[AUTO_PIN_MIC], 0, |
| 1153 | AC_VERB_SET_UNSOLICITED_ENABLE, |
| 1154 | AC_USRSP_EN | ALC880_MIC_EVENT); |
Takashi Iwai | 4605b71 | 2008-10-31 14:18:24 +0100 | [diff] [blame] | 1155 | #endif /* disabled */ |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 1156 | |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1157 | spec->unsol_event = alc_sku_unsol_event; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 1158 | } |
| 1159 | |
Takashi Iwai | 41e41f1 | 2005-06-08 14:48:49 +0200 | [diff] [blame] | 1160 | /* |
Takashi Iwai | f95474e | 2007-07-10 00:47:43 +0200 | [diff] [blame] | 1161 | * Fix-up pin default configurations |
| 1162 | */ |
| 1163 | |
| 1164 | struct alc_pincfg { |
| 1165 | hda_nid_t nid; |
| 1166 | u32 val; |
| 1167 | }; |
| 1168 | |
| 1169 | static void alc_fix_pincfg(struct hda_codec *codec, |
| 1170 | const struct snd_pci_quirk *quirk, |
| 1171 | const struct alc_pincfg **pinfix) |
| 1172 | { |
| 1173 | const struct alc_pincfg *cfg; |
| 1174 | |
| 1175 | quirk = snd_pci_quirk_lookup(codec->bus->pci, quirk); |
| 1176 | if (!quirk) |
| 1177 | return; |
| 1178 | |
| 1179 | cfg = pinfix[quirk->value]; |
Takashi Iwai | 0e8a21b | 2009-02-20 14:13:06 +0100 | [diff] [blame] | 1180 | for (; cfg->nid; cfg++) |
| 1181 | snd_hda_codec_set_pincfg(codec, cfg->nid, cfg->val); |
Takashi Iwai | f95474e | 2007-07-10 00:47:43 +0200 | [diff] [blame] | 1182 | } |
| 1183 | |
| 1184 | /* |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 1185 | * ALC888 |
| 1186 | */ |
| 1187 | |
| 1188 | /* |
| 1189 | * 2ch mode |
| 1190 | */ |
| 1191 | static struct hda_verb alc888_4ST_ch2_intel_init[] = { |
| 1192 | /* Mic-in jack as mic in */ |
| 1193 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 1194 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 1195 | /* Line-in jack as Line in */ |
| 1196 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 1197 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 1198 | /* Line-Out as Front */ |
| 1199 | { 0x17, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 1200 | { } /* end */ |
| 1201 | }; |
| 1202 | |
| 1203 | /* |
| 1204 | * 4ch mode |
| 1205 | */ |
| 1206 | static struct hda_verb alc888_4ST_ch4_intel_init[] = { |
| 1207 | /* Mic-in jack as mic in */ |
| 1208 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 1209 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 1210 | /* Line-in jack as Surround */ |
| 1211 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 1212 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 1213 | /* Line-Out as Front */ |
| 1214 | { 0x17, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 1215 | { } /* end */ |
| 1216 | }; |
| 1217 | |
| 1218 | /* |
| 1219 | * 6ch mode |
| 1220 | */ |
| 1221 | static struct hda_verb alc888_4ST_ch6_intel_init[] = { |
| 1222 | /* Mic-in jack as CLFE */ |
| 1223 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 1224 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 1225 | /* Line-in jack as Surround */ |
| 1226 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 1227 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 1228 | /* Line-Out as CLFE (workaround because Mic-in is not loud enough) */ |
| 1229 | { 0x17, AC_VERB_SET_CONNECT_SEL, 0x03}, |
| 1230 | { } /* end */ |
| 1231 | }; |
| 1232 | |
| 1233 | /* |
| 1234 | * 8ch mode |
| 1235 | */ |
| 1236 | static struct hda_verb alc888_4ST_ch8_intel_init[] = { |
| 1237 | /* Mic-in jack as CLFE */ |
| 1238 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 1239 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 1240 | /* Line-in jack as Surround */ |
| 1241 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 1242 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 1243 | /* Line-Out as Side */ |
| 1244 | { 0x17, AC_VERB_SET_CONNECT_SEL, 0x03}, |
| 1245 | { } /* end */ |
| 1246 | }; |
| 1247 | |
| 1248 | static struct hda_channel_mode alc888_4ST_8ch_intel_modes[4] = { |
| 1249 | { 2, alc888_4ST_ch2_intel_init }, |
| 1250 | { 4, alc888_4ST_ch4_intel_init }, |
| 1251 | { 6, alc888_4ST_ch6_intel_init }, |
| 1252 | { 8, alc888_4ST_ch8_intel_init }, |
| 1253 | }; |
| 1254 | |
| 1255 | /* |
| 1256 | * ALC888 Fujitsu Siemens Amillo xa3530 |
| 1257 | */ |
| 1258 | |
| 1259 | static struct hda_verb alc888_fujitsu_xa3530_verbs[] = { |
| 1260 | /* Front Mic: set to PIN_IN (empty by default) */ |
| 1261 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 1262 | /* Connect Internal HP to Front */ |
| 1263 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1264 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1265 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 1266 | /* Connect Bass HP to Front */ |
| 1267 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1268 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1269 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 1270 | /* Connect Line-Out side jack (SPDIF) to Side */ |
| 1271 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1272 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1273 | {0x17, AC_VERB_SET_CONNECT_SEL, 0x03}, |
| 1274 | /* Connect Mic jack to CLFE */ |
| 1275 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1276 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1277 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 1278 | /* Connect Line-in jack to Surround */ |
| 1279 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1280 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1281 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 1282 | /* Connect HP out jack to Front */ |
| 1283 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1284 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1285 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 1286 | /* Enable unsolicited event for HP jack and Line-out jack */ |
| 1287 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 1288 | {0x17, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 1289 | {} |
| 1290 | }; |
| 1291 | |
| 1292 | static void alc888_fujitsu_xa3530_automute(struct hda_codec *codec) |
| 1293 | { |
| 1294 | unsigned int present; |
| 1295 | unsigned int bits; |
| 1296 | /* Line out presence */ |
| 1297 | present = snd_hda_codec_read(codec, 0x17, 0, |
| 1298 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 1299 | /* HP out presence */ |
| 1300 | present = present || snd_hda_codec_read(codec, 0x1b, 0, |
| 1301 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 1302 | bits = present ? HDA_AMP_MUTE : 0; |
| 1303 | /* Toggle internal speakers muting */ |
| 1304 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 1305 | HDA_AMP_MUTE, bits); |
| 1306 | /* Toggle internal bass muting */ |
| 1307 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 1308 | HDA_AMP_MUTE, bits); |
| 1309 | } |
| 1310 | |
| 1311 | static void alc888_fujitsu_xa3530_unsol_event(struct hda_codec *codec, |
| 1312 | unsigned int res) |
| 1313 | { |
| 1314 | if (res >> 26 == ALC880_HP_EVENT) |
| 1315 | alc888_fujitsu_xa3530_automute(codec); |
| 1316 | } |
| 1317 | |
| 1318 | |
| 1319 | /* |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 1320 | * ALC888 Acer Aspire 4930G model |
| 1321 | */ |
| 1322 | |
| 1323 | static struct hda_verb alc888_acer_aspire_4930g_verbs[] = { |
| 1324 | /* Front Mic: set to PIN_IN (empty by default) */ |
| 1325 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 1326 | /* Unselect Front Mic by default in input mixer 3 */ |
| 1327 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0xb)}, |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 1328 | /* Enable unsolicited event for HP jack */ |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 1329 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 1330 | /* Connect Internal HP to front */ |
| 1331 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1332 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1333 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 1334 | /* Connect HP out to front */ |
| 1335 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1336 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1337 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 1338 | { } |
| 1339 | }; |
| 1340 | |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 1341 | static struct hda_input_mux alc888_2_capture_sources[2] = { |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 1342 | /* Front mic only available on one ADC */ |
| 1343 | { |
| 1344 | .num_items = 4, |
| 1345 | .items = { |
| 1346 | { "Mic", 0x0 }, |
| 1347 | { "Line", 0x2 }, |
| 1348 | { "CD", 0x4 }, |
| 1349 | { "Front Mic", 0xb }, |
| 1350 | }, |
| 1351 | }, |
| 1352 | { |
| 1353 | .num_items = 3, |
| 1354 | .items = { |
| 1355 | { "Mic", 0x0 }, |
| 1356 | { "Line", 0x2 }, |
| 1357 | { "CD", 0x4 }, |
| 1358 | }, |
| 1359 | } |
| 1360 | }; |
| 1361 | |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 1362 | static struct snd_kcontrol_new alc888_base_mixer[] = { |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 1363 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 1364 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 1365 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 1366 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
| 1367 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, |
| 1368 | HDA_OUTPUT), |
| 1369 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 1370 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 1371 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 1372 | HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
| 1373 | HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT), |
| 1374 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 1375 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 1376 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 1377 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 1378 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 1379 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 1380 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 1381 | { } /* end */ |
| 1382 | }; |
| 1383 | |
| 1384 | static void alc888_acer_aspire_4930g_automute(struct hda_codec *codec) |
| 1385 | { |
| 1386 | unsigned int present; |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 1387 | unsigned int bits; |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 1388 | present = snd_hda_codec_read(codec, 0x15, 0, |
| 1389 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 1390 | bits = present ? HDA_AMP_MUTE : 0; |
| 1391 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 1392 | HDA_AMP_MUTE, bits); |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 1393 | } |
| 1394 | |
| 1395 | static void alc888_acer_aspire_4930g_unsol_event(struct hda_codec *codec, |
| 1396 | unsigned int res) |
| 1397 | { |
| 1398 | if (res >> 26 == ALC880_HP_EVENT) |
| 1399 | alc888_acer_aspire_4930g_automute(codec); |
| 1400 | } |
| 1401 | |
| 1402 | /* |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1403 | * ALC880 3-stack model |
| 1404 | * |
| 1405 | * DAC: Front = 0x02 (0x0c), Surr = 0x05 (0x0f), CLFE = 0x04 (0x0e) |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 1406 | * Pin assignment: Front = 0x14, Line-In/Surr = 0x1a, Mic/CLFE = 0x18, |
| 1407 | * F-Mic = 0x1b, HP = 0x19 |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1408 | */ |
| 1409 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1410 | static hda_nid_t alc880_dac_nids[4] = { |
| 1411 | /* front, rear, clfe, rear_surr */ |
| 1412 | 0x02, 0x05, 0x04, 0x03 |
| 1413 | }; |
| 1414 | |
| 1415 | static hda_nid_t alc880_adc_nids[3] = { |
| 1416 | /* ADC0-2 */ |
| 1417 | 0x07, 0x08, 0x09, |
| 1418 | }; |
| 1419 | |
| 1420 | /* The datasheet says the node 0x07 is connected from inputs, |
| 1421 | * but it shows zero connection in the real implementation on some devices. |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 1422 | * Note: this is a 915GAV bug, fixed on 915GLV |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1423 | */ |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1424 | static hda_nid_t alc880_adc_nids_alt[2] = { |
| 1425 | /* ADC1-2 */ |
| 1426 | 0x08, 0x09, |
| 1427 | }; |
| 1428 | |
| 1429 | #define ALC880_DIGOUT_NID 0x06 |
| 1430 | #define ALC880_DIGIN_NID 0x0a |
| 1431 | |
| 1432 | static struct hda_input_mux alc880_capture_source = { |
| 1433 | .num_items = 4, |
| 1434 | .items = { |
| 1435 | { "Mic", 0x0 }, |
| 1436 | { "Front Mic", 0x3 }, |
| 1437 | { "Line", 0x2 }, |
| 1438 | { "CD", 0x4 }, |
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 | }; |
| 1441 | |
| 1442 | /* channel source setting (2/6 channel selection for 3-stack) */ |
| 1443 | /* 2ch mode */ |
| 1444 | static struct hda_verb alc880_threestack_ch2_init[] = { |
| 1445 | /* set line-in to input, mute it */ |
| 1446 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 1447 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 1448 | /* set mic-in to input vref 80%, mute it */ |
| 1449 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 1450 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1451 | { } /* end */ |
| 1452 | }; |
| 1453 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1454 | /* 6ch mode */ |
| 1455 | static struct hda_verb alc880_threestack_ch6_init[] = { |
| 1456 | /* set line-in to output, unmute it */ |
| 1457 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 1458 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 1459 | /* set mic-in to output, unmute it */ |
| 1460 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 1461 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 1462 | { } /* end */ |
| 1463 | }; |
| 1464 | |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 1465 | static struct hda_channel_mode alc880_threestack_modes[2] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1466 | { 2, alc880_threestack_ch2_init }, |
| 1467 | { 6, alc880_threestack_ch6_init }, |
| 1468 | }; |
| 1469 | |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 1470 | static struct snd_kcontrol_new alc880_three_stack_mixer[] = { |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 1471 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 1472 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 1473 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 1474 | HDA_BIND_MUTE("Surround Playback Switch", 0x0f, 2, HDA_INPUT), |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 1475 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 1476 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 1477 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 1478 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1479 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 1480 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 1481 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 1482 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 1483 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 1484 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 1485 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x3, HDA_INPUT), |
| 1486 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x3, HDA_INPUT), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1487 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x19, 0x0, HDA_OUTPUT), |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1488 | { |
| 1489 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 1490 | .name = "Channel Mode", |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 1491 | .info = alc_ch_mode_info, |
| 1492 | .get = alc_ch_mode_get, |
| 1493 | .put = alc_ch_mode_put, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1494 | }, |
| 1495 | { } /* end */ |
| 1496 | }; |
| 1497 | |
| 1498 | /* capture mixer elements */ |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 1499 | static int alc_cap_vol_info(struct snd_kcontrol *kcontrol, |
| 1500 | struct snd_ctl_elem_info *uinfo) |
| 1501 | { |
| 1502 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 1503 | struct alc_spec *spec = codec->spec; |
| 1504 | int err; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1505 | |
Wu Fengguang | 5a9e02e | 2009-01-09 16:45:24 +0800 | [diff] [blame] | 1506 | mutex_lock(&codec->control_mutex); |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 1507 | kcontrol->private_value = HDA_COMPOSE_AMP_VAL(spec->adc_nids[0], 3, 0, |
| 1508 | HDA_INPUT); |
| 1509 | err = snd_hda_mixer_amp_volume_info(kcontrol, uinfo); |
Wu Fengguang | 5a9e02e | 2009-01-09 16:45:24 +0800 | [diff] [blame] | 1510 | mutex_unlock(&codec->control_mutex); |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 1511 | return err; |
| 1512 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1513 | |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 1514 | static int alc_cap_vol_tlv(struct snd_kcontrol *kcontrol, int op_flag, |
| 1515 | unsigned int size, unsigned int __user *tlv) |
| 1516 | { |
| 1517 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 1518 | struct alc_spec *spec = codec->spec; |
| 1519 | int err; |
| 1520 | |
Wu Fengguang | 5a9e02e | 2009-01-09 16:45:24 +0800 | [diff] [blame] | 1521 | mutex_lock(&codec->control_mutex); |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 1522 | kcontrol->private_value = HDA_COMPOSE_AMP_VAL(spec->adc_nids[0], 3, 0, |
| 1523 | HDA_INPUT); |
| 1524 | err = snd_hda_mixer_amp_tlv(kcontrol, op_flag, size, tlv); |
Wu Fengguang | 5a9e02e | 2009-01-09 16:45:24 +0800 | [diff] [blame] | 1525 | mutex_unlock(&codec->control_mutex); |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 1526 | return err; |
| 1527 | } |
| 1528 | |
| 1529 | typedef int (*getput_call_t)(struct snd_kcontrol *kcontrol, |
| 1530 | struct snd_ctl_elem_value *ucontrol); |
| 1531 | |
| 1532 | static int alc_cap_getput_caller(struct snd_kcontrol *kcontrol, |
| 1533 | struct snd_ctl_elem_value *ucontrol, |
| 1534 | getput_call_t func) |
| 1535 | { |
| 1536 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 1537 | struct alc_spec *spec = codec->spec; |
| 1538 | unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id); |
| 1539 | int err; |
| 1540 | |
Wu Fengguang | 5a9e02e | 2009-01-09 16:45:24 +0800 | [diff] [blame] | 1541 | mutex_lock(&codec->control_mutex); |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 1542 | kcontrol->private_value = HDA_COMPOSE_AMP_VAL(spec->adc_nids[adc_idx], |
| 1543 | 3, 0, HDA_INPUT); |
| 1544 | err = func(kcontrol, ucontrol); |
Wu Fengguang | 5a9e02e | 2009-01-09 16:45:24 +0800 | [diff] [blame] | 1545 | mutex_unlock(&codec->control_mutex); |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 1546 | return err; |
| 1547 | } |
| 1548 | |
| 1549 | static int alc_cap_vol_get(struct snd_kcontrol *kcontrol, |
| 1550 | struct snd_ctl_elem_value *ucontrol) |
| 1551 | { |
| 1552 | return alc_cap_getput_caller(kcontrol, ucontrol, |
| 1553 | snd_hda_mixer_amp_volume_get); |
| 1554 | } |
| 1555 | |
| 1556 | static int alc_cap_vol_put(struct snd_kcontrol *kcontrol, |
| 1557 | struct snd_ctl_elem_value *ucontrol) |
| 1558 | { |
| 1559 | return alc_cap_getput_caller(kcontrol, ucontrol, |
| 1560 | snd_hda_mixer_amp_volume_put); |
| 1561 | } |
| 1562 | |
| 1563 | /* capture mixer elements */ |
| 1564 | #define alc_cap_sw_info snd_ctl_boolean_stereo_info |
| 1565 | |
| 1566 | static int alc_cap_sw_get(struct snd_kcontrol *kcontrol, |
| 1567 | struct snd_ctl_elem_value *ucontrol) |
| 1568 | { |
| 1569 | return alc_cap_getput_caller(kcontrol, ucontrol, |
| 1570 | snd_hda_mixer_amp_switch_get); |
| 1571 | } |
| 1572 | |
| 1573 | static int alc_cap_sw_put(struct snd_kcontrol *kcontrol, |
| 1574 | struct snd_ctl_elem_value *ucontrol) |
| 1575 | { |
| 1576 | return alc_cap_getput_caller(kcontrol, ucontrol, |
| 1577 | snd_hda_mixer_amp_switch_put); |
| 1578 | } |
| 1579 | |
| 1580 | #define DEFINE_CAPMIX(num) \ |
| 1581 | static struct snd_kcontrol_new alc_capture_mixer ## num[] = { \ |
| 1582 | { \ |
| 1583 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \ |
| 1584 | .name = "Capture Switch", \ |
| 1585 | .access = SNDRV_CTL_ELEM_ACCESS_READWRITE, \ |
| 1586 | .count = num, \ |
| 1587 | .info = alc_cap_sw_info, \ |
| 1588 | .get = alc_cap_sw_get, \ |
| 1589 | .put = alc_cap_sw_put, \ |
| 1590 | }, \ |
| 1591 | { \ |
| 1592 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \ |
| 1593 | .name = "Capture Volume", \ |
| 1594 | .access = (SNDRV_CTL_ELEM_ACCESS_READWRITE | \ |
| 1595 | SNDRV_CTL_ELEM_ACCESS_TLV_READ | \ |
| 1596 | SNDRV_CTL_ELEM_ACCESS_TLV_CALLBACK), \ |
| 1597 | .count = num, \ |
| 1598 | .info = alc_cap_vol_info, \ |
| 1599 | .get = alc_cap_vol_get, \ |
| 1600 | .put = alc_cap_vol_put, \ |
| 1601 | .tlv = { .c = alc_cap_vol_tlv }, \ |
| 1602 | }, \ |
Takashi Iwai | 3c3e989 | 2008-10-31 17:48:56 +0100 | [diff] [blame] | 1603 | { \ |
| 1604 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \ |
| 1605 | /* .name = "Capture Source", */ \ |
| 1606 | .name = "Input Source", \ |
| 1607 | .count = num, \ |
| 1608 | .info = alc_mux_enum_info, \ |
| 1609 | .get = alc_mux_enum_get, \ |
| 1610 | .put = alc_mux_enum_put, \ |
| 1611 | }, \ |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 1612 | { } /* end */ \ |
| 1613 | } |
| 1614 | |
| 1615 | /* up to three ADCs */ |
| 1616 | DEFINE_CAPMIX(1); |
| 1617 | DEFINE_CAPMIX(2); |
| 1618 | DEFINE_CAPMIX(3); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1619 | |
| 1620 | |
| 1621 | /* |
| 1622 | * ALC880 5-stack model |
| 1623 | * |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 1624 | * DAC: Front = 0x02 (0x0c), Surr = 0x05 (0x0f), CLFE = 0x04 (0x0d), |
| 1625 | * Side = 0x02 (0xd) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1626 | * Pin assignment: Front = 0x14, Surr = 0x17, CLFE = 0x16 |
| 1627 | * Line-In/Side = 0x1a, Mic = 0x18, F-Mic = 0x1b, HP = 0x19 |
| 1628 | */ |
| 1629 | |
| 1630 | /* additional mixers to alc880_three_stack_mixer */ |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 1631 | static struct snd_kcontrol_new alc880_five_stack_mixer[] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1632 | HDA_CODEC_VOLUME("Side Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 1633 | HDA_BIND_MUTE("Side Playback Switch", 0x0d, 2, HDA_INPUT), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1634 | { } /* end */ |
| 1635 | }; |
| 1636 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1637 | /* channel source setting (6/8 channel selection for 5-stack) */ |
| 1638 | /* 6ch mode */ |
| 1639 | static struct hda_verb alc880_fivestack_ch6_init[] = { |
| 1640 | /* set line-in to input, mute it */ |
| 1641 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 1642 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
Takashi Iwai | dfc0ff6 | 2005-05-12 14:31:49 +0200 | [diff] [blame] | 1643 | { } /* end */ |
| 1644 | }; |
| 1645 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1646 | /* 8ch mode */ |
| 1647 | static struct hda_verb alc880_fivestack_ch8_init[] = { |
| 1648 | /* set line-in to output, unmute it */ |
| 1649 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 1650 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 1651 | { } /* end */ |
| 1652 | }; |
| 1653 | |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 1654 | static struct hda_channel_mode alc880_fivestack_modes[2] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1655 | { 6, alc880_fivestack_ch6_init }, |
| 1656 | { 8, alc880_fivestack_ch8_init }, |
| 1657 | }; |
| 1658 | |
| 1659 | |
| 1660 | /* |
| 1661 | * ALC880 6-stack model |
| 1662 | * |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 1663 | * DAC: Front = 0x02 (0x0c), Surr = 0x03 (0x0d), CLFE = 0x04 (0x0e), |
| 1664 | * Side = 0x05 (0x0f) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1665 | * Pin assignment: Front = 0x14, Surr = 0x15, CLFE = 0x16, Side = 0x17, |
| 1666 | * Mic = 0x18, F-Mic = 0x19, Line = 0x1a, HP = 0x1b |
| 1667 | */ |
| 1668 | |
| 1669 | static hda_nid_t alc880_6st_dac_nids[4] = { |
| 1670 | /* front, rear, clfe, rear_surr */ |
| 1671 | 0x02, 0x03, 0x04, 0x05 |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 1672 | }; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1673 | |
| 1674 | static struct hda_input_mux alc880_6stack_capture_source = { |
| 1675 | .num_items = 4, |
| 1676 | .items = { |
| 1677 | { "Mic", 0x0 }, |
| 1678 | { "Front Mic", 0x1 }, |
| 1679 | { "Line", 0x2 }, |
| 1680 | { "CD", 0x4 }, |
| 1681 | }, |
| 1682 | }; |
| 1683 | |
| 1684 | /* fixed 8-channels */ |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 1685 | static struct hda_channel_mode alc880_sixstack_modes[1] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1686 | { 8, NULL }, |
| 1687 | }; |
| 1688 | |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 1689 | static struct snd_kcontrol_new alc880_six_stack_mixer[] = { |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1690 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 1691 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1692 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 1693 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1694 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 1695 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 1696 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 1697 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1698 | HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 1699 | HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1700 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 1701 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 1702 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 1703 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 1704 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 1705 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 1706 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 1707 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1708 | { |
| 1709 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 1710 | .name = "Channel Mode", |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 1711 | .info = alc_ch_mode_info, |
| 1712 | .get = alc_ch_mode_get, |
| 1713 | .put = alc_ch_mode_put, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1714 | }, |
| 1715 | { } /* end */ |
| 1716 | }; |
| 1717 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1718 | |
| 1719 | /* |
| 1720 | * ALC880 W810 model |
| 1721 | * |
| 1722 | * W810 has rear IO for: |
| 1723 | * Front (DAC 02) |
| 1724 | * Surround (DAC 03) |
| 1725 | * Center/LFE (DAC 04) |
| 1726 | * Digital out (06) |
| 1727 | * |
| 1728 | * The system also has a pair of internal speakers, and a headphone jack. |
| 1729 | * 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] | 1730 | * |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1731 | * There is a variable resistor to control the speaker or headphone |
| 1732 | * volume. This is a hardware-only device without a software API. |
| 1733 | * |
| 1734 | * Plugging headphones in will disable the internal speakers. This is |
| 1735 | * implemented in hardware, not via the driver using jack sense. In |
| 1736 | * a similar fashion, plugging into the rear socket marked "front" will |
| 1737 | * disable both the speakers and headphones. |
| 1738 | * |
| 1739 | * For input, there's a microphone jack, and an "audio in" jack. |
| 1740 | * These may not do anything useful with this driver yet, because I |
| 1741 | * haven't setup any initialization verbs for these yet... |
| 1742 | */ |
| 1743 | |
| 1744 | static hda_nid_t alc880_w810_dac_nids[3] = { |
| 1745 | /* front, rear/surround, clfe */ |
| 1746 | 0x02, 0x03, 0x04 |
| 1747 | }; |
| 1748 | |
| 1749 | /* fixed 6 channels */ |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 1750 | static struct hda_channel_mode alc880_w810_modes[1] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1751 | { 6, NULL } |
| 1752 | }; |
| 1753 | |
| 1754 | /* Pin assignment: Front = 0x14, Surr = 0x15, CLFE = 0x16, HP = 0x1b */ |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 1755 | static struct snd_kcontrol_new alc880_w810_base_mixer[] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1756 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 1757 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1758 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 1759 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1760 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 1761 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 1762 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 1763 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1764 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 1765 | { } /* end */ |
| 1766 | }; |
| 1767 | |
| 1768 | |
| 1769 | /* |
| 1770 | * Z710V model |
| 1771 | * |
| 1772 | * DAC: Front = 0x02 (0x0c), HP = 0x03 (0x0d) |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 1773 | * Pin assignment: Front = 0x14, HP = 0x15, Mic = 0x18, Mic2 = 0x19(?), |
| 1774 | * Line = 0x1a |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1775 | */ |
| 1776 | |
| 1777 | static hda_nid_t alc880_z71v_dac_nids[1] = { |
| 1778 | 0x02 |
| 1779 | }; |
| 1780 | #define ALC880_Z71V_HP_DAC 0x03 |
| 1781 | |
| 1782 | /* fixed 2 channels */ |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 1783 | static struct hda_channel_mode alc880_2_jack_modes[1] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1784 | { 2, NULL } |
| 1785 | }; |
| 1786 | |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 1787 | static struct snd_kcontrol_new alc880_z71v_mixer[] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1788 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 1789 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1790 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 1791 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT), |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1792 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 1793 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 1794 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 1795 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 1796 | { } /* end */ |
| 1797 | }; |
| 1798 | |
| 1799 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1800 | /* |
| 1801 | * ALC880 F1734 model |
| 1802 | * |
| 1803 | * DAC: HP = 0x02 (0x0c), Front = 0x03 (0x0d) |
| 1804 | * Pin assignment: HP = 0x14, Front = 0x15, Mic = 0x18 |
| 1805 | */ |
| 1806 | |
| 1807 | static hda_nid_t alc880_f1734_dac_nids[1] = { |
| 1808 | 0x03 |
| 1809 | }; |
| 1810 | #define ALC880_F1734_HP_DAC 0x02 |
| 1811 | |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 1812 | static struct snd_kcontrol_new alc880_f1734_mixer[] = { |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1813 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 1814 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT), |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 1815 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 1816 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1817 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 1818 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
Takashi Iwai | 937b416 | 2008-02-11 14:52:36 +0100 | [diff] [blame] | 1819 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 1820 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1821 | { } /* end */ |
| 1822 | }; |
| 1823 | |
Takashi Iwai | 937b416 | 2008-02-11 14:52:36 +0100 | [diff] [blame] | 1824 | static struct hda_input_mux alc880_f1734_capture_source = { |
| 1825 | .num_items = 2, |
| 1826 | .items = { |
| 1827 | { "Mic", 0x1 }, |
| 1828 | { "CD", 0x4 }, |
| 1829 | }, |
| 1830 | }; |
| 1831 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1832 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1833 | /* |
| 1834 | * ALC880 ASUS model |
| 1835 | * |
| 1836 | * DAC: HP/Front = 0x02 (0x0c), Surr = 0x03 (0x0d), CLFE = 0x04 (0x0e) |
| 1837 | * Pin assignment: HP/Front = 0x14, Surr = 0x15, CLFE = 0x16, |
| 1838 | * Mic = 0x18, Line = 0x1a |
| 1839 | */ |
| 1840 | |
| 1841 | #define alc880_asus_dac_nids alc880_w810_dac_nids /* identical with w810 */ |
| 1842 | #define alc880_asus_modes alc880_threestack_modes /* 2/6 channel mode */ |
| 1843 | |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 1844 | static struct snd_kcontrol_new alc880_asus_mixer[] = { |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1845 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 1846 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1847 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 1848 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1849 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 1850 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 1851 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 1852 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1853 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 1854 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 1855 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 1856 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 1857 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 1858 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1859 | { |
| 1860 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 1861 | .name = "Channel Mode", |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 1862 | .info = alc_ch_mode_info, |
| 1863 | .get = alc_ch_mode_get, |
| 1864 | .put = alc_ch_mode_put, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1865 | }, |
| 1866 | { } /* end */ |
| 1867 | }; |
| 1868 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1869 | /* |
| 1870 | * ALC880 ASUS W1V model |
| 1871 | * |
| 1872 | * DAC: HP/Front = 0x02 (0x0c), Surr = 0x03 (0x0d), CLFE = 0x04 (0x0e) |
| 1873 | * Pin assignment: HP/Front = 0x14, Surr = 0x15, CLFE = 0x16, |
| 1874 | * Mic = 0x18, Line = 0x1a, Line2 = 0x1b |
| 1875 | */ |
| 1876 | |
| 1877 | /* additional mixers to alc880_asus_mixer */ |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 1878 | static struct snd_kcontrol_new alc880_asus_w1v_mixer[] = { |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1879 | HDA_CODEC_VOLUME("Line2 Playback Volume", 0x0b, 0x03, HDA_INPUT), |
| 1880 | HDA_CODEC_MUTE("Line2 Playback Switch", 0x0b, 0x03, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1881 | { } /* end */ |
| 1882 | }; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1883 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 1884 | /* TCL S700 */ |
| 1885 | static struct snd_kcontrol_new alc880_tcl_s700_mixer[] = { |
| 1886 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 1887 | HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 1888 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 1889 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0B, 0x04, HDA_INPUT), |
| 1890 | HDA_CODEC_MUTE("CD Playback Switch", 0x0B, 0x04, HDA_INPUT), |
| 1891 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0B, 0x0, HDA_INPUT), |
| 1892 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0B, 0x0, HDA_INPUT), |
| 1893 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 1894 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 1895 | { } /* end */ |
| 1896 | }; |
| 1897 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 1898 | /* Uniwill */ |
| 1899 | static struct snd_kcontrol_new alc880_uniwill_mixer[] = { |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 1900 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 1901 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT), |
| 1902 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 1903 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 1904 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 1905 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 1906 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 1907 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 1908 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 1909 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 1910 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 1911 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 1912 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 1913 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 1914 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 1915 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 1916 | { |
| 1917 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 1918 | .name = "Channel Mode", |
| 1919 | .info = alc_ch_mode_info, |
| 1920 | .get = alc_ch_mode_get, |
| 1921 | .put = alc_ch_mode_put, |
| 1922 | }, |
| 1923 | { } /* end */ |
| 1924 | }; |
| 1925 | |
Tobin Davis | 2cf9f0f | 2007-02-07 16:04:25 +0100 | [diff] [blame] | 1926 | static struct snd_kcontrol_new alc880_fujitsu_mixer[] = { |
| 1927 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 1928 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT), |
| 1929 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 1930 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT), |
| 1931 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 1932 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 1933 | HDA_CODEC_VOLUME("Ext Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 1934 | HDA_CODEC_MUTE("Ext Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 1935 | HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 1936 | HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 1937 | { } /* end */ |
| 1938 | }; |
| 1939 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 1940 | static struct snd_kcontrol_new alc880_uniwill_p53_mixer[] = { |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 1941 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 1942 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT), |
| 1943 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 1944 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 1945 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 1946 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 1947 | { } /* end */ |
| 1948 | }; |
| 1949 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1950 | /* |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 1951 | * virtual master controls |
| 1952 | */ |
| 1953 | |
| 1954 | /* |
| 1955 | * slave controls for virtual master |
| 1956 | */ |
| 1957 | static const char *alc_slave_vols[] = { |
| 1958 | "Front Playback Volume", |
| 1959 | "Surround Playback Volume", |
| 1960 | "Center Playback Volume", |
| 1961 | "LFE Playback Volume", |
| 1962 | "Side Playback Volume", |
| 1963 | "Headphone Playback Volume", |
| 1964 | "Speaker Playback Volume", |
| 1965 | "Mono Playback Volume", |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 1966 | "Line-Out Playback Volume", |
Takashi Iwai | 26f5df2 | 2008-11-03 17:39:46 +0100 | [diff] [blame] | 1967 | "PCM Playback Volume", |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 1968 | NULL, |
| 1969 | }; |
| 1970 | |
| 1971 | static const char *alc_slave_sws[] = { |
| 1972 | "Front Playback Switch", |
| 1973 | "Surround Playback Switch", |
| 1974 | "Center Playback Switch", |
| 1975 | "LFE Playback Switch", |
| 1976 | "Side Playback Switch", |
| 1977 | "Headphone Playback Switch", |
| 1978 | "Speaker Playback Switch", |
| 1979 | "Mono Playback Switch", |
Takashi Iwai | edb54a5 | 2008-01-29 12:47:02 +0100 | [diff] [blame] | 1980 | "IEC958 Playback Switch", |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 1981 | NULL, |
| 1982 | }; |
| 1983 | |
| 1984 | /* |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1985 | * build control elements |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1986 | */ |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 1987 | |
| 1988 | static void alc_free_kctls(struct hda_codec *codec); |
| 1989 | |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 1990 | /* additional beep mixers; the actual parameters are overwritten at build */ |
| 1991 | static struct snd_kcontrol_new alc_beep_mixer[] = { |
| 1992 | HDA_CODEC_VOLUME("Beep Playback Volume", 0, 0, HDA_INPUT), |
| 1993 | HDA_CODEC_MUTE("Beep Playback Switch", 0, 0, HDA_INPUT), |
| 1994 | { } /* end */ |
| 1995 | }; |
| 1996 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1997 | static int alc_build_controls(struct hda_codec *codec) |
| 1998 | { |
| 1999 | struct alc_spec *spec = codec->spec; |
| 2000 | int err; |
| 2001 | int i; |
| 2002 | |
| 2003 | for (i = 0; i < spec->num_mixers; i++) { |
| 2004 | err = snd_hda_add_new_ctls(codec, spec->mixers[i]); |
| 2005 | if (err < 0) |
| 2006 | return err; |
| 2007 | } |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 2008 | if (spec->cap_mixer) { |
| 2009 | err = snd_hda_add_new_ctls(codec, spec->cap_mixer); |
| 2010 | if (err < 0) |
| 2011 | return err; |
| 2012 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2013 | if (spec->multiout.dig_out_nid) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 2014 | err = snd_hda_create_spdif_out_ctls(codec, |
| 2015 | spec->multiout.dig_out_nid); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2016 | if (err < 0) |
| 2017 | return err; |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 2018 | if (!spec->no_analog) { |
| 2019 | err = snd_hda_create_spdif_share_sw(codec, |
| 2020 | &spec->multiout); |
| 2021 | if (err < 0) |
| 2022 | return err; |
| 2023 | spec->multiout.share_spdif = 1; |
| 2024 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2025 | } |
| 2026 | if (spec->dig_in_nid) { |
| 2027 | err = snd_hda_create_spdif_in_ctls(codec, spec->dig_in_nid); |
| 2028 | if (err < 0) |
| 2029 | return err; |
| 2030 | } |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 2031 | |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 2032 | /* create beep controls if needed */ |
| 2033 | if (spec->beep_amp) { |
| 2034 | struct snd_kcontrol_new *knew; |
| 2035 | for (knew = alc_beep_mixer; knew->name; knew++) { |
| 2036 | struct snd_kcontrol *kctl; |
| 2037 | kctl = snd_ctl_new1(knew, codec); |
| 2038 | if (!kctl) |
| 2039 | return -ENOMEM; |
| 2040 | kctl->private_value = spec->beep_amp; |
| 2041 | err = snd_hda_ctl_add(codec, kctl); |
| 2042 | if (err < 0) |
| 2043 | return err; |
| 2044 | } |
| 2045 | } |
| 2046 | |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 2047 | /* if we have no master control, let's create it */ |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 2048 | if (!spec->no_analog && |
| 2049 | !snd_hda_find_mixer_ctl(codec, "Master Playback Volume")) { |
Takashi Iwai | 1c82ed1 | 2008-02-18 13:05:50 +0100 | [diff] [blame] | 2050 | unsigned int vmaster_tlv[4]; |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 2051 | snd_hda_set_vmaster_tlv(codec, spec->vmaster_nid, |
Takashi Iwai | 1c82ed1 | 2008-02-18 13:05:50 +0100 | [diff] [blame] | 2052 | HDA_OUTPUT, vmaster_tlv); |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 2053 | err = snd_hda_add_vmaster(codec, "Master Playback Volume", |
Takashi Iwai | 1c82ed1 | 2008-02-18 13:05:50 +0100 | [diff] [blame] | 2054 | vmaster_tlv, alc_slave_vols); |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 2055 | if (err < 0) |
| 2056 | return err; |
| 2057 | } |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 2058 | if (!spec->no_analog && |
| 2059 | !snd_hda_find_mixer_ctl(codec, "Master Playback Switch")) { |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 2060 | err = snd_hda_add_vmaster(codec, "Master Playback Switch", |
| 2061 | NULL, alc_slave_sws); |
| 2062 | if (err < 0) |
| 2063 | return err; |
| 2064 | } |
| 2065 | |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 2066 | alc_free_kctls(codec); /* no longer needed */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2067 | return 0; |
| 2068 | } |
| 2069 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2070 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2071 | /* |
| 2072 | * initialize the codec volumes, etc |
| 2073 | */ |
| 2074 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2075 | /* |
| 2076 | * generic initialization of ADC, input mixers and output mixers |
| 2077 | */ |
| 2078 | static struct hda_verb alc880_volume_init_verbs[] = { |
| 2079 | /* |
| 2080 | * Unmute ADC0-2 and set the default input to mic-in |
| 2081 | */ |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 2082 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2083 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 2084 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2085 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 2086 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2087 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2088 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2089 | /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback |
| 2090 | * mixer widget |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 2091 | * Note: PASD motherboards uses the Line In 2 as the input for front |
| 2092 | * panel mic (mic 2) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2093 | */ |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2094 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 2095 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 2096 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 2097 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 2098 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 2099 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 2100 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, |
| 2101 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2102 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2103 | /* |
| 2104 | * Set up output mixers (0x0c - 0x0f) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2105 | */ |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2106 | /* set vol=0 to output mixers */ |
| 2107 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 2108 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 2109 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 2110 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 2111 | /* set up input amps for analog loopback */ |
| 2112 | /* Amp Indices: DAC = 0, mixer = 1 */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 2113 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 2114 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 2115 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 2116 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 2117 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 2118 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 2119 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 2120 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2121 | |
| 2122 | { } |
| 2123 | }; |
| 2124 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2125 | /* |
| 2126 | * 3-stack pin configuration: |
| 2127 | * front = 0x14, mic/clfe = 0x18, HP = 0x19, line/surr = 0x1a, f-mic = 0x1b |
| 2128 | */ |
| 2129 | static struct hda_verb alc880_pin_3stack_init_verbs[] = { |
| 2130 | /* |
| 2131 | * preset connection lists of input pins |
| 2132 | * 0 = front, 1 = rear_surr, 2 = CLFE, 3 = surround |
| 2133 | */ |
| 2134 | {0x10, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */ |
| 2135 | {0x11, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 2136 | {0x12, AC_VERB_SET_CONNECT_SEL, 0x03}, /* line/surround */ |
| 2137 | |
| 2138 | /* |
| 2139 | * Set pin mode and muting |
| 2140 | */ |
| 2141 | /* set front pin widgets 0x14 for output */ |
| 2142 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2143 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2144 | /* Mic1 (rear panel) pin widget for input and vref at 80% */ |
| 2145 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 2146 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 2147 | /* Mic2 (as headphone out) for HP output */ |
| 2148 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 2149 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2150 | /* Line In pin widget for input */ |
| 2151 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 2152 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 2153 | /* Line2 (as front mic) pin widget for input and vref at 80% */ |
| 2154 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 2155 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 2156 | /* CD pin widget for input */ |
| 2157 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 2158 | |
| 2159 | { } |
| 2160 | }; |
| 2161 | |
| 2162 | /* |
| 2163 | * 5-stack pin configuration: |
| 2164 | * front = 0x14, surround = 0x17, clfe = 0x16, mic = 0x18, HP = 0x19, |
| 2165 | * line-in/side = 0x1a, f-mic = 0x1b |
| 2166 | */ |
| 2167 | static struct hda_verb alc880_pin_5stack_init_verbs[] = { |
| 2168 | /* |
| 2169 | * preset connection lists of input pins |
| 2170 | * 0 = front, 1 = rear_surr, 2 = CLFE, 3 = surround |
| 2171 | */ |
| 2172 | {0x11, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 2173 | {0x12, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/side */ |
| 2174 | |
| 2175 | /* |
| 2176 | * Set pin mode and muting |
| 2177 | */ |
| 2178 | /* set pin widgets 0x14-0x17 for output */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 2179 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2180 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2181 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2182 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2183 | /* unmute pins for output (no gain on this amp) */ |
| 2184 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2185 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2186 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2187 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2188 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2189 | /* Mic1 (rear panel) pin widget for input and vref at 80% */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2190 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2191 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 2192 | /* Mic2 (as headphone out) for HP output */ |
| 2193 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 2194 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2195 | /* Line In pin widget for input */ |
| 2196 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 2197 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 2198 | /* Line2 (as front mic) pin widget for input and vref at 80% */ |
| 2199 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 2200 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 2201 | /* CD pin widget for input */ |
| 2202 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2203 | |
| 2204 | { } |
| 2205 | }; |
| 2206 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2207 | /* |
| 2208 | * W810 pin configuration: |
| 2209 | * front = 0x14, surround = 0x15, clfe = 0x16, HP = 0x1b |
| 2210 | */ |
| 2211 | static struct hda_verb alc880_pin_w810_init_verbs[] = { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2212 | /* hphone/speaker input selector: front DAC */ |
| 2213 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x0}, |
| 2214 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2215 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2216 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2217 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2218 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2219 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2220 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2221 | |
| 2222 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 2223 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2224 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2225 | { } |
| 2226 | }; |
| 2227 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2228 | /* |
| 2229 | * Z71V pin configuration: |
| 2230 | * Speaker-out = 0x14, HP = 0x15, Mic = 0x18, Line-in = 0x1a, Mic2 = 0x1b (?) |
| 2231 | */ |
| 2232 | static struct hda_verb alc880_pin_z71v_init_verbs[] = { |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 2233 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2234 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 2235 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2236 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | dfc0ff6 | 2005-05-12 14:31:49 +0200 | [diff] [blame] | 2237 | |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2238 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2239 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2240 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2241 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Takashi Iwai | dfc0ff6 | 2005-05-12 14:31:49 +0200 | [diff] [blame] | 2242 | |
| 2243 | { } |
| 2244 | }; |
| 2245 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2246 | /* |
| 2247 | * 6-stack pin configuration: |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 2248 | * front = 0x14, surr = 0x15, clfe = 0x16, side = 0x17, mic = 0x18, |
| 2249 | * f-mic = 0x19, line = 0x1a, HP = 0x1b |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2250 | */ |
| 2251 | static struct hda_verb alc880_pin_6stack_init_verbs[] = { |
| 2252 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 2253 | |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2254 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2255 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2256 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2257 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2258 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2259 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2260 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2261 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2262 | |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2263 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2264 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2265 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2266 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2267 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2268 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2269 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2270 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2271 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 2272 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2273 | { } |
| 2274 | }; |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2275 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 2276 | /* |
| 2277 | * Uniwill pin configuration: |
| 2278 | * HP = 0x14, InternalSpeaker = 0x15, mic = 0x18, internal mic = 0x19, |
| 2279 | * line = 0x1a |
| 2280 | */ |
| 2281 | static struct hda_verb alc880_uniwill_init_verbs[] = { |
| 2282 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 2283 | |
| 2284 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 2285 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2286 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 2287 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2288 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 2289 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2290 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2291 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2292 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 2293 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 2294 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 2295 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 2296 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 2297 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 2298 | |
| 2299 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 2300 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 2301 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 2302 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 2303 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 2304 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 2305 | /* {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, */ |
| 2306 | /* {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, */ |
| 2307 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 2308 | |
| 2309 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 2310 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 2311 | |
| 2312 | { } |
| 2313 | }; |
| 2314 | |
| 2315 | /* |
| 2316 | * Uniwill P53 |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 2317 | * HP = 0x14, InternalSpeaker = 0x15, mic = 0x19, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 2318 | */ |
| 2319 | static struct hda_verb alc880_uniwill_p53_init_verbs[] = { |
| 2320 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 2321 | |
| 2322 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 2323 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2324 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 2325 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2326 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 2327 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2328 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 2329 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 2330 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 2331 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 2332 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 2333 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 2334 | |
| 2335 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 2336 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 2337 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 2338 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 2339 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 2340 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 2341 | |
| 2342 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 2343 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_DCVOL_EVENT}, |
| 2344 | |
| 2345 | { } |
| 2346 | }; |
| 2347 | |
Tobin Davis | 2cf9f0f | 2007-02-07 16:04:25 +0100 | [diff] [blame] | 2348 | static struct hda_verb alc880_beep_init_verbs[] = { |
| 2349 | { 0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(5) }, |
| 2350 | { } |
| 2351 | }; |
| 2352 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 2353 | /* toggle speaker-output according to the hp-jack state */ |
Takashi Iwai | 458a4fa | 2007-05-05 12:18:40 +0200 | [diff] [blame] | 2354 | static void alc880_uniwill_hp_automute(struct hda_codec *codec) |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 2355 | { |
| 2356 | unsigned int present; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 2357 | unsigned char bits; |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 2358 | |
| 2359 | present = snd_hda_codec_read(codec, 0x14, 0, |
| 2360 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 2361 | bits = present ? HDA_AMP_MUTE : 0; |
| 2362 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 2363 | HDA_AMP_MUTE, bits); |
| 2364 | snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0, |
| 2365 | HDA_AMP_MUTE, bits); |
Takashi Iwai | 458a4fa | 2007-05-05 12:18:40 +0200 | [diff] [blame] | 2366 | } |
| 2367 | |
| 2368 | /* auto-toggle front mic */ |
| 2369 | static void alc880_uniwill_mic_automute(struct hda_codec *codec) |
| 2370 | { |
| 2371 | unsigned int present; |
| 2372 | unsigned char bits; |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 2373 | |
| 2374 | present = snd_hda_codec_read(codec, 0x18, 0, |
| 2375 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 2376 | bits = present ? HDA_AMP_MUTE : 0; |
| 2377 | snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, 1, HDA_AMP_MUTE, bits); |
Takashi Iwai | 458a4fa | 2007-05-05 12:18:40 +0200 | [diff] [blame] | 2378 | } |
| 2379 | |
| 2380 | static void alc880_uniwill_automute(struct hda_codec *codec) |
| 2381 | { |
| 2382 | alc880_uniwill_hp_automute(codec); |
| 2383 | alc880_uniwill_mic_automute(codec); |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 2384 | } |
| 2385 | |
| 2386 | static void alc880_uniwill_unsol_event(struct hda_codec *codec, |
| 2387 | unsigned int res) |
| 2388 | { |
| 2389 | /* Looks like the unsol event is incompatible with the standard |
| 2390 | * definition. 4bit tag is placed at 28 bit! |
| 2391 | */ |
Takashi Iwai | 458a4fa | 2007-05-05 12:18:40 +0200 | [diff] [blame] | 2392 | switch (res >> 28) { |
| 2393 | case ALC880_HP_EVENT: |
| 2394 | alc880_uniwill_hp_automute(codec); |
| 2395 | break; |
| 2396 | case ALC880_MIC_EVENT: |
| 2397 | alc880_uniwill_mic_automute(codec); |
| 2398 | break; |
| 2399 | } |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 2400 | } |
| 2401 | |
| 2402 | static void alc880_uniwill_p53_hp_automute(struct hda_codec *codec) |
| 2403 | { |
| 2404 | unsigned int present; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 2405 | unsigned char bits; |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 2406 | |
| 2407 | present = snd_hda_codec_read(codec, 0x14, 0, |
| 2408 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 2409 | bits = present ? HDA_AMP_MUTE : 0; |
Jiang zhe | 64654c2 | 2008-04-14 13:26:21 +0200 | [diff] [blame] | 2410 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, HDA_AMP_MUTE, bits); |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 2411 | } |
| 2412 | |
| 2413 | static void alc880_uniwill_p53_dcvol_automute(struct hda_codec *codec) |
| 2414 | { |
| 2415 | unsigned int present; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 2416 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 2417 | present = snd_hda_codec_read(codec, 0x21, 0, |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 2418 | AC_VERB_GET_VOLUME_KNOB_CONTROL, 0); |
| 2419 | present &= HDA_AMP_VOLMASK; |
| 2420 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_OUTPUT, 0, |
| 2421 | HDA_AMP_VOLMASK, present); |
| 2422 | snd_hda_codec_amp_stereo(codec, 0x0d, HDA_OUTPUT, 0, |
| 2423 | HDA_AMP_VOLMASK, present); |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 2424 | } |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 2425 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 2426 | static void alc880_uniwill_p53_unsol_event(struct hda_codec *codec, |
| 2427 | unsigned int res) |
| 2428 | { |
| 2429 | /* Looks like the unsol event is incompatible with the standard |
| 2430 | * definition. 4bit tag is placed at 28 bit! |
| 2431 | */ |
| 2432 | if ((res >> 28) == ALC880_HP_EVENT) |
| 2433 | alc880_uniwill_p53_hp_automute(codec); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 2434 | if ((res >> 28) == ALC880_DCVOL_EVENT) |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 2435 | alc880_uniwill_p53_dcvol_automute(codec); |
| 2436 | } |
| 2437 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2438 | /* |
| 2439 | * F1734 pin configuration: |
| 2440 | * HP = 0x14, speaker-out = 0x15, mic = 0x18 |
| 2441 | */ |
| 2442 | static struct hda_verb alc880_pin_f1734_init_verbs[] = { |
Michael Gruber | ee7a9c7 | 2008-03-10 11:30:59 +0100 | [diff] [blame] | 2443 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x01}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2444 | {0x10, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 2445 | {0x11, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 2446 | {0x12, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 2447 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 2448 | |
| 2449 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 2450 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2451 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2452 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2453 | |
| 2454 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 2455 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Michael Gruber | ee7a9c7 | 2008-03-10 11:30:59 +0100 | [diff] [blame] | 2456 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2457 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 2458 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2459 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2460 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2461 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2462 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2463 | |
Takashi Iwai | 937b416 | 2008-02-11 14:52:36 +0100 | [diff] [blame] | 2464 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_HP_EVENT}, |
| 2465 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_DCVOL_EVENT}, |
| 2466 | |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2467 | { } |
| 2468 | }; |
| 2469 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2470 | /* |
| 2471 | * ASUS pin configuration: |
| 2472 | * HP/front = 0x14, surr = 0x15, clfe = 0x16, mic = 0x18, line = 0x1a |
| 2473 | */ |
| 2474 | static struct hda_verb alc880_pin_asus_init_verbs[] = { |
| 2475 | {0x10, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 2476 | {0x11, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 2477 | {0x12, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 2478 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 2479 | |
| 2480 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 2481 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2482 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2483 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2484 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2485 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2486 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2487 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2488 | |
| 2489 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 2490 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 2491 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 2492 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 2493 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 2494 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 2495 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2496 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2497 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 2498 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2499 | { } |
| 2500 | }; |
| 2501 | |
| 2502 | /* Enable GPIO mask and set output */ |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 2503 | #define alc880_gpio1_init_verbs alc_gpio1_init_verbs |
| 2504 | #define alc880_gpio2_init_verbs alc_gpio2_init_verbs |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2505 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 2506 | /* Clevo m520g init */ |
| 2507 | static struct hda_verb alc880_pin_clevo_init_verbs[] = { |
| 2508 | /* headphone output */ |
| 2509 | {0x11, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 2510 | /* line-out */ |
| 2511 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2512 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2513 | /* Line-in */ |
| 2514 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 2515 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2516 | /* CD */ |
| 2517 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 2518 | {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2519 | /* Mic1 (rear panel) */ |
| 2520 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 2521 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2522 | /* Mic2 (front panel) */ |
| 2523 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 2524 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2525 | /* headphone */ |
| 2526 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 2527 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2528 | /* change to EAPD mode */ |
| 2529 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 2530 | {0x20, AC_VERB_SET_PROC_COEF, 0x3060}, |
| 2531 | |
| 2532 | { } |
| 2533 | }; |
| 2534 | |
| 2535 | static struct hda_verb alc880_pin_tcl_S700_init_verbs[] = { |
Takashi Iwai | 4b146cb | 2006-07-28 14:42:36 +0200 | [diff] [blame] | 2536 | /* change to EAPD mode */ |
| 2537 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 2538 | {0x20, AC_VERB_SET_PROC_COEF, 0x3060}, |
| 2539 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 2540 | /* Headphone output */ |
| 2541 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 2542 | /* Front output*/ |
| 2543 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2544 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 2545 | |
| 2546 | /* Line In pin widget for input */ |
| 2547 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 2548 | /* CD pin widget for input */ |
| 2549 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 2550 | /* Mic1 (rear panel) pin widget for input and vref at 80% */ |
| 2551 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 2552 | |
| 2553 | /* change to EAPD mode */ |
| 2554 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 2555 | {0x20, AC_VERB_SET_PROC_COEF, 0x3070}, |
| 2556 | |
| 2557 | { } |
| 2558 | }; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2559 | |
| 2560 | /* |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 2561 | * LG m1 express dual |
| 2562 | * |
| 2563 | * Pin assignment: |
| 2564 | * Rear Line-In/Out (blue): 0x14 |
| 2565 | * Build-in Mic-In: 0x15 |
| 2566 | * Speaker-out: 0x17 |
| 2567 | * HP-Out (green): 0x1b |
| 2568 | * Mic-In/Out (red): 0x19 |
| 2569 | * SPDIF-Out: 0x1e |
| 2570 | */ |
| 2571 | |
| 2572 | /* To make 5.1 output working (green=Front, blue=Surr, red=CLFE) */ |
| 2573 | static hda_nid_t alc880_lg_dac_nids[3] = { |
| 2574 | 0x05, 0x02, 0x03 |
| 2575 | }; |
| 2576 | |
| 2577 | /* seems analog CD is not working */ |
| 2578 | static struct hda_input_mux alc880_lg_capture_source = { |
| 2579 | .num_items = 3, |
| 2580 | .items = { |
| 2581 | { "Mic", 0x1 }, |
| 2582 | { "Line", 0x5 }, |
| 2583 | { "Internal Mic", 0x6 }, |
| 2584 | }, |
| 2585 | }; |
| 2586 | |
| 2587 | /* 2,4,6 channel modes */ |
| 2588 | static struct hda_verb alc880_lg_ch2_init[] = { |
| 2589 | /* set line-in and mic-in to input */ |
| 2590 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 2591 | { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 2592 | { } |
| 2593 | }; |
| 2594 | |
| 2595 | static struct hda_verb alc880_lg_ch4_init[] = { |
| 2596 | /* set line-in to out and mic-in to input */ |
| 2597 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, |
| 2598 | { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 2599 | { } |
| 2600 | }; |
| 2601 | |
| 2602 | static struct hda_verb alc880_lg_ch6_init[] = { |
| 2603 | /* set line-in and mic-in to output */ |
| 2604 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, |
| 2605 | { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, |
| 2606 | { } |
| 2607 | }; |
| 2608 | |
| 2609 | static struct hda_channel_mode alc880_lg_ch_modes[3] = { |
| 2610 | { 2, alc880_lg_ch2_init }, |
| 2611 | { 4, alc880_lg_ch4_init }, |
| 2612 | { 6, alc880_lg_ch6_init }, |
| 2613 | }; |
| 2614 | |
| 2615 | static struct snd_kcontrol_new alc880_lg_mixer[] = { |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 2616 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
| 2617 | HDA_BIND_MUTE("Front Playback Switch", 0x0f, 2, HDA_INPUT), |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 2618 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 2619 | HDA_BIND_MUTE("Surround Playback Switch", 0x0c, 2, HDA_INPUT), |
| 2620 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0d, 1, 0x0, HDA_OUTPUT), |
| 2621 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0d, 2, 0x0, HDA_OUTPUT), |
| 2622 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0d, 1, 2, HDA_INPUT), |
| 2623 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0d, 2, 2, HDA_INPUT), |
| 2624 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 2625 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 2626 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x06, HDA_INPUT), |
| 2627 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x06, HDA_INPUT), |
| 2628 | HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x07, HDA_INPUT), |
| 2629 | HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x07, HDA_INPUT), |
| 2630 | { |
| 2631 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 2632 | .name = "Channel Mode", |
| 2633 | .info = alc_ch_mode_info, |
| 2634 | .get = alc_ch_mode_get, |
| 2635 | .put = alc_ch_mode_put, |
| 2636 | }, |
| 2637 | { } /* end */ |
| 2638 | }; |
| 2639 | |
| 2640 | static struct hda_verb alc880_lg_init_verbs[] = { |
| 2641 | /* set capture source to mic-in */ |
| 2642 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 2643 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 2644 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 2645 | /* mute all amp mixer inputs */ |
| 2646 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(5)}, |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 2647 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, |
| 2648 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 2649 | /* line-in to input */ |
| 2650 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 2651 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2652 | /* built-in mic */ |
| 2653 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 2654 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2655 | /* speaker-out */ |
| 2656 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 2657 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2658 | /* mic-in to input */ |
| 2659 | {0x11, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 2660 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 2661 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2662 | /* HP-out */ |
| 2663 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x03}, |
| 2664 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 2665 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2666 | /* jack sense */ |
| 2667 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | 0x1}, |
| 2668 | { } |
| 2669 | }; |
| 2670 | |
| 2671 | /* toggle speaker-output according to the hp-jack state */ |
| 2672 | static void alc880_lg_automute(struct hda_codec *codec) |
| 2673 | { |
| 2674 | unsigned int present; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 2675 | unsigned char bits; |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 2676 | |
| 2677 | present = snd_hda_codec_read(codec, 0x1b, 0, |
| 2678 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 2679 | bits = present ? HDA_AMP_MUTE : 0; |
| 2680 | snd_hda_codec_amp_stereo(codec, 0x17, HDA_OUTPUT, 0, |
| 2681 | HDA_AMP_MUTE, bits); |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 2682 | } |
| 2683 | |
| 2684 | static void alc880_lg_unsol_event(struct hda_codec *codec, unsigned int res) |
| 2685 | { |
| 2686 | /* Looks like the unsol event is incompatible with the standard |
| 2687 | * definition. 4bit tag is placed at 28 bit! |
| 2688 | */ |
| 2689 | if ((res >> 28) == 0x01) |
| 2690 | alc880_lg_automute(codec); |
| 2691 | } |
| 2692 | |
| 2693 | /* |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 2694 | * LG LW20 |
| 2695 | * |
| 2696 | * Pin assignment: |
| 2697 | * Speaker-out: 0x14 |
| 2698 | * Mic-In: 0x18 |
Claudio Matsuoka | e4f41da | 2007-07-13 11:51:06 +0200 | [diff] [blame] | 2699 | * Built-in Mic-In: 0x19 |
| 2700 | * Line-In: 0x1b |
| 2701 | * HP-Out: 0x1a |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 2702 | * SPDIF-Out: 0x1e |
| 2703 | */ |
| 2704 | |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 2705 | static struct hda_input_mux alc880_lg_lw_capture_source = { |
Claudio Matsuoka | e4f41da | 2007-07-13 11:51:06 +0200 | [diff] [blame] | 2706 | .num_items = 3, |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 2707 | .items = { |
| 2708 | { "Mic", 0x0 }, |
| 2709 | { "Internal Mic", 0x1 }, |
Claudio Matsuoka | e4f41da | 2007-07-13 11:51:06 +0200 | [diff] [blame] | 2710 | { "Line In", 0x2 }, |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 2711 | }, |
| 2712 | }; |
| 2713 | |
Claudio Matsuoka | 0a8c5da | 2007-07-04 15:17:38 +0200 | [diff] [blame] | 2714 | #define alc880_lg_lw_modes alc880_threestack_modes |
| 2715 | |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 2716 | static struct snd_kcontrol_new alc880_lg_lw_mixer[] = { |
Claudio Matsuoka | 0a8c5da | 2007-07-04 15:17:38 +0200 | [diff] [blame] | 2717 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 2718 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 2719 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
| 2720 | HDA_BIND_MUTE("Surround Playback Switch", 0x0f, 2, HDA_INPUT), |
| 2721 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 2722 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 2723 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 2724 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 2725 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 2726 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 2727 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 2728 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 2729 | HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 2730 | HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
Claudio Matsuoka | 0a8c5da | 2007-07-04 15:17:38 +0200 | [diff] [blame] | 2731 | { |
| 2732 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 2733 | .name = "Channel Mode", |
| 2734 | .info = alc_ch_mode_info, |
| 2735 | .get = alc_ch_mode_get, |
| 2736 | .put = alc_ch_mode_put, |
| 2737 | }, |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 2738 | { } /* end */ |
| 2739 | }; |
| 2740 | |
| 2741 | static struct hda_verb alc880_lg_lw_init_verbs[] = { |
Claudio Matsuoka | 0a8c5da | 2007-07-04 15:17:38 +0200 | [diff] [blame] | 2742 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 2743 | {0x10, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */ |
| 2744 | {0x12, AC_VERB_SET_CONNECT_SEL, 0x03}, /* line/surround */ |
| 2745 | |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 2746 | /* set capture source to mic-in */ |
| 2747 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 2748 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 2749 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 2750 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 2751 | /* speaker-out */ |
| 2752 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 2753 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2754 | /* HP-out */ |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 2755 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 2756 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2757 | /* mic-in to input */ |
| 2758 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 2759 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2760 | /* built-in mic */ |
| 2761 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 2762 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2763 | /* jack sense */ |
| 2764 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | 0x1}, |
| 2765 | { } |
| 2766 | }; |
| 2767 | |
| 2768 | /* toggle speaker-output according to the hp-jack state */ |
| 2769 | static void alc880_lg_lw_automute(struct hda_codec *codec) |
| 2770 | { |
| 2771 | unsigned int present; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 2772 | unsigned char bits; |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 2773 | |
| 2774 | present = snd_hda_codec_read(codec, 0x1b, 0, |
| 2775 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 2776 | bits = present ? HDA_AMP_MUTE : 0; |
| 2777 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 2778 | HDA_AMP_MUTE, bits); |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 2779 | } |
| 2780 | |
| 2781 | static void alc880_lg_lw_unsol_event(struct hda_codec *codec, unsigned int res) |
| 2782 | { |
| 2783 | /* Looks like the unsol event is incompatible with the standard |
| 2784 | * definition. 4bit tag is placed at 28 bit! |
| 2785 | */ |
| 2786 | if ((res >> 28) == 0x01) |
| 2787 | alc880_lg_lw_automute(codec); |
| 2788 | } |
| 2789 | |
Takashi Iwai | df99cd3 | 2008-04-25 15:25:04 +0200 | [diff] [blame] | 2790 | static struct snd_kcontrol_new alc880_medion_rim_mixer[] = { |
| 2791 | HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 2792 | HDA_BIND_MUTE("Master Playback Switch", 0x0c, 2, HDA_INPUT), |
| 2793 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 2794 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 2795 | HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 2796 | HDA_CODEC_MUTE("Internal Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 2797 | { } /* end */ |
| 2798 | }; |
| 2799 | |
| 2800 | static struct hda_input_mux alc880_medion_rim_capture_source = { |
| 2801 | .num_items = 2, |
| 2802 | .items = { |
| 2803 | { "Mic", 0x0 }, |
| 2804 | { "Internal Mic", 0x1 }, |
| 2805 | }, |
| 2806 | }; |
| 2807 | |
| 2808 | static struct hda_verb alc880_medion_rim_init_verbs[] = { |
| 2809 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 2810 | |
| 2811 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 2812 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2813 | |
| 2814 | /* Mic1 (rear panel) pin widget for input and vref at 80% */ |
| 2815 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 2816 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 2817 | /* Mic2 (as headphone out) for HP output */ |
| 2818 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 2819 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 2820 | /* Internal Speaker */ |
| 2821 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2822 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2823 | |
| 2824 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 2825 | {0x20, AC_VERB_SET_PROC_COEF, 0x3060}, |
| 2826 | |
| 2827 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 2828 | { } |
| 2829 | }; |
| 2830 | |
| 2831 | /* toggle speaker-output according to the hp-jack state */ |
| 2832 | static void alc880_medion_rim_automute(struct hda_codec *codec) |
| 2833 | { |
| 2834 | unsigned int present; |
| 2835 | unsigned char bits; |
| 2836 | |
| 2837 | present = snd_hda_codec_read(codec, 0x14, 0, |
| 2838 | AC_VERB_GET_PIN_SENSE, 0) |
| 2839 | & AC_PINSENSE_PRESENCE; |
| 2840 | bits = present ? HDA_AMP_MUTE : 0; |
| 2841 | snd_hda_codec_amp_stereo(codec, 0x1b, HDA_OUTPUT, 0, |
| 2842 | HDA_AMP_MUTE, bits); |
| 2843 | if (present) |
| 2844 | snd_hda_codec_write(codec, 0x01, 0, AC_VERB_SET_GPIO_DATA, 0); |
| 2845 | else |
| 2846 | snd_hda_codec_write(codec, 0x01, 0, AC_VERB_SET_GPIO_DATA, 2); |
| 2847 | } |
| 2848 | |
| 2849 | static void alc880_medion_rim_unsol_event(struct hda_codec *codec, |
| 2850 | unsigned int res) |
| 2851 | { |
| 2852 | /* Looks like the unsol event is incompatible with the standard |
| 2853 | * definition. 4bit tag is placed at 28 bit! |
| 2854 | */ |
| 2855 | if ((res >> 28) == ALC880_HP_EVENT) |
| 2856 | alc880_medion_rim_automute(codec); |
| 2857 | } |
| 2858 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 2859 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 2860 | static struct hda_amp_list alc880_loopbacks[] = { |
| 2861 | { 0x0b, HDA_INPUT, 0 }, |
| 2862 | { 0x0b, HDA_INPUT, 1 }, |
| 2863 | { 0x0b, HDA_INPUT, 2 }, |
| 2864 | { 0x0b, HDA_INPUT, 3 }, |
| 2865 | { 0x0b, HDA_INPUT, 4 }, |
| 2866 | { } /* end */ |
| 2867 | }; |
| 2868 | |
| 2869 | static struct hda_amp_list alc880_lg_loopbacks[] = { |
| 2870 | { 0x0b, HDA_INPUT, 1 }, |
| 2871 | { 0x0b, HDA_INPUT, 6 }, |
| 2872 | { 0x0b, HDA_INPUT, 7 }, |
| 2873 | { } /* end */ |
| 2874 | }; |
| 2875 | #endif |
| 2876 | |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 2877 | /* |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 2878 | * Common callbacks |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2879 | */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2880 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2881 | static int alc_init(struct hda_codec *codec) |
| 2882 | { |
| 2883 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2884 | unsigned int i; |
| 2885 | |
Takashi Iwai | 2c3bf9a | 2008-06-04 12:39:38 +0200 | [diff] [blame] | 2886 | alc_fix_pll(codec); |
Takashi Iwai | 1082c74 | 2008-08-22 15:24:22 +0200 | [diff] [blame] | 2887 | if (codec->vendor_id == 0x10ec0888) |
| 2888 | alc888_coef_init(codec); |
Takashi Iwai | 2c3bf9a | 2008-06-04 12:39:38 +0200 | [diff] [blame] | 2889 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2890 | for (i = 0; i < spec->num_init_verbs; i++) |
| 2891 | snd_hda_sequence_write(codec, spec->init_verbs[i]); |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 2892 | |
| 2893 | if (spec->init_hook) |
| 2894 | spec->init_hook(codec); |
| 2895 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2896 | return 0; |
| 2897 | } |
| 2898 | |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 2899 | static void alc_unsol_event(struct hda_codec *codec, unsigned int res) |
| 2900 | { |
| 2901 | struct alc_spec *spec = codec->spec; |
| 2902 | |
| 2903 | if (spec->unsol_event) |
| 2904 | spec->unsol_event(codec, res); |
| 2905 | } |
| 2906 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 2907 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 2908 | static int alc_check_power_status(struct hda_codec *codec, hda_nid_t nid) |
| 2909 | { |
| 2910 | struct alc_spec *spec = codec->spec; |
| 2911 | return snd_hda_check_amp_list_power(codec, &spec->loopback, nid); |
| 2912 | } |
| 2913 | #endif |
| 2914 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2915 | /* |
| 2916 | * Analog playback callbacks |
| 2917 | */ |
| 2918 | static int alc880_playback_pcm_open(struct hda_pcm_stream *hinfo, |
| 2919 | struct hda_codec *codec, |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 2920 | struct snd_pcm_substream *substream) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2921 | { |
| 2922 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 9a08160 | 2008-02-12 18:37:26 +0100 | [diff] [blame] | 2923 | return snd_hda_multi_out_analog_open(codec, &spec->multiout, substream, |
| 2924 | hinfo); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2925 | } |
| 2926 | |
| 2927 | static int alc880_playback_pcm_prepare(struct hda_pcm_stream *hinfo, |
| 2928 | struct hda_codec *codec, |
| 2929 | unsigned int stream_tag, |
| 2930 | unsigned int format, |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 2931 | struct snd_pcm_substream *substream) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2932 | { |
| 2933 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 2934 | return snd_hda_multi_out_analog_prepare(codec, &spec->multiout, |
| 2935 | stream_tag, format, substream); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2936 | } |
| 2937 | |
| 2938 | static int alc880_playback_pcm_cleanup(struct hda_pcm_stream *hinfo, |
| 2939 | struct hda_codec *codec, |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 2940 | struct snd_pcm_substream *substream) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2941 | { |
| 2942 | struct alc_spec *spec = codec->spec; |
| 2943 | return snd_hda_multi_out_analog_cleanup(codec, &spec->multiout); |
| 2944 | } |
| 2945 | |
| 2946 | /* |
| 2947 | * Digital out |
| 2948 | */ |
| 2949 | static int alc880_dig_playback_pcm_open(struct hda_pcm_stream *hinfo, |
| 2950 | struct hda_codec *codec, |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 2951 | struct snd_pcm_substream *substream) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2952 | { |
| 2953 | struct alc_spec *spec = codec->spec; |
| 2954 | return snd_hda_multi_out_dig_open(codec, &spec->multiout); |
| 2955 | } |
| 2956 | |
Takashi Iwai | 6b97eb4 | 2007-04-05 14:51:48 +0200 | [diff] [blame] | 2957 | static int alc880_dig_playback_pcm_prepare(struct hda_pcm_stream *hinfo, |
| 2958 | struct hda_codec *codec, |
| 2959 | unsigned int stream_tag, |
| 2960 | unsigned int format, |
| 2961 | struct snd_pcm_substream *substream) |
| 2962 | { |
| 2963 | struct alc_spec *spec = codec->spec; |
| 2964 | return snd_hda_multi_out_dig_prepare(codec, &spec->multiout, |
| 2965 | stream_tag, format, substream); |
| 2966 | } |
| 2967 | |
Takashi Iwai | 9b5f12e | 2009-02-13 11:47:37 +0100 | [diff] [blame] | 2968 | static int alc880_dig_playback_pcm_cleanup(struct hda_pcm_stream *hinfo, |
| 2969 | struct hda_codec *codec, |
| 2970 | struct snd_pcm_substream *substream) |
| 2971 | { |
| 2972 | struct alc_spec *spec = codec->spec; |
| 2973 | return snd_hda_multi_out_dig_cleanup(codec, &spec->multiout); |
| 2974 | } |
| 2975 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2976 | static int alc880_dig_playback_pcm_close(struct hda_pcm_stream *hinfo, |
| 2977 | struct hda_codec *codec, |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 2978 | struct snd_pcm_substream *substream) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2979 | { |
| 2980 | struct alc_spec *spec = codec->spec; |
| 2981 | return snd_hda_multi_out_dig_close(codec, &spec->multiout); |
| 2982 | } |
| 2983 | |
| 2984 | /* |
| 2985 | * Analog capture |
| 2986 | */ |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 2987 | static int alc880_alt_capture_pcm_prepare(struct hda_pcm_stream *hinfo, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2988 | struct hda_codec *codec, |
| 2989 | unsigned int stream_tag, |
| 2990 | unsigned int format, |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 2991 | struct snd_pcm_substream *substream) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2992 | { |
| 2993 | struct alc_spec *spec = codec->spec; |
| 2994 | |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 2995 | snd_hda_codec_setup_stream(codec, spec->adc_nids[substream->number + 1], |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2996 | stream_tag, 0, format); |
| 2997 | return 0; |
| 2998 | } |
| 2999 | |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 3000 | static int alc880_alt_capture_pcm_cleanup(struct hda_pcm_stream *hinfo, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3001 | struct hda_codec *codec, |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 3002 | struct snd_pcm_substream *substream) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3003 | { |
| 3004 | struct alc_spec *spec = codec->spec; |
| 3005 | |
Takashi Iwai | 888afa1 | 2008-03-18 09:57:50 +0100 | [diff] [blame] | 3006 | snd_hda_codec_cleanup_stream(codec, |
| 3007 | spec->adc_nids[substream->number + 1]); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3008 | return 0; |
| 3009 | } |
| 3010 | |
| 3011 | |
| 3012 | /* |
| 3013 | */ |
| 3014 | static struct hda_pcm_stream alc880_pcm_analog_playback = { |
| 3015 | .substreams = 1, |
| 3016 | .channels_min = 2, |
| 3017 | .channels_max = 8, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3018 | /* NID is set in alc_build_pcms */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3019 | .ops = { |
| 3020 | .open = alc880_playback_pcm_open, |
| 3021 | .prepare = alc880_playback_pcm_prepare, |
| 3022 | .cleanup = alc880_playback_pcm_cleanup |
| 3023 | }, |
| 3024 | }; |
| 3025 | |
| 3026 | static struct hda_pcm_stream alc880_pcm_analog_capture = { |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 3027 | .substreams = 1, |
| 3028 | .channels_min = 2, |
| 3029 | .channels_max = 2, |
| 3030 | /* NID is set in alc_build_pcms */ |
| 3031 | }; |
| 3032 | |
| 3033 | static struct hda_pcm_stream alc880_pcm_analog_alt_playback = { |
| 3034 | .substreams = 1, |
| 3035 | .channels_min = 2, |
| 3036 | .channels_max = 2, |
| 3037 | /* NID is set in alc_build_pcms */ |
| 3038 | }; |
| 3039 | |
| 3040 | static struct hda_pcm_stream alc880_pcm_analog_alt_capture = { |
| 3041 | .substreams = 2, /* can be overridden */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3042 | .channels_min = 2, |
| 3043 | .channels_max = 2, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3044 | /* NID is set in alc_build_pcms */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3045 | .ops = { |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 3046 | .prepare = alc880_alt_capture_pcm_prepare, |
| 3047 | .cleanup = alc880_alt_capture_pcm_cleanup |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3048 | }, |
| 3049 | }; |
| 3050 | |
| 3051 | static struct hda_pcm_stream alc880_pcm_digital_playback = { |
| 3052 | .substreams = 1, |
| 3053 | .channels_min = 2, |
| 3054 | .channels_max = 2, |
| 3055 | /* NID is set in alc_build_pcms */ |
| 3056 | .ops = { |
| 3057 | .open = alc880_dig_playback_pcm_open, |
Takashi Iwai | 6b97eb4 | 2007-04-05 14:51:48 +0200 | [diff] [blame] | 3058 | .close = alc880_dig_playback_pcm_close, |
Takashi Iwai | 9b5f12e | 2009-02-13 11:47:37 +0100 | [diff] [blame] | 3059 | .prepare = alc880_dig_playback_pcm_prepare, |
| 3060 | .cleanup = alc880_dig_playback_pcm_cleanup |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3061 | }, |
| 3062 | }; |
| 3063 | |
| 3064 | static struct hda_pcm_stream alc880_pcm_digital_capture = { |
| 3065 | .substreams = 1, |
| 3066 | .channels_min = 2, |
| 3067 | .channels_max = 2, |
| 3068 | /* NID is set in alc_build_pcms */ |
| 3069 | }; |
| 3070 | |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 3071 | /* 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] | 3072 | static struct hda_pcm_stream alc_pcm_null_stream = { |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 3073 | .substreams = 0, |
| 3074 | .channels_min = 0, |
| 3075 | .channels_max = 0, |
| 3076 | }; |
| 3077 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3078 | static int alc_build_pcms(struct hda_codec *codec) |
| 3079 | { |
| 3080 | struct alc_spec *spec = codec->spec; |
| 3081 | struct hda_pcm *info = spec->pcm_rec; |
| 3082 | int i; |
| 3083 | |
| 3084 | codec->num_pcms = 1; |
| 3085 | codec->pcm_info = info; |
| 3086 | |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 3087 | if (spec->no_analog) |
| 3088 | goto skip_analog; |
| 3089 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3090 | info->name = spec->stream_name_analog; |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 3091 | if (spec->stream_analog_playback) { |
Takashi Iwai | da3cec3 | 2008-08-08 17:12:14 +0200 | [diff] [blame] | 3092 | if (snd_BUG_ON(!spec->multiout.dac_nids)) |
| 3093 | return -EINVAL; |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 3094 | info->stream[SNDRV_PCM_STREAM_PLAYBACK] = *(spec->stream_analog_playback); |
| 3095 | info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = spec->multiout.dac_nids[0]; |
| 3096 | } |
| 3097 | if (spec->stream_analog_capture) { |
Takashi Iwai | da3cec3 | 2008-08-08 17:12:14 +0200 | [diff] [blame] | 3098 | if (snd_BUG_ON(!spec->adc_nids)) |
| 3099 | return -EINVAL; |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 3100 | info->stream[SNDRV_PCM_STREAM_CAPTURE] = *(spec->stream_analog_capture); |
| 3101 | info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = spec->adc_nids[0]; |
| 3102 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3103 | |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 3104 | if (spec->channel_mode) { |
| 3105 | info->stream[SNDRV_PCM_STREAM_PLAYBACK].channels_max = 0; |
| 3106 | for (i = 0; i < spec->num_channel_mode; i++) { |
| 3107 | if (spec->channel_mode[i].channels > info->stream[SNDRV_PCM_STREAM_PLAYBACK].channels_max) { |
| 3108 | info->stream[SNDRV_PCM_STREAM_PLAYBACK].channels_max = spec->channel_mode[i].channels; |
| 3109 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3110 | } |
| 3111 | } |
| 3112 | |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 3113 | skip_analog: |
Takashi Iwai | e08a007 | 2006-09-07 17:52:14 +0200 | [diff] [blame] | 3114 | /* SPDIF for stream index #1 */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3115 | if (spec->multiout.dig_out_nid || spec->dig_in_nid) { |
Takashi Iwai | e08a007 | 2006-09-07 17:52:14 +0200 | [diff] [blame] | 3116 | codec->num_pcms = 2; |
Wu Fengguang | b25c9da | 2009-02-06 15:02:27 +0800 | [diff] [blame] | 3117 | codec->slave_dig_outs = spec->multiout.slave_dig_outs; |
Takashi Iwai | c06134d | 2006-10-11 18:49:13 +0200 | [diff] [blame] | 3118 | info = spec->pcm_rec + 1; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3119 | info->name = spec->stream_name_digital; |
Takashi Iwai | 8c44198 | 2009-01-20 18:30:20 +0100 | [diff] [blame] | 3120 | if (spec->dig_out_type) |
| 3121 | info->pcm_type = spec->dig_out_type; |
| 3122 | else |
| 3123 | info->pcm_type = HDA_PCM_TYPE_SPDIF; |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 3124 | if (spec->multiout.dig_out_nid && |
| 3125 | spec->stream_digital_playback) { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3126 | info->stream[SNDRV_PCM_STREAM_PLAYBACK] = *(spec->stream_digital_playback); |
| 3127 | info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = spec->multiout.dig_out_nid; |
| 3128 | } |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 3129 | if (spec->dig_in_nid && |
| 3130 | spec->stream_digital_capture) { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3131 | info->stream[SNDRV_PCM_STREAM_CAPTURE] = *(spec->stream_digital_capture); |
| 3132 | info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = spec->dig_in_nid; |
| 3133 | } |
Takashi Iwai | 963f803 | 2008-08-11 10:04:40 +0200 | [diff] [blame] | 3134 | /* FIXME: do we need this for all Realtek codec models? */ |
| 3135 | codec->spdif_status_reset = 1; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3136 | } |
| 3137 | |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 3138 | if (spec->no_analog) |
| 3139 | return 0; |
| 3140 | |
Takashi Iwai | e08a007 | 2006-09-07 17:52:14 +0200 | [diff] [blame] | 3141 | /* If the use of more than one ADC is requested for the current |
| 3142 | * model, configure a second analog capture-only PCM. |
| 3143 | */ |
| 3144 | /* Additional Analaog capture for index #2 */ |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 3145 | if ((spec->alt_dac_nid && spec->stream_analog_alt_playback) || |
| 3146 | (spec->num_adc_nids > 1 && spec->stream_analog_alt_capture)) { |
Takashi Iwai | e08a007 | 2006-09-07 17:52:14 +0200 | [diff] [blame] | 3147 | codec->num_pcms = 3; |
Takashi Iwai | c06134d | 2006-10-11 18:49:13 +0200 | [diff] [blame] | 3148 | info = spec->pcm_rec + 2; |
Takashi Iwai | e08a007 | 2006-09-07 17:52:14 +0200 | [diff] [blame] | 3149 | info->name = spec->stream_name_analog; |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 3150 | if (spec->alt_dac_nid) { |
| 3151 | info->stream[SNDRV_PCM_STREAM_PLAYBACK] = |
| 3152 | *spec->stream_analog_alt_playback; |
| 3153 | info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = |
| 3154 | spec->alt_dac_nid; |
| 3155 | } else { |
| 3156 | info->stream[SNDRV_PCM_STREAM_PLAYBACK] = |
| 3157 | alc_pcm_null_stream; |
| 3158 | info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = 0; |
| 3159 | } |
| 3160 | if (spec->num_adc_nids > 1) { |
| 3161 | info->stream[SNDRV_PCM_STREAM_CAPTURE] = |
| 3162 | *spec->stream_analog_alt_capture; |
| 3163 | info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = |
| 3164 | spec->adc_nids[1]; |
| 3165 | info->stream[SNDRV_PCM_STREAM_CAPTURE].substreams = |
| 3166 | spec->num_adc_nids - 1; |
| 3167 | } else { |
| 3168 | info->stream[SNDRV_PCM_STREAM_CAPTURE] = |
| 3169 | alc_pcm_null_stream; |
| 3170 | info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = 0; |
Takashi Iwai | e08a007 | 2006-09-07 17:52:14 +0200 | [diff] [blame] | 3171 | } |
| 3172 | } |
| 3173 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3174 | return 0; |
| 3175 | } |
| 3176 | |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 3177 | static void alc_free_kctls(struct hda_codec *codec) |
| 3178 | { |
| 3179 | struct alc_spec *spec = codec->spec; |
| 3180 | |
| 3181 | if (spec->kctls.list) { |
| 3182 | struct snd_kcontrol_new *kctl = spec->kctls.list; |
| 3183 | int i; |
| 3184 | for (i = 0; i < spec->kctls.used; i++) |
| 3185 | kfree(kctl[i].name); |
| 3186 | } |
| 3187 | snd_array_free(&spec->kctls); |
| 3188 | } |
| 3189 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3190 | static void alc_free(struct hda_codec *codec) |
| 3191 | { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3192 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3193 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3194 | if (!spec) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3195 | return; |
| 3196 | |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 3197 | alc_free_kctls(codec); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3198 | kfree(spec); |
Kusanagi Kouichi | 680cd53 | 2009-02-05 00:00:58 +0900 | [diff] [blame] | 3199 | snd_hda_detach_beep_device(codec); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3200 | } |
| 3201 | |
Takashi Iwai | e044c39 | 2008-10-27 16:56:24 +0100 | [diff] [blame] | 3202 | #ifdef SND_HDA_NEEDS_RESUME |
Takashi Iwai | e044c39 | 2008-10-27 16:56:24 +0100 | [diff] [blame] | 3203 | static int alc_resume(struct hda_codec *codec) |
| 3204 | { |
Takashi Iwai | e044c39 | 2008-10-27 16:56:24 +0100 | [diff] [blame] | 3205 | codec->patch_ops.init(codec); |
| 3206 | snd_hda_codec_resume_amp(codec); |
| 3207 | snd_hda_codec_resume_cache(codec); |
| 3208 | return 0; |
| 3209 | } |
Takashi Iwai | e044c39 | 2008-10-27 16:56:24 +0100 | [diff] [blame] | 3210 | #endif |
| 3211 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3212 | /* |
| 3213 | */ |
| 3214 | static struct hda_codec_ops alc_patch_ops = { |
| 3215 | .build_controls = alc_build_controls, |
| 3216 | .build_pcms = alc_build_pcms, |
| 3217 | .init = alc_init, |
| 3218 | .free = alc_free, |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 3219 | .unsol_event = alc_unsol_event, |
Takashi Iwai | e044c39 | 2008-10-27 16:56:24 +0100 | [diff] [blame] | 3220 | #ifdef SND_HDA_NEEDS_RESUME |
| 3221 | .resume = alc_resume, |
| 3222 | #endif |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 3223 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 3224 | .check_power_status = alc_check_power_status, |
| 3225 | #endif |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3226 | }; |
| 3227 | |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3228 | |
| 3229 | /* |
| 3230 | * Test configuration for debugging |
| 3231 | * |
| 3232 | * Almost all inputs/outputs are enabled. I/O pins can be configured via |
| 3233 | * enum controls. |
| 3234 | */ |
| 3235 | #ifdef CONFIG_SND_DEBUG |
| 3236 | static hda_nid_t alc880_test_dac_nids[4] = { |
| 3237 | 0x02, 0x03, 0x04, 0x05 |
| 3238 | }; |
| 3239 | |
| 3240 | static struct hda_input_mux alc880_test_capture_source = { |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 3241 | .num_items = 7, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3242 | .items = { |
| 3243 | { "In-1", 0x0 }, |
| 3244 | { "In-2", 0x1 }, |
| 3245 | { "In-3", 0x2 }, |
| 3246 | { "In-4", 0x3 }, |
| 3247 | { "CD", 0x4 }, |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 3248 | { "Front", 0x5 }, |
| 3249 | { "Surround", 0x6 }, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3250 | }, |
| 3251 | }; |
| 3252 | |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 3253 | static struct hda_channel_mode alc880_test_modes[4] = { |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3254 | { 2, NULL }, |
Takashi Iwai | fd2c326 | 2005-05-13 17:18:42 +0200 | [diff] [blame] | 3255 | { 4, NULL }, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3256 | { 6, NULL }, |
Takashi Iwai | fd2c326 | 2005-05-13 17:18:42 +0200 | [diff] [blame] | 3257 | { 8, NULL }, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3258 | }; |
| 3259 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 3260 | static int alc_test_pin_ctl_info(struct snd_kcontrol *kcontrol, |
| 3261 | struct snd_ctl_elem_info *uinfo) |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3262 | { |
| 3263 | static char *texts[] = { |
| 3264 | "N/A", "Line Out", "HP Out", |
| 3265 | "In Hi-Z", "In 50%", "In Grd", "In 80%", "In 100%" |
| 3266 | }; |
| 3267 | uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED; |
| 3268 | uinfo->count = 1; |
| 3269 | uinfo->value.enumerated.items = 8; |
| 3270 | if (uinfo->value.enumerated.item >= 8) |
| 3271 | uinfo->value.enumerated.item = 7; |
| 3272 | strcpy(uinfo->value.enumerated.name, texts[uinfo->value.enumerated.item]); |
| 3273 | return 0; |
| 3274 | } |
| 3275 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 3276 | static int alc_test_pin_ctl_get(struct snd_kcontrol *kcontrol, |
| 3277 | struct snd_ctl_elem_value *ucontrol) |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3278 | { |
| 3279 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 3280 | hda_nid_t nid = (hda_nid_t)kcontrol->private_value; |
| 3281 | unsigned int pin_ctl, item = 0; |
| 3282 | |
| 3283 | pin_ctl = snd_hda_codec_read(codec, nid, 0, |
| 3284 | AC_VERB_GET_PIN_WIDGET_CONTROL, 0); |
| 3285 | if (pin_ctl & AC_PINCTL_OUT_EN) { |
| 3286 | if (pin_ctl & AC_PINCTL_HP_EN) |
| 3287 | item = 2; |
| 3288 | else |
| 3289 | item = 1; |
| 3290 | } else if (pin_ctl & AC_PINCTL_IN_EN) { |
| 3291 | switch (pin_ctl & AC_PINCTL_VREFEN) { |
| 3292 | case AC_PINCTL_VREF_HIZ: item = 3; break; |
| 3293 | case AC_PINCTL_VREF_50: item = 4; break; |
| 3294 | case AC_PINCTL_VREF_GRD: item = 5; break; |
| 3295 | case AC_PINCTL_VREF_80: item = 6; break; |
| 3296 | case AC_PINCTL_VREF_100: item = 7; break; |
| 3297 | } |
| 3298 | } |
| 3299 | ucontrol->value.enumerated.item[0] = item; |
| 3300 | return 0; |
| 3301 | } |
| 3302 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 3303 | static int alc_test_pin_ctl_put(struct snd_kcontrol *kcontrol, |
| 3304 | struct snd_ctl_elem_value *ucontrol) |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3305 | { |
| 3306 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 3307 | hda_nid_t nid = (hda_nid_t)kcontrol->private_value; |
| 3308 | static unsigned int ctls[] = { |
| 3309 | 0, AC_PINCTL_OUT_EN, AC_PINCTL_OUT_EN | AC_PINCTL_HP_EN, |
| 3310 | AC_PINCTL_IN_EN | AC_PINCTL_VREF_HIZ, |
| 3311 | AC_PINCTL_IN_EN | AC_PINCTL_VREF_50, |
| 3312 | AC_PINCTL_IN_EN | AC_PINCTL_VREF_GRD, |
| 3313 | AC_PINCTL_IN_EN | AC_PINCTL_VREF_80, |
| 3314 | AC_PINCTL_IN_EN | AC_PINCTL_VREF_100, |
| 3315 | }; |
| 3316 | unsigned int old_ctl, new_ctl; |
| 3317 | |
| 3318 | old_ctl = snd_hda_codec_read(codec, nid, 0, |
| 3319 | AC_VERB_GET_PIN_WIDGET_CONTROL, 0); |
| 3320 | new_ctl = ctls[ucontrol->value.enumerated.item[0]]; |
| 3321 | if (old_ctl != new_ctl) { |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 3322 | int val; |
| 3323 | snd_hda_codec_write_cache(codec, nid, 0, |
| 3324 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 3325 | new_ctl); |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 3326 | val = ucontrol->value.enumerated.item[0] >= 3 ? |
| 3327 | HDA_AMP_MUTE : 0; |
| 3328 | snd_hda_codec_amp_stereo(codec, nid, HDA_OUTPUT, 0, |
| 3329 | HDA_AMP_MUTE, val); |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3330 | return 1; |
| 3331 | } |
| 3332 | return 0; |
| 3333 | } |
| 3334 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 3335 | static int alc_test_pin_src_info(struct snd_kcontrol *kcontrol, |
| 3336 | struct snd_ctl_elem_info *uinfo) |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3337 | { |
| 3338 | static char *texts[] = { |
| 3339 | "Front", "Surround", "CLFE", "Side" |
| 3340 | }; |
| 3341 | uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED; |
| 3342 | uinfo->count = 1; |
| 3343 | uinfo->value.enumerated.items = 4; |
| 3344 | if (uinfo->value.enumerated.item >= 4) |
| 3345 | uinfo->value.enumerated.item = 3; |
| 3346 | strcpy(uinfo->value.enumerated.name, texts[uinfo->value.enumerated.item]); |
| 3347 | return 0; |
| 3348 | } |
| 3349 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 3350 | static int alc_test_pin_src_get(struct snd_kcontrol *kcontrol, |
| 3351 | struct snd_ctl_elem_value *ucontrol) |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3352 | { |
| 3353 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 3354 | hda_nid_t nid = (hda_nid_t)kcontrol->private_value; |
| 3355 | unsigned int sel; |
| 3356 | |
| 3357 | sel = snd_hda_codec_read(codec, nid, 0, AC_VERB_GET_CONNECT_SEL, 0); |
| 3358 | ucontrol->value.enumerated.item[0] = sel & 3; |
| 3359 | return 0; |
| 3360 | } |
| 3361 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 3362 | static int alc_test_pin_src_put(struct snd_kcontrol *kcontrol, |
| 3363 | struct snd_ctl_elem_value *ucontrol) |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3364 | { |
| 3365 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 3366 | hda_nid_t nid = (hda_nid_t)kcontrol->private_value; |
| 3367 | unsigned int sel; |
| 3368 | |
| 3369 | sel = snd_hda_codec_read(codec, nid, 0, AC_VERB_GET_CONNECT_SEL, 0) & 3; |
| 3370 | if (ucontrol->value.enumerated.item[0] != sel) { |
| 3371 | sel = ucontrol->value.enumerated.item[0] & 3; |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 3372 | snd_hda_codec_write_cache(codec, nid, 0, |
| 3373 | AC_VERB_SET_CONNECT_SEL, sel); |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3374 | return 1; |
| 3375 | } |
| 3376 | return 0; |
| 3377 | } |
| 3378 | |
| 3379 | #define PIN_CTL_TEST(xname,nid) { \ |
| 3380 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \ |
| 3381 | .name = xname, \ |
| 3382 | .info = alc_test_pin_ctl_info, \ |
| 3383 | .get = alc_test_pin_ctl_get, \ |
| 3384 | .put = alc_test_pin_ctl_put, \ |
| 3385 | .private_value = nid \ |
| 3386 | } |
| 3387 | |
| 3388 | #define PIN_SRC_TEST(xname,nid) { \ |
| 3389 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \ |
| 3390 | .name = xname, \ |
| 3391 | .info = alc_test_pin_src_info, \ |
| 3392 | .get = alc_test_pin_src_get, \ |
| 3393 | .put = alc_test_pin_src_put, \ |
| 3394 | .private_value = nid \ |
| 3395 | } |
| 3396 | |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 3397 | static struct snd_kcontrol_new alc880_test_mixer[] = { |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 3398 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 3399 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 3400 | HDA_CODEC_VOLUME("CLFE Playback Volume", 0x0e, 0x0, HDA_OUTPUT), |
| 3401 | HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 3402 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 3403 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
| 3404 | HDA_BIND_MUTE("CLFE Playback Switch", 0x0e, 2, HDA_INPUT), |
| 3405 | HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT), |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3406 | PIN_CTL_TEST("Front Pin Mode", 0x14), |
| 3407 | PIN_CTL_TEST("Surround Pin Mode", 0x15), |
| 3408 | PIN_CTL_TEST("CLFE Pin Mode", 0x16), |
| 3409 | PIN_CTL_TEST("Side Pin Mode", 0x17), |
| 3410 | PIN_CTL_TEST("In-1 Pin Mode", 0x18), |
| 3411 | PIN_CTL_TEST("In-2 Pin Mode", 0x19), |
| 3412 | PIN_CTL_TEST("In-3 Pin Mode", 0x1a), |
| 3413 | PIN_CTL_TEST("In-4 Pin Mode", 0x1b), |
| 3414 | PIN_SRC_TEST("In-1 Pin Source", 0x18), |
| 3415 | PIN_SRC_TEST("In-2 Pin Source", 0x19), |
| 3416 | PIN_SRC_TEST("In-3 Pin Source", 0x1a), |
| 3417 | PIN_SRC_TEST("In-4 Pin Source", 0x1b), |
| 3418 | HDA_CODEC_VOLUME("In-1 Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 3419 | HDA_CODEC_MUTE("In-1 Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 3420 | HDA_CODEC_VOLUME("In-2 Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 3421 | HDA_CODEC_MUTE("In-2 Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 3422 | HDA_CODEC_VOLUME("In-3 Playback Volume", 0x0b, 0x2, HDA_INPUT), |
| 3423 | HDA_CODEC_MUTE("In-3 Playback Switch", 0x0b, 0x2, HDA_INPUT), |
| 3424 | HDA_CODEC_VOLUME("In-4 Playback Volume", 0x0b, 0x3, HDA_INPUT), |
| 3425 | HDA_CODEC_MUTE("In-4 Playback Switch", 0x0b, 0x3, HDA_INPUT), |
| 3426 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x4, HDA_INPUT), |
| 3427 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x4, HDA_INPUT), |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3428 | { |
| 3429 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 3430 | .name = "Channel Mode", |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3431 | .info = alc_ch_mode_info, |
| 3432 | .get = alc_ch_mode_get, |
| 3433 | .put = alc_ch_mode_put, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3434 | }, |
| 3435 | { } /* end */ |
| 3436 | }; |
| 3437 | |
| 3438 | static struct hda_verb alc880_test_init_verbs[] = { |
| 3439 | /* Unmute inputs of 0x0c - 0x0f */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 3440 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 3441 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 3442 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 3443 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 3444 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 3445 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 3446 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 3447 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3448 | /* Vol output for 0x0c-0x0f */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 3449 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 3450 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 3451 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 3452 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3453 | /* Set output pins 0x14-0x17 */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 3454 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 3455 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 3456 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 3457 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3458 | /* Unmute output pins 0x14-0x17 */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 3459 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3460 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3461 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3462 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3463 | /* Set input pins 0x18-0x1c */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3464 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 3465 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 3466 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 3467 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 3468 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3469 | /* Mute input pins 0x18-0x1b */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 3470 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 3471 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 3472 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 3473 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 3474 | /* ADC set up */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 3475 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 3476 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 3477 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 3478 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 3479 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 3480 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 3481 | /* Analog input/passthru */ |
| 3482 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 3483 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 3484 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 3485 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 3486 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3487 | { } |
| 3488 | }; |
| 3489 | #endif |
| 3490 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3491 | /* |
| 3492 | */ |
| 3493 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3494 | static const char *alc880_models[ALC880_MODEL_LAST] = { |
| 3495 | [ALC880_3ST] = "3stack", |
| 3496 | [ALC880_TCL_S700] = "tcl", |
| 3497 | [ALC880_3ST_DIG] = "3stack-digout", |
| 3498 | [ALC880_CLEVO] = "clevo", |
| 3499 | [ALC880_5ST] = "5stack", |
| 3500 | [ALC880_5ST_DIG] = "5stack-digout", |
| 3501 | [ALC880_W810] = "w810", |
| 3502 | [ALC880_Z71V] = "z71v", |
| 3503 | [ALC880_6ST] = "6stack", |
| 3504 | [ALC880_6ST_DIG] = "6stack-digout", |
| 3505 | [ALC880_ASUS] = "asus", |
| 3506 | [ALC880_ASUS_W1V] = "asus-w1v", |
| 3507 | [ALC880_ASUS_DIG] = "asus-dig", |
| 3508 | [ALC880_ASUS_DIG2] = "asus-dig2", |
| 3509 | [ALC880_UNIWILL_DIG] = "uniwill", |
Tobin Davis | 2cf9f0f | 2007-02-07 16:04:25 +0100 | [diff] [blame] | 3510 | [ALC880_UNIWILL_P53] = "uniwill-p53", |
| 3511 | [ALC880_FUJITSU] = "fujitsu", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3512 | [ALC880_F1734] = "F1734", |
| 3513 | [ALC880_LG] = "lg", |
| 3514 | [ALC880_LG_LW] = "lg-lw", |
Takashi Iwai | df99cd3 | 2008-04-25 15:25:04 +0200 | [diff] [blame] | 3515 | [ALC880_MEDION_RIM] = "medion", |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3516 | #ifdef CONFIG_SND_DEBUG |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3517 | [ALC880_TEST] = "test", |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3518 | #endif |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3519 | [ALC880_AUTO] = "auto", |
| 3520 | }; |
| 3521 | |
| 3522 | static struct snd_pci_quirk alc880_cfg_tbl[] = { |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 3523 | SND_PCI_QUIRK(0x1019, 0x0f69, "Coeus G610P", ALC880_W810), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3524 | SND_PCI_QUIRK(0x1019, 0xa880, "ECS", ALC880_5ST_DIG), |
| 3525 | SND_PCI_QUIRK(0x1019, 0xa884, "Acer APFV", ALC880_6ST), |
| 3526 | SND_PCI_QUIRK(0x1025, 0x0070, "ULI", ALC880_3ST_DIG), |
| 3527 | SND_PCI_QUIRK(0x1025, 0x0077, "ULI", ALC880_6ST_DIG), |
| 3528 | SND_PCI_QUIRK(0x1025, 0x0078, "ULI", ALC880_6ST_DIG), |
| 3529 | SND_PCI_QUIRK(0x1025, 0x0087, "ULI", ALC880_6ST_DIG), |
| 3530 | SND_PCI_QUIRK(0x1025, 0xe309, "ULI", ALC880_3ST_DIG), |
| 3531 | SND_PCI_QUIRK(0x1025, 0xe310, "ULI", ALC880_3ST), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3532 | SND_PCI_QUIRK(0x1039, 0x1234, NULL, ALC880_6ST_DIG), |
| 3533 | SND_PCI_QUIRK(0x103c, 0x2a09, "HP", ALC880_5ST), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3534 | SND_PCI_QUIRK(0x1043, 0x10b3, "ASUS W1V", ALC880_ASUS_W1V), |
| 3535 | SND_PCI_QUIRK(0x1043, 0x10c2, "ASUS W6A", ALC880_ASUS_DIG), |
| 3536 | SND_PCI_QUIRK(0x1043, 0x10c3, "ASUS Wxx", ALC880_ASUS_DIG), |
| 3537 | SND_PCI_QUIRK(0x1043, 0x1113, "ASUS", ALC880_ASUS_DIG), |
| 3538 | SND_PCI_QUIRK(0x1043, 0x1123, "ASUS", ALC880_ASUS_DIG), |
| 3539 | SND_PCI_QUIRK(0x1043, 0x1173, "ASUS", ALC880_ASUS_DIG), |
| 3540 | SND_PCI_QUIRK(0x1043, 0x1964, "ASUS Z71V", ALC880_Z71V), |
| 3541 | /* SND_PCI_QUIRK(0x1043, 0x1964, "ASUS", ALC880_ASUS_DIG), */ |
| 3542 | SND_PCI_QUIRK(0x1043, 0x1973, "ASUS", ALC880_ASUS_DIG), |
| 3543 | SND_PCI_QUIRK(0x1043, 0x19b3, "ASUS", ALC880_ASUS_DIG), |
Travis Place | 186c311 | 2008-05-20 11:54:41 +0200 | [diff] [blame] | 3544 | SND_PCI_QUIRK(0x1043, 0x814e, "ASUS P5GD1 w/SPDIF", ALC880_6ST_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3545 | SND_PCI_QUIRK(0x1043, 0x8181, "ASUS P4GPL", ALC880_ASUS_DIG), |
| 3546 | SND_PCI_QUIRK(0x1043, 0x8196, "ASUS P5GD1", ALC880_6ST), |
| 3547 | SND_PCI_QUIRK(0x1043, 0x81b4, "ASUS", ALC880_6ST), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 3548 | SND_PCI_QUIRK_VENDOR(0x1043, "ASUS", ALC880_ASUS), /* default ASUS */ |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3549 | SND_PCI_QUIRK(0x104d, 0x81a0, "Sony", ALC880_3ST), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 3550 | SND_PCI_QUIRK(0x104d, 0x81d6, "Sony", ALC880_3ST), |
| 3551 | SND_PCI_QUIRK(0x107b, 0x3032, "Gateway", ALC880_5ST), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3552 | SND_PCI_QUIRK(0x107b, 0x3033, "Gateway", ALC880_5ST), |
| 3553 | SND_PCI_QUIRK(0x107b, 0x4039, "Gateway", ALC880_5ST), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3554 | SND_PCI_QUIRK(0x1297, 0xc790, "Shuttle ST20G5", ALC880_6ST_DIG), |
| 3555 | SND_PCI_QUIRK(0x1458, 0xa102, "Gigabyte K8", ALC880_6ST_DIG), |
| 3556 | SND_PCI_QUIRK(0x1462, 0x1150, "MSI", ALC880_6ST_DIG), |
| 3557 | SND_PCI_QUIRK(0x1509, 0x925d, "FIC P4M", ALC880_6ST_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 3558 | SND_PCI_QUIRK(0x1558, 0x0520, "Clevo m520G", ALC880_CLEVO), |
| 3559 | SND_PCI_QUIRK(0x1558, 0x0660, "Clevo m655n", ALC880_CLEVO), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3560 | SND_PCI_QUIRK(0x1558, 0x5401, "ASUS", ALC880_ASUS_DIG2), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 3561 | SND_PCI_QUIRK(0x1565, 0x8202, "Biostar", ALC880_5ST_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3562 | SND_PCI_QUIRK(0x1584, 0x9050, "Uniwill", ALC880_UNIWILL_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 3563 | SND_PCI_QUIRK(0x1584, 0x9054, "Uniwlll", ALC880_F1734), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3564 | SND_PCI_QUIRK(0x1584, 0x9070, "Uniwill", ALC880_UNIWILL), |
| 3565 | SND_PCI_QUIRK(0x1584, 0x9077, "Uniwill P53", ALC880_UNIWILL_P53), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 3566 | SND_PCI_QUIRK(0x161f, 0x203d, "W810", ALC880_W810), |
Takashi Iwai | df99cd3 | 2008-04-25 15:25:04 +0200 | [diff] [blame] | 3567 | SND_PCI_QUIRK(0x161f, 0x205d, "Medion Rim 2150", ALC880_MEDION_RIM), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 3568 | SND_PCI_QUIRK(0x1695, 0x400d, "EPoX", ALC880_5ST_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3569 | SND_PCI_QUIRK(0x1695, 0x4012, "EPox EP-5LDA", ALC880_5ST_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3570 | SND_PCI_QUIRK(0x1734, 0x107c, "FSC F1734", ALC880_F1734), |
Travis Place | 1d11604 | 2008-06-23 11:42:30 +0200 | [diff] [blame] | 3571 | SND_PCI_QUIRK(0x1734, 0x1094, "FSC Amilo M1451G", ALC880_FUJITSU), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 3572 | SND_PCI_QUIRK(0x1734, 0x10ac, "FSC", ALC880_UNIWILL), |
Tobin Davis | 2cf9f0f | 2007-02-07 16:04:25 +0100 | [diff] [blame] | 3573 | SND_PCI_QUIRK(0x1734, 0x10b0, "Fujitsu", ALC880_FUJITSU), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 3574 | SND_PCI_QUIRK(0x1854, 0x0018, "LG LW20", ALC880_LG_LW), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3575 | SND_PCI_QUIRK(0x1854, 0x003b, "LG", ALC880_LG), |
| 3576 | SND_PCI_QUIRK(0x1854, 0x0068, "LG w1", ALC880_LG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3577 | SND_PCI_QUIRK(0x1854, 0x0077, "LG LW25", ALC880_LG_LW), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 3578 | SND_PCI_QUIRK(0x19db, 0x4188, "TCL S700", ALC880_TCL_S700), |
| 3579 | SND_PCI_QUIRK(0x2668, 0x8086, NULL, ALC880_6ST_DIG), /* broken BIOS */ |
| 3580 | SND_PCI_QUIRK(0x8086, 0x2668, NULL, ALC880_6ST_DIG), |
| 3581 | SND_PCI_QUIRK(0x8086, 0xa100, "Intel mobo", ALC880_5ST_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3582 | SND_PCI_QUIRK(0x8086, 0xd400, "Intel mobo", ALC880_5ST_DIG), |
| 3583 | SND_PCI_QUIRK(0x8086, 0xd401, "Intel mobo", ALC880_5ST_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 3584 | SND_PCI_QUIRK(0x8086, 0xd402, "Intel mobo", ALC880_3ST_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3585 | SND_PCI_QUIRK(0x8086, 0xe224, "Intel mobo", ALC880_5ST_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 3586 | SND_PCI_QUIRK(0x8086, 0xe305, "Intel mobo", ALC880_3ST_DIG), |
| 3587 | SND_PCI_QUIRK(0x8086, 0xe308, "Intel mobo", ALC880_3ST_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3588 | SND_PCI_QUIRK(0x8086, 0xe400, "Intel mobo", ALC880_5ST_DIG), |
| 3589 | SND_PCI_QUIRK(0x8086, 0xe401, "Intel mobo", ALC880_5ST_DIG), |
| 3590 | SND_PCI_QUIRK(0x8086, 0xe402, "Intel mobo", ALC880_5ST_DIG), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 3591 | /* default Intel */ |
| 3592 | SND_PCI_QUIRK_VENDOR(0x8086, "Intel mobo", ALC880_3ST), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 3593 | SND_PCI_QUIRK(0xa0a0, 0x0560, "AOpen i915GMm-HFS", ALC880_5ST_DIG), |
| 3594 | SND_PCI_QUIRK(0xe803, 0x1019, NULL, ALC880_6ST_DIG), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3595 | {} |
| 3596 | }; |
| 3597 | |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3598 | /* |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3599 | * ALC880 codec presets |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3600 | */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3601 | static struct alc_config_preset alc880_presets[] = { |
| 3602 | [ALC880_3ST] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3603 | .mixers = { alc880_three_stack_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3604 | .init_verbs = { alc880_volume_init_verbs, |
| 3605 | alc880_pin_3stack_init_verbs }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3606 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3607 | .dac_nids = alc880_dac_nids, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3608 | .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes), |
| 3609 | .channel_mode = alc880_threestack_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 3610 | .need_dac_fix = 1, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3611 | .input_mux = &alc880_capture_source, |
| 3612 | }, |
| 3613 | [ALC880_3ST_DIG] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3614 | .mixers = { alc880_three_stack_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3615 | .init_verbs = { alc880_volume_init_verbs, |
| 3616 | alc880_pin_3stack_init_verbs }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3617 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3618 | .dac_nids = alc880_dac_nids, |
| 3619 | .dig_out_nid = ALC880_DIGOUT_NID, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3620 | .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes), |
| 3621 | .channel_mode = alc880_threestack_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 3622 | .need_dac_fix = 1, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3623 | .input_mux = &alc880_capture_source, |
| 3624 | }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3625 | [ALC880_TCL_S700] = { |
| 3626 | .mixers = { alc880_tcl_s700_mixer }, |
| 3627 | .init_verbs = { alc880_volume_init_verbs, |
| 3628 | alc880_pin_tcl_S700_init_verbs, |
| 3629 | alc880_gpio2_init_verbs }, |
| 3630 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
| 3631 | .dac_nids = alc880_dac_nids, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 3632 | .adc_nids = alc880_adc_nids_alt, /* FIXME: correct? */ |
| 3633 | .num_adc_nids = 1, /* single ADC */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3634 | .hp_nid = 0x03, |
| 3635 | .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes), |
| 3636 | .channel_mode = alc880_2_jack_modes, |
| 3637 | .input_mux = &alc880_capture_source, |
| 3638 | }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3639 | [ALC880_5ST] = { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3640 | .mixers = { alc880_three_stack_mixer, |
| 3641 | alc880_five_stack_mixer}, |
| 3642 | .init_verbs = { alc880_volume_init_verbs, |
| 3643 | alc880_pin_5stack_init_verbs }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3644 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
| 3645 | .dac_nids = alc880_dac_nids, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3646 | .num_channel_mode = ARRAY_SIZE(alc880_fivestack_modes), |
| 3647 | .channel_mode = alc880_fivestack_modes, |
| 3648 | .input_mux = &alc880_capture_source, |
| 3649 | }, |
| 3650 | [ALC880_5ST_DIG] = { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3651 | .mixers = { alc880_three_stack_mixer, |
| 3652 | alc880_five_stack_mixer }, |
| 3653 | .init_verbs = { alc880_volume_init_verbs, |
| 3654 | alc880_pin_5stack_init_verbs }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3655 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
| 3656 | .dac_nids = alc880_dac_nids, |
| 3657 | .dig_out_nid = ALC880_DIGOUT_NID, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3658 | .num_channel_mode = ARRAY_SIZE(alc880_fivestack_modes), |
| 3659 | .channel_mode = alc880_fivestack_modes, |
| 3660 | .input_mux = &alc880_capture_source, |
| 3661 | }, |
Takashi Iwai | b6482d4 | 2005-06-27 15:32:43 +0200 | [diff] [blame] | 3662 | [ALC880_6ST] = { |
| 3663 | .mixers = { alc880_six_stack_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3664 | .init_verbs = { alc880_volume_init_verbs, |
| 3665 | alc880_pin_6stack_init_verbs }, |
Takashi Iwai | b6482d4 | 2005-06-27 15:32:43 +0200 | [diff] [blame] | 3666 | .num_dacs = ARRAY_SIZE(alc880_6st_dac_nids), |
| 3667 | .dac_nids = alc880_6st_dac_nids, |
| 3668 | .num_channel_mode = ARRAY_SIZE(alc880_sixstack_modes), |
| 3669 | .channel_mode = alc880_sixstack_modes, |
| 3670 | .input_mux = &alc880_6stack_capture_source, |
| 3671 | }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3672 | [ALC880_6ST_DIG] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3673 | .mixers = { alc880_six_stack_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3674 | .init_verbs = { alc880_volume_init_verbs, |
| 3675 | alc880_pin_6stack_init_verbs }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3676 | .num_dacs = ARRAY_SIZE(alc880_6st_dac_nids), |
| 3677 | .dac_nids = alc880_6st_dac_nids, |
| 3678 | .dig_out_nid = ALC880_DIGOUT_NID, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3679 | .num_channel_mode = ARRAY_SIZE(alc880_sixstack_modes), |
| 3680 | .channel_mode = alc880_sixstack_modes, |
| 3681 | .input_mux = &alc880_6stack_capture_source, |
| 3682 | }, |
| 3683 | [ALC880_W810] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3684 | .mixers = { alc880_w810_base_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3685 | .init_verbs = { alc880_volume_init_verbs, |
| 3686 | alc880_pin_w810_init_verbs, |
Takashi Iwai | b0af0de | 2005-06-21 14:49:19 +0200 | [diff] [blame] | 3687 | alc880_gpio2_init_verbs }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3688 | .num_dacs = ARRAY_SIZE(alc880_w810_dac_nids), |
| 3689 | .dac_nids = alc880_w810_dac_nids, |
| 3690 | .dig_out_nid = ALC880_DIGOUT_NID, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3691 | .num_channel_mode = ARRAY_SIZE(alc880_w810_modes), |
| 3692 | .channel_mode = alc880_w810_modes, |
| 3693 | .input_mux = &alc880_capture_source, |
| 3694 | }, |
| 3695 | [ALC880_Z71V] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3696 | .mixers = { alc880_z71v_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3697 | .init_verbs = { alc880_volume_init_verbs, |
| 3698 | alc880_pin_z71v_init_verbs }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3699 | .num_dacs = ARRAY_SIZE(alc880_z71v_dac_nids), |
| 3700 | .dac_nids = alc880_z71v_dac_nids, |
| 3701 | .dig_out_nid = ALC880_DIGOUT_NID, |
| 3702 | .hp_nid = 0x03, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3703 | .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes), |
| 3704 | .channel_mode = alc880_2_jack_modes, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3705 | .input_mux = &alc880_capture_source, |
| 3706 | }, |
| 3707 | [ALC880_F1734] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3708 | .mixers = { alc880_f1734_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3709 | .init_verbs = { alc880_volume_init_verbs, |
| 3710 | alc880_pin_f1734_init_verbs }, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3711 | .num_dacs = ARRAY_SIZE(alc880_f1734_dac_nids), |
| 3712 | .dac_nids = alc880_f1734_dac_nids, |
| 3713 | .hp_nid = 0x02, |
| 3714 | .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes), |
| 3715 | .channel_mode = alc880_2_jack_modes, |
Takashi Iwai | 937b416 | 2008-02-11 14:52:36 +0100 | [diff] [blame] | 3716 | .input_mux = &alc880_f1734_capture_source, |
| 3717 | .unsol_event = alc880_uniwill_p53_unsol_event, |
| 3718 | .init_hook = alc880_uniwill_p53_hp_automute, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3719 | }, |
| 3720 | [ALC880_ASUS] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3721 | .mixers = { alc880_asus_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3722 | .init_verbs = { alc880_volume_init_verbs, |
| 3723 | alc880_pin_asus_init_verbs, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3724 | alc880_gpio1_init_verbs }, |
| 3725 | .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids), |
| 3726 | .dac_nids = alc880_asus_dac_nids, |
| 3727 | .num_channel_mode = ARRAY_SIZE(alc880_asus_modes), |
| 3728 | .channel_mode = alc880_asus_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 3729 | .need_dac_fix = 1, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3730 | .input_mux = &alc880_capture_source, |
| 3731 | }, |
| 3732 | [ALC880_ASUS_DIG] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3733 | .mixers = { alc880_asus_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3734 | .init_verbs = { alc880_volume_init_verbs, |
| 3735 | alc880_pin_asus_init_verbs, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3736 | alc880_gpio1_init_verbs }, |
| 3737 | .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids), |
| 3738 | .dac_nids = alc880_asus_dac_nids, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3739 | .dig_out_nid = ALC880_DIGOUT_NID, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3740 | .num_channel_mode = ARRAY_SIZE(alc880_asus_modes), |
| 3741 | .channel_mode = alc880_asus_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 3742 | .need_dac_fix = 1, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3743 | .input_mux = &alc880_capture_source, |
| 3744 | }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3745 | [ALC880_ASUS_DIG2] = { |
| 3746 | .mixers = { alc880_asus_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3747 | .init_verbs = { alc880_volume_init_verbs, |
| 3748 | alc880_pin_asus_init_verbs, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3749 | alc880_gpio2_init_verbs }, /* use GPIO2 */ |
| 3750 | .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids), |
| 3751 | .dac_nids = alc880_asus_dac_nids, |
| 3752 | .dig_out_nid = ALC880_DIGOUT_NID, |
| 3753 | .num_channel_mode = ARRAY_SIZE(alc880_asus_modes), |
| 3754 | .channel_mode = alc880_asus_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 3755 | .need_dac_fix = 1, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3756 | .input_mux = &alc880_capture_source, |
| 3757 | }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3758 | [ALC880_ASUS_W1V] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3759 | .mixers = { alc880_asus_mixer, alc880_asus_w1v_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3760 | .init_verbs = { alc880_volume_init_verbs, |
| 3761 | alc880_pin_asus_init_verbs, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3762 | alc880_gpio1_init_verbs }, |
| 3763 | .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids), |
| 3764 | .dac_nids = alc880_asus_dac_nids, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3765 | .dig_out_nid = ALC880_DIGOUT_NID, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3766 | .num_channel_mode = ARRAY_SIZE(alc880_asus_modes), |
| 3767 | .channel_mode = alc880_asus_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 3768 | .need_dac_fix = 1, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3769 | .input_mux = &alc880_capture_source, |
| 3770 | }, |
| 3771 | [ALC880_UNIWILL_DIG] = { |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 3772 | .mixers = { alc880_asus_mixer }, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 3773 | .init_verbs = { alc880_volume_init_verbs, |
| 3774 | alc880_pin_asus_init_verbs }, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3775 | .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids), |
| 3776 | .dac_nids = alc880_asus_dac_nids, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3777 | .dig_out_nid = ALC880_DIGOUT_NID, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3778 | .num_channel_mode = ARRAY_SIZE(alc880_asus_modes), |
| 3779 | .channel_mode = alc880_asus_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 3780 | .need_dac_fix = 1, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3781 | .input_mux = &alc880_capture_source, |
| 3782 | }, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 3783 | [ALC880_UNIWILL] = { |
| 3784 | .mixers = { alc880_uniwill_mixer }, |
| 3785 | .init_verbs = { alc880_volume_init_verbs, |
| 3786 | alc880_uniwill_init_verbs }, |
| 3787 | .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids), |
| 3788 | .dac_nids = alc880_asus_dac_nids, |
| 3789 | .dig_out_nid = ALC880_DIGOUT_NID, |
| 3790 | .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes), |
| 3791 | .channel_mode = alc880_threestack_modes, |
| 3792 | .need_dac_fix = 1, |
| 3793 | .input_mux = &alc880_capture_source, |
| 3794 | .unsol_event = alc880_uniwill_unsol_event, |
| 3795 | .init_hook = alc880_uniwill_automute, |
| 3796 | }, |
| 3797 | [ALC880_UNIWILL_P53] = { |
| 3798 | .mixers = { alc880_uniwill_p53_mixer }, |
| 3799 | .init_verbs = { alc880_volume_init_verbs, |
| 3800 | alc880_uniwill_p53_init_verbs }, |
| 3801 | .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids), |
| 3802 | .dac_nids = alc880_asus_dac_nids, |
| 3803 | .num_channel_mode = ARRAY_SIZE(alc880_w810_modes), |
Tobin Davis | 2cf9f0f | 2007-02-07 16:04:25 +0100 | [diff] [blame] | 3804 | .channel_mode = alc880_threestack_modes, |
| 3805 | .input_mux = &alc880_capture_source, |
| 3806 | .unsol_event = alc880_uniwill_p53_unsol_event, |
| 3807 | .init_hook = alc880_uniwill_p53_hp_automute, |
| 3808 | }, |
| 3809 | [ALC880_FUJITSU] = { |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 3810 | .mixers = { alc880_fujitsu_mixer }, |
Tobin Davis | 2cf9f0f | 2007-02-07 16:04:25 +0100 | [diff] [blame] | 3811 | .init_verbs = { alc880_volume_init_verbs, |
| 3812 | alc880_uniwill_p53_init_verbs, |
| 3813 | alc880_beep_init_verbs }, |
| 3814 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
| 3815 | .dac_nids = alc880_dac_nids, |
Takashi Iwai | d53d7d9 | 2007-08-20 15:20:02 +0200 | [diff] [blame] | 3816 | .dig_out_nid = ALC880_DIGOUT_NID, |
Tobin Davis | 2cf9f0f | 2007-02-07 16:04:25 +0100 | [diff] [blame] | 3817 | .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes), |
| 3818 | .channel_mode = alc880_2_jack_modes, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 3819 | .input_mux = &alc880_capture_source, |
| 3820 | .unsol_event = alc880_uniwill_p53_unsol_event, |
| 3821 | .init_hook = alc880_uniwill_p53_hp_automute, |
| 3822 | }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3823 | [ALC880_CLEVO] = { |
| 3824 | .mixers = { alc880_three_stack_mixer }, |
| 3825 | .init_verbs = { alc880_volume_init_verbs, |
| 3826 | alc880_pin_clevo_init_verbs }, |
| 3827 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
| 3828 | .dac_nids = alc880_dac_nids, |
| 3829 | .hp_nid = 0x03, |
| 3830 | .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes), |
| 3831 | .channel_mode = alc880_threestack_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 3832 | .need_dac_fix = 1, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3833 | .input_mux = &alc880_capture_source, |
| 3834 | }, |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 3835 | [ALC880_LG] = { |
| 3836 | .mixers = { alc880_lg_mixer }, |
| 3837 | .init_verbs = { alc880_volume_init_verbs, |
| 3838 | alc880_lg_init_verbs }, |
| 3839 | .num_dacs = ARRAY_SIZE(alc880_lg_dac_nids), |
| 3840 | .dac_nids = alc880_lg_dac_nids, |
| 3841 | .dig_out_nid = ALC880_DIGOUT_NID, |
| 3842 | .num_channel_mode = ARRAY_SIZE(alc880_lg_ch_modes), |
| 3843 | .channel_mode = alc880_lg_ch_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 3844 | .need_dac_fix = 1, |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 3845 | .input_mux = &alc880_lg_capture_source, |
| 3846 | .unsol_event = alc880_lg_unsol_event, |
| 3847 | .init_hook = alc880_lg_automute, |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 3848 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 3849 | .loopbacks = alc880_lg_loopbacks, |
| 3850 | #endif |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 3851 | }, |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 3852 | [ALC880_LG_LW] = { |
| 3853 | .mixers = { alc880_lg_lw_mixer }, |
| 3854 | .init_verbs = { alc880_volume_init_verbs, |
| 3855 | alc880_lg_lw_init_verbs }, |
Claudio Matsuoka | 0a8c5da | 2007-07-04 15:17:38 +0200 | [diff] [blame] | 3856 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 3857 | .dac_nids = alc880_dac_nids, |
| 3858 | .dig_out_nid = ALC880_DIGOUT_NID, |
Claudio Matsuoka | 0a8c5da | 2007-07-04 15:17:38 +0200 | [diff] [blame] | 3859 | .num_channel_mode = ARRAY_SIZE(alc880_lg_lw_modes), |
| 3860 | .channel_mode = alc880_lg_lw_modes, |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 3861 | .input_mux = &alc880_lg_lw_capture_source, |
| 3862 | .unsol_event = alc880_lg_lw_unsol_event, |
| 3863 | .init_hook = alc880_lg_lw_automute, |
| 3864 | }, |
Takashi Iwai | df99cd3 | 2008-04-25 15:25:04 +0200 | [diff] [blame] | 3865 | [ALC880_MEDION_RIM] = { |
| 3866 | .mixers = { alc880_medion_rim_mixer }, |
| 3867 | .init_verbs = { alc880_volume_init_verbs, |
| 3868 | alc880_medion_rim_init_verbs, |
| 3869 | alc_gpio2_init_verbs }, |
| 3870 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
| 3871 | .dac_nids = alc880_dac_nids, |
| 3872 | .dig_out_nid = ALC880_DIGOUT_NID, |
| 3873 | .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes), |
| 3874 | .channel_mode = alc880_2_jack_modes, |
| 3875 | .input_mux = &alc880_medion_rim_capture_source, |
| 3876 | .unsol_event = alc880_medion_rim_unsol_event, |
| 3877 | .init_hook = alc880_medion_rim_automute, |
| 3878 | }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3879 | #ifdef CONFIG_SND_DEBUG |
| 3880 | [ALC880_TEST] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3881 | .mixers = { alc880_test_mixer }, |
| 3882 | .init_verbs = { alc880_test_init_verbs }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3883 | .num_dacs = ARRAY_SIZE(alc880_test_dac_nids), |
| 3884 | .dac_nids = alc880_test_dac_nids, |
| 3885 | .dig_out_nid = ALC880_DIGOUT_NID, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3886 | .num_channel_mode = ARRAY_SIZE(alc880_test_modes), |
| 3887 | .channel_mode = alc880_test_modes, |
| 3888 | .input_mux = &alc880_test_capture_source, |
| 3889 | }, |
| 3890 | #endif |
| 3891 | }; |
| 3892 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3893 | /* |
| 3894 | * Automatic parse of I/O pins from the BIOS configuration |
| 3895 | */ |
| 3896 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3897 | enum { |
| 3898 | ALC_CTL_WIDGET_VOL, |
| 3899 | ALC_CTL_WIDGET_MUTE, |
| 3900 | ALC_CTL_BIND_MUTE, |
| 3901 | }; |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 3902 | static struct snd_kcontrol_new alc880_control_templates[] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3903 | HDA_CODEC_VOLUME(NULL, 0, 0, 0), |
| 3904 | HDA_CODEC_MUTE(NULL, 0, 0, 0), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 3905 | HDA_BIND_MUTE(NULL, 0, 0, 0), |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3906 | }; |
| 3907 | |
| 3908 | /* add dynamic controls */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3909 | static int add_control(struct alc_spec *spec, int type, const char *name, |
| 3910 | unsigned long val) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3911 | { |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 3912 | struct snd_kcontrol_new *knew; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3913 | |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 3914 | snd_array_init(&spec->kctls, sizeof(*knew), 32); |
| 3915 | knew = snd_array_new(&spec->kctls); |
| 3916 | if (!knew) |
| 3917 | return -ENOMEM; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3918 | *knew = alc880_control_templates[type]; |
Paulo Marques | 543537b | 2005-06-23 00:09:02 -0700 | [diff] [blame] | 3919 | knew->name = kstrdup(name, GFP_KERNEL); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3920 | if (!knew->name) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3921 | return -ENOMEM; |
| 3922 | knew->private_value = val; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3923 | return 0; |
| 3924 | } |
| 3925 | |
| 3926 | #define alc880_is_fixed_pin(nid) ((nid) >= 0x14 && (nid) <= 0x17) |
| 3927 | #define alc880_fixed_pin_idx(nid) ((nid) - 0x14) |
| 3928 | #define alc880_is_multi_pin(nid) ((nid) >= 0x18) |
| 3929 | #define alc880_multi_pin_idx(nid) ((nid) - 0x18) |
| 3930 | #define alc880_is_input_pin(nid) ((nid) >= 0x18) |
| 3931 | #define alc880_input_pin_idx(nid) ((nid) - 0x18) |
| 3932 | #define alc880_idx_to_dac(nid) ((nid) + 0x02) |
| 3933 | #define alc880_dac_to_idx(nid) ((nid) - 0x02) |
| 3934 | #define alc880_idx_to_mixer(nid) ((nid) + 0x0c) |
| 3935 | #define alc880_idx_to_selector(nid) ((nid) + 0x10) |
| 3936 | #define ALC880_PIN_CD_NID 0x1c |
| 3937 | |
| 3938 | /* fill in the dac_nids table from the parsed pin configuration */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3939 | static int alc880_auto_fill_dac_nids(struct alc_spec *spec, |
| 3940 | const struct auto_pin_cfg *cfg) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3941 | { |
| 3942 | hda_nid_t nid; |
| 3943 | int assigned[4]; |
| 3944 | int i, j; |
| 3945 | |
| 3946 | memset(assigned, 0, sizeof(assigned)); |
Takashi Iwai | b0af0de | 2005-06-21 14:49:19 +0200 | [diff] [blame] | 3947 | spec->multiout.dac_nids = spec->private_dac_nids; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3948 | |
| 3949 | /* check the pins hardwired to audio widget */ |
| 3950 | for (i = 0; i < cfg->line_outs; i++) { |
| 3951 | nid = cfg->line_out_pins[i]; |
| 3952 | if (alc880_is_fixed_pin(nid)) { |
| 3953 | int idx = alc880_fixed_pin_idx(nid); |
Libin Yang | 5014f19 | 2005-11-23 15:48:36 +0100 | [diff] [blame] | 3954 | spec->multiout.dac_nids[i] = alc880_idx_to_dac(idx); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3955 | assigned[idx] = 1; |
| 3956 | } |
| 3957 | } |
| 3958 | /* left pins can be connect to any audio widget */ |
| 3959 | for (i = 0; i < cfg->line_outs; i++) { |
| 3960 | nid = cfg->line_out_pins[i]; |
| 3961 | if (alc880_is_fixed_pin(nid)) |
| 3962 | continue; |
| 3963 | /* search for an empty channel */ |
| 3964 | for (j = 0; j < cfg->line_outs; j++) { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3965 | if (!assigned[j]) { |
| 3966 | spec->multiout.dac_nids[i] = |
| 3967 | alc880_idx_to_dac(j); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3968 | assigned[j] = 1; |
| 3969 | break; |
| 3970 | } |
| 3971 | } |
| 3972 | } |
| 3973 | spec->multiout.num_dacs = cfg->line_outs; |
| 3974 | return 0; |
| 3975 | } |
| 3976 | |
| 3977 | /* add playback controls from the parsed DAC table */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3978 | static int alc880_auto_create_multi_out_ctls(struct alc_spec *spec, |
| 3979 | const struct auto_pin_cfg *cfg) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3980 | { |
| 3981 | char name[32]; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3982 | static const char *chname[4] = { |
| 3983 | "Front", "Surround", NULL /*CLFE*/, "Side" |
| 3984 | }; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3985 | hda_nid_t nid; |
| 3986 | int i, err; |
| 3987 | |
| 3988 | for (i = 0; i < cfg->line_outs; i++) { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3989 | if (!spec->multiout.dac_nids[i]) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3990 | continue; |
| 3991 | nid = alc880_idx_to_mixer(alc880_dac_to_idx(spec->multiout.dac_nids[i])); |
| 3992 | if (i == 2) { |
| 3993 | /* Center/LFE */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3994 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 3995 | "Center Playback Volume", |
| 3996 | HDA_COMPOSE_AMP_VAL(nid, 1, 0, |
| 3997 | HDA_OUTPUT)); |
| 3998 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3999 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4000 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 4001 | "LFE Playback Volume", |
| 4002 | HDA_COMPOSE_AMP_VAL(nid, 2, 0, |
| 4003 | HDA_OUTPUT)); |
| 4004 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4005 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4006 | err = add_control(spec, ALC_CTL_BIND_MUTE, |
| 4007 | "Center Playback Switch", |
| 4008 | HDA_COMPOSE_AMP_VAL(nid, 1, 2, |
| 4009 | HDA_INPUT)); |
| 4010 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4011 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4012 | err = add_control(spec, ALC_CTL_BIND_MUTE, |
| 4013 | "LFE Playback Switch", |
| 4014 | HDA_COMPOSE_AMP_VAL(nid, 2, 2, |
| 4015 | HDA_INPUT)); |
| 4016 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4017 | return err; |
| 4018 | } else { |
| 4019 | sprintf(name, "%s Playback Volume", chname[i]); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4020 | err = add_control(spec, ALC_CTL_WIDGET_VOL, name, |
| 4021 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, |
| 4022 | HDA_OUTPUT)); |
| 4023 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4024 | return err; |
| 4025 | sprintf(name, "%s Playback Switch", chname[i]); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4026 | err = add_control(spec, ALC_CTL_BIND_MUTE, name, |
| 4027 | HDA_COMPOSE_AMP_VAL(nid, 3, 2, |
| 4028 | HDA_INPUT)); |
| 4029 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4030 | return err; |
| 4031 | } |
| 4032 | } |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4033 | return 0; |
| 4034 | } |
| 4035 | |
Takashi Iwai | 8d88bc3 | 2005-11-17 11:09:23 +0100 | [diff] [blame] | 4036 | /* add playback controls for speaker and HP outputs */ |
| 4037 | static int alc880_auto_create_extra_out(struct alc_spec *spec, hda_nid_t pin, |
| 4038 | const char *pfx) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4039 | { |
| 4040 | hda_nid_t nid; |
| 4041 | int err; |
Takashi Iwai | 8d88bc3 | 2005-11-17 11:09:23 +0100 | [diff] [blame] | 4042 | char name[32]; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4043 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4044 | if (!pin) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4045 | return 0; |
| 4046 | |
| 4047 | if (alc880_is_fixed_pin(pin)) { |
| 4048 | nid = alc880_idx_to_dac(alc880_fixed_pin_idx(pin)); |
Takashi Iwai | 82bc955 | 2006-03-21 11:24:42 +0100 | [diff] [blame] | 4049 | /* specify the DAC as the extra output */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4050 | if (!spec->multiout.hp_nid) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4051 | spec->multiout.hp_nid = nid; |
Takashi Iwai | 82bc955 | 2006-03-21 11:24:42 +0100 | [diff] [blame] | 4052 | else |
| 4053 | spec->multiout.extra_out_nid[0] = nid; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4054 | /* control HP volume/switch on the output mixer amp */ |
| 4055 | nid = alc880_idx_to_mixer(alc880_fixed_pin_idx(pin)); |
Takashi Iwai | 8d88bc3 | 2005-11-17 11:09:23 +0100 | [diff] [blame] | 4056 | sprintf(name, "%s Playback Volume", pfx); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4057 | err = add_control(spec, ALC_CTL_WIDGET_VOL, name, |
| 4058 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT)); |
| 4059 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4060 | return err; |
Takashi Iwai | 8d88bc3 | 2005-11-17 11:09:23 +0100 | [diff] [blame] | 4061 | sprintf(name, "%s Playback Switch", pfx); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4062 | err = add_control(spec, ALC_CTL_BIND_MUTE, name, |
| 4063 | HDA_COMPOSE_AMP_VAL(nid, 3, 2, HDA_INPUT)); |
| 4064 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4065 | return err; |
| 4066 | } else if (alc880_is_multi_pin(pin)) { |
| 4067 | /* set manual connection */ |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4068 | /* we have only a switch on HP-out PIN */ |
Takashi Iwai | 8d88bc3 | 2005-11-17 11:09:23 +0100 | [diff] [blame] | 4069 | sprintf(name, "%s Playback Switch", pfx); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4070 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, name, |
| 4071 | HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT)); |
| 4072 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4073 | return err; |
| 4074 | } |
| 4075 | return 0; |
| 4076 | } |
| 4077 | |
| 4078 | /* create input playback/capture controls for the given pin */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4079 | static int new_analog_input(struct alc_spec *spec, hda_nid_t pin, |
| 4080 | const char *ctlname, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4081 | int idx, hda_nid_t mix_nid) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4082 | { |
| 4083 | char name[32]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4084 | int err; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4085 | |
| 4086 | sprintf(name, "%s Playback Volume", ctlname); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4087 | err = add_control(spec, ALC_CTL_WIDGET_VOL, name, |
| 4088 | HDA_COMPOSE_AMP_VAL(mix_nid, 3, idx, HDA_INPUT)); |
| 4089 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4090 | return err; |
| 4091 | sprintf(name, "%s Playback Switch", ctlname); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4092 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, name, |
| 4093 | HDA_COMPOSE_AMP_VAL(mix_nid, 3, idx, HDA_INPUT)); |
| 4094 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4095 | return err; |
| 4096 | return 0; |
| 4097 | } |
| 4098 | |
| 4099 | /* create playback/capture controls for input pins */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4100 | static int alc880_auto_create_analog_input_ctls(struct alc_spec *spec, |
| 4101 | const struct auto_pin_cfg *cfg) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4102 | { |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 4103 | struct hda_input_mux *imux = &spec->private_imux[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4104 | int i, err, idx; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4105 | |
| 4106 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
| 4107 | if (alc880_is_input_pin(cfg->input_pins[i])) { |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4108 | idx = alc880_input_pin_idx(cfg->input_pins[i]); |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 4109 | err = new_analog_input(spec, cfg->input_pins[i], |
| 4110 | auto_pin_cfg_labels[i], |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4111 | idx, 0x0b); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4112 | if (err < 0) |
| 4113 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4114 | imux->items[imux->num_items].label = |
| 4115 | auto_pin_cfg_labels[i]; |
| 4116 | imux->items[imux->num_items].index = |
| 4117 | alc880_input_pin_idx(cfg->input_pins[i]); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4118 | imux->num_items++; |
| 4119 | } |
| 4120 | } |
| 4121 | return 0; |
| 4122 | } |
| 4123 | |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 4124 | static void alc_set_pin_output(struct hda_codec *codec, hda_nid_t nid, |
| 4125 | unsigned int pin_type) |
| 4126 | { |
| 4127 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 4128 | pin_type); |
| 4129 | /* unmute pin */ |
Takashi Iwai | d260cdf | 2008-02-13 17:19:35 +0100 | [diff] [blame] | 4130 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_AMP_GAIN_MUTE, |
| 4131 | AMP_OUT_UNMUTE); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 4132 | } |
| 4133 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4134 | static void alc880_auto_set_output_and_unmute(struct hda_codec *codec, |
| 4135 | hda_nid_t nid, int pin_type, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4136 | int dac_idx) |
| 4137 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 4138 | alc_set_pin_output(codec, nid, pin_type); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4139 | /* need the manual connection? */ |
| 4140 | if (alc880_is_multi_pin(nid)) { |
| 4141 | struct alc_spec *spec = codec->spec; |
| 4142 | int idx = alc880_multi_pin_idx(nid); |
| 4143 | snd_hda_codec_write(codec, alc880_idx_to_selector(idx), 0, |
| 4144 | AC_VERB_SET_CONNECT_SEL, |
| 4145 | alc880_dac_to_idx(spec->multiout.dac_nids[dac_idx])); |
| 4146 | } |
| 4147 | } |
| 4148 | |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 4149 | static int get_pin_type(int line_out_type) |
| 4150 | { |
| 4151 | if (line_out_type == AUTO_PIN_HP_OUT) |
| 4152 | return PIN_HP; |
| 4153 | else |
| 4154 | return PIN_OUT; |
| 4155 | } |
| 4156 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4157 | static void alc880_auto_init_multi_out(struct hda_codec *codec) |
| 4158 | { |
| 4159 | struct alc_spec *spec = codec->spec; |
| 4160 | int i; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 4161 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 4162 | alc_subsystem_id(codec, 0x15, 0x1b, 0x14); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4163 | for (i = 0; i < spec->autocfg.line_outs; i++) { |
| 4164 | hda_nid_t nid = spec->autocfg.line_out_pins[i]; |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 4165 | int pin_type = get_pin_type(spec->autocfg.line_out_type); |
| 4166 | alc880_auto_set_output_and_unmute(codec, nid, pin_type, i); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4167 | } |
| 4168 | } |
| 4169 | |
Takashi Iwai | 8d88bc3 | 2005-11-17 11:09:23 +0100 | [diff] [blame] | 4170 | static void alc880_auto_init_extra_out(struct hda_codec *codec) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4171 | { |
| 4172 | struct alc_spec *spec = codec->spec; |
| 4173 | hda_nid_t pin; |
| 4174 | |
Takashi Iwai | 82bc955 | 2006-03-21 11:24:42 +0100 | [diff] [blame] | 4175 | pin = spec->autocfg.speaker_pins[0]; |
Takashi Iwai | 8d88bc3 | 2005-11-17 11:09:23 +0100 | [diff] [blame] | 4176 | if (pin) /* connect to front */ |
| 4177 | alc880_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0); |
Takashi Iwai | eb06ed8 | 2006-09-20 17:10:27 +0200 | [diff] [blame] | 4178 | pin = spec->autocfg.hp_pins[0]; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4179 | if (pin) /* connect to front */ |
| 4180 | alc880_auto_set_output_and_unmute(codec, pin, PIN_HP, 0); |
| 4181 | } |
| 4182 | |
| 4183 | static void alc880_auto_init_analog_input(struct hda_codec *codec) |
| 4184 | { |
| 4185 | struct alc_spec *spec = codec->spec; |
| 4186 | int i; |
| 4187 | |
| 4188 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
| 4189 | hda_nid_t nid = spec->autocfg.input_pins[i]; |
| 4190 | if (alc880_is_input_pin(nid)) { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4191 | snd_hda_codec_write(codec, nid, 0, |
| 4192 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 4193 | i <= AUTO_PIN_FRONT_MIC ? |
| 4194 | PIN_VREF80 : PIN_IN); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4195 | if (nid != ALC880_PIN_CD_NID) |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4196 | snd_hda_codec_write(codec, nid, 0, |
| 4197 | AC_VERB_SET_AMP_GAIN_MUTE, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4198 | AMP_OUT_MUTE); |
| 4199 | } |
| 4200 | } |
| 4201 | } |
| 4202 | |
| 4203 | /* parse the BIOS configuration and set up the alc_spec */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4204 | /* return 1 if successful, 0 if the proper config is not found, |
| 4205 | * or a negative error code |
| 4206 | */ |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4207 | static int alc880_parse_auto_config(struct hda_codec *codec) |
| 4208 | { |
| 4209 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 6a05ac4 | 2009-02-13 11:19:09 +0100 | [diff] [blame] | 4210 | int i, err; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4211 | static hda_nid_t alc880_ignore[] = { 0x1d, 0 }; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4212 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4213 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 4214 | alc880_ignore); |
| 4215 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4216 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4217 | if (!spec->autocfg.line_outs) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4218 | return 0; /* can't find valid BIOS pin config */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4219 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4220 | err = alc880_auto_fill_dac_nids(spec, &spec->autocfg); |
| 4221 | if (err < 0) |
| 4222 | return err; |
| 4223 | err = alc880_auto_create_multi_out_ctls(spec, &spec->autocfg); |
| 4224 | if (err < 0) |
| 4225 | return err; |
| 4226 | err = alc880_auto_create_extra_out(spec, |
| 4227 | spec->autocfg.speaker_pins[0], |
| 4228 | "Speaker"); |
| 4229 | if (err < 0) |
| 4230 | return err; |
| 4231 | err = alc880_auto_create_extra_out(spec, spec->autocfg.hp_pins[0], |
| 4232 | "Headphone"); |
| 4233 | if (err < 0) |
| 4234 | return err; |
| 4235 | err = alc880_auto_create_analog_input_ctls(spec, &spec->autocfg); |
| 4236 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4237 | return err; |
| 4238 | |
| 4239 | spec->multiout.max_channels = spec->multiout.num_dacs * 2; |
| 4240 | |
Takashi Iwai | 6a05ac4 | 2009-02-13 11:19:09 +0100 | [diff] [blame] | 4241 | /* check multiple SPDIF-out (for recent codecs) */ |
| 4242 | for (i = 0; i < spec->autocfg.dig_outs; i++) { |
| 4243 | hda_nid_t dig_nid; |
| 4244 | err = snd_hda_get_connections(codec, |
| 4245 | spec->autocfg.dig_out_pins[i], |
| 4246 | &dig_nid, 1); |
| 4247 | if (err < 0) |
| 4248 | continue; |
| 4249 | if (!i) |
| 4250 | spec->multiout.dig_out_nid = dig_nid; |
| 4251 | else { |
| 4252 | spec->multiout.slave_dig_outs = spec->slave_dig_outs; |
| 4253 | spec->slave_dig_outs[i - 1] = dig_nid; |
| 4254 | if (i == ARRAY_SIZE(spec->slave_dig_outs) - 1) |
| 4255 | break; |
| 4256 | } |
| 4257 | } |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4258 | if (spec->autocfg.dig_in_pin) |
| 4259 | spec->dig_in_nid = ALC880_DIGIN_NID; |
| 4260 | |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 4261 | if (spec->kctls.list) |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 4262 | add_mixer(spec, spec->kctls.list); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4263 | |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 4264 | add_verb(spec, alc880_volume_init_verbs); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4265 | |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 4266 | spec->num_mux_defs = 1; |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 4267 | spec->input_mux = &spec->private_imux[0]; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4268 | |
| 4269 | return 1; |
| 4270 | } |
| 4271 | |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 4272 | /* additional initialization for auto-configuration model */ |
| 4273 | static void alc880_auto_init(struct hda_codec *codec) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4274 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 4275 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4276 | alc880_auto_init_multi_out(codec); |
Takashi Iwai | 8d88bc3 | 2005-11-17 11:09:23 +0100 | [diff] [blame] | 4277 | alc880_auto_init_extra_out(codec); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4278 | alc880_auto_init_analog_input(codec); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 4279 | if (spec->unsol_event) |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 4280 | alc_inithook(codec); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4281 | } |
| 4282 | |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 4283 | static void set_capture_mixer(struct alc_spec *spec) |
| 4284 | { |
| 4285 | static struct snd_kcontrol_new *caps[3] = { |
| 4286 | alc_capture_mixer1, |
| 4287 | alc_capture_mixer2, |
| 4288 | alc_capture_mixer3, |
| 4289 | }; |
Takashi Iwai | 30d72e9 | 2008-11-27 15:25:34 +0100 | [diff] [blame] | 4290 | if (spec->num_adc_nids > 0 && spec->num_adc_nids <= 3) |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 4291 | spec->cap_mixer = caps[spec->num_adc_nids - 1]; |
| 4292 | } |
| 4293 | |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 4294 | #define set_beep_amp(spec, nid, idx, dir) \ |
| 4295 | ((spec)->beep_amp = HDA_COMPOSE_AMP_VAL(nid, 3, idx, dir)) |
| 4296 | |
| 4297 | /* |
| 4298 | * OK, here we have finally the patch for ALC880 |
| 4299 | */ |
| 4300 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4301 | static int patch_alc880(struct hda_codec *codec) |
| 4302 | { |
| 4303 | struct alc_spec *spec; |
| 4304 | int board_config; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4305 | int err; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4306 | |
Takashi Iwai | e560d8d | 2005-09-09 14:21:46 +0200 | [diff] [blame] | 4307 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4308 | if (spec == NULL) |
| 4309 | return -ENOMEM; |
| 4310 | |
| 4311 | codec->spec = spec; |
| 4312 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 4313 | board_config = snd_hda_check_board_config(codec, ALC880_MODEL_LAST, |
| 4314 | alc880_models, |
| 4315 | alc880_cfg_tbl); |
| 4316 | if (board_config < 0) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 4317 | printk(KERN_INFO "hda_codec: Unknown model for ALC880, " |
| 4318 | "trying auto-probe from BIOS...\n"); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4319 | board_config = ALC880_AUTO; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4320 | } |
| 4321 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4322 | if (board_config == ALC880_AUTO) { |
| 4323 | /* automatic parse from the BIOS config */ |
| 4324 | err = alc880_parse_auto_config(codec); |
| 4325 | if (err < 0) { |
| 4326 | alc_free(codec); |
| 4327 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4328 | } else if (!err) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 4329 | printk(KERN_INFO |
| 4330 | "hda_codec: Cannot set up configuration " |
| 4331 | "from BIOS. Using 3-stack mode...\n"); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4332 | board_config = ALC880_3ST; |
| 4333 | } |
| 4334 | } |
| 4335 | |
Kusanagi Kouichi | 680cd53 | 2009-02-05 00:00:58 +0900 | [diff] [blame] | 4336 | err = snd_hda_attach_beep_device(codec, 0x1); |
| 4337 | if (err < 0) { |
| 4338 | alc_free(codec); |
| 4339 | return err; |
| 4340 | } |
| 4341 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4342 | if (board_config != ALC880_AUTO) |
| 4343 | setup_preset(spec, &alc880_presets[board_config]); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4344 | |
| 4345 | spec->stream_name_analog = "ALC880 Analog"; |
| 4346 | spec->stream_analog_playback = &alc880_pcm_analog_playback; |
| 4347 | spec->stream_analog_capture = &alc880_pcm_analog_capture; |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 4348 | spec->stream_analog_alt_capture = &alc880_pcm_analog_alt_capture; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4349 | |
| 4350 | spec->stream_name_digital = "ALC880 Digital"; |
| 4351 | spec->stream_digital_playback = &alc880_pcm_digital_playback; |
| 4352 | spec->stream_digital_capture = &alc880_pcm_digital_capture; |
| 4353 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4354 | if (!spec->adc_nids && spec->input_mux) { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4355 | /* check whether NID 0x07 is valid */ |
Takashi Iwai | 54d1740 | 2005-11-21 16:33:22 +0100 | [diff] [blame] | 4356 | unsigned int wcap = get_wcaps(codec, alc880_adc_nids[0]); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4357 | /* get type */ |
| 4358 | wcap = (wcap & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4359 | if (wcap != AC_WID_AUD_IN) { |
| 4360 | spec->adc_nids = alc880_adc_nids_alt; |
| 4361 | spec->num_adc_nids = ARRAY_SIZE(alc880_adc_nids_alt); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4362 | } else { |
| 4363 | spec->adc_nids = alc880_adc_nids; |
| 4364 | spec->num_adc_nids = ARRAY_SIZE(alc880_adc_nids); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4365 | } |
| 4366 | } |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 4367 | set_capture_mixer(spec); |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 4368 | set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4369 | |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 4370 | spec->vmaster_nid = 0x0c; |
| 4371 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4372 | codec->patch_ops = alc_patch_ops; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4373 | if (board_config == ALC880_AUTO) |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 4374 | spec->init_hook = alc880_auto_init; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 4375 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 4376 | if (!spec->loopback.amplist) |
| 4377 | spec->loopback.amplist = alc880_loopbacks; |
| 4378 | #endif |
Takashi Iwai | daead53 | 2008-11-28 12:55:36 +0100 | [diff] [blame] | 4379 | codec->proc_widget_hook = print_realtek_coef; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4380 | |
| 4381 | return 0; |
| 4382 | } |
| 4383 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4384 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4385 | /* |
| 4386 | * ALC260 support |
| 4387 | */ |
| 4388 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4389 | static hda_nid_t alc260_dac_nids[1] = { |
| 4390 | /* front */ |
| 4391 | 0x02, |
| 4392 | }; |
| 4393 | |
| 4394 | static hda_nid_t alc260_adc_nids[1] = { |
| 4395 | /* ADC0 */ |
| 4396 | 0x04, |
| 4397 | }; |
| 4398 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4399 | static hda_nid_t alc260_adc_nids_alt[1] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4400 | /* ADC1 */ |
| 4401 | 0x05, |
| 4402 | }; |
| 4403 | |
Jonathan Woithe | d57fdac | 2006-02-28 11:38:35 +0100 | [diff] [blame] | 4404 | /* NIDs used when simultaneous access to both ADCs makes sense. Note that |
| 4405 | * alc260_capture_mixer assumes ADC0 (nid 0x04) is the first ADC. |
| 4406 | */ |
| 4407 | static hda_nid_t alc260_dual_adc_nids[2] = { |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 4408 | /* ADC0, ADC1 */ |
| 4409 | 0x04, 0x05 |
| 4410 | }; |
| 4411 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4412 | #define ALC260_DIGOUT_NID 0x03 |
| 4413 | #define ALC260_DIGIN_NID 0x06 |
| 4414 | |
| 4415 | static struct hda_input_mux alc260_capture_source = { |
| 4416 | .num_items = 4, |
| 4417 | .items = { |
| 4418 | { "Mic", 0x0 }, |
| 4419 | { "Front Mic", 0x1 }, |
| 4420 | { "Line", 0x2 }, |
| 4421 | { "CD", 0x4 }, |
| 4422 | }, |
| 4423 | }; |
| 4424 | |
Jonathan Woithe | 17e7aec | 2006-02-28 11:35:18 +0100 | [diff] [blame] | 4425 | /* On Fujitsu S702x laptops capture only makes sense from Mic/LineIn jack, |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 4426 | * headphone jack and the internal CD lines since these are the only pins at |
| 4427 | * which audio can appear. For flexibility, also allow the option of |
| 4428 | * recording the mixer output on the second ADC (ADC0 doesn't have a |
| 4429 | * connection to the mixer output). |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 4430 | */ |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 4431 | static struct hda_input_mux alc260_fujitsu_capture_sources[2] = { |
| 4432 | { |
| 4433 | .num_items = 3, |
| 4434 | .items = { |
| 4435 | { "Mic/Line", 0x0 }, |
| 4436 | { "CD", 0x4 }, |
| 4437 | { "Headphone", 0x2 }, |
| 4438 | }, |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 4439 | }, |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 4440 | { |
| 4441 | .num_items = 4, |
| 4442 | .items = { |
| 4443 | { "Mic/Line", 0x0 }, |
| 4444 | { "CD", 0x4 }, |
| 4445 | { "Headphone", 0x2 }, |
| 4446 | { "Mixer", 0x5 }, |
| 4447 | }, |
| 4448 | }, |
| 4449 | |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 4450 | }; |
| 4451 | |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 4452 | /* Acer TravelMate(/Extensa/Aspire) notebooks have similar configuration to |
| 4453 | * the Fujitsu S702x, but jacks are marked differently. |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 4454 | */ |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 4455 | static struct hda_input_mux alc260_acer_capture_sources[2] = { |
| 4456 | { |
| 4457 | .num_items = 4, |
| 4458 | .items = { |
| 4459 | { "Mic", 0x0 }, |
| 4460 | { "Line", 0x2 }, |
| 4461 | { "CD", 0x4 }, |
| 4462 | { "Headphone", 0x5 }, |
| 4463 | }, |
| 4464 | }, |
| 4465 | { |
| 4466 | .num_items = 5, |
| 4467 | .items = { |
| 4468 | { "Mic", 0x0 }, |
| 4469 | { "Line", 0x2 }, |
| 4470 | { "CD", 0x4 }, |
| 4471 | { "Headphone", 0x6 }, |
| 4472 | { "Mixer", 0x5 }, |
| 4473 | }, |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 4474 | }, |
| 4475 | }; |
Michael Schwingen | cc95948 | 2009-02-22 18:58:45 +0100 | [diff] [blame] | 4476 | |
| 4477 | /* Maxdata Favorit 100XS */ |
| 4478 | static struct hda_input_mux alc260_favorit100_capture_sources[2] = { |
| 4479 | { |
| 4480 | .num_items = 2, |
| 4481 | .items = { |
| 4482 | { "Line/Mic", 0x0 }, |
| 4483 | { "CD", 0x4 }, |
| 4484 | }, |
| 4485 | }, |
| 4486 | { |
| 4487 | .num_items = 3, |
| 4488 | .items = { |
| 4489 | { "Line/Mic", 0x0 }, |
| 4490 | { "CD", 0x4 }, |
| 4491 | { "Mixer", 0x5 }, |
| 4492 | }, |
| 4493 | }, |
| 4494 | }; |
| 4495 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4496 | /* |
| 4497 | * This is just place-holder, so there's something for alc_build_pcms to look |
| 4498 | * at when it calculates the maximum number of channels. ALC260 has no mixer |
| 4499 | * element which allows changing the channel mode, so the verb list is |
| 4500 | * never used. |
| 4501 | */ |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 4502 | static struct hda_channel_mode alc260_modes[1] = { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4503 | { 2, NULL }, |
| 4504 | }; |
| 4505 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4506 | |
| 4507 | /* Mixer combinations |
| 4508 | * |
| 4509 | * basic: base_output + input + pc_beep + capture |
| 4510 | * HP: base_output + input + capture_alt |
| 4511 | * HP_3013: hp_3013 + input + capture |
| 4512 | * fujitsu: fujitsu + capture |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 4513 | * acer: acer + capture |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4514 | */ |
| 4515 | |
| 4516 | static struct snd_kcontrol_new alc260_base_output_mixer[] = { |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 4517 | HDA_CODEC_VOLUME("Front Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 4518 | HDA_BIND_MUTE("Front Playback Switch", 0x08, 2, HDA_INPUT), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4519 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x09, 0x0, HDA_OUTPUT), |
| 4520 | HDA_BIND_MUTE("Headphone Playback Switch", 0x09, 2, HDA_INPUT), |
| 4521 | HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT), |
| 4522 | HDA_BIND_MUTE_MONO("Mono Playback Switch", 0x0a, 1, 2, HDA_INPUT), |
| 4523 | { } /* end */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4524 | }; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4525 | |
| 4526 | static struct snd_kcontrol_new alc260_input_mixer[] = { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4527 | HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT), |
| 4528 | HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT), |
| 4529 | HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT), |
| 4530 | HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT), |
| 4531 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT), |
| 4532 | HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT), |
| 4533 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x07, 0x01, HDA_INPUT), |
| 4534 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x07, 0x01, HDA_INPUT), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4535 | { } /* end */ |
| 4536 | }; |
| 4537 | |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 4538 | /* update HP, line and mono out pins according to the master switch */ |
| 4539 | static void alc260_hp_master_update(struct hda_codec *codec, |
| 4540 | hda_nid_t hp, hda_nid_t line, |
| 4541 | hda_nid_t mono) |
| 4542 | { |
| 4543 | struct alc_spec *spec = codec->spec; |
| 4544 | unsigned int val = spec->master_sw ? PIN_HP : 0; |
| 4545 | /* change HP and line-out pins */ |
Takashi Iwai | 30cde0a | 2008-11-07 14:49:28 +0100 | [diff] [blame] | 4546 | snd_hda_codec_write(codec, hp, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 4547 | val); |
Takashi Iwai | 30cde0a | 2008-11-07 14:49:28 +0100 | [diff] [blame] | 4548 | snd_hda_codec_write(codec, line, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 4549 | val); |
| 4550 | /* mono (speaker) depending on the HP jack sense */ |
| 4551 | val = (val && !spec->jack_present) ? PIN_OUT : 0; |
Takashi Iwai | 30cde0a | 2008-11-07 14:49:28 +0100 | [diff] [blame] | 4552 | snd_hda_codec_write(codec, mono, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 4553 | val); |
| 4554 | } |
| 4555 | |
| 4556 | static int alc260_hp_master_sw_get(struct snd_kcontrol *kcontrol, |
| 4557 | struct snd_ctl_elem_value *ucontrol) |
| 4558 | { |
| 4559 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 4560 | struct alc_spec *spec = codec->spec; |
| 4561 | *ucontrol->value.integer.value = spec->master_sw; |
| 4562 | return 0; |
| 4563 | } |
| 4564 | |
| 4565 | static int alc260_hp_master_sw_put(struct snd_kcontrol *kcontrol, |
| 4566 | struct snd_ctl_elem_value *ucontrol) |
| 4567 | { |
| 4568 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 4569 | struct alc_spec *spec = codec->spec; |
| 4570 | int val = !!*ucontrol->value.integer.value; |
| 4571 | hda_nid_t hp, line, mono; |
| 4572 | |
| 4573 | if (val == spec->master_sw) |
| 4574 | return 0; |
| 4575 | spec->master_sw = val; |
| 4576 | hp = (kcontrol->private_value >> 16) & 0xff; |
| 4577 | line = (kcontrol->private_value >> 8) & 0xff; |
| 4578 | mono = kcontrol->private_value & 0xff; |
| 4579 | alc260_hp_master_update(codec, hp, line, mono); |
| 4580 | return 1; |
| 4581 | } |
| 4582 | |
| 4583 | static struct snd_kcontrol_new alc260_hp_output_mixer[] = { |
| 4584 | { |
| 4585 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 4586 | .name = "Master Playback Switch", |
| 4587 | .info = snd_ctl_boolean_mono_info, |
| 4588 | .get = alc260_hp_master_sw_get, |
| 4589 | .put = alc260_hp_master_sw_put, |
| 4590 | .private_value = (0x0f << 16) | (0x10 << 8) | 0x11 |
| 4591 | }, |
| 4592 | HDA_CODEC_VOLUME("Front Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
| 4593 | HDA_BIND_MUTE("Front Playback Switch", 0x08, 2, HDA_INPUT), |
| 4594 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x09, 0x0, HDA_OUTPUT), |
| 4595 | HDA_BIND_MUTE("Headphone Playback Switch", 0x09, 2, HDA_INPUT), |
| 4596 | HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0a, 1, 0x0, |
| 4597 | HDA_OUTPUT), |
| 4598 | HDA_BIND_MUTE_MONO("Speaker Playback Switch", 0x0a, 1, 2, HDA_INPUT), |
| 4599 | { } /* end */ |
| 4600 | }; |
| 4601 | |
| 4602 | static struct hda_verb alc260_hp_unsol_verbs[] = { |
| 4603 | {0x10, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 4604 | {}, |
| 4605 | }; |
| 4606 | |
| 4607 | static void alc260_hp_automute(struct hda_codec *codec) |
| 4608 | { |
| 4609 | struct alc_spec *spec = codec->spec; |
| 4610 | unsigned int present; |
| 4611 | |
| 4612 | present = snd_hda_codec_read(codec, 0x10, 0, |
| 4613 | AC_VERB_GET_PIN_SENSE, 0); |
| 4614 | spec->jack_present = (present & AC_PINSENSE_PRESENCE) != 0; |
| 4615 | alc260_hp_master_update(codec, 0x0f, 0x10, 0x11); |
| 4616 | } |
| 4617 | |
| 4618 | static void alc260_hp_unsol_event(struct hda_codec *codec, unsigned int res) |
| 4619 | { |
| 4620 | if ((res >> 26) == ALC880_HP_EVENT) |
| 4621 | alc260_hp_automute(codec); |
| 4622 | } |
| 4623 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4624 | static struct snd_kcontrol_new alc260_hp_3013_mixer[] = { |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 4625 | { |
| 4626 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 4627 | .name = "Master Playback Switch", |
| 4628 | .info = snd_ctl_boolean_mono_info, |
| 4629 | .get = alc260_hp_master_sw_get, |
| 4630 | .put = alc260_hp_master_sw_put, |
Takashi Iwai | 30cde0a | 2008-11-07 14:49:28 +0100 | [diff] [blame] | 4631 | .private_value = (0x15 << 16) | (0x10 << 8) | 0x11 |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 4632 | }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4633 | HDA_CODEC_VOLUME("Front Playback Volume", 0x09, 0x0, HDA_OUTPUT), |
| 4634 | HDA_CODEC_MUTE("Front Playback Switch", 0x10, 0x0, HDA_OUTPUT), |
| 4635 | HDA_CODEC_VOLUME("Aux-In Playback Volume", 0x07, 0x06, HDA_INPUT), |
| 4636 | HDA_CODEC_MUTE("Aux-In Playback Switch", 0x07, 0x06, HDA_INPUT), |
| 4637 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
| 4638 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
Takashi Iwai | 86cd929 | 2008-01-28 18:09:56 +0100 | [diff] [blame] | 4639 | HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT), |
| 4640 | HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x11, 1, 0x0, HDA_OUTPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4641 | { } /* end */ |
| 4642 | }; |
| 4643 | |
Kailang Yang | 3f87830 | 2008-08-26 13:02:23 +0200 | [diff] [blame] | 4644 | static struct hda_bind_ctls alc260_dc7600_bind_master_vol = { |
| 4645 | .ops = &snd_hda_bind_vol, |
| 4646 | .values = { |
| 4647 | HDA_COMPOSE_AMP_VAL(0x08, 3, 0, HDA_OUTPUT), |
| 4648 | HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_OUTPUT), |
| 4649 | HDA_COMPOSE_AMP_VAL(0x0a, 3, 0, HDA_OUTPUT), |
| 4650 | 0 |
| 4651 | }, |
| 4652 | }; |
| 4653 | |
| 4654 | static struct hda_bind_ctls alc260_dc7600_bind_switch = { |
| 4655 | .ops = &snd_hda_bind_sw, |
| 4656 | .values = { |
| 4657 | HDA_COMPOSE_AMP_VAL(0x11, 3, 0, HDA_OUTPUT), |
| 4658 | HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT), |
| 4659 | 0 |
| 4660 | }, |
| 4661 | }; |
| 4662 | |
| 4663 | static struct snd_kcontrol_new alc260_hp_dc7600_mixer[] = { |
| 4664 | HDA_BIND_VOL("Master Playback Volume", &alc260_dc7600_bind_master_vol), |
| 4665 | HDA_BIND_SW("LineOut Playback Switch", &alc260_dc7600_bind_switch), |
| 4666 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x0f, 0x0, HDA_OUTPUT), |
| 4667 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x10, 0x0, HDA_OUTPUT), |
| 4668 | { } /* end */ |
| 4669 | }; |
| 4670 | |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 4671 | static struct hda_verb alc260_hp_3013_unsol_verbs[] = { |
| 4672 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 4673 | {}, |
| 4674 | }; |
| 4675 | |
| 4676 | static void alc260_hp_3013_automute(struct hda_codec *codec) |
| 4677 | { |
| 4678 | struct alc_spec *spec = codec->spec; |
| 4679 | unsigned int present; |
| 4680 | |
| 4681 | present = snd_hda_codec_read(codec, 0x15, 0, |
| 4682 | AC_VERB_GET_PIN_SENSE, 0); |
| 4683 | spec->jack_present = (present & AC_PINSENSE_PRESENCE) != 0; |
Takashi Iwai | 30cde0a | 2008-11-07 14:49:28 +0100 | [diff] [blame] | 4684 | alc260_hp_master_update(codec, 0x15, 0x10, 0x11); |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 4685 | } |
| 4686 | |
| 4687 | static void alc260_hp_3013_unsol_event(struct hda_codec *codec, |
| 4688 | unsigned int res) |
| 4689 | { |
| 4690 | if ((res >> 26) == ALC880_HP_EVENT) |
| 4691 | alc260_hp_3013_automute(codec); |
| 4692 | } |
| 4693 | |
Kailang Yang | 3f87830 | 2008-08-26 13:02:23 +0200 | [diff] [blame] | 4694 | static void alc260_hp_3012_automute(struct hda_codec *codec) |
| 4695 | { |
| 4696 | unsigned int present, bits; |
| 4697 | |
| 4698 | present = snd_hda_codec_read(codec, 0x10, 0, |
| 4699 | AC_VERB_GET_PIN_SENSE, 0) & AC_PINSENSE_PRESENCE; |
| 4700 | |
| 4701 | bits = present ? 0 : PIN_OUT; |
| 4702 | snd_hda_codec_write(codec, 0x0f, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 4703 | bits); |
| 4704 | snd_hda_codec_write(codec, 0x11, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 4705 | bits); |
| 4706 | snd_hda_codec_write(codec, 0x15, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 4707 | bits); |
| 4708 | } |
| 4709 | |
| 4710 | static void alc260_hp_3012_unsol_event(struct hda_codec *codec, |
| 4711 | unsigned int res) |
| 4712 | { |
| 4713 | if ((res >> 26) == ALC880_HP_EVENT) |
| 4714 | alc260_hp_3012_automute(codec); |
| 4715 | } |
| 4716 | |
| 4717 | /* Fujitsu S702x series laptops. ALC260 pin usage: Mic/Line jack = 0x12, |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 4718 | * HP jack = 0x14, CD audio = 0x16, internal speaker = 0x10. |
| 4719 | */ |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 4720 | static struct snd_kcontrol_new alc260_fujitsu_mixer[] = { |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 4721 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 4722 | HDA_BIND_MUTE("Headphone Playback Switch", 0x08, 2, HDA_INPUT), |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 4723 | ALC_PIN_MODE("Headphone Jack Mode", 0x14, ALC_PIN_DIR_INOUT), |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 4724 | HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT), |
| 4725 | HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT), |
| 4726 | HDA_CODEC_VOLUME("Mic/Line Playback Volume", 0x07, 0x0, HDA_INPUT), |
| 4727 | HDA_CODEC_MUTE("Mic/Line Playback Switch", 0x07, 0x0, HDA_INPUT), |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 4728 | ALC_PIN_MODE("Mic/Line Jack Mode", 0x12, ALC_PIN_DIR_IN), |
Takashi Iwai | 31bffaa | 2008-02-27 16:10:44 +0100 | [diff] [blame] | 4729 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x09, 0x0, HDA_OUTPUT), |
| 4730 | HDA_BIND_MUTE("Speaker Playback Switch", 0x09, 2, HDA_INPUT), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4731 | { } /* end */ |
| 4732 | }; |
| 4733 | |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 4734 | /* Mixer for Acer TravelMate(/Extensa/Aspire) notebooks. Note that current |
| 4735 | * versions of the ALC260 don't act on requests to enable mic bias from NID |
| 4736 | * 0x0f (used to drive the headphone jack in these laptops). The ALC260 |
| 4737 | * datasheet doesn't mention this restriction. At this stage it's not clear |
| 4738 | * whether this behaviour is intentional or is a hardware bug in chip |
| 4739 | * revisions available in early 2006. Therefore for now allow the |
| 4740 | * "Headphone Jack Mode" control to span all choices, but if it turns out |
| 4741 | * that the lack of mic bias for this NID is intentional we could change the |
| 4742 | * mode from ALC_PIN_DIR_INOUT to ALC_PIN_DIR_INOUT_NOMICBIAS. |
| 4743 | * |
| 4744 | * In addition, Acer TravelMate(/Extensa/Aspire) notebooks in early 2006 |
| 4745 | * don't appear to make the mic bias available from the "line" jack, even |
| 4746 | * though the NID used for this jack (0x14) can supply it. The theory is |
| 4747 | * that perhaps Acer have included blocking capacitors between the ALC260 |
| 4748 | * and the output jack. If this turns out to be the case for all such |
| 4749 | * models the "Line Jack Mode" mode could be changed from ALC_PIN_DIR_INOUT |
| 4750 | * to ALC_PIN_DIR_INOUT_NOMICBIAS. |
Jonathan Woithe | bd86948 | 2006-11-28 11:35:52 +0100 | [diff] [blame] | 4751 | * |
| 4752 | * The C20x Tablet series have a mono internal speaker which is controlled |
| 4753 | * via the chip's Mono sum widget and pin complex, so include the necessary |
| 4754 | * controls for such models. On models without a "mono speaker" the control |
| 4755 | * won't do anything. |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 4756 | */ |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 4757 | static struct snd_kcontrol_new alc260_acer_mixer[] = { |
| 4758 | HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
| 4759 | HDA_BIND_MUTE("Master Playback Switch", 0x08, 2, HDA_INPUT), |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 4760 | ALC_PIN_MODE("Headphone Jack Mode", 0x0f, ALC_PIN_DIR_INOUT), |
Takashi Iwai | 31bffaa | 2008-02-27 16:10:44 +0100 | [diff] [blame] | 4761 | HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0a, 1, 0x0, |
Jonathan Woithe | bd86948 | 2006-11-28 11:35:52 +0100 | [diff] [blame] | 4762 | HDA_OUTPUT), |
Takashi Iwai | 31bffaa | 2008-02-27 16:10:44 +0100 | [diff] [blame] | 4763 | HDA_BIND_MUTE_MONO("Speaker Playback Switch", 0x0a, 1, 2, |
Jonathan Woithe | bd86948 | 2006-11-28 11:35:52 +0100 | [diff] [blame] | 4764 | HDA_INPUT), |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 4765 | HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT), |
| 4766 | HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT), |
| 4767 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT), |
| 4768 | HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT), |
| 4769 | ALC_PIN_MODE("Mic Jack Mode", 0x12, ALC_PIN_DIR_IN), |
| 4770 | HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT), |
| 4771 | HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT), |
| 4772 | ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT), |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 4773 | { } /* end */ |
| 4774 | }; |
| 4775 | |
Michael Schwingen | cc95948 | 2009-02-22 18:58:45 +0100 | [diff] [blame] | 4776 | /* Maxdata Favorit 100XS: one output and one input (0x12) jack |
| 4777 | */ |
| 4778 | static struct snd_kcontrol_new alc260_favorit100_mixer[] = { |
| 4779 | HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
| 4780 | HDA_BIND_MUTE("Master Playback Switch", 0x08, 2, HDA_INPUT), |
| 4781 | ALC_PIN_MODE("Output Jack Mode", 0x0f, ALC_PIN_DIR_INOUT), |
| 4782 | HDA_CODEC_VOLUME("Line/Mic Playback Volume", 0x07, 0x0, HDA_INPUT), |
| 4783 | HDA_CODEC_MUTE("Line/Mic Playback Switch", 0x07, 0x0, HDA_INPUT), |
| 4784 | ALC_PIN_MODE("Line/Mic Jack Mode", 0x12, ALC_PIN_DIR_IN), |
| 4785 | { } /* end */ |
| 4786 | }; |
| 4787 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 4788 | /* Packard bell V7900 ALC260 pin usage: HP = 0x0f, Mic jack = 0x12, |
| 4789 | * Line In jack = 0x14, CD audio = 0x16, pc beep = 0x17. |
| 4790 | */ |
| 4791 | static struct snd_kcontrol_new alc260_will_mixer[] = { |
| 4792 | HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
| 4793 | HDA_BIND_MUTE("Master Playback Switch", 0x08, 0x2, HDA_INPUT), |
| 4794 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT), |
| 4795 | HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT), |
| 4796 | ALC_PIN_MODE("Mic Jack Mode", 0x12, ALC_PIN_DIR_IN), |
| 4797 | HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT), |
| 4798 | HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT), |
| 4799 | ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT), |
| 4800 | HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT), |
| 4801 | HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 4802 | { } /* end */ |
| 4803 | }; |
| 4804 | |
| 4805 | /* Replacer 672V ALC260 pin usage: Mic jack = 0x12, |
| 4806 | * Line In jack = 0x14, ATAPI Mic = 0x13, speaker = 0x0f. |
| 4807 | */ |
| 4808 | static struct snd_kcontrol_new alc260_replacer_672v_mixer[] = { |
| 4809 | HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
| 4810 | HDA_BIND_MUTE("Master Playback Switch", 0x08, 0x2, HDA_INPUT), |
| 4811 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT), |
| 4812 | HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT), |
| 4813 | ALC_PIN_MODE("Mic Jack Mode", 0x12, ALC_PIN_DIR_IN), |
| 4814 | HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x07, 0x1, HDA_INPUT), |
| 4815 | HDA_CODEC_MUTE("ATATI Mic Playback Switch", 0x07, 0x1, HDA_INPUT), |
| 4816 | HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT), |
| 4817 | HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT), |
| 4818 | ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT), |
| 4819 | { } /* end */ |
| 4820 | }; |
| 4821 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4822 | /* |
| 4823 | * initialization verbs |
| 4824 | */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4825 | static struct hda_verb alc260_init_verbs[] = { |
| 4826 | /* Line In pin widget for input */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 4827 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4828 | /* CD pin widget for input */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 4829 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4830 | /* Mic1 (rear panel) pin widget for input and vref at 80% */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4831 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4832 | /* Mic2 (front panel) pin widget for input and vref at 80% */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4833 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4834 | /* LINE-2 is used for line-out in rear */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 4835 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4836 | /* select line-out */ |
Jonathan Woithe | fd56f2d | 2006-01-24 10:35:46 +0100 | [diff] [blame] | 4837 | {0x0e, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4838 | /* LINE-OUT pin */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 4839 | {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4840 | /* enable HP */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 4841 | {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4842 | /* enable Mono */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 4843 | {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 4844 | /* mute capture amp left and right */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4845 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4846 | /* set connection select to line in (default select for this ADC) */ |
| 4847 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x02}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4848 | /* mute capture amp left and right */ |
| 4849 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 4850 | /* set connection select to line in (default select for this ADC) */ |
| 4851 | {0x05, AC_VERB_SET_CONNECT_SEL, 0x02}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 4852 | /* set vol=0 Line-Out mixer amp left and right */ |
| 4853 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 4854 | /* unmute pin widget amp left and right (no gain on this amp) */ |
| 4855 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 4856 | /* set vol=0 HP mixer amp left and right */ |
| 4857 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 4858 | /* unmute pin widget amp left and right (no gain on this amp) */ |
| 4859 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 4860 | /* set vol=0 Mono mixer amp left and right */ |
| 4861 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 4862 | /* unmute pin widget amp left and right (no gain on this amp) */ |
| 4863 | {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 4864 | /* unmute LINE-2 out pin */ |
| 4865 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4866 | /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 & |
| 4867 | * Line In 2 = 0x03 |
| 4868 | */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 4869 | /* mute analog inputs */ |
| 4870 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 4871 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 4872 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 4873 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 4874 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4875 | /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 4876 | /* mute Front out path */ |
| 4877 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 4878 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 4879 | /* mute Headphone out path */ |
| 4880 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 4881 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 4882 | /* mute Mono out path */ |
| 4883 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 4884 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4885 | { } |
| 4886 | }; |
| 4887 | |
Takashi Iwai | 474167d | 2006-05-17 17:17:43 +0200 | [diff] [blame] | 4888 | #if 0 /* should be identical with alc260_init_verbs? */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4889 | static struct hda_verb alc260_hp_init_verbs[] = { |
| 4890 | /* Headphone and output */ |
| 4891 | {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0}, |
| 4892 | /* mono output */ |
| 4893 | {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, |
| 4894 | /* Mic1 (rear panel) pin widget for input and vref at 80% */ |
| 4895 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 4896 | /* Mic2 (front panel) pin widget for input and vref at 80% */ |
| 4897 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 4898 | /* Line In pin widget for input */ |
| 4899 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 4900 | /* Line-2 pin widget for output */ |
| 4901 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, |
| 4902 | /* CD pin widget for input */ |
| 4903 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 4904 | /* unmute amp left and right */ |
| 4905 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000}, |
| 4906 | /* set connection select to line in (default select for this ADC) */ |
| 4907 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 4908 | /* unmute Line-Out mixer amp left and right (volume = 0) */ |
| 4909 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000}, |
| 4910 | /* mute pin widget amp left and right (no gain on this amp) */ |
| 4911 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
| 4912 | /* unmute HP mixer amp left and right (volume = 0) */ |
| 4913 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000}, |
| 4914 | /* mute pin widget amp left and right (no gain on this amp) */ |
| 4915 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4916 | /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 & |
| 4917 | * Line In 2 = 0x03 |
| 4918 | */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 4919 | /* mute analog inputs */ |
| 4920 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 4921 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 4922 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 4923 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 4924 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4925 | /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */ |
| 4926 | /* Unmute Front out path */ |
| 4927 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 4928 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 4929 | /* Unmute Headphone out path */ |
| 4930 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 4931 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 4932 | /* Unmute Mono out path */ |
| 4933 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 4934 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 4935 | { } |
| 4936 | }; |
Takashi Iwai | 474167d | 2006-05-17 17:17:43 +0200 | [diff] [blame] | 4937 | #endif |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4938 | |
| 4939 | static struct hda_verb alc260_hp_3013_init_verbs[] = { |
| 4940 | /* Line out and output */ |
| 4941 | {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, |
| 4942 | /* mono output */ |
| 4943 | {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, |
| 4944 | /* Mic1 (rear panel) pin widget for input and vref at 80% */ |
| 4945 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 4946 | /* Mic2 (front panel) pin widget for input and vref at 80% */ |
| 4947 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 4948 | /* Line In pin widget for input */ |
| 4949 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 4950 | /* Headphone pin widget for output */ |
| 4951 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0}, |
| 4952 | /* CD pin widget for input */ |
| 4953 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 4954 | /* unmute amp left and right */ |
| 4955 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000}, |
| 4956 | /* set connection select to line in (default select for this ADC) */ |
| 4957 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 4958 | /* unmute Line-Out mixer amp left and right (volume = 0) */ |
| 4959 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000}, |
| 4960 | /* mute pin widget amp left and right (no gain on this amp) */ |
| 4961 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
| 4962 | /* unmute HP mixer amp left and right (volume = 0) */ |
| 4963 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000}, |
| 4964 | /* mute pin widget amp left and right (no gain on this amp) */ |
| 4965 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4966 | /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 & |
| 4967 | * Line In 2 = 0x03 |
| 4968 | */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 4969 | /* mute analog inputs */ |
| 4970 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 4971 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 4972 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 4973 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 4974 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4975 | /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */ |
| 4976 | /* Unmute Front out path */ |
| 4977 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 4978 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 4979 | /* Unmute Headphone out path */ |
| 4980 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 4981 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 4982 | /* Unmute Mono out path */ |
| 4983 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 4984 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 4985 | { } |
| 4986 | }; |
| 4987 | |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 4988 | /* Initialisation sequence for ALC260 as configured in Fujitsu S702x |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 4989 | * laptops. ALC260 pin usage: Mic/Line jack = 0x12, HP jack = 0x14, CD |
| 4990 | * audio = 0x16, internal speaker = 0x10. |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 4991 | */ |
| 4992 | static struct hda_verb alc260_fujitsu_init_verbs[] = { |
| 4993 | /* Disable all GPIOs */ |
| 4994 | {0x01, AC_VERB_SET_GPIO_MASK, 0}, |
| 4995 | /* Internal speaker is connected to headphone pin */ |
| 4996 | {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 4997 | /* Headphone/Line-out jack connects to Line1 pin; make it an output */ |
| 4998 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 4999 | /* Mic/Line-in jack is connected to mic1 pin, so make it an input */ |
| 5000 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 5001 | /* Ensure all other unused pins are disabled and muted. */ |
| 5002 | {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
| 5003 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 5004 | {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 5005 | {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 5006 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 5007 | {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5008 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
| 5009 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 5010 | |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 5011 | /* Disable digital (SPDIF) pins */ |
| 5012 | {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0}, |
| 5013 | {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0}, |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 5014 | |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 5015 | /* Ensure Line1 pin widget takes its input from the OUT1 sum bus |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 5016 | * when acting as an output. |
| 5017 | */ |
| 5018 | {0x0d, AC_VERB_SET_CONNECT_SEL, 0}, |
| 5019 | |
| 5020 | /* Start with output sum widgets muted and their output gains at min */ |
Takashi Iwai | 8b33a5a | 2006-02-09 11:57:01 +0100 | [diff] [blame] | 5021 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5022 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 5023 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5024 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5025 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 5026 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5027 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5028 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 5029 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 5030 | |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 5031 | /* Unmute HP pin widget amp left and right (no equiv mixer ctrl) */ |
| 5032 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 5033 | /* Unmute Line1 pin widget output buffer since it starts as an output. |
| 5034 | * If the pin mode is changed by the user the pin mode control will |
| 5035 | * take care of enabling the pin's input/output buffers as needed. |
| 5036 | * Therefore there's no need to enable the input buffer at this |
| 5037 | * stage. |
Jonathan Woithe | cdcd926 | 2006-02-28 11:36:42 +0100 | [diff] [blame] | 5038 | */ |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 5039 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 5040 | /* Unmute input buffer of pin widget used for Line-in (no equiv |
Jonathan Woithe | cdcd926 | 2006-02-28 11:36:42 +0100 | [diff] [blame] | 5041 | * mixer ctrl) |
| 5042 | */ |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 5043 | {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 5044 | |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 5045 | /* Mute capture amp left and right */ |
| 5046 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 5047 | /* Set ADC connection select to match default mixer setting - line |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 5048 | * in (on mic1 pin) |
| 5049 | */ |
| 5050 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 5051 | |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 5052 | /* Do the same for the second ADC: mute capture input amp and |
| 5053 | * set ADC connection to line in (on mic1 pin) |
| 5054 | */ |
| 5055 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5056 | {0x05, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 5057 | |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 5058 | /* Mute all inputs to mixer widget (even unconnected ones) */ |
| 5059 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */ |
| 5060 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */ |
| 5061 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */ |
| 5062 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */ |
| 5063 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */ |
| 5064 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */ |
| 5065 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */ |
| 5066 | {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] | 5067 | |
| 5068 | { } |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 5069 | }; |
| 5070 | |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 5071 | /* Initialisation sequence for ALC260 as configured in Acer TravelMate and |
| 5072 | * similar laptops (adapted from Fujitsu init verbs). |
| 5073 | */ |
| 5074 | static struct hda_verb alc260_acer_init_verbs[] = { |
| 5075 | /* On TravelMate laptops, GPIO 0 enables the internal speaker and |
| 5076 | * the headphone jack. Turn this on and rely on the standard mute |
| 5077 | * methods whenever the user wants to turn these outputs off. |
| 5078 | */ |
| 5079 | {0x01, AC_VERB_SET_GPIO_MASK, 0x01}, |
| 5080 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01}, |
| 5081 | {0x01, AC_VERB_SET_GPIO_DATA, 0x01}, |
| 5082 | /* Internal speaker/Headphone jack is connected to Line-out pin */ |
| 5083 | {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 5084 | /* Internal microphone/Mic jack is connected to Mic1 pin */ |
| 5085 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50}, |
| 5086 | /* Line In jack is connected to Line1 pin */ |
| 5087 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Jonathan Woithe | bd86948 | 2006-11-28 11:35:52 +0100 | [diff] [blame] | 5088 | /* Some Acers (eg: C20x Tablets) use Mono pin for internal speaker */ |
| 5089 | {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 5090 | /* Ensure all other unused pins are disabled and muted. */ |
| 5091 | {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
| 5092 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 5093 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
| 5094 | {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5095 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
| 5096 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5097 | /* Disable digital (SPDIF) pins */ |
| 5098 | {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0}, |
| 5099 | {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0}, |
| 5100 | |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 5101 | /* Ensure Mic1 and Line1 pin widgets take input from the OUT1 sum |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 5102 | * bus when acting as outputs. |
| 5103 | */ |
| 5104 | {0x0b, AC_VERB_SET_CONNECT_SEL, 0}, |
| 5105 | {0x0d, AC_VERB_SET_CONNECT_SEL, 0}, |
| 5106 | |
| 5107 | /* Start with output sum widgets muted and their output gains at min */ |
| 5108 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5109 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 5110 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5111 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5112 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 5113 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5114 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5115 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 5116 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5117 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5118 | /* Unmute Line-out pin widget amp left and right |
| 5119 | * (no equiv mixer ctrl) |
| 5120 | */ |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 5121 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Jonathan Woithe | bd86948 | 2006-11-28 11:35:52 +0100 | [diff] [blame] | 5122 | /* Unmute mono pin widget amp output (no equiv mixer ctrl) */ |
| 5123 | {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 5124 | /* Unmute Mic1 and Line1 pin widget input buffers since they start as |
| 5125 | * inputs. If the pin mode is changed by the user the pin mode control |
| 5126 | * will take care of enabling the pin's input/output buffers as needed. |
| 5127 | * Therefore there's no need to enable the input buffer at this |
| 5128 | * stage. |
| 5129 | */ |
| 5130 | {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5131 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5132 | |
| 5133 | /* Mute capture amp left and right */ |
| 5134 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5135 | /* Set ADC connection select to match default mixer setting - mic |
| 5136 | * (on mic1 pin) |
| 5137 | */ |
| 5138 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 5139 | |
| 5140 | /* Do similar with the second ADC: mute capture input amp and |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 5141 | * set ADC connection to mic to match ALSA's default state. |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 5142 | */ |
| 5143 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 5144 | {0x05, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 5145 | |
| 5146 | /* Mute all inputs to mixer widget (even unconnected ones) */ |
| 5147 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */ |
| 5148 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */ |
| 5149 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */ |
| 5150 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */ |
| 5151 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */ |
| 5152 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */ |
| 5153 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */ |
| 5154 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */ |
| 5155 | |
| 5156 | { } |
| 5157 | }; |
| 5158 | |
Michael Schwingen | cc95948 | 2009-02-22 18:58:45 +0100 | [diff] [blame] | 5159 | /* Initialisation sequence for Maxdata Favorit 100XS |
| 5160 | * (adapted from Acer init verbs). |
| 5161 | */ |
| 5162 | static struct hda_verb alc260_favorit100_init_verbs[] = { |
| 5163 | /* GPIO 0 enables the output jack. |
| 5164 | * Turn this on and rely on the standard mute |
| 5165 | * methods whenever the user wants to turn these outputs off. |
| 5166 | */ |
| 5167 | {0x01, AC_VERB_SET_GPIO_MASK, 0x01}, |
| 5168 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01}, |
| 5169 | {0x01, AC_VERB_SET_GPIO_DATA, 0x01}, |
| 5170 | /* Line/Mic input jack is connected to Mic1 pin */ |
| 5171 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50}, |
| 5172 | /* Ensure all other unused pins are disabled and muted. */ |
| 5173 | {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
| 5174 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5175 | {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
| 5176 | {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5177 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
| 5178 | {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5179 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
| 5180 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5181 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
| 5182 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5183 | /* Disable digital (SPDIF) pins */ |
| 5184 | {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0}, |
| 5185 | {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0}, |
| 5186 | |
| 5187 | /* Ensure Mic1 and Line1 pin widgets take input from the OUT1 sum |
| 5188 | * bus when acting as outputs. |
| 5189 | */ |
| 5190 | {0x0b, AC_VERB_SET_CONNECT_SEL, 0}, |
| 5191 | {0x0d, AC_VERB_SET_CONNECT_SEL, 0}, |
| 5192 | |
| 5193 | /* Start with output sum widgets muted and their output gains at min */ |
| 5194 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5195 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 5196 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5197 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5198 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 5199 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5200 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5201 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 5202 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5203 | |
| 5204 | /* Unmute Line-out pin widget amp left and right |
| 5205 | * (no equiv mixer ctrl) |
| 5206 | */ |
| 5207 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 5208 | /* Unmute Mic1 and Line1 pin widget input buffers since they start as |
| 5209 | * inputs. If the pin mode is changed by the user the pin mode control |
| 5210 | * will take care of enabling the pin's input/output buffers as needed. |
| 5211 | * Therefore there's no need to enable the input buffer at this |
| 5212 | * stage. |
| 5213 | */ |
| 5214 | {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5215 | |
| 5216 | /* Mute capture amp left and right */ |
| 5217 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5218 | /* Set ADC connection select to match default mixer setting - mic |
| 5219 | * (on mic1 pin) |
| 5220 | */ |
| 5221 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 5222 | |
| 5223 | /* Do similar with the second ADC: mute capture input amp and |
| 5224 | * set ADC connection to mic to match ALSA's default state. |
| 5225 | */ |
| 5226 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5227 | {0x05, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 5228 | |
| 5229 | /* Mute all inputs to mixer widget (even unconnected ones) */ |
| 5230 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */ |
| 5231 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */ |
| 5232 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */ |
| 5233 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */ |
| 5234 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */ |
| 5235 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */ |
| 5236 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */ |
| 5237 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */ |
| 5238 | |
| 5239 | { } |
| 5240 | }; |
| 5241 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 5242 | static struct hda_verb alc260_will_verbs[] = { |
| 5243 | {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 5244 | {0x0b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 5245 | {0x0d, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 5246 | {0x0f, AC_VERB_SET_EAPD_BTLENABLE, 0x02}, |
| 5247 | {0x1a, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 5248 | {0x1a, AC_VERB_SET_PROC_COEF, 0x3040}, |
| 5249 | {} |
| 5250 | }; |
| 5251 | |
| 5252 | static struct hda_verb alc260_replacer_672v_verbs[] = { |
| 5253 | {0x0f, AC_VERB_SET_EAPD_BTLENABLE, 0x02}, |
| 5254 | {0x1a, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 5255 | {0x1a, AC_VERB_SET_PROC_COEF, 0x3050}, |
| 5256 | |
| 5257 | {0x01, AC_VERB_SET_GPIO_MASK, 0x01}, |
| 5258 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01}, |
| 5259 | {0x01, AC_VERB_SET_GPIO_DATA, 0x00}, |
| 5260 | |
| 5261 | {0x0f, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 5262 | {} |
| 5263 | }; |
| 5264 | |
| 5265 | /* toggle speaker-output according to the hp-jack state */ |
| 5266 | static void alc260_replacer_672v_automute(struct hda_codec *codec) |
| 5267 | { |
| 5268 | unsigned int present; |
| 5269 | |
| 5270 | /* speaker --> GPIO Data 0, hp or spdif --> GPIO data 1 */ |
| 5271 | present = snd_hda_codec_read(codec, 0x0f, 0, |
| 5272 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 5273 | if (present) { |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 5274 | snd_hda_codec_write_cache(codec, 0x01, 0, |
| 5275 | AC_VERB_SET_GPIO_DATA, 1); |
| 5276 | snd_hda_codec_write_cache(codec, 0x0f, 0, |
| 5277 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 5278 | PIN_HP); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 5279 | } else { |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 5280 | snd_hda_codec_write_cache(codec, 0x01, 0, |
| 5281 | AC_VERB_SET_GPIO_DATA, 0); |
| 5282 | snd_hda_codec_write_cache(codec, 0x0f, 0, |
| 5283 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 5284 | PIN_OUT); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 5285 | } |
| 5286 | } |
| 5287 | |
| 5288 | static void alc260_replacer_672v_unsol_event(struct hda_codec *codec, |
| 5289 | unsigned int res) |
| 5290 | { |
| 5291 | if ((res >> 26) == ALC880_HP_EVENT) |
| 5292 | alc260_replacer_672v_automute(codec); |
| 5293 | } |
| 5294 | |
Kailang Yang | 3f87830 | 2008-08-26 13:02:23 +0200 | [diff] [blame] | 5295 | static struct hda_verb alc260_hp_dc7600_verbs[] = { |
| 5296 | {0x05, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 5297 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 5298 | {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 5299 | {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 5300 | {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 5301 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 5302 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 5303 | {0x10, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 5304 | {0x11, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 5305 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 5306 | {} |
| 5307 | }; |
| 5308 | |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 5309 | /* Test configuration for debugging, modelled after the ALC880 test |
| 5310 | * configuration. |
| 5311 | */ |
| 5312 | #ifdef CONFIG_SND_DEBUG |
| 5313 | static hda_nid_t alc260_test_dac_nids[1] = { |
| 5314 | 0x02, |
| 5315 | }; |
| 5316 | static hda_nid_t alc260_test_adc_nids[2] = { |
| 5317 | 0x04, 0x05, |
| 5318 | }; |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 5319 | /* For testing the ALC260, each input MUX needs its own definition since |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 5320 | * the signal assignments are different. This assumes that the first ADC |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 5321 | * is NID 0x04. |
Jonathan Woithe | 17e7aec | 2006-02-28 11:35:18 +0100 | [diff] [blame] | 5322 | */ |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 5323 | static struct hda_input_mux alc260_test_capture_sources[2] = { |
| 5324 | { |
| 5325 | .num_items = 7, |
| 5326 | .items = { |
| 5327 | { "MIC1 pin", 0x0 }, |
| 5328 | { "MIC2 pin", 0x1 }, |
| 5329 | { "LINE1 pin", 0x2 }, |
| 5330 | { "LINE2 pin", 0x3 }, |
| 5331 | { "CD pin", 0x4 }, |
| 5332 | { "LINE-OUT pin", 0x5 }, |
| 5333 | { "HP-OUT pin", 0x6 }, |
| 5334 | }, |
| 5335 | }, |
| 5336 | { |
| 5337 | .num_items = 8, |
| 5338 | .items = { |
| 5339 | { "MIC1 pin", 0x0 }, |
| 5340 | { "MIC2 pin", 0x1 }, |
| 5341 | { "LINE1 pin", 0x2 }, |
| 5342 | { "LINE2 pin", 0x3 }, |
| 5343 | { "CD pin", 0x4 }, |
| 5344 | { "Mixer", 0x5 }, |
| 5345 | { "LINE-OUT pin", 0x6 }, |
| 5346 | { "HP-OUT pin", 0x7 }, |
| 5347 | }, |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 5348 | }, |
| 5349 | }; |
| 5350 | static struct snd_kcontrol_new alc260_test_mixer[] = { |
| 5351 | /* Output driver widgets */ |
| 5352 | HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT), |
| 5353 | HDA_BIND_MUTE_MONO("Mono Playback Switch", 0x0a, 1, 2, HDA_INPUT), |
| 5354 | HDA_CODEC_VOLUME("LOUT2 Playback Volume", 0x09, 0x0, HDA_OUTPUT), |
| 5355 | HDA_BIND_MUTE("LOUT2 Playback Switch", 0x09, 2, HDA_INPUT), |
| 5356 | HDA_CODEC_VOLUME("LOUT1 Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
| 5357 | HDA_BIND_MUTE("LOUT1 Playback Switch", 0x08, 2, HDA_INPUT), |
| 5358 | |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 5359 | /* Modes for retasking pin widgets |
| 5360 | * Note: the ALC260 doesn't seem to act on requests to enable mic |
| 5361 | * bias from NIDs 0x0f and 0x10. The ALC260 datasheet doesn't |
| 5362 | * mention this restriction. At this stage it's not clear whether |
| 5363 | * this behaviour is intentional or is a hardware bug in chip |
| 5364 | * revisions available at least up until early 2006. Therefore for |
| 5365 | * now allow the "HP-OUT" and "LINE-OUT" Mode controls to span all |
| 5366 | * choices, but if it turns out that the lack of mic bias for these |
| 5367 | * NIDs is intentional we could change their modes from |
| 5368 | * ALC_PIN_DIR_INOUT to ALC_PIN_DIR_INOUT_NOMICBIAS. |
| 5369 | */ |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 5370 | ALC_PIN_MODE("HP-OUT pin mode", 0x10, ALC_PIN_DIR_INOUT), |
| 5371 | ALC_PIN_MODE("LINE-OUT pin mode", 0x0f, ALC_PIN_DIR_INOUT), |
| 5372 | ALC_PIN_MODE("LINE2 pin mode", 0x15, ALC_PIN_DIR_INOUT), |
| 5373 | ALC_PIN_MODE("LINE1 pin mode", 0x14, ALC_PIN_DIR_INOUT), |
| 5374 | ALC_PIN_MODE("MIC2 pin mode", 0x13, ALC_PIN_DIR_INOUT), |
| 5375 | ALC_PIN_MODE("MIC1 pin mode", 0x12, ALC_PIN_DIR_INOUT), |
| 5376 | |
| 5377 | /* Loopback mixer controls */ |
| 5378 | HDA_CODEC_VOLUME("MIC1 Playback Volume", 0x07, 0x00, HDA_INPUT), |
| 5379 | HDA_CODEC_MUTE("MIC1 Playback Switch", 0x07, 0x00, HDA_INPUT), |
| 5380 | HDA_CODEC_VOLUME("MIC2 Playback Volume", 0x07, 0x01, HDA_INPUT), |
| 5381 | HDA_CODEC_MUTE("MIC2 Playback Switch", 0x07, 0x01, HDA_INPUT), |
| 5382 | HDA_CODEC_VOLUME("LINE1 Playback Volume", 0x07, 0x02, HDA_INPUT), |
| 5383 | HDA_CODEC_MUTE("LINE1 Playback Switch", 0x07, 0x02, HDA_INPUT), |
| 5384 | HDA_CODEC_VOLUME("LINE2 Playback Volume", 0x07, 0x03, HDA_INPUT), |
| 5385 | HDA_CODEC_MUTE("LINE2 Playback Switch", 0x07, 0x03, HDA_INPUT), |
| 5386 | HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT), |
| 5387 | HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT), |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 5388 | HDA_CODEC_VOLUME("LINE-OUT loopback Playback Volume", 0x07, 0x06, HDA_INPUT), |
| 5389 | HDA_CODEC_MUTE("LINE-OUT loopback Playback Switch", 0x07, 0x06, HDA_INPUT), |
| 5390 | HDA_CODEC_VOLUME("HP-OUT loopback Playback Volume", 0x07, 0x7, HDA_INPUT), |
| 5391 | HDA_CODEC_MUTE("HP-OUT loopback Playback Switch", 0x07, 0x7, HDA_INPUT), |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 5392 | |
| 5393 | /* Controls for GPIO pins, assuming they are configured as outputs */ |
| 5394 | ALC_GPIO_DATA_SWITCH("GPIO pin 0", 0x01, 0x01), |
| 5395 | ALC_GPIO_DATA_SWITCH("GPIO pin 1", 0x01, 0x02), |
| 5396 | ALC_GPIO_DATA_SWITCH("GPIO pin 2", 0x01, 0x04), |
| 5397 | ALC_GPIO_DATA_SWITCH("GPIO pin 3", 0x01, 0x08), |
| 5398 | |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 5399 | /* Switches to allow the digital IO pins to be enabled. The datasheet |
| 5400 | * is ambigious as to which NID is which; testing on laptops which |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 5401 | * make this output available should provide clarification. |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 5402 | */ |
| 5403 | ALC_SPDIF_CTRL_SWITCH("SPDIF Playback Switch", 0x03, 0x01), |
| 5404 | ALC_SPDIF_CTRL_SWITCH("SPDIF Capture Switch", 0x06, 0x01), |
| 5405 | |
Jonathan Woithe | f8225f6 | 2008-01-08 12:16:54 +0100 | [diff] [blame] | 5406 | /* A switch allowing EAPD to be enabled. Some laptops seem to use |
| 5407 | * this output to turn on an external amplifier. |
| 5408 | */ |
| 5409 | ALC_EAPD_CTRL_SWITCH("LINE-OUT EAPD Enable Switch", 0x0f, 0x02), |
| 5410 | ALC_EAPD_CTRL_SWITCH("HP-OUT EAPD Enable Switch", 0x10, 0x02), |
| 5411 | |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 5412 | { } /* end */ |
| 5413 | }; |
| 5414 | static struct hda_verb alc260_test_init_verbs[] = { |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 5415 | /* Enable all GPIOs as outputs with an initial value of 0 */ |
| 5416 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x0f}, |
| 5417 | {0x01, AC_VERB_SET_GPIO_DATA, 0x00}, |
| 5418 | {0x01, AC_VERB_SET_GPIO_MASK, 0x0f}, |
| 5419 | |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 5420 | /* Enable retasking pins as output, initially without power amp */ |
| 5421 | {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 5422 | {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 5423 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 5424 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 5425 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 5426 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 5427 | |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 5428 | /* Disable digital (SPDIF) pins initially, but users can enable |
| 5429 | * them via a mixer switch. In the case of SPDIF-out, this initverb |
| 5430 | * payload also sets the generation to 0, output to be in "consumer" |
| 5431 | * PCM format, copyright asserted, no pre-emphasis and no validity |
| 5432 | * control. |
| 5433 | */ |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 5434 | {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0}, |
| 5435 | {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0}, |
| 5436 | |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 5437 | /* Ensure mic1, mic2, line1 and line2 pin widgets take input from the |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 5438 | * OUT1 sum bus when acting as an output. |
| 5439 | */ |
| 5440 | {0x0b, AC_VERB_SET_CONNECT_SEL, 0}, |
| 5441 | {0x0c, AC_VERB_SET_CONNECT_SEL, 0}, |
| 5442 | {0x0d, AC_VERB_SET_CONNECT_SEL, 0}, |
| 5443 | {0x0e, AC_VERB_SET_CONNECT_SEL, 0}, |
| 5444 | |
| 5445 | /* Start with output sum widgets muted and their output gains at min */ |
| 5446 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5447 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 5448 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5449 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5450 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 5451 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5452 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5453 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 5454 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5455 | |
Jonathan Woithe | cdcd926 | 2006-02-28 11:36:42 +0100 | [diff] [blame] | 5456 | /* Unmute retasking pin widget output buffers since the default |
| 5457 | * state appears to be output. As the pin mode is changed by the |
| 5458 | * user the pin mode control will take care of enabling the pin's |
| 5459 | * input/output buffers as needed. |
| 5460 | */ |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 5461 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 5462 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 5463 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 5464 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 5465 | {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 5466 | {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 5467 | /* Also unmute the mono-out pin widget */ |
| 5468 | {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 5469 | |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 5470 | /* Mute capture amp left and right */ |
| 5471 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 5472 | /* Set ADC connection select to match default mixer setting (mic1 |
| 5473 | * pin) |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 5474 | */ |
| 5475 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 5476 | |
| 5477 | /* Do the same for the second ADC: mute capture input amp and |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 5478 | * set ADC connection to mic1 pin |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 5479 | */ |
| 5480 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5481 | {0x05, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 5482 | |
| 5483 | /* Mute all inputs to mixer widget (even unconnected ones) */ |
| 5484 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */ |
| 5485 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */ |
| 5486 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */ |
| 5487 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */ |
| 5488 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */ |
| 5489 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */ |
| 5490 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */ |
| 5491 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */ |
| 5492 | |
| 5493 | { } |
| 5494 | }; |
| 5495 | #endif |
| 5496 | |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 5497 | #define alc260_pcm_analog_playback alc880_pcm_analog_alt_playback |
| 5498 | #define alc260_pcm_analog_capture alc880_pcm_analog_capture |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5499 | |
Takashi Iwai | a3bcba3 | 2005-12-06 19:05:29 +0100 | [diff] [blame] | 5500 | #define alc260_pcm_digital_playback alc880_pcm_digital_playback |
| 5501 | #define alc260_pcm_digital_capture alc880_pcm_digital_capture |
| 5502 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5503 | /* |
| 5504 | * for BIOS auto-configuration |
| 5505 | */ |
| 5506 | |
| 5507 | 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] | 5508 | const char *pfx, int *vol_bits) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5509 | { |
| 5510 | hda_nid_t nid_vol; |
| 5511 | unsigned long vol_val, sw_val; |
| 5512 | char name[32]; |
| 5513 | int err; |
| 5514 | |
| 5515 | if (nid >= 0x0f && nid < 0x11) { |
| 5516 | nid_vol = nid - 0x7; |
| 5517 | vol_val = HDA_COMPOSE_AMP_VAL(nid_vol, 3, 0, HDA_OUTPUT); |
| 5518 | sw_val = HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT); |
| 5519 | } else if (nid == 0x11) { |
| 5520 | nid_vol = nid - 0x7; |
| 5521 | vol_val = HDA_COMPOSE_AMP_VAL(nid_vol, 2, 0, HDA_OUTPUT); |
| 5522 | sw_val = HDA_COMPOSE_AMP_VAL(nid, 2, 0, HDA_OUTPUT); |
| 5523 | } else if (nid >= 0x12 && nid <= 0x15) { |
| 5524 | nid_vol = 0x08; |
| 5525 | vol_val = HDA_COMPOSE_AMP_VAL(nid_vol, 3, 0, HDA_OUTPUT); |
| 5526 | sw_val = HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT); |
| 5527 | } else |
| 5528 | return 0; /* N/A */ |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 5529 | |
Takashi Iwai | 863b451 | 2008-10-21 17:01:47 +0200 | [diff] [blame] | 5530 | if (!(*vol_bits & (1 << nid_vol))) { |
| 5531 | /* first control for the volume widget */ |
| 5532 | snprintf(name, sizeof(name), "%s Playback Volume", pfx); |
| 5533 | err = add_control(spec, ALC_CTL_WIDGET_VOL, name, vol_val); |
| 5534 | if (err < 0) |
| 5535 | return err; |
| 5536 | *vol_bits |= (1 << nid_vol); |
| 5537 | } |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5538 | snprintf(name, sizeof(name), "%s Playback Switch", pfx); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5539 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, name, sw_val); |
| 5540 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5541 | return err; |
| 5542 | return 1; |
| 5543 | } |
| 5544 | |
| 5545 | /* add playback controls from the parsed DAC table */ |
| 5546 | static int alc260_auto_create_multi_out_ctls(struct alc_spec *spec, |
| 5547 | const struct auto_pin_cfg *cfg) |
| 5548 | { |
| 5549 | hda_nid_t nid; |
| 5550 | int err; |
Takashi Iwai | 863b451 | 2008-10-21 17:01:47 +0200 | [diff] [blame] | 5551 | int vols = 0; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5552 | |
| 5553 | spec->multiout.num_dacs = 1; |
| 5554 | spec->multiout.dac_nids = spec->private_dac_nids; |
| 5555 | spec->multiout.dac_nids[0] = 0x02; |
| 5556 | |
| 5557 | nid = cfg->line_out_pins[0]; |
| 5558 | if (nid) { |
Takashi Iwai | 863b451 | 2008-10-21 17:01:47 +0200 | [diff] [blame] | 5559 | err = alc260_add_playback_controls(spec, nid, "Front", &vols); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5560 | if (err < 0) |
| 5561 | return err; |
| 5562 | } |
| 5563 | |
Takashi Iwai | 82bc955 | 2006-03-21 11:24:42 +0100 | [diff] [blame] | 5564 | nid = cfg->speaker_pins[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5565 | if (nid) { |
Takashi Iwai | 863b451 | 2008-10-21 17:01:47 +0200 | [diff] [blame] | 5566 | err = alc260_add_playback_controls(spec, nid, "Speaker", &vols); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5567 | if (err < 0) |
| 5568 | return err; |
| 5569 | } |
| 5570 | |
Takashi Iwai | eb06ed8 | 2006-09-20 17:10:27 +0200 | [diff] [blame] | 5571 | nid = cfg->hp_pins[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5572 | if (nid) { |
Takashi Iwai | 863b451 | 2008-10-21 17:01:47 +0200 | [diff] [blame] | 5573 | err = alc260_add_playback_controls(spec, nid, "Headphone", |
| 5574 | &vols); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5575 | if (err < 0) |
| 5576 | return err; |
| 5577 | } |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5578 | return 0; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5579 | } |
| 5580 | |
| 5581 | /* create playback/capture controls for input pins */ |
| 5582 | static int alc260_auto_create_analog_input_ctls(struct alc_spec *spec, |
| 5583 | const struct auto_pin_cfg *cfg) |
| 5584 | { |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 5585 | struct hda_input_mux *imux = &spec->private_imux[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5586 | int i, err, idx; |
| 5587 | |
| 5588 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
| 5589 | if (cfg->input_pins[i] >= 0x12) { |
| 5590 | idx = cfg->input_pins[i] - 0x12; |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 5591 | err = new_analog_input(spec, cfg->input_pins[i], |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5592 | auto_pin_cfg_labels[i], idx, |
| 5593 | 0x07); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5594 | if (err < 0) |
| 5595 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5596 | imux->items[imux->num_items].label = |
| 5597 | auto_pin_cfg_labels[i]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5598 | imux->items[imux->num_items].index = idx; |
| 5599 | imux->num_items++; |
| 5600 | } |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5601 | if (cfg->input_pins[i] >= 0x0f && cfg->input_pins[i] <= 0x10){ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5602 | idx = cfg->input_pins[i] - 0x09; |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 5603 | err = new_analog_input(spec, cfg->input_pins[i], |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5604 | auto_pin_cfg_labels[i], idx, |
| 5605 | 0x07); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5606 | if (err < 0) |
| 5607 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5608 | imux->items[imux->num_items].label = |
| 5609 | auto_pin_cfg_labels[i]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5610 | imux->items[imux->num_items].index = idx; |
| 5611 | imux->num_items++; |
| 5612 | } |
| 5613 | } |
| 5614 | return 0; |
| 5615 | } |
| 5616 | |
| 5617 | static void alc260_auto_set_output_and_unmute(struct hda_codec *codec, |
| 5618 | hda_nid_t nid, int pin_type, |
| 5619 | int sel_idx) |
| 5620 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 5621 | alc_set_pin_output(codec, nid, pin_type); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5622 | /* need the manual connection? */ |
| 5623 | if (nid >= 0x12) { |
| 5624 | int idx = nid - 0x12; |
| 5625 | snd_hda_codec_write(codec, idx + 0x0b, 0, |
| 5626 | AC_VERB_SET_CONNECT_SEL, sel_idx); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5627 | } |
| 5628 | } |
| 5629 | |
| 5630 | static void alc260_auto_init_multi_out(struct hda_codec *codec) |
| 5631 | { |
| 5632 | struct alc_spec *spec = codec->spec; |
| 5633 | hda_nid_t nid; |
| 5634 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 5635 | alc_subsystem_id(codec, 0x10, 0x15, 0x0f); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5636 | nid = spec->autocfg.line_out_pins[0]; |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 5637 | if (nid) { |
| 5638 | int pin_type = get_pin_type(spec->autocfg.line_out_type); |
| 5639 | alc260_auto_set_output_and_unmute(codec, nid, pin_type, 0); |
| 5640 | } |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 5641 | |
Takashi Iwai | 82bc955 | 2006-03-21 11:24:42 +0100 | [diff] [blame] | 5642 | nid = spec->autocfg.speaker_pins[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5643 | if (nid) |
| 5644 | alc260_auto_set_output_and_unmute(codec, nid, PIN_OUT, 0); |
| 5645 | |
Takashi Iwai | eb06ed8 | 2006-09-20 17:10:27 +0200 | [diff] [blame] | 5646 | nid = spec->autocfg.hp_pins[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5647 | if (nid) |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 5648 | alc260_auto_set_output_and_unmute(codec, nid, PIN_HP, 0); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5649 | } |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5650 | |
| 5651 | #define ALC260_PIN_CD_NID 0x16 |
| 5652 | static void alc260_auto_init_analog_input(struct hda_codec *codec) |
| 5653 | { |
| 5654 | struct alc_spec *spec = codec->spec; |
| 5655 | int i; |
| 5656 | |
| 5657 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
| 5658 | hda_nid_t nid = spec->autocfg.input_pins[i]; |
| 5659 | if (nid >= 0x12) { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5660 | snd_hda_codec_write(codec, nid, 0, |
| 5661 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 5662 | i <= AUTO_PIN_FRONT_MIC ? |
| 5663 | PIN_VREF80 : PIN_IN); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5664 | if (nid != ALC260_PIN_CD_NID) |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5665 | snd_hda_codec_write(codec, nid, 0, |
| 5666 | AC_VERB_SET_AMP_GAIN_MUTE, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5667 | AMP_OUT_MUTE); |
| 5668 | } |
| 5669 | } |
| 5670 | } |
| 5671 | |
| 5672 | /* |
| 5673 | * generic initialization of ADC, input mixers and output mixers |
| 5674 | */ |
| 5675 | static struct hda_verb alc260_volume_init_verbs[] = { |
| 5676 | /* |
| 5677 | * Unmute ADC0-1 and set the default input to mic-in |
| 5678 | */ |
| 5679 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 5680 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5681 | {0x05, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 5682 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 5683 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5684 | /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback |
| 5685 | * mixer widget |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5686 | * Note: PASD motherboards uses the Line In 2 as the input for |
| 5687 | * front panel mic (mic 2) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5688 | */ |
| 5689 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 5690 | /* mute analog inputs */ |
| 5691 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5692 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 5693 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 5694 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 5695 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5696 | |
| 5697 | /* |
| 5698 | * Set up output mixers (0x08 - 0x0a) |
| 5699 | */ |
| 5700 | /* set vol=0 to output mixers */ |
| 5701 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5702 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5703 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5704 | /* set up input amps for analog loopback */ |
| 5705 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 5706 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5707 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 5708 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5709 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 5710 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5711 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 5712 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5713 | { } |
| 5714 | }; |
| 5715 | |
| 5716 | static int alc260_parse_auto_config(struct hda_codec *codec) |
| 5717 | { |
| 5718 | struct alc_spec *spec = codec->spec; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5719 | int err; |
| 5720 | static hda_nid_t alc260_ignore[] = { 0x17, 0 }; |
| 5721 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5722 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 5723 | alc260_ignore); |
| 5724 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5725 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5726 | err = alc260_auto_create_multi_out_ctls(spec, &spec->autocfg); |
| 5727 | if (err < 0) |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 5728 | return err; |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 5729 | if (!spec->kctls.list) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5730 | return 0; /* can't find valid BIOS pin config */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5731 | err = alc260_auto_create_analog_input_ctls(spec, &spec->autocfg); |
| 5732 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5733 | return err; |
| 5734 | |
| 5735 | spec->multiout.max_channels = 2; |
| 5736 | |
Takashi Iwai | 0852d7a | 2009-02-11 11:35:15 +0100 | [diff] [blame] | 5737 | if (spec->autocfg.dig_outs) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5738 | spec->multiout.dig_out_nid = ALC260_DIGOUT_NID; |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 5739 | if (spec->kctls.list) |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 5740 | add_mixer(spec, spec->kctls.list); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5741 | |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 5742 | add_verb(spec, alc260_volume_init_verbs); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5743 | |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 5744 | spec->num_mux_defs = 1; |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 5745 | spec->input_mux = &spec->private_imux[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5746 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5747 | return 1; |
| 5748 | } |
| 5749 | |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 5750 | /* additional initialization for auto-configuration model */ |
| 5751 | static void alc260_auto_init(struct hda_codec *codec) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5752 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 5753 | struct alc_spec *spec = codec->spec; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5754 | alc260_auto_init_multi_out(codec); |
| 5755 | alc260_auto_init_analog_input(codec); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 5756 | if (spec->unsol_event) |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 5757 | alc_inithook(codec); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5758 | } |
| 5759 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 5760 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 5761 | static struct hda_amp_list alc260_loopbacks[] = { |
| 5762 | { 0x07, HDA_INPUT, 0 }, |
| 5763 | { 0x07, HDA_INPUT, 1 }, |
| 5764 | { 0x07, HDA_INPUT, 2 }, |
| 5765 | { 0x07, HDA_INPUT, 3 }, |
| 5766 | { 0x07, HDA_INPUT, 4 }, |
| 5767 | { } /* end */ |
| 5768 | }; |
| 5769 | #endif |
| 5770 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5771 | /* |
| 5772 | * ALC260 configurations |
| 5773 | */ |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 5774 | static const char *alc260_models[ALC260_MODEL_LAST] = { |
| 5775 | [ALC260_BASIC] = "basic", |
| 5776 | [ALC260_HP] = "hp", |
| 5777 | [ALC260_HP_3013] = "hp-3013", |
Takashi Iwai | 2922c9a | 2008-08-27 18:12:42 +0200 | [diff] [blame] | 5778 | [ALC260_HP_DC7600] = "hp-dc7600", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 5779 | [ALC260_FUJITSU_S702X] = "fujitsu", |
| 5780 | [ALC260_ACER] = "acer", |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 5781 | [ALC260_WILL] = "will", |
| 5782 | [ALC260_REPLACER_672V] = "replacer", |
Michael Schwingen | cc95948 | 2009-02-22 18:58:45 +0100 | [diff] [blame] | 5783 | [ALC260_FAVORIT100] = "favorit100", |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 5784 | #ifdef CONFIG_SND_DEBUG |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 5785 | [ALC260_TEST] = "test", |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 5786 | #endif |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 5787 | [ALC260_AUTO] = "auto", |
| 5788 | }; |
| 5789 | |
| 5790 | static struct snd_pci_quirk alc260_cfg_tbl[] = { |
Jonathan Woithe | bd86948 | 2006-11-28 11:35:52 +0100 | [diff] [blame] | 5791 | SND_PCI_QUIRK(0x1025, 0x007b, "Acer C20x", ALC260_ACER), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 5792 | SND_PCI_QUIRK(0x1025, 0x008f, "Acer", ALC260_ACER), |
Michael Schwingen | cc95948 | 2009-02-22 18:58:45 +0100 | [diff] [blame] | 5793 | SND_PCI_QUIRK(0x1509, 0x4540, "Favorit 100XS", ALC260_FAVORIT100), |
Takashi Iwai | 9720b71 | 2007-03-13 21:46:23 +0100 | [diff] [blame] | 5794 | SND_PCI_QUIRK(0x103c, 0x2808, "HP d5700", ALC260_HP_3013), |
Takashi Iwai | a8a5d06 | 2007-03-15 15:10:28 +0100 | [diff] [blame] | 5795 | SND_PCI_QUIRK(0x103c, 0x280a, "HP d5750", ALC260_HP_3013), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 5796 | SND_PCI_QUIRK(0x103c, 0x3010, "HP", ALC260_HP_3013), |
Jaroslav Kysela | 34ec8a0 | 2008-07-10 14:49:19 +0200 | [diff] [blame] | 5797 | SND_PCI_QUIRK(0x103c, 0x3011, "HP", ALC260_HP_3013), |
Kailang Yang | 3f87830 | 2008-08-26 13:02:23 +0200 | [diff] [blame] | 5798 | SND_PCI_QUIRK(0x103c, 0x3012, "HP", ALC260_HP_DC7600), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 5799 | SND_PCI_QUIRK(0x103c, 0x3013, "HP", ALC260_HP_3013), |
| 5800 | SND_PCI_QUIRK(0x103c, 0x3014, "HP", ALC260_HP), |
| 5801 | SND_PCI_QUIRK(0x103c, 0x3015, "HP", ALC260_HP), |
| 5802 | SND_PCI_QUIRK(0x103c, 0x3016, "HP", ALC260_HP), |
| 5803 | SND_PCI_QUIRK(0x104d, 0x81bb, "Sony VAIO", ALC260_BASIC), |
| 5804 | SND_PCI_QUIRK(0x104d, 0x81cc, "Sony VAIO", ALC260_BASIC), |
| 5805 | SND_PCI_QUIRK(0x104d, 0x81cd, "Sony VAIO", ALC260_BASIC), |
| 5806 | SND_PCI_QUIRK(0x10cf, 0x1326, "Fujitsu S702X", ALC260_FUJITSU_S702X), |
| 5807 | SND_PCI_QUIRK(0x152d, 0x0729, "CTL U553W", ALC260_BASIC), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 5808 | SND_PCI_QUIRK(0x161f, 0x2057, "Replacer 672V", ALC260_REPLACER_672V), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 5809 | SND_PCI_QUIRK(0x1631, 0xc017, "PB V7900", ALC260_WILL), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 5810 | {} |
| 5811 | }; |
| 5812 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5813 | static struct alc_config_preset alc260_presets[] = { |
| 5814 | [ALC260_BASIC] = { |
| 5815 | .mixers = { alc260_base_output_mixer, |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 5816 | alc260_input_mixer }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5817 | .init_verbs = { alc260_init_verbs }, |
| 5818 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
| 5819 | .dac_nids = alc260_dac_nids, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 5820 | .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5821 | .adc_nids = alc260_adc_nids, |
| 5822 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 5823 | .channel_mode = alc260_modes, |
| 5824 | .input_mux = &alc260_capture_source, |
| 5825 | }, |
| 5826 | [ALC260_HP] = { |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 5827 | .mixers = { alc260_hp_output_mixer, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 5828 | alc260_input_mixer }, |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 5829 | .init_verbs = { alc260_init_verbs, |
| 5830 | alc260_hp_unsol_verbs }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5831 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
| 5832 | .dac_nids = alc260_dac_nids, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 5833 | .num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt), |
| 5834 | .adc_nids = alc260_adc_nids_alt, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5835 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 5836 | .channel_mode = alc260_modes, |
| 5837 | .input_mux = &alc260_capture_source, |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 5838 | .unsol_event = alc260_hp_unsol_event, |
| 5839 | .init_hook = alc260_hp_automute, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5840 | }, |
Kailang Yang | 3f87830 | 2008-08-26 13:02:23 +0200 | [diff] [blame] | 5841 | [ALC260_HP_DC7600] = { |
| 5842 | .mixers = { alc260_hp_dc7600_mixer, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 5843 | alc260_input_mixer }, |
Kailang Yang | 3f87830 | 2008-08-26 13:02:23 +0200 | [diff] [blame] | 5844 | .init_verbs = { alc260_init_verbs, |
| 5845 | alc260_hp_dc7600_verbs }, |
| 5846 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
| 5847 | .dac_nids = alc260_dac_nids, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 5848 | .num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt), |
| 5849 | .adc_nids = alc260_adc_nids_alt, |
Kailang Yang | 3f87830 | 2008-08-26 13:02:23 +0200 | [diff] [blame] | 5850 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 5851 | .channel_mode = alc260_modes, |
| 5852 | .input_mux = &alc260_capture_source, |
| 5853 | .unsol_event = alc260_hp_3012_unsol_event, |
| 5854 | .init_hook = alc260_hp_3012_automute, |
| 5855 | }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5856 | [ALC260_HP_3013] = { |
| 5857 | .mixers = { alc260_hp_3013_mixer, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 5858 | alc260_input_mixer }, |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 5859 | .init_verbs = { alc260_hp_3013_init_verbs, |
| 5860 | alc260_hp_3013_unsol_verbs }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5861 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
| 5862 | .dac_nids = alc260_dac_nids, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 5863 | .num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt), |
| 5864 | .adc_nids = alc260_adc_nids_alt, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5865 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 5866 | .channel_mode = alc260_modes, |
| 5867 | .input_mux = &alc260_capture_source, |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 5868 | .unsol_event = alc260_hp_3013_unsol_event, |
| 5869 | .init_hook = alc260_hp_3013_automute, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5870 | }, |
| 5871 | [ALC260_FUJITSU_S702X] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 5872 | .mixers = { alc260_fujitsu_mixer }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5873 | .init_verbs = { alc260_fujitsu_init_verbs }, |
| 5874 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
| 5875 | .dac_nids = alc260_dac_nids, |
Jonathan Woithe | d57fdac | 2006-02-28 11:38:35 +0100 | [diff] [blame] | 5876 | .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids), |
| 5877 | .adc_nids = alc260_dual_adc_nids, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5878 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 5879 | .channel_mode = alc260_modes, |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 5880 | .num_mux_defs = ARRAY_SIZE(alc260_fujitsu_capture_sources), |
| 5881 | .input_mux = alc260_fujitsu_capture_sources, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5882 | }, |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 5883 | [ALC260_ACER] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 5884 | .mixers = { alc260_acer_mixer }, |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 5885 | .init_verbs = { alc260_acer_init_verbs }, |
| 5886 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
| 5887 | .dac_nids = alc260_dac_nids, |
| 5888 | .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids), |
| 5889 | .adc_nids = alc260_dual_adc_nids, |
| 5890 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 5891 | .channel_mode = alc260_modes, |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 5892 | .num_mux_defs = ARRAY_SIZE(alc260_acer_capture_sources), |
| 5893 | .input_mux = alc260_acer_capture_sources, |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 5894 | }, |
Michael Schwingen | cc95948 | 2009-02-22 18:58:45 +0100 | [diff] [blame] | 5895 | [ALC260_FAVORIT100] = { |
| 5896 | .mixers = { alc260_favorit100_mixer }, |
| 5897 | .init_verbs = { alc260_favorit100_init_verbs }, |
| 5898 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
| 5899 | .dac_nids = alc260_dac_nids, |
| 5900 | .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids), |
| 5901 | .adc_nids = alc260_dual_adc_nids, |
| 5902 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 5903 | .channel_mode = alc260_modes, |
| 5904 | .num_mux_defs = ARRAY_SIZE(alc260_favorit100_capture_sources), |
| 5905 | .input_mux = alc260_favorit100_capture_sources, |
| 5906 | }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 5907 | [ALC260_WILL] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 5908 | .mixers = { alc260_will_mixer }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 5909 | .init_verbs = { alc260_init_verbs, alc260_will_verbs }, |
| 5910 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
| 5911 | .dac_nids = alc260_dac_nids, |
| 5912 | .num_adc_nids = ARRAY_SIZE(alc260_adc_nids), |
| 5913 | .adc_nids = alc260_adc_nids, |
| 5914 | .dig_out_nid = ALC260_DIGOUT_NID, |
| 5915 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 5916 | .channel_mode = alc260_modes, |
| 5917 | .input_mux = &alc260_capture_source, |
| 5918 | }, |
| 5919 | [ALC260_REPLACER_672V] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 5920 | .mixers = { alc260_replacer_672v_mixer }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 5921 | .init_verbs = { alc260_init_verbs, alc260_replacer_672v_verbs }, |
| 5922 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
| 5923 | .dac_nids = alc260_dac_nids, |
| 5924 | .num_adc_nids = ARRAY_SIZE(alc260_adc_nids), |
| 5925 | .adc_nids = alc260_adc_nids, |
| 5926 | .dig_out_nid = ALC260_DIGOUT_NID, |
| 5927 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 5928 | .channel_mode = alc260_modes, |
| 5929 | .input_mux = &alc260_capture_source, |
| 5930 | .unsol_event = alc260_replacer_672v_unsol_event, |
| 5931 | .init_hook = alc260_replacer_672v_automute, |
| 5932 | }, |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 5933 | #ifdef CONFIG_SND_DEBUG |
| 5934 | [ALC260_TEST] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 5935 | .mixers = { alc260_test_mixer }, |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 5936 | .init_verbs = { alc260_test_init_verbs }, |
| 5937 | .num_dacs = ARRAY_SIZE(alc260_test_dac_nids), |
| 5938 | .dac_nids = alc260_test_dac_nids, |
| 5939 | .num_adc_nids = ARRAY_SIZE(alc260_test_adc_nids), |
| 5940 | .adc_nids = alc260_test_adc_nids, |
| 5941 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 5942 | .channel_mode = alc260_modes, |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 5943 | .num_mux_defs = ARRAY_SIZE(alc260_test_capture_sources), |
| 5944 | .input_mux = alc260_test_capture_sources, |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 5945 | }, |
| 5946 | #endif |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5947 | }; |
| 5948 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5949 | static int patch_alc260(struct hda_codec *codec) |
| 5950 | { |
| 5951 | struct alc_spec *spec; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5952 | int err, board_config; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5953 | |
Takashi Iwai | e560d8d | 2005-09-09 14:21:46 +0200 | [diff] [blame] | 5954 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5955 | if (spec == NULL) |
| 5956 | return -ENOMEM; |
| 5957 | |
| 5958 | codec->spec = spec; |
| 5959 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 5960 | board_config = snd_hda_check_board_config(codec, ALC260_MODEL_LAST, |
| 5961 | alc260_models, |
| 5962 | alc260_cfg_tbl); |
| 5963 | if (board_config < 0) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 5964 | snd_printd(KERN_INFO "hda_codec: Unknown model for ALC260, " |
| 5965 | "trying auto-probe from BIOS...\n"); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5966 | board_config = ALC260_AUTO; |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 5967 | } |
| 5968 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5969 | if (board_config == ALC260_AUTO) { |
| 5970 | /* automatic parse from the BIOS config */ |
| 5971 | err = alc260_parse_auto_config(codec); |
| 5972 | if (err < 0) { |
| 5973 | alc_free(codec); |
| 5974 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5975 | } else if (!err) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 5976 | printk(KERN_INFO |
| 5977 | "hda_codec: Cannot set up configuration " |
| 5978 | "from BIOS. Using base mode...\n"); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5979 | board_config = ALC260_BASIC; |
| 5980 | } |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 5981 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5982 | |
Kusanagi Kouichi | 680cd53 | 2009-02-05 00:00:58 +0900 | [diff] [blame] | 5983 | err = snd_hda_attach_beep_device(codec, 0x1); |
| 5984 | if (err < 0) { |
| 5985 | alc_free(codec); |
| 5986 | return err; |
| 5987 | } |
| 5988 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5989 | if (board_config != ALC260_AUTO) |
| 5990 | setup_preset(spec, &alc260_presets[board_config]); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5991 | |
| 5992 | spec->stream_name_analog = "ALC260 Analog"; |
| 5993 | spec->stream_analog_playback = &alc260_pcm_analog_playback; |
| 5994 | spec->stream_analog_capture = &alc260_pcm_analog_capture; |
| 5995 | |
Takashi Iwai | a3bcba3 | 2005-12-06 19:05:29 +0100 | [diff] [blame] | 5996 | spec->stream_name_digital = "ALC260 Digital"; |
| 5997 | spec->stream_digital_playback = &alc260_pcm_digital_playback; |
| 5998 | spec->stream_digital_capture = &alc260_pcm_digital_capture; |
| 5999 | |
Takashi Iwai | 4ef0ef1 | 2008-11-03 17:47:49 +0100 | [diff] [blame] | 6000 | if (!spec->adc_nids && spec->input_mux) { |
| 6001 | /* check whether NID 0x04 is valid */ |
| 6002 | unsigned int wcap = get_wcaps(codec, 0x04); |
| 6003 | wcap = (wcap & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT; |
| 6004 | /* get type */ |
| 6005 | if (wcap != AC_WID_AUD_IN || spec->input_mux->num_items == 1) { |
| 6006 | spec->adc_nids = alc260_adc_nids_alt; |
| 6007 | spec->num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt); |
| 6008 | } else { |
| 6009 | spec->adc_nids = alc260_adc_nids; |
| 6010 | spec->num_adc_nids = ARRAY_SIZE(alc260_adc_nids); |
| 6011 | } |
| 6012 | } |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 6013 | set_capture_mixer(spec); |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 6014 | set_beep_amp(spec, 0x07, 0x05, HDA_INPUT); |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 6015 | |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 6016 | spec->vmaster_nid = 0x08; |
| 6017 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6018 | codec->patch_ops = alc_patch_ops; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6019 | if (board_config == ALC260_AUTO) |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 6020 | spec->init_hook = alc260_auto_init; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 6021 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 6022 | if (!spec->loopback.amplist) |
| 6023 | spec->loopback.amplist = alc260_loopbacks; |
| 6024 | #endif |
Takashi Iwai | daead53 | 2008-11-28 12:55:36 +0100 | [diff] [blame] | 6025 | codec->proc_widget_hook = print_realtek_coef; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6026 | |
| 6027 | return 0; |
| 6028 | } |
| 6029 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 6030 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6031 | /* |
| 6032 | * ALC882 support |
| 6033 | * |
| 6034 | * ALC882 is almost identical with ALC880 but has cleaner and more flexible |
| 6035 | * configuration. Each pin widget can choose any input DACs and a mixer. |
| 6036 | * Each ADC is connected from a mixer of all inputs. This makes possible |
| 6037 | * 6-channel independent captures. |
| 6038 | * |
| 6039 | * In addition, an independent DAC for the multi-playback (not used in this |
| 6040 | * driver yet). |
| 6041 | */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6042 | #define ALC882_DIGOUT_NID 0x06 |
| 6043 | #define ALC882_DIGIN_NID 0x0a |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6044 | |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 6045 | static struct hda_channel_mode alc882_ch_modes[1] = { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6046 | { 8, NULL } |
| 6047 | }; |
| 6048 | |
| 6049 | static hda_nid_t alc882_dac_nids[4] = { |
| 6050 | /* front, rear, clfe, rear_surr */ |
| 6051 | 0x02, 0x03, 0x04, 0x05 |
| 6052 | }; |
| 6053 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6054 | /* identical with ALC880 */ |
| 6055 | #define alc882_adc_nids alc880_adc_nids |
| 6056 | #define alc882_adc_nids_alt alc880_adc_nids_alt |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6057 | |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 6058 | static hda_nid_t alc882_capsrc_nids[3] = { 0x24, 0x23, 0x22 }; |
| 6059 | static hda_nid_t alc882_capsrc_nids_alt[2] = { 0x23, 0x22 }; |
| 6060 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6061 | /* input MUX */ |
| 6062 | /* FIXME: should be a matrix-type input source selection */ |
| 6063 | |
| 6064 | static struct hda_input_mux alc882_capture_source = { |
| 6065 | .num_items = 4, |
| 6066 | .items = { |
| 6067 | { "Mic", 0x0 }, |
| 6068 | { "Front Mic", 0x1 }, |
| 6069 | { "Line", 0x2 }, |
| 6070 | { "CD", 0x4 }, |
| 6071 | }, |
| 6072 | }; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6073 | /* |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 6074 | * 2ch mode |
| 6075 | */ |
| 6076 | static struct hda_verb alc882_3ST_ch2_init[] = { |
| 6077 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 6078 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 6079 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 6080 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 6081 | { } /* end */ |
| 6082 | }; |
| 6083 | |
| 6084 | /* |
| 6085 | * 6ch mode |
| 6086 | */ |
| 6087 | static struct hda_verb alc882_3ST_ch6_init[] = { |
| 6088 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6089 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 6090 | { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 }, |
| 6091 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6092 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 6093 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 6094 | { } /* end */ |
| 6095 | }; |
| 6096 | |
| 6097 | static struct hda_channel_mode alc882_3ST_6ch_modes[2] = { |
| 6098 | { 2, alc882_3ST_ch2_init }, |
| 6099 | { 6, alc882_3ST_ch6_init }, |
| 6100 | }; |
| 6101 | |
| 6102 | /* |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6103 | * 6ch mode |
| 6104 | */ |
| 6105 | static struct hda_verb alc882_sixstack_ch6_init[] = { |
| 6106 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 6107 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6108 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6109 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6110 | { } /* end */ |
| 6111 | }; |
| 6112 | |
| 6113 | /* |
| 6114 | * 8ch mode |
| 6115 | */ |
| 6116 | static struct hda_verb alc882_sixstack_ch8_init[] = { |
| 6117 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6118 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6119 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6120 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6121 | { } /* end */ |
| 6122 | }; |
| 6123 | |
| 6124 | static struct hda_channel_mode alc882_sixstack_modes[2] = { |
| 6125 | { 6, alc882_sixstack_ch6_init }, |
| 6126 | { 8, alc882_sixstack_ch8_init }, |
| 6127 | }; |
| 6128 | |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 6129 | /* |
| 6130 | * macbook pro ALC885 can switch LineIn to LineOut without loosing Mic |
| 6131 | */ |
| 6132 | |
| 6133 | /* |
| 6134 | * 2ch mode |
| 6135 | */ |
| 6136 | static struct hda_verb alc885_mbp_ch2_init[] = { |
| 6137 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 6138 | { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6139 | { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 6140 | { } /* end */ |
| 6141 | }; |
| 6142 | |
| 6143 | /* |
| 6144 | * 6ch mode |
| 6145 | */ |
| 6146 | static struct hda_verb alc885_mbp_ch6_init[] = { |
| 6147 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6148 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 6149 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 6150 | { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6151 | { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 6152 | { } /* end */ |
| 6153 | }; |
| 6154 | |
| 6155 | static struct hda_channel_mode alc885_mbp_6ch_modes[2] = { |
| 6156 | { 2, alc885_mbp_ch2_init }, |
| 6157 | { 6, alc885_mbp_ch6_init }, |
| 6158 | }; |
| 6159 | |
| 6160 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6161 | /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17 |
| 6162 | * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b |
| 6163 | */ |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 6164 | static struct snd_kcontrol_new alc882_base_mixer[] = { |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 6165 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 6166 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 6167 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 6168 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 6169 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 6170 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 6171 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 6172 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 6173 | HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 6174 | HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6175 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 6176 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 6177 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 6178 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 6179 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 6180 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 6181 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6182 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 6183 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 6184 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6185 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6186 | { } /* end */ |
| 6187 | }; |
| 6188 | |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 6189 | static struct snd_kcontrol_new alc885_mbp3_mixer[] = { |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 6190 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x00, HDA_OUTPUT), |
| 6191 | HDA_BIND_MUTE ("Front Playback Switch", 0x0c, 0x02, HDA_INPUT), |
| 6192 | HDA_CODEC_MUTE ("Speaker Playback Switch", 0x14, 0x00, HDA_OUTPUT), |
| 6193 | HDA_CODEC_VOLUME("Line-Out Playback Volume", 0x0d, 0x00, HDA_OUTPUT), |
| 6194 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 6195 | HDA_CODEC_MUTE ("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 6196 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x00, HDA_INPUT), |
| 6197 | HDA_CODEC_MUTE ("Mic Playback Switch", 0x0b, 0x00, HDA_INPUT), |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 6198 | HDA_CODEC_VOLUME("Line Boost", 0x1a, 0x00, HDA_INPUT), |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 6199 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0x00, HDA_INPUT), |
| 6200 | { } /* end */ |
| 6201 | }; |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 6202 | static struct snd_kcontrol_new alc882_w2jc_mixer[] = { |
| 6203 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 6204 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 6205 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 6206 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 6207 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 6208 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 6209 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 6210 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 6211 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 6212 | { } /* end */ |
| 6213 | }; |
| 6214 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 6215 | static struct snd_kcontrol_new alc882_targa_mixer[] = { |
| 6216 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 6217 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 6218 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 6219 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 6220 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 6221 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 6222 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 6223 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 6224 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Takashi Iwai | 96fe7cc8 | 2007-09-07 10:57:44 +0200 | [diff] [blame] | 6225 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 6226 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 6227 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Takashi Iwai | 96fe7cc8 | 2007-09-07 10:57:44 +0200 | [diff] [blame] | 6228 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 6229 | { } /* end */ |
| 6230 | }; |
| 6231 | |
| 6232 | /* Pin assignment: Front=0x14, HP = 0x15, Front = 0x16, ??? |
| 6233 | * Front Mic=0x18, Line In = 0x1a, Line In = 0x1b, CD = 0x1c |
| 6234 | */ |
| 6235 | static struct snd_kcontrol_new alc882_asus_a7j_mixer[] = { |
| 6236 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 6237 | HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 6238 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 6239 | HDA_CODEC_MUTE("Mobile Front Playback Switch", 0x16, 0x0, HDA_OUTPUT), |
| 6240 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 6241 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 6242 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 6243 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 6244 | HDA_CODEC_VOLUME("Mobile Line Playback Volume", 0x0b, 0x03, HDA_INPUT), |
| 6245 | HDA_CODEC_MUTE("Mobile Line Playback Switch", 0x0b, 0x03, HDA_INPUT), |
| 6246 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 6247 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Takashi Iwai | 96fe7cc8 | 2007-09-07 10:57:44 +0200 | [diff] [blame] | 6248 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 6249 | { } /* end */ |
| 6250 | }; |
| 6251 | |
Takashi Iwai | 914759b | 2007-09-06 14:52:04 +0200 | [diff] [blame] | 6252 | static struct snd_kcontrol_new alc882_asus_a7m_mixer[] = { |
| 6253 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 6254 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 6255 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 6256 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 6257 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 6258 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 6259 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 6260 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 6261 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 6262 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Takashi Iwai | 914759b | 2007-09-06 14:52:04 +0200 | [diff] [blame] | 6263 | { } /* end */ |
| 6264 | }; |
| 6265 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6266 | static struct snd_kcontrol_new alc882_chmode_mixer[] = { |
| 6267 | { |
| 6268 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 6269 | .name = "Channel Mode", |
| 6270 | .info = alc_ch_mode_info, |
| 6271 | .get = alc_ch_mode_get, |
| 6272 | .put = alc_ch_mode_put, |
| 6273 | }, |
| 6274 | { } /* end */ |
| 6275 | }; |
| 6276 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6277 | static struct hda_verb alc882_init_verbs[] = { |
| 6278 | /* Front mixer: unmute input/output amp left and right (volume = 0) */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 6279 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 6280 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6281 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6282 | /* Rear mixer */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 6283 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 6284 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6285 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6286 | /* CLFE mixer */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 6287 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 6288 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6289 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6290 | /* Side mixer */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 6291 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 6292 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6293 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6294 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 6295 | /* Front Pin: output 0 (0x0c) */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 6296 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 6297 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6298 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 6299 | /* Rear Pin: output 1 (0x0d) */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 6300 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 6301 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6302 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 6303 | /* CLFE Pin: output 2 (0x0e) */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 6304 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 6305 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6306 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x02}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 6307 | /* Side Pin: output 3 (0x0f) */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 6308 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 6309 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6310 | {0x17, AC_VERB_SET_CONNECT_SEL, 0x03}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 6311 | /* Mic (rear) pin: input vref at 80% */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 6312 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 6313 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 6314 | /* Front Mic pin: input vref at 80% */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 6315 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 6316 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 6317 | /* Line In pin: input */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 6318 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 6319 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 6320 | /* Line-2 In: Headphone output (output 0 - 0x0c) */ |
| 6321 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 6322 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 6323 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6324 | /* CD pin widget for input */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 6325 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6326 | |
| 6327 | /* FIXME: use matrix-type input source selection */ |
| 6328 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 6329 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 6330 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6331 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 6332 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 6333 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6334 | /* Input mixer2 */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 6335 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6336 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 6337 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 6338 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6339 | /* Input mixer3 */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 6340 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6341 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 6342 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 6343 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 6344 | /* ADC1: mute amp left and right */ |
| 6345 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 6346 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 6347 | /* ADC2: mute amp left and right */ |
| 6348 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 6349 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 6350 | /* ADC3: mute amp left and right */ |
| 6351 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 6352 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6353 | |
| 6354 | { } |
| 6355 | }; |
| 6356 | |
Takashi Iwai | 4b146cb | 2006-07-28 14:42:36 +0200 | [diff] [blame] | 6357 | static struct hda_verb alc882_eapd_verbs[] = { |
| 6358 | /* change to EAPD mode */ |
| 6359 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
Andrew L. Neporada | b373bde | 2006-11-07 11:37:08 +0100 | [diff] [blame] | 6360 | {0x20, AC_VERB_SET_PROC_COEF, 0x3060}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6361 | { } |
Takashi Iwai | 4b146cb | 2006-07-28 14:42:36 +0200 | [diff] [blame] | 6362 | }; |
| 6363 | |
Tobin Davis | 9102cd1 | 2006-12-15 10:02:12 +0100 | [diff] [blame] | 6364 | /* Mac Pro test */ |
| 6365 | static struct snd_kcontrol_new alc882_macpro_mixer[] = { |
| 6366 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 6367 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 6368 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x18, 0x0, HDA_OUTPUT), |
| 6369 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 6370 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT), |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 6371 | /* FIXME: this looks suspicious... |
Tobin Davis | 9102cd1 | 2006-12-15 10:02:12 +0100 | [diff] [blame] | 6372 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 6373 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x02, HDA_INPUT), |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 6374 | */ |
Tobin Davis | 9102cd1 | 2006-12-15 10:02:12 +0100 | [diff] [blame] | 6375 | { } /* end */ |
| 6376 | }; |
| 6377 | |
| 6378 | static struct hda_verb alc882_macpro_init_verbs[] = { |
| 6379 | /* Front mixer: unmute input/output amp left and right (volume = 0) */ |
| 6380 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 6381 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6382 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 6383 | /* Front Pin: output 0 (0x0c) */ |
| 6384 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 6385 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 6386 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 6387 | /* Front Mic pin: input vref at 80% */ |
| 6388 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 6389 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 6390 | /* Speaker: output */ |
| 6391 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 6392 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 6393 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x04}, |
| 6394 | /* Headphone output (output 0 - 0x0c) */ |
| 6395 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 6396 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 6397 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 6398 | |
| 6399 | /* FIXME: use matrix-type input source selection */ |
| 6400 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 6401 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ |
| 6402 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6403 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 6404 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 6405 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 6406 | /* Input mixer2 */ |
| 6407 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6408 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 6409 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 6410 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 6411 | /* Input mixer3 */ |
| 6412 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6413 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 6414 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 6415 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 6416 | /* ADC1: mute amp left and right */ |
| 6417 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6418 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 6419 | /* ADC2: mute amp left and right */ |
| 6420 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6421 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 6422 | /* ADC3: mute amp left and right */ |
| 6423 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6424 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 6425 | |
| 6426 | { } |
| 6427 | }; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6428 | |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 6429 | /* Macbook Pro rev3 */ |
| 6430 | static struct hda_verb alc885_mbp3_init_verbs[] = { |
| 6431 | /* Front mixer: unmute input/output amp left and right (volume = 0) */ |
| 6432 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 6433 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6434 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 6435 | /* Rear mixer */ |
| 6436 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 6437 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6438 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 6439 | /* Front Pin: output 0 (0x0c) */ |
| 6440 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 6441 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 6442 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 6443 | /* HP Pin: output 0 (0x0d) */ |
| 6444 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc4}, |
| 6445 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 6446 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 6447 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 6448 | /* Mic (rear) pin: input vref at 80% */ |
| 6449 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 6450 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 6451 | /* Front Mic pin: input vref at 80% */ |
| 6452 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 6453 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 6454 | /* Line In pin: use output 1 when in LineOut mode */ |
| 6455 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 6456 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 6457 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 6458 | |
| 6459 | /* FIXME: use matrix-type input source selection */ |
| 6460 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 6461 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ |
| 6462 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6463 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 6464 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 6465 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 6466 | /* Input mixer2 */ |
| 6467 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6468 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 6469 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 6470 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 6471 | /* Input mixer3 */ |
| 6472 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6473 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 6474 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 6475 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 6476 | /* ADC1: mute amp left and right */ |
| 6477 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6478 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 6479 | /* ADC2: mute amp left and right */ |
| 6480 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6481 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 6482 | /* ADC3: mute amp left and right */ |
| 6483 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6484 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 6485 | |
| 6486 | { } |
| 6487 | }; |
| 6488 | |
Nicola Fagnani | c54728d | 2007-07-19 23:28:52 +0200 | [diff] [blame] | 6489 | /* iMac 24 mixer. */ |
| 6490 | static struct snd_kcontrol_new alc885_imac24_mixer[] = { |
| 6491 | HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x00, HDA_OUTPUT), |
| 6492 | HDA_CODEC_MUTE("Master Playback Switch", 0x0c, 0x00, HDA_INPUT), |
| 6493 | { } /* end */ |
| 6494 | }; |
| 6495 | |
| 6496 | /* iMac 24 init verbs. */ |
| 6497 | static struct hda_verb alc885_imac24_init_verbs[] = { |
| 6498 | /* Internal speakers: output 0 (0x0c) */ |
| 6499 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 6500 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 6501 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 6502 | /* Internal speakers: output 0 (0x0c) */ |
| 6503 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 6504 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 6505 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 6506 | /* Headphone: output 0 (0x0c) */ |
| 6507 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 6508 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 6509 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 6510 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 6511 | /* Front Mic: input vref at 80% */ |
| 6512 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 6513 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 6514 | { } |
| 6515 | }; |
| 6516 | |
| 6517 | /* Toggle speaker-output according to the hp-jack state */ |
| 6518 | static void alc885_imac24_automute(struct hda_codec *codec) |
| 6519 | { |
| 6520 | unsigned int present; |
| 6521 | |
| 6522 | present = snd_hda_codec_read(codec, 0x14, 0, |
| 6523 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 6524 | snd_hda_codec_amp_stereo(codec, 0x18, HDA_OUTPUT, 0, |
| 6525 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
| 6526 | snd_hda_codec_amp_stereo(codec, 0x1a, HDA_OUTPUT, 0, |
| 6527 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
Nicola Fagnani | c54728d | 2007-07-19 23:28:52 +0200 | [diff] [blame] | 6528 | } |
| 6529 | |
| 6530 | /* Processes unsolicited events. */ |
| 6531 | static void alc885_imac24_unsol_event(struct hda_codec *codec, |
| 6532 | unsigned int res) |
| 6533 | { |
| 6534 | /* Headphone insertion or removal. */ |
| 6535 | if ((res >> 26) == ALC880_HP_EVENT) |
| 6536 | alc885_imac24_automute(codec); |
| 6537 | } |
| 6538 | |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 6539 | static void alc885_mbp3_automute(struct hda_codec *codec) |
| 6540 | { |
| 6541 | unsigned int present; |
| 6542 | |
| 6543 | present = snd_hda_codec_read(codec, 0x15, 0, |
| 6544 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 6545 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 6546 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
| 6547 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 6548 | HDA_AMP_MUTE, present ? 0 : HDA_AMP_MUTE); |
| 6549 | |
| 6550 | } |
| 6551 | static void alc885_mbp3_unsol_event(struct hda_codec *codec, |
| 6552 | unsigned int res) |
| 6553 | { |
| 6554 | /* Headphone insertion or removal. */ |
| 6555 | if ((res >> 26) == ALC880_HP_EVENT) |
| 6556 | alc885_mbp3_automute(codec); |
| 6557 | } |
| 6558 | |
| 6559 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 6560 | static struct hda_verb alc882_targa_verbs[] = { |
| 6561 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6562 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 6563 | |
| 6564 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 6565 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 6566 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 6567 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */ |
| 6568 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */ |
| 6569 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 6570 | |
| 6571 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 6572 | {0x01, AC_VERB_SET_GPIO_MASK, 0x03}, |
| 6573 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x03}, |
| 6574 | {0x01, AC_VERB_SET_GPIO_DATA, 0x03}, |
| 6575 | { } /* end */ |
| 6576 | }; |
| 6577 | |
| 6578 | /* toggle speaker-output according to the hp-jack state */ |
| 6579 | static void alc882_targa_automute(struct hda_codec *codec) |
| 6580 | { |
| 6581 | unsigned int present; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 6582 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 6583 | present = snd_hda_codec_read(codec, 0x14, 0, |
| 6584 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 6585 | snd_hda_codec_amp_stereo(codec, 0x1b, HDA_OUTPUT, 0, |
| 6586 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 6587 | snd_hda_codec_write_cache(codec, 1, 0, AC_VERB_SET_GPIO_DATA, |
| 6588 | present ? 1 : 3); |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 6589 | } |
| 6590 | |
| 6591 | static void alc882_targa_unsol_event(struct hda_codec *codec, unsigned int res) |
| 6592 | { |
| 6593 | /* Looks like the unsol event is incompatible with the standard |
| 6594 | * definition. 4bit tag is placed at 26 bit! |
| 6595 | */ |
| 6596 | if (((res >> 26) == ALC880_HP_EVENT)) { |
| 6597 | alc882_targa_automute(codec); |
| 6598 | } |
| 6599 | } |
| 6600 | |
| 6601 | static struct hda_verb alc882_asus_a7j_verbs[] = { |
| 6602 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6603 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 6604 | |
| 6605 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 6606 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 6607 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 6608 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 6609 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */ |
| 6610 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 6611 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */ |
| 6612 | |
| 6613 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */ |
| 6614 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */ |
| 6615 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 6616 | { } /* end */ |
| 6617 | }; |
| 6618 | |
Takashi Iwai | 914759b | 2007-09-06 14:52:04 +0200 | [diff] [blame] | 6619 | static struct hda_verb alc882_asus_a7m_verbs[] = { |
| 6620 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6621 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 6622 | |
| 6623 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 6624 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 6625 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 6626 | |
Takashi Iwai | 914759b | 2007-09-06 14:52:04 +0200 | [diff] [blame] | 6627 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */ |
| 6628 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 6629 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */ |
| 6630 | |
| 6631 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */ |
| 6632 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */ |
| 6633 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 6634 | { } /* end */ |
| 6635 | }; |
| 6636 | |
Tobin Davis | 9102cd1 | 2006-12-15 10:02:12 +0100 | [diff] [blame] | 6637 | static void alc882_gpio_mute(struct hda_codec *codec, int pin, int muted) |
| 6638 | { |
| 6639 | unsigned int gpiostate, gpiomask, gpiodir; |
| 6640 | |
| 6641 | gpiostate = snd_hda_codec_read(codec, codec->afg, 0, |
| 6642 | AC_VERB_GET_GPIO_DATA, 0); |
| 6643 | |
| 6644 | if (!muted) |
| 6645 | gpiostate |= (1 << pin); |
| 6646 | else |
| 6647 | gpiostate &= ~(1 << pin); |
| 6648 | |
| 6649 | gpiomask = snd_hda_codec_read(codec, codec->afg, 0, |
| 6650 | AC_VERB_GET_GPIO_MASK, 0); |
| 6651 | gpiomask |= (1 << pin); |
| 6652 | |
| 6653 | gpiodir = snd_hda_codec_read(codec, codec->afg, 0, |
| 6654 | AC_VERB_GET_GPIO_DIRECTION, 0); |
| 6655 | gpiodir |= (1 << pin); |
| 6656 | |
| 6657 | |
| 6658 | snd_hda_codec_write(codec, codec->afg, 0, |
| 6659 | AC_VERB_SET_GPIO_MASK, gpiomask); |
| 6660 | snd_hda_codec_write(codec, codec->afg, 0, |
| 6661 | AC_VERB_SET_GPIO_DIRECTION, gpiodir); |
| 6662 | |
| 6663 | msleep(1); |
| 6664 | |
| 6665 | snd_hda_codec_write(codec, codec->afg, 0, |
| 6666 | AC_VERB_SET_GPIO_DATA, gpiostate); |
| 6667 | } |
| 6668 | |
Takashi Iwai | 7debbe5 | 2007-08-16 15:01:03 +0200 | [diff] [blame] | 6669 | /* set up GPIO at initialization */ |
| 6670 | static void alc885_macpro_init_hook(struct hda_codec *codec) |
| 6671 | { |
| 6672 | alc882_gpio_mute(codec, 0, 0); |
| 6673 | alc882_gpio_mute(codec, 1, 0); |
| 6674 | } |
| 6675 | |
| 6676 | /* set up GPIO and update auto-muting at initialization */ |
| 6677 | static void alc885_imac24_init_hook(struct hda_codec *codec) |
| 6678 | { |
| 6679 | alc885_macpro_init_hook(codec); |
| 6680 | alc885_imac24_automute(codec); |
| 6681 | } |
| 6682 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6683 | /* |
| 6684 | * generic initialization of ADC, input mixers and output mixers |
| 6685 | */ |
| 6686 | static struct hda_verb alc882_auto_init_verbs[] = { |
| 6687 | /* |
| 6688 | * Unmute ADC0-2 and set the default input to mic-in |
| 6689 | */ |
| 6690 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 6691 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6692 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 6693 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6694 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 6695 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6696 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 6697 | /* 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] | 6698 | * mixer widget |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6699 | * Note: PASD motherboards uses the Line In 2 as the input for |
| 6700 | * front panel mic (mic 2) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6701 | */ |
| 6702 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 6703 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6704 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 6705 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 6706 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 6707 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6708 | |
| 6709 | /* |
| 6710 | * Set up output mixers (0x0c - 0x0f) |
| 6711 | */ |
| 6712 | /* set vol=0 to output mixers */ |
| 6713 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 6714 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 6715 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 6716 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 6717 | /* set up input amps for analog loopback */ |
| 6718 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 6719 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6720 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 6721 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6722 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 6723 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6724 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 6725 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6726 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 6727 | {0x26, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6728 | {0x26, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 6729 | |
| 6730 | /* FIXME: use matrix-type input source selection */ |
| 6731 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 6732 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ |
| 6733 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 6734 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 6735 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 6736 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 6737 | /* Input mixer2 */ |
| 6738 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 6739 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 6740 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 6741 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 6742 | /* Input mixer3 */ |
| 6743 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 6744 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 6745 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 6746 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 6747 | |
| 6748 | { } |
| 6749 | }; |
| 6750 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 6751 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 6752 | #define alc882_loopbacks alc880_loopbacks |
| 6753 | #endif |
| 6754 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6755 | /* pcm configuration: identiacal with ALC880 */ |
| 6756 | #define alc882_pcm_analog_playback alc880_pcm_analog_playback |
| 6757 | #define alc882_pcm_analog_capture alc880_pcm_analog_capture |
| 6758 | #define alc882_pcm_digital_playback alc880_pcm_digital_playback |
| 6759 | #define alc882_pcm_digital_capture alc880_pcm_digital_capture |
| 6760 | |
| 6761 | /* |
| 6762 | * configuration and preset |
| 6763 | */ |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 6764 | static const char *alc882_models[ALC882_MODEL_LAST] = { |
| 6765 | [ALC882_3ST_DIG] = "3stack-dig", |
| 6766 | [ALC882_6ST_DIG] = "6stack-dig", |
| 6767 | [ALC882_ARIMA] = "arima", |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 6768 | [ALC882_W2JC] = "w2jc", |
Takashi Iwai | 0438a00 | 2007-09-06 14:54:11 +0200 | [diff] [blame] | 6769 | [ALC882_TARGA] = "targa", |
| 6770 | [ALC882_ASUS_A7J] = "asus-a7j", |
| 6771 | [ALC882_ASUS_A7M] = "asus-a7m", |
Tobin Davis | 9102cd1 | 2006-12-15 10:02:12 +0100 | [diff] [blame] | 6772 | [ALC885_MACPRO] = "macpro", |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 6773 | [ALC885_MBP3] = "mbp3", |
Nicola Fagnani | c54728d | 2007-07-19 23:28:52 +0200 | [diff] [blame] | 6774 | [ALC885_IMAC24] = "imac24", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 6775 | [ALC882_AUTO] = "auto", |
| 6776 | }; |
| 6777 | |
| 6778 | static struct snd_pci_quirk alc882_cfg_tbl[] = { |
| 6779 | SND_PCI_QUIRK(0x1019, 0x6668, "ECS", ALC882_6ST_DIG), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 6780 | SND_PCI_QUIRK(0x1043, 0x060d, "Asus A7J", ALC882_ASUS_A7J), |
Kailang Yang | ac8842a | 2007-09-20 12:51:39 +0200 | [diff] [blame] | 6781 | SND_PCI_QUIRK(0x1043, 0x1243, "Asus A7J", ALC882_ASUS_A7J), |
Takashi Iwai | 914759b | 2007-09-06 14:52:04 +0200 | [diff] [blame] | 6782 | SND_PCI_QUIRK(0x1043, 0x13c2, "Asus A7M", ALC882_ASUS_A7M), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 6783 | SND_PCI_QUIRK(0x1043, 0x1971, "Asus W2JC", ALC882_W2JC), |
Claudio Matsuoka | c5d9f1c | 2007-07-19 23:18:32 +0200 | [diff] [blame] | 6784 | SND_PCI_QUIRK(0x1043, 0x817f, "Asus P5LD2", ALC882_6ST_DIG), |
Tobin Davis | 7b9470d | 2006-12-28 13:56:48 +0100 | [diff] [blame] | 6785 | SND_PCI_QUIRK(0x1043, 0x81d8, "Asus P5WD", ALC882_6ST_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 6786 | SND_PCI_QUIRK(0x105b, 0x6668, "Foxconn", ALC882_6ST_DIG), |
Jiang zhe | 4444704 | 2008-01-28 12:28:24 +0100 | [diff] [blame] | 6787 | SND_PCI_QUIRK(0x1458, 0xa002, "Gigabyte P35 DS3R", ALC882_6ST_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 6788 | SND_PCI_QUIRK(0x1462, 0x28fb, "Targa T8", ALC882_TARGA), /* MSI-1049 T8 */ |
| 6789 | SND_PCI_QUIRK(0x1462, 0x6668, "MSI", ALC882_6ST_DIG), |
| 6790 | SND_PCI_QUIRK(0x161f, 0x2054, "Arima W820", ALC882_ARIMA), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6791 | {} |
| 6792 | }; |
| 6793 | |
| 6794 | static struct alc_config_preset alc882_presets[] = { |
| 6795 | [ALC882_3ST_DIG] = { |
| 6796 | .mixers = { alc882_base_mixer }, |
| 6797 | .init_verbs = { alc882_init_verbs }, |
| 6798 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 6799 | .dac_nids = alc882_dac_nids, |
| 6800 | .dig_out_nid = ALC882_DIGOUT_NID, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6801 | .dig_in_nid = ALC882_DIGIN_NID, |
| 6802 | .num_channel_mode = ARRAY_SIZE(alc882_ch_modes), |
| 6803 | .channel_mode = alc882_ch_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 6804 | .need_dac_fix = 1, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6805 | .input_mux = &alc882_capture_source, |
| 6806 | }, |
| 6807 | [ALC882_6ST_DIG] = { |
| 6808 | .mixers = { alc882_base_mixer, alc882_chmode_mixer }, |
| 6809 | .init_verbs = { alc882_init_verbs }, |
| 6810 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 6811 | .dac_nids = alc882_dac_nids, |
| 6812 | .dig_out_nid = ALC882_DIGOUT_NID, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6813 | .dig_in_nid = ALC882_DIGIN_NID, |
| 6814 | .num_channel_mode = ARRAY_SIZE(alc882_sixstack_modes), |
| 6815 | .channel_mode = alc882_sixstack_modes, |
| 6816 | .input_mux = &alc882_capture_source, |
| 6817 | }, |
Takashi Iwai | 4b146cb | 2006-07-28 14:42:36 +0200 | [diff] [blame] | 6818 | [ALC882_ARIMA] = { |
| 6819 | .mixers = { alc882_base_mixer, alc882_chmode_mixer }, |
| 6820 | .init_verbs = { alc882_init_verbs, alc882_eapd_verbs }, |
| 6821 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 6822 | .dac_nids = alc882_dac_nids, |
| 6823 | .num_channel_mode = ARRAY_SIZE(alc882_sixstack_modes), |
| 6824 | .channel_mode = alc882_sixstack_modes, |
| 6825 | .input_mux = &alc882_capture_source, |
| 6826 | }, |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 6827 | [ALC882_W2JC] = { |
| 6828 | .mixers = { alc882_w2jc_mixer, alc882_chmode_mixer }, |
| 6829 | .init_verbs = { alc882_init_verbs, alc882_eapd_verbs, |
| 6830 | alc880_gpio1_init_verbs }, |
| 6831 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 6832 | .dac_nids = alc882_dac_nids, |
| 6833 | .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes), |
| 6834 | .channel_mode = alc880_threestack_modes, |
| 6835 | .need_dac_fix = 1, |
| 6836 | .input_mux = &alc882_capture_source, |
| 6837 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 6838 | }, |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 6839 | [ALC885_MBP3] = { |
| 6840 | .mixers = { alc885_mbp3_mixer, alc882_chmode_mixer }, |
| 6841 | .init_verbs = { alc885_mbp3_init_verbs, |
| 6842 | alc880_gpio1_init_verbs }, |
| 6843 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 6844 | .dac_nids = alc882_dac_nids, |
| 6845 | .channel_mode = alc885_mbp_6ch_modes, |
| 6846 | .num_channel_mode = ARRAY_SIZE(alc885_mbp_6ch_modes), |
| 6847 | .input_mux = &alc882_capture_source, |
| 6848 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 6849 | .dig_in_nid = ALC882_DIGIN_NID, |
| 6850 | .unsol_event = alc885_mbp3_unsol_event, |
| 6851 | .init_hook = alc885_mbp3_automute, |
| 6852 | }, |
Tobin Davis | 9102cd1 | 2006-12-15 10:02:12 +0100 | [diff] [blame] | 6853 | [ALC885_MACPRO] = { |
| 6854 | .mixers = { alc882_macpro_mixer }, |
| 6855 | .init_verbs = { alc882_macpro_init_verbs }, |
| 6856 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 6857 | .dac_nids = alc882_dac_nids, |
| 6858 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 6859 | .dig_in_nid = ALC882_DIGIN_NID, |
| 6860 | .num_channel_mode = ARRAY_SIZE(alc882_ch_modes), |
| 6861 | .channel_mode = alc882_ch_modes, |
| 6862 | .input_mux = &alc882_capture_source, |
Takashi Iwai | 7debbe5 | 2007-08-16 15:01:03 +0200 | [diff] [blame] | 6863 | .init_hook = alc885_macpro_init_hook, |
Tobin Davis | 9102cd1 | 2006-12-15 10:02:12 +0100 | [diff] [blame] | 6864 | }, |
Nicola Fagnani | c54728d | 2007-07-19 23:28:52 +0200 | [diff] [blame] | 6865 | [ALC885_IMAC24] = { |
| 6866 | .mixers = { alc885_imac24_mixer }, |
| 6867 | .init_verbs = { alc885_imac24_init_verbs }, |
| 6868 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 6869 | .dac_nids = alc882_dac_nids, |
| 6870 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 6871 | .dig_in_nid = ALC882_DIGIN_NID, |
| 6872 | .num_channel_mode = ARRAY_SIZE(alc882_ch_modes), |
| 6873 | .channel_mode = alc882_ch_modes, |
| 6874 | .input_mux = &alc882_capture_source, |
| 6875 | .unsol_event = alc885_imac24_unsol_event, |
Takashi Iwai | 7debbe5 | 2007-08-16 15:01:03 +0200 | [diff] [blame] | 6876 | .init_hook = alc885_imac24_init_hook, |
Nicola Fagnani | c54728d | 2007-07-19 23:28:52 +0200 | [diff] [blame] | 6877 | }, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 6878 | [ALC882_TARGA] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 6879 | .mixers = { alc882_targa_mixer, alc882_chmode_mixer }, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 6880 | .init_verbs = { alc882_init_verbs, alc882_targa_verbs}, |
| 6881 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 6882 | .dac_nids = alc882_dac_nids, |
| 6883 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 6884 | .num_adc_nids = ARRAY_SIZE(alc882_adc_nids), |
| 6885 | .adc_nids = alc882_adc_nids, |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 6886 | .capsrc_nids = alc882_capsrc_nids, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 6887 | .num_channel_mode = ARRAY_SIZE(alc882_3ST_6ch_modes), |
| 6888 | .channel_mode = alc882_3ST_6ch_modes, |
| 6889 | .need_dac_fix = 1, |
| 6890 | .input_mux = &alc882_capture_source, |
| 6891 | .unsol_event = alc882_targa_unsol_event, |
| 6892 | .init_hook = alc882_targa_automute, |
| 6893 | }, |
| 6894 | [ALC882_ASUS_A7J] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 6895 | .mixers = { alc882_asus_a7j_mixer, alc882_chmode_mixer }, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 6896 | .init_verbs = { alc882_init_verbs, alc882_asus_a7j_verbs}, |
| 6897 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 6898 | .dac_nids = alc882_dac_nids, |
| 6899 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 6900 | .num_adc_nids = ARRAY_SIZE(alc882_adc_nids), |
| 6901 | .adc_nids = alc882_adc_nids, |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 6902 | .capsrc_nids = alc882_capsrc_nids, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 6903 | .num_channel_mode = ARRAY_SIZE(alc882_3ST_6ch_modes), |
| 6904 | .channel_mode = alc882_3ST_6ch_modes, |
| 6905 | .need_dac_fix = 1, |
| 6906 | .input_mux = &alc882_capture_source, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 6907 | }, |
Takashi Iwai | 914759b | 2007-09-06 14:52:04 +0200 | [diff] [blame] | 6908 | [ALC882_ASUS_A7M] = { |
| 6909 | .mixers = { alc882_asus_a7m_mixer, alc882_chmode_mixer }, |
| 6910 | .init_verbs = { alc882_init_verbs, alc882_eapd_verbs, |
| 6911 | alc880_gpio1_init_verbs, |
| 6912 | alc882_asus_a7m_verbs }, |
| 6913 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 6914 | .dac_nids = alc882_dac_nids, |
| 6915 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 6916 | .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes), |
| 6917 | .channel_mode = alc880_threestack_modes, |
| 6918 | .need_dac_fix = 1, |
| 6919 | .input_mux = &alc882_capture_source, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 6920 | }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6921 | }; |
| 6922 | |
| 6923 | |
| 6924 | /* |
Takashi Iwai | f95474e | 2007-07-10 00:47:43 +0200 | [diff] [blame] | 6925 | * Pin config fixes |
| 6926 | */ |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 6927 | enum { |
Takashi Iwai | f95474e | 2007-07-10 00:47:43 +0200 | [diff] [blame] | 6928 | PINFIX_ABIT_AW9D_MAX |
| 6929 | }; |
| 6930 | |
| 6931 | static struct alc_pincfg alc882_abit_aw9d_pinfix[] = { |
| 6932 | { 0x15, 0x01080104 }, /* side */ |
| 6933 | { 0x16, 0x01011012 }, /* rear */ |
| 6934 | { 0x17, 0x01016011 }, /* clfe */ |
| 6935 | { } |
| 6936 | }; |
| 6937 | |
| 6938 | static const struct alc_pincfg *alc882_pin_fixes[] = { |
| 6939 | [PINFIX_ABIT_AW9D_MAX] = alc882_abit_aw9d_pinfix, |
| 6940 | }; |
| 6941 | |
| 6942 | static struct snd_pci_quirk alc882_pinfix_tbl[] = { |
| 6943 | SND_PCI_QUIRK(0x147b, 0x107a, "Abit AW9D-MAX", PINFIX_ABIT_AW9D_MAX), |
| 6944 | {} |
| 6945 | }; |
| 6946 | |
| 6947 | /* |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6948 | * BIOS auto configuration |
| 6949 | */ |
| 6950 | static void alc882_auto_set_output_and_unmute(struct hda_codec *codec, |
| 6951 | hda_nid_t nid, int pin_type, |
| 6952 | int dac_idx) |
| 6953 | { |
| 6954 | /* set as output */ |
| 6955 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6956 | int idx; |
| 6957 | |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 6958 | alc_set_pin_output(codec, nid, pin_type); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6959 | if (spec->multiout.dac_nids[dac_idx] == 0x25) |
| 6960 | idx = 4; |
| 6961 | else |
| 6962 | idx = spec->multiout.dac_nids[dac_idx] - 2; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6963 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_CONNECT_SEL, idx); |
| 6964 | |
| 6965 | } |
| 6966 | |
| 6967 | static void alc882_auto_init_multi_out(struct hda_codec *codec) |
| 6968 | { |
| 6969 | struct alc_spec *spec = codec->spec; |
| 6970 | int i; |
| 6971 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 6972 | alc_subsystem_id(codec, 0x15, 0x1b, 0x14); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6973 | for (i = 0; i <= HDA_SIDE; i++) { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6974 | hda_nid_t nid = spec->autocfg.line_out_pins[i]; |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 6975 | int pin_type = get_pin_type(spec->autocfg.line_out_type); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6976 | if (nid) |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 6977 | alc882_auto_set_output_and_unmute(codec, nid, pin_type, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6978 | i); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6979 | } |
| 6980 | } |
| 6981 | |
| 6982 | static void alc882_auto_init_hp_out(struct hda_codec *codec) |
| 6983 | { |
| 6984 | struct alc_spec *spec = codec->spec; |
| 6985 | hda_nid_t pin; |
| 6986 | |
Takashi Iwai | eb06ed8 | 2006-09-20 17:10:27 +0200 | [diff] [blame] | 6987 | pin = spec->autocfg.hp_pins[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6988 | if (pin) /* connect to front */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6989 | /* use dac 0 */ |
| 6990 | alc882_auto_set_output_and_unmute(codec, pin, PIN_HP, 0); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 6991 | pin = spec->autocfg.speaker_pins[0]; |
| 6992 | if (pin) |
| 6993 | alc882_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6994 | } |
| 6995 | |
| 6996 | #define alc882_is_input_pin(nid) alc880_is_input_pin(nid) |
| 6997 | #define ALC882_PIN_CD_NID ALC880_PIN_CD_NID |
| 6998 | |
| 6999 | static void alc882_auto_init_analog_input(struct hda_codec *codec) |
| 7000 | { |
| 7001 | struct alc_spec *spec = codec->spec; |
| 7002 | int i; |
| 7003 | |
| 7004 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
| 7005 | hda_nid_t nid = spec->autocfg.input_pins[i]; |
Takashi Iwai | 7194cae | 2008-03-06 16:58:17 +0100 | [diff] [blame] | 7006 | unsigned int vref; |
| 7007 | if (!nid) |
| 7008 | continue; |
| 7009 | vref = PIN_IN; |
| 7010 | if (1 /*i <= AUTO_PIN_FRONT_MIC*/) { |
Kailang Yang | 531240f | 2008-05-27 12:10:25 +0200 | [diff] [blame] | 7011 | unsigned int pincap; |
| 7012 | pincap = snd_hda_param_read(codec, nid, AC_PAR_PIN_CAP); |
| 7013 | if ((pincap >> AC_PINCAP_VREF_SHIFT) & |
Takashi Iwai | 7194cae | 2008-03-06 16:58:17 +0100 | [diff] [blame] | 7014 | AC_PINCAP_VREF_80) |
| 7015 | vref = PIN_VREF80; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7016 | } |
Takashi Iwai | 7194cae | 2008-03-06 16:58:17 +0100 | [diff] [blame] | 7017 | snd_hda_codec_write(codec, nid, 0, |
| 7018 | AC_VERB_SET_PIN_WIDGET_CONTROL, vref); |
| 7019 | if (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP) |
| 7020 | snd_hda_codec_write(codec, nid, 0, |
| 7021 | AC_VERB_SET_AMP_GAIN_MUTE, |
| 7022 | AMP_OUT_MUTE); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7023 | } |
| 7024 | } |
| 7025 | |
Takashi Iwai | f511b01 | 2008-08-15 16:46:42 +0200 | [diff] [blame] | 7026 | static void alc882_auto_init_input_src(struct hda_codec *codec) |
| 7027 | { |
| 7028 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | f511b01 | 2008-08-15 16:46:42 +0200 | [diff] [blame] | 7029 | int c; |
| 7030 | |
| 7031 | for (c = 0; c < spec->num_adc_nids; c++) { |
| 7032 | hda_nid_t conn_list[HDA_MAX_NUM_INPUTS]; |
| 7033 | hda_nid_t nid = spec->capsrc_nids[c]; |
Herton Ronaldo Krzesinski | b98b7b3 | 2009-01-29 13:18:31 -0200 | [diff] [blame] | 7034 | unsigned int mux_idx; |
| 7035 | const struct hda_input_mux *imux; |
Takashi Iwai | f511b01 | 2008-08-15 16:46:42 +0200 | [diff] [blame] | 7036 | int conns, mute, idx, item; |
| 7037 | |
| 7038 | conns = snd_hda_get_connections(codec, nid, conn_list, |
| 7039 | ARRAY_SIZE(conn_list)); |
| 7040 | if (conns < 0) |
| 7041 | continue; |
Herton Ronaldo Krzesinski | b98b7b3 | 2009-01-29 13:18:31 -0200 | [diff] [blame] | 7042 | mux_idx = c >= spec->num_mux_defs ? 0 : c; |
| 7043 | imux = &spec->input_mux[mux_idx]; |
Takashi Iwai | f511b01 | 2008-08-15 16:46:42 +0200 | [diff] [blame] | 7044 | for (idx = 0; idx < conns; idx++) { |
| 7045 | /* if the current connection is the selected one, |
| 7046 | * unmute it as default - otherwise mute it |
| 7047 | */ |
| 7048 | mute = AMP_IN_MUTE(idx); |
| 7049 | for (item = 0; item < imux->num_items; item++) { |
| 7050 | if (imux->items[item].index == idx) { |
| 7051 | if (spec->cur_mux[c] == item) |
| 7052 | mute = AMP_IN_UNMUTE(idx); |
| 7053 | break; |
| 7054 | } |
| 7055 | } |
Herton Ronaldo Krzesinski | b98b7b3 | 2009-01-29 13:18:31 -0200 | [diff] [blame] | 7056 | /* check if we have a selector or mixer |
| 7057 | * we could check for the widget type instead, but |
| 7058 | * just check for Amp-In presence (in case of mixer |
| 7059 | * without amp-in there is something wrong, this |
| 7060 | * function shouldn't be used or capsrc nid is wrong) |
| 7061 | */ |
| 7062 | if (get_wcaps(codec, nid) & AC_WCAP_IN_AMP) |
| 7063 | snd_hda_codec_write(codec, nid, 0, |
| 7064 | AC_VERB_SET_AMP_GAIN_MUTE, |
| 7065 | mute); |
| 7066 | else if (mute != AMP_IN_MUTE(idx)) |
| 7067 | snd_hda_codec_write(codec, nid, 0, |
| 7068 | AC_VERB_SET_CONNECT_SEL, |
| 7069 | idx); |
Takashi Iwai | f511b01 | 2008-08-15 16:46:42 +0200 | [diff] [blame] | 7070 | } |
| 7071 | } |
| 7072 | } |
| 7073 | |
Takashi Iwai | 776e184 | 2007-08-29 15:07:11 +0200 | [diff] [blame] | 7074 | /* add mic boosts if needed */ |
| 7075 | static int alc_auto_add_mic_boost(struct hda_codec *codec) |
| 7076 | { |
| 7077 | struct alc_spec *spec = codec->spec; |
| 7078 | int err; |
| 7079 | hda_nid_t nid; |
| 7080 | |
| 7081 | nid = spec->autocfg.input_pins[AUTO_PIN_MIC]; |
Takashi Iwai | ce22e03 | 2008-01-11 17:38:35 +0100 | [diff] [blame] | 7082 | if (nid && (get_wcaps(codec, nid) & AC_WCAP_IN_AMP)) { |
Takashi Iwai | 776e184 | 2007-08-29 15:07:11 +0200 | [diff] [blame] | 7083 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 7084 | "Mic Boost", |
| 7085 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_INPUT)); |
| 7086 | if (err < 0) |
| 7087 | return err; |
| 7088 | } |
| 7089 | nid = spec->autocfg.input_pins[AUTO_PIN_FRONT_MIC]; |
Takashi Iwai | ce22e03 | 2008-01-11 17:38:35 +0100 | [diff] [blame] | 7090 | if (nid && (get_wcaps(codec, nid) & AC_WCAP_IN_AMP)) { |
Takashi Iwai | 776e184 | 2007-08-29 15:07:11 +0200 | [diff] [blame] | 7091 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 7092 | "Front Mic Boost", |
| 7093 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_INPUT)); |
| 7094 | if (err < 0) |
| 7095 | return err; |
| 7096 | } |
| 7097 | return 0; |
| 7098 | } |
| 7099 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7100 | /* almost identical with ALC880 parser... */ |
| 7101 | static int alc882_parse_auto_config(struct hda_codec *codec) |
| 7102 | { |
| 7103 | struct alc_spec *spec = codec->spec; |
| 7104 | int err = alc880_parse_auto_config(codec); |
| 7105 | |
| 7106 | if (err < 0) |
| 7107 | return err; |
Takashi Iwai | 776e184 | 2007-08-29 15:07:11 +0200 | [diff] [blame] | 7108 | else if (!err) |
| 7109 | return 0; /* no config found */ |
| 7110 | |
| 7111 | err = alc_auto_add_mic_boost(codec); |
| 7112 | if (err < 0) |
| 7113 | return err; |
| 7114 | |
| 7115 | /* hack - override the init verbs */ |
| 7116 | spec->init_verbs[0] = alc882_auto_init_verbs; |
| 7117 | |
| 7118 | return 1; /* config found */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7119 | } |
| 7120 | |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 7121 | /* additional initialization for auto-configuration model */ |
| 7122 | static void alc882_auto_init(struct hda_codec *codec) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7123 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 7124 | struct alc_spec *spec = codec->spec; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7125 | alc882_auto_init_multi_out(codec); |
| 7126 | alc882_auto_init_hp_out(codec); |
| 7127 | alc882_auto_init_analog_input(codec); |
Takashi Iwai | f511b01 | 2008-08-15 16:46:42 +0200 | [diff] [blame] | 7128 | alc882_auto_init_input_src(codec); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 7129 | if (spec->unsol_event) |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 7130 | alc_inithook(codec); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7131 | } |
| 7132 | |
Takashi Iwai | 7943a8a | 2008-04-16 17:29:09 +0200 | [diff] [blame] | 7133 | static int patch_alc883(struct hda_codec *codec); /* called in patch_alc882() */ |
| 7134 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7135 | static int patch_alc882(struct hda_codec *codec) |
| 7136 | { |
| 7137 | struct alc_spec *spec; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7138 | int err, board_config; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7139 | |
Takashi Iwai | e560d8d | 2005-09-09 14:21:46 +0200 | [diff] [blame] | 7140 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7141 | if (spec == NULL) |
| 7142 | return -ENOMEM; |
| 7143 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7144 | codec->spec = spec; |
| 7145 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 7146 | board_config = snd_hda_check_board_config(codec, ALC882_MODEL_LAST, |
| 7147 | alc882_models, |
| 7148 | alc882_cfg_tbl); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7149 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7150 | if (board_config < 0 || board_config >= ALC882_MODEL_LAST) { |
Tobin Davis | 081d17c | 2007-02-15 17:46:18 +0100 | [diff] [blame] | 7151 | /* Pick up systems that don't supply PCI SSID */ |
| 7152 | switch (codec->subsystem_id) { |
| 7153 | case 0x106b0c00: /* Mac Pro */ |
| 7154 | board_config = ALC885_MACPRO; |
| 7155 | break; |
Nicola Fagnani | c54728d | 2007-07-19 23:28:52 +0200 | [diff] [blame] | 7156 | case 0x106b1000: /* iMac 24 */ |
Peter Korsgaard | f3911c5 | 2008-09-27 09:13:45 +0200 | [diff] [blame] | 7157 | case 0x106b2800: /* AppleTV */ |
Mark Eggleston | 3077e44 | 2009-01-31 17:57:54 +0100 | [diff] [blame] | 7158 | case 0x106b3e00: /* iMac 24 Aluminium */ |
Nicola Fagnani | c54728d | 2007-07-19 23:28:52 +0200 | [diff] [blame] | 7159 | board_config = ALC885_IMAC24; |
| 7160 | break; |
Luke Yelavich | 2d46638 | 2009-02-23 13:00:33 +1100 | [diff] [blame] | 7161 | case 0x106b00a0: /* MacBookPro3,1 - Another revision */ |
Takashi Iwai | c7e0757 | 2008-06-26 14:42:51 +0200 | [diff] [blame] | 7162 | case 0x106b00a1: /* Macbook (might be wrong - PCI SSID?) */ |
David Woodhouse | 9c95c43 | 2008-09-18 13:37:13 -0700 | [diff] [blame] | 7163 | case 0x106b00a4: /* MacbookPro4,1 */ |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 7164 | case 0x106b2c00: /* Macbook Pro rev3 */ |
Takashi Iwai | c7e0757 | 2008-06-26 14:42:51 +0200 | [diff] [blame] | 7165 | case 0x106b3600: /* Macbook 3.1 */ |
Luke Yelavich | 2a88464 | 2009-01-28 15:58:38 +1100 | [diff] [blame] | 7166 | case 0x106b3800: /* MacbookPro4,1 - latter revision */ |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 7167 | board_config = ALC885_MBP3; |
| 7168 | break; |
Tobin Davis | 081d17c | 2007-02-15 17:46:18 +0100 | [diff] [blame] | 7169 | default: |
Takashi Iwai | 7943a8a | 2008-04-16 17:29:09 +0200 | [diff] [blame] | 7170 | /* ALC889A is handled better as ALC888-compatible */ |
Clive Messer | 669faba | 2008-09-30 15:49:13 +0200 | [diff] [blame] | 7171 | if (codec->revision_id == 0x100101 || |
| 7172 | codec->revision_id == 0x100103) { |
Takashi Iwai | 7943a8a | 2008-04-16 17:29:09 +0200 | [diff] [blame] | 7173 | alc_free(codec); |
| 7174 | return patch_alc883(codec); |
| 7175 | } |
Tobin Davis | 081d17c | 2007-02-15 17:46:18 +0100 | [diff] [blame] | 7176 | printk(KERN_INFO "hda_codec: Unknown model for ALC882, " |
| 7177 | "trying auto-probe from BIOS...\n"); |
| 7178 | board_config = ALC882_AUTO; |
| 7179 | } |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7180 | } |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 7181 | |
Takashi Iwai | f95474e | 2007-07-10 00:47:43 +0200 | [diff] [blame] | 7182 | alc_fix_pincfg(codec, alc882_pinfix_tbl, alc882_pin_fixes); |
| 7183 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7184 | if (board_config == ALC882_AUTO) { |
| 7185 | /* automatic parse from the BIOS config */ |
| 7186 | err = alc882_parse_auto_config(codec); |
| 7187 | if (err < 0) { |
| 7188 | alc_free(codec); |
| 7189 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 7190 | } else if (!err) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7191 | printk(KERN_INFO |
| 7192 | "hda_codec: Cannot set up configuration " |
| 7193 | "from BIOS. Using base mode...\n"); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7194 | board_config = ALC882_3ST_DIG; |
| 7195 | } |
| 7196 | } |
| 7197 | |
Kusanagi Kouichi | 680cd53 | 2009-02-05 00:00:58 +0900 | [diff] [blame] | 7198 | err = snd_hda_attach_beep_device(codec, 0x1); |
| 7199 | if (err < 0) { |
| 7200 | alc_free(codec); |
| 7201 | return err; |
| 7202 | } |
| 7203 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7204 | if (board_config != ALC882_AUTO) |
| 7205 | setup_preset(spec, &alc882_presets[board_config]); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7206 | |
Kailang Yang | 2f89328 | 2008-05-27 12:14:47 +0200 | [diff] [blame] | 7207 | if (codec->vendor_id == 0x10ec0885) { |
| 7208 | spec->stream_name_analog = "ALC885 Analog"; |
| 7209 | spec->stream_name_digital = "ALC885 Digital"; |
| 7210 | } else { |
| 7211 | spec->stream_name_analog = "ALC882 Analog"; |
| 7212 | spec->stream_name_digital = "ALC882 Digital"; |
| 7213 | } |
| 7214 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7215 | spec->stream_analog_playback = &alc882_pcm_analog_playback; |
| 7216 | spec->stream_analog_capture = &alc882_pcm_analog_capture; |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 7217 | /* FIXME: setup DAC5 */ |
| 7218 | /*spec->stream_analog_alt_playback = &alc880_pcm_analog_alt_playback;*/ |
| 7219 | spec->stream_analog_alt_capture = &alc880_pcm_analog_alt_capture; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7220 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7221 | spec->stream_digital_playback = &alc882_pcm_digital_playback; |
| 7222 | spec->stream_digital_capture = &alc882_pcm_digital_capture; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7223 | |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 7224 | spec->capture_style = CAPT_MIX; /* matrix-style capture */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 7225 | if (!spec->adc_nids && spec->input_mux) { |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7226 | /* check whether NID 0x07 is valid */ |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 7227 | unsigned int wcap = get_wcaps(codec, 0x07); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 7228 | /* get type */ |
| 7229 | wcap = (wcap & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7230 | if (wcap != AC_WID_AUD_IN) { |
| 7231 | spec->adc_nids = alc882_adc_nids_alt; |
| 7232 | spec->num_adc_nids = ARRAY_SIZE(alc882_adc_nids_alt); |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 7233 | spec->capsrc_nids = alc882_capsrc_nids_alt; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7234 | } else { |
| 7235 | spec->adc_nids = alc882_adc_nids; |
| 7236 | spec->num_adc_nids = ARRAY_SIZE(alc882_adc_nids); |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 7237 | spec->capsrc_nids = alc882_capsrc_nids; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7238 | } |
| 7239 | } |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 7240 | set_capture_mixer(spec); |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 7241 | set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7242 | |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 7243 | spec->vmaster_nid = 0x0c; |
| 7244 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7245 | codec->patch_ops = alc_patch_ops; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7246 | if (board_config == ALC882_AUTO) |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 7247 | spec->init_hook = alc882_auto_init; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 7248 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 7249 | if (!spec->loopback.amplist) |
| 7250 | spec->loopback.amplist = alc882_loopbacks; |
| 7251 | #endif |
Takashi Iwai | daead53 | 2008-11-28 12:55:36 +0100 | [diff] [blame] | 7252 | codec->proc_widget_hook = print_realtek_coef; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7253 | |
| 7254 | return 0; |
| 7255 | } |
| 7256 | |
| 7257 | /* |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7258 | * ALC883 support |
| 7259 | * |
| 7260 | * ALC883 is almost identical with ALC880 but has cleaner and more flexible |
| 7261 | * configuration. Each pin widget can choose any input DACs and a mixer. |
| 7262 | * Each ADC is connected from a mixer of all inputs. This makes possible |
| 7263 | * 6-channel independent captures. |
| 7264 | * |
| 7265 | * In addition, an independent DAC for the multi-playback (not used in this |
| 7266 | * driver yet). |
| 7267 | */ |
| 7268 | #define ALC883_DIGOUT_NID 0x06 |
| 7269 | #define ALC883_DIGIN_NID 0x0a |
| 7270 | |
Wu Fengguang | 3ab9093 | 2008-11-17 09:51:09 +0100 | [diff] [blame] | 7271 | #define ALC1200_DIGOUT_NID 0x10 |
| 7272 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7273 | static hda_nid_t alc883_dac_nids[4] = { |
| 7274 | /* front, rear, clfe, rear_surr */ |
Herton Ronaldo Krzesinski | f32a19e | 2008-03-18 09:27:08 +0100 | [diff] [blame] | 7275 | 0x02, 0x03, 0x04, 0x05 |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7276 | }; |
| 7277 | |
| 7278 | static hda_nid_t alc883_adc_nids[2] = { |
| 7279 | /* ADC1-2 */ |
| 7280 | 0x08, 0x09, |
| 7281 | }; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 7282 | |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 7283 | static hda_nid_t alc883_adc_nids_alt[1] = { |
| 7284 | /* ADC1 */ |
| 7285 | 0x08, |
| 7286 | }; |
| 7287 | |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 7288 | static hda_nid_t alc883_adc_nids_rev[2] = { |
| 7289 | /* ADC2-1 */ |
| 7290 | 0x09, 0x08 |
| 7291 | }; |
| 7292 | |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 7293 | #define alc889_adc_nids alc880_adc_nids |
| 7294 | |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 7295 | static hda_nid_t alc883_capsrc_nids[2] = { 0x23, 0x22 }; |
| 7296 | |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 7297 | static hda_nid_t alc883_capsrc_nids_rev[2] = { 0x22, 0x23 }; |
| 7298 | |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 7299 | #define alc889_capsrc_nids alc882_capsrc_nids |
| 7300 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7301 | /* input MUX */ |
| 7302 | /* FIXME: should be a matrix-type input source selection */ |
| 7303 | |
| 7304 | static struct hda_input_mux alc883_capture_source = { |
| 7305 | .num_items = 4, |
| 7306 | .items = { |
| 7307 | { "Mic", 0x0 }, |
| 7308 | { "Front Mic", 0x1 }, |
| 7309 | { "Line", 0x2 }, |
| 7310 | { "CD", 0x4 }, |
| 7311 | }, |
| 7312 | }; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 7313 | |
Jiang zhe | 17bba1b | 2008-06-04 12:11:07 +0200 | [diff] [blame] | 7314 | static struct hda_input_mux alc883_3stack_6ch_intel = { |
| 7315 | .num_items = 4, |
| 7316 | .items = { |
| 7317 | { "Mic", 0x1 }, |
| 7318 | { "Front Mic", 0x0 }, |
| 7319 | { "Line", 0x2 }, |
| 7320 | { "CD", 0x4 }, |
| 7321 | }, |
| 7322 | }; |
| 7323 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 7324 | static struct hda_input_mux alc883_lenovo_101e_capture_source = { |
| 7325 | .num_items = 2, |
| 7326 | .items = { |
| 7327 | { "Mic", 0x1 }, |
| 7328 | { "Line", 0x2 }, |
| 7329 | }, |
| 7330 | }; |
| 7331 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7332 | static struct hda_input_mux alc883_lenovo_nb0763_capture_source = { |
| 7333 | .num_items = 4, |
| 7334 | .items = { |
| 7335 | { "Mic", 0x0 }, |
| 7336 | { "iMic", 0x1 }, |
| 7337 | { "Line", 0x2 }, |
| 7338 | { "CD", 0x4 }, |
| 7339 | }, |
| 7340 | }; |
| 7341 | |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 7342 | static struct hda_input_mux alc883_fujitsu_pi2515_capture_source = { |
| 7343 | .num_items = 2, |
| 7344 | .items = { |
| 7345 | { "Mic", 0x0 }, |
| 7346 | { "Int Mic", 0x1 }, |
| 7347 | }, |
| 7348 | }; |
| 7349 | |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 7350 | static struct hda_input_mux alc883_lenovo_sky_capture_source = { |
| 7351 | .num_items = 3, |
| 7352 | .items = { |
| 7353 | { "Mic", 0x0 }, |
| 7354 | { "Front Mic", 0x1 }, |
| 7355 | { "Line", 0x4 }, |
| 7356 | }, |
| 7357 | }; |
| 7358 | |
| 7359 | static struct hda_input_mux alc883_asus_eee1601_capture_source = { |
| 7360 | .num_items = 2, |
| 7361 | .items = { |
| 7362 | { "Mic", 0x0 }, |
| 7363 | { "Line", 0x2 }, |
| 7364 | }, |
| 7365 | }; |
| 7366 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7367 | /* |
| 7368 | * 2ch mode |
| 7369 | */ |
| 7370 | static struct hda_channel_mode alc883_3ST_2ch_modes[1] = { |
| 7371 | { 2, NULL } |
| 7372 | }; |
| 7373 | |
| 7374 | /* |
| 7375 | * 2ch mode |
| 7376 | */ |
| 7377 | static struct hda_verb alc883_3ST_ch2_init[] = { |
| 7378 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 7379 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 7380 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 7381 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 7382 | { } /* end */ |
| 7383 | }; |
| 7384 | |
| 7385 | /* |
Tobin Davis | b201131 | 2007-09-17 12:45:11 +0200 | [diff] [blame] | 7386 | * 4ch mode |
| 7387 | */ |
| 7388 | static struct hda_verb alc883_3ST_ch4_init[] = { |
| 7389 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 7390 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 7391 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7392 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 7393 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 7394 | { } /* end */ |
| 7395 | }; |
| 7396 | |
| 7397 | /* |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7398 | * 6ch mode |
| 7399 | */ |
| 7400 | static struct hda_verb alc883_3ST_ch6_init[] = { |
| 7401 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7402 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 7403 | { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 }, |
| 7404 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7405 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 7406 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 7407 | { } /* end */ |
| 7408 | }; |
| 7409 | |
Tobin Davis | b201131 | 2007-09-17 12:45:11 +0200 | [diff] [blame] | 7410 | static struct hda_channel_mode alc883_3ST_6ch_modes[3] = { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7411 | { 2, alc883_3ST_ch2_init }, |
Tobin Davis | b201131 | 2007-09-17 12:45:11 +0200 | [diff] [blame] | 7412 | { 4, alc883_3ST_ch4_init }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7413 | { 6, alc883_3ST_ch6_init }, |
| 7414 | }; |
| 7415 | |
| 7416 | /* |
Jiang zhe | 17bba1b | 2008-06-04 12:11:07 +0200 | [diff] [blame] | 7417 | * 2ch mode |
| 7418 | */ |
| 7419 | static struct hda_verb alc883_3ST_ch2_intel_init[] = { |
| 7420 | { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 7421 | { 0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 7422 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 7423 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 7424 | { } /* end */ |
| 7425 | }; |
| 7426 | |
| 7427 | /* |
| 7428 | * 4ch mode |
| 7429 | */ |
| 7430 | static struct hda_verb alc883_3ST_ch4_intel_init[] = { |
| 7431 | { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 7432 | { 0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 7433 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7434 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 7435 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 7436 | { } /* end */ |
| 7437 | }; |
| 7438 | |
| 7439 | /* |
| 7440 | * 6ch mode |
| 7441 | */ |
| 7442 | static struct hda_verb alc883_3ST_ch6_intel_init[] = { |
| 7443 | { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7444 | { 0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 7445 | { 0x19, AC_VERB_SET_CONNECT_SEL, 0x02 }, |
| 7446 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7447 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 7448 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 7449 | { } /* end */ |
| 7450 | }; |
| 7451 | |
| 7452 | static struct hda_channel_mode alc883_3ST_6ch_intel_modes[3] = { |
| 7453 | { 2, alc883_3ST_ch2_intel_init }, |
| 7454 | { 4, alc883_3ST_ch4_intel_init }, |
| 7455 | { 6, alc883_3ST_ch6_intel_init }, |
| 7456 | }; |
| 7457 | |
| 7458 | /* |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7459 | * 6ch mode |
| 7460 | */ |
| 7461 | static struct hda_verb alc883_sixstack_ch6_init[] = { |
| 7462 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 7463 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7464 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7465 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7466 | { } /* end */ |
| 7467 | }; |
| 7468 | |
| 7469 | /* |
| 7470 | * 8ch mode |
| 7471 | */ |
| 7472 | static struct hda_verb alc883_sixstack_ch8_init[] = { |
| 7473 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7474 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7475 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7476 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7477 | { } /* end */ |
| 7478 | }; |
| 7479 | |
| 7480 | static struct hda_channel_mode alc883_sixstack_modes[2] = { |
| 7481 | { 6, alc883_sixstack_ch6_init }, |
| 7482 | { 8, alc883_sixstack_ch8_init }, |
| 7483 | }; |
| 7484 | |
Andrew L. Neporada | b373bde | 2006-11-07 11:37:08 +0100 | [diff] [blame] | 7485 | static struct hda_verb alc883_medion_eapd_verbs[] = { |
| 7486 | /* eanable EAPD on medion laptop */ |
| 7487 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 7488 | {0x20, AC_VERB_SET_PROC_COEF, 0x3070}, |
| 7489 | { } |
| 7490 | }; |
| 7491 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7492 | /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17 |
| 7493 | * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b |
| 7494 | */ |
| 7495 | |
| 7496 | static struct snd_kcontrol_new alc883_base_mixer[] = { |
| 7497 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 7498 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 7499 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 7500 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
| 7501 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 7502 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 7503 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 7504 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 7505 | HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
| 7506 | HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT), |
| 7507 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 7508 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 7509 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 7510 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 7511 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 7512 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 7513 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7514 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 7515 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 7516 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7517 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7518 | { } /* end */ |
| 7519 | }; |
| 7520 | |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 7521 | static struct snd_kcontrol_new alc883_mitac_mixer[] = { |
| 7522 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 7523 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 7524 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 7525 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 7526 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 7527 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 7528 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 7529 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 7530 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 7531 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 7532 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 7533 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
| 7534 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 7535 | { } /* end */ |
| 7536 | }; |
| 7537 | |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 7538 | static struct snd_kcontrol_new alc883_clevo_m720_mixer[] = { |
Jiang zhe | 368c7a9 | 2008-03-04 11:20:33 +0100 | [diff] [blame] | 7539 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 7540 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT), |
| 7541 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 7542 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT), |
| 7543 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 7544 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 7545 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 7546 | HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 7547 | HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT), |
| 7548 | HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Jiang zhe | 368c7a9 | 2008-03-04 11:20:33 +0100 | [diff] [blame] | 7549 | { } /* end */ |
| 7550 | }; |
| 7551 | |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 7552 | static struct snd_kcontrol_new alc883_2ch_fujitsu_pi2515_mixer[] = { |
| 7553 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 7554 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT), |
| 7555 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 7556 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT), |
| 7557 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 7558 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 7559 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 7560 | HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 7561 | HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT), |
| 7562 | HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 7563 | { } /* end */ |
| 7564 | }; |
| 7565 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7566 | static struct snd_kcontrol_new alc883_3ST_2ch_mixer[] = { |
| 7567 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 7568 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 7569 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 7570 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 7571 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 7572 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 7573 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 7574 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 7575 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7576 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 7577 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 7578 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7579 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7580 | { } /* end */ |
| 7581 | }; |
| 7582 | |
| 7583 | static struct snd_kcontrol_new alc883_3ST_6ch_mixer[] = { |
| 7584 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 7585 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 7586 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 7587 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
| 7588 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 7589 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 7590 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 7591 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 7592 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 7593 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 7594 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 7595 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 7596 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 7597 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 7598 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7599 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 7600 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 7601 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7602 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7603 | { } /* end */ |
| 7604 | }; |
| 7605 | |
Jiang zhe | 17bba1b | 2008-06-04 12:11:07 +0200 | [diff] [blame] | 7606 | static struct snd_kcontrol_new alc883_3ST_6ch_intel_mixer[] = { |
| 7607 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 7608 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 7609 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 7610 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
| 7611 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, |
| 7612 | HDA_OUTPUT), |
| 7613 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 7614 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 7615 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 7616 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 7617 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 7618 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 7619 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 7620 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 7621 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 7622 | HDA_CODEC_VOLUME("Mic Boost", 0x19, 0, HDA_INPUT), |
| 7623 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 7624 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 7625 | HDA_CODEC_VOLUME("Front Mic Boost", 0x18, 0, HDA_INPUT), |
| 7626 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Jiang zhe | 17bba1b | 2008-06-04 12:11:07 +0200 | [diff] [blame] | 7627 | { } /* end */ |
| 7628 | }; |
| 7629 | |
Takashi Iwai | d1d985f | 2006-11-23 19:27:12 +0100 | [diff] [blame] | 7630 | static struct snd_kcontrol_new alc883_fivestack_mixer[] = { |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 7631 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | 0701e06 | 2008-06-27 16:30:57 +0200 | [diff] [blame] | 7632 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 7633 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
Takashi Iwai | 0701e06 | 2008-06-27 16:30:57 +0200 | [diff] [blame] | 7634 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 7635 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 7636 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
Takashi Iwai | 0701e06 | 2008-06-27 16:30:57 +0200 | [diff] [blame] | 7637 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 7638 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 7639 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 7640 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 7641 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 7642 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 7643 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 7644 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 7645 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 7646 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 7647 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 7648 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 7649 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 7650 | { } /* end */ |
| 7651 | }; |
| 7652 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 7653 | static struct snd_kcontrol_new alc883_tagra_mixer[] = { |
| 7654 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 7655 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 7656 | HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 7657 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 7658 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
| 7659 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 7660 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 7661 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 7662 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 7663 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 7664 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 7665 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 7666 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 7667 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 7668 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 7669 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 7670 | { } /* end */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 7671 | }; |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 7672 | |
| 7673 | static struct snd_kcontrol_new alc883_tagra_2ch_mixer[] = { |
| 7674 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 7675 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 7676 | HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 7677 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 7678 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 7679 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 7680 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 7681 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Jiang zhe | 4383fae | 2008-04-14 12:58:57 +0200 | [diff] [blame] | 7682 | HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 7683 | HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT), |
| 7684 | HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 7685 | { } /* end */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 7686 | }; |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 7687 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 7688 | static struct snd_kcontrol_new alc883_lenovo_101e_2ch_mixer[] = { |
| 7689 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 7690 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Takashi Iwai | 86cd929 | 2008-01-28 18:09:56 +0100 | [diff] [blame] | 7691 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 7692 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 7693 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 7694 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 7695 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 7696 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 7697 | { } /* end */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 7698 | }; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 7699 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7700 | static struct snd_kcontrol_new alc883_lenovo_nb0763_mixer[] = { |
| 7701 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 7702 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0c, 2, HDA_INPUT), |
| 7703 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 7704 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 7705 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 7706 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 7707 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 7708 | HDA_CODEC_VOLUME("iMic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 7709 | HDA_CODEC_MUTE("iMic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7710 | { } /* end */ |
| 7711 | }; |
| 7712 | |
| 7713 | static struct snd_kcontrol_new alc883_medion_md2_mixer[] = { |
| 7714 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 7715 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 7716 | HDA_CODEC_MUTE("Front Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 7717 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 7718 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 7719 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 7720 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 7721 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 7722 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7723 | { } /* end */ |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 7724 | }; |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7725 | |
Tobin Davis | 2880a86 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 7726 | static struct snd_kcontrol_new alc883_acer_aspire_mixer[] = { |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 7727 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 7728 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Tobin Davis | 2880a86 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 7729 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
Tobin Davis | 2880a86 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 7730 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 7731 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 7732 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 7733 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 7734 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Tobin Davis | 2880a86 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 7735 | { } /* end */ |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 7736 | }; |
Tobin Davis | 2880a86 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 7737 | |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 7738 | static struct snd_kcontrol_new alc888_lenovo_sky_mixer[] = { |
| 7739 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 7740 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 7741 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0e, 0x0, HDA_OUTPUT), |
| 7742 | HDA_BIND_MUTE("Surround Playback Switch", 0x0e, 2, HDA_INPUT), |
| 7743 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", |
| 7744 | 0x0d, 1, 0x0, HDA_OUTPUT), |
| 7745 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0d, 2, 0x0, HDA_OUTPUT), |
| 7746 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0d, 1, 2, HDA_INPUT), |
| 7747 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0d, 2, 2, HDA_INPUT), |
| 7748 | HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
| 7749 | HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT), |
| 7750 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 7751 | HDA_CODEC_MUTE("iSpeaker Playback Switch", 0x1a, 0x0, HDA_OUTPUT), |
| 7752 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 7753 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 7754 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 7755 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 7756 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 7757 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 7758 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 7759 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 7760 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
| 7761 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 7762 | { } /* end */ |
| 7763 | }; |
| 7764 | |
| 7765 | static struct hda_bind_ctls alc883_bind_cap_vol = { |
| 7766 | .ops = &snd_hda_bind_vol, |
| 7767 | .values = { |
| 7768 | HDA_COMPOSE_AMP_VAL(0x08, 3, 0, HDA_INPUT), |
| 7769 | HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_INPUT), |
| 7770 | 0 |
| 7771 | }, |
| 7772 | }; |
| 7773 | |
| 7774 | static struct hda_bind_ctls alc883_bind_cap_switch = { |
| 7775 | .ops = &snd_hda_bind_sw, |
| 7776 | .values = { |
| 7777 | HDA_COMPOSE_AMP_VAL(0x08, 3, 0, HDA_INPUT), |
| 7778 | HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_INPUT), |
| 7779 | 0 |
| 7780 | }, |
| 7781 | }; |
| 7782 | |
| 7783 | static struct snd_kcontrol_new alc883_asus_eee1601_mixer[] = { |
| 7784 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 7785 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 7786 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 7787 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 7788 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 7789 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 7790 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 7791 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 7792 | { } /* end */ |
| 7793 | }; |
| 7794 | |
| 7795 | static struct snd_kcontrol_new alc883_asus_eee1601_cap_mixer[] = { |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 7796 | HDA_BIND_VOL("Capture Volume", &alc883_bind_cap_vol), |
| 7797 | HDA_BIND_SW("Capture Switch", &alc883_bind_cap_switch), |
| 7798 | { |
| 7799 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 7800 | /* .name = "Capture Source", */ |
| 7801 | .name = "Input Source", |
| 7802 | .count = 1, |
Takashi Iwai | 54cbc9a | 2008-10-31 15:24:04 +0100 | [diff] [blame] | 7803 | .info = alc_mux_enum_info, |
| 7804 | .get = alc_mux_enum_get, |
| 7805 | .put = alc_mux_enum_put, |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 7806 | }, |
| 7807 | { } /* end */ |
| 7808 | }; |
| 7809 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7810 | static struct snd_kcontrol_new alc883_chmode_mixer[] = { |
| 7811 | { |
| 7812 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 7813 | .name = "Channel Mode", |
| 7814 | .info = alc_ch_mode_info, |
| 7815 | .get = alc_ch_mode_get, |
| 7816 | .put = alc_ch_mode_put, |
| 7817 | }, |
| 7818 | { } /* end */ |
| 7819 | }; |
| 7820 | |
| 7821 | static struct hda_verb alc883_init_verbs[] = { |
| 7822 | /* ADC1: mute amp left and right */ |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 7823 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7824 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7825 | /* ADC2: mute amp left and right */ |
| 7826 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7827 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7828 | /* Front mixer: unmute input/output amp left and right (volume = 0) */ |
| 7829 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 7830 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7831 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 7832 | /* Rear mixer */ |
| 7833 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 7834 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7835 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 7836 | /* CLFE mixer */ |
| 7837 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 7838 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7839 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 7840 | /* Side mixer */ |
| 7841 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 7842 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7843 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 7844 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 7845 | /* mute analog input loopbacks */ |
| 7846 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7847 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 7848 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 7849 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 7850 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7851 | |
| 7852 | /* Front Pin: output 0 (0x0c) */ |
| 7853 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 7854 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 7855 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7856 | /* Rear Pin: output 1 (0x0d) */ |
| 7857 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 7858 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 7859 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 7860 | /* CLFE Pin: output 2 (0x0e) */ |
| 7861 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 7862 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 7863 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 7864 | /* Side Pin: output 3 (0x0f) */ |
| 7865 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 7866 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 7867 | {0x17, AC_VERB_SET_CONNECT_SEL, 0x03}, |
| 7868 | /* Mic (rear) pin: input vref at 80% */ |
| 7869 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 7870 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 7871 | /* Front Mic pin: input vref at 80% */ |
| 7872 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 7873 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 7874 | /* Line In pin: input */ |
| 7875 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 7876 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 7877 | /* Line-2 In: Headphone output (output 0 - 0x0c) */ |
| 7878 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 7879 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 7880 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7881 | /* CD pin widget for input */ |
| 7882 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 7883 | |
| 7884 | /* FIXME: use matrix-type input source selection */ |
| 7885 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 7886 | /* Input mixer2 */ |
| 7887 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 7888 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 7889 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 7890 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7891 | /* Input mixer3 */ |
| 7892 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 7893 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 7894 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 7895 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7896 | { } |
| 7897 | }; |
| 7898 | |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 7899 | /* toggle speaker-output according to the hp-jack state */ |
| 7900 | static void alc883_mitac_hp_automute(struct hda_codec *codec) |
| 7901 | { |
| 7902 | unsigned int present; |
| 7903 | |
| 7904 | present = snd_hda_codec_read(codec, 0x15, 0, |
| 7905 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 7906 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 7907 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
| 7908 | snd_hda_codec_amp_stereo(codec, 0x17, HDA_OUTPUT, 0, |
| 7909 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
| 7910 | } |
| 7911 | |
| 7912 | /* auto-toggle front mic */ |
| 7913 | /* |
| 7914 | static void alc883_mitac_mic_automute(struct hda_codec *codec) |
| 7915 | { |
| 7916 | unsigned int present; |
| 7917 | unsigned char bits; |
| 7918 | |
| 7919 | present = snd_hda_codec_read(codec, 0x18, 0, |
| 7920 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 7921 | bits = present ? HDA_AMP_MUTE : 0; |
| 7922 | snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, 1, HDA_AMP_MUTE, bits); |
| 7923 | } |
| 7924 | */ |
| 7925 | |
| 7926 | static void alc883_mitac_automute(struct hda_codec *codec) |
| 7927 | { |
| 7928 | alc883_mitac_hp_automute(codec); |
| 7929 | /* alc883_mitac_mic_automute(codec); */ |
| 7930 | } |
| 7931 | |
| 7932 | static void alc883_mitac_unsol_event(struct hda_codec *codec, |
| 7933 | unsigned int res) |
| 7934 | { |
| 7935 | switch (res >> 26) { |
| 7936 | case ALC880_HP_EVENT: |
| 7937 | alc883_mitac_hp_automute(codec); |
| 7938 | break; |
| 7939 | case ALC880_MIC_EVENT: |
| 7940 | /* alc883_mitac_mic_automute(codec); */ |
| 7941 | break; |
| 7942 | } |
| 7943 | } |
| 7944 | |
| 7945 | static struct hda_verb alc883_mitac_verbs[] = { |
| 7946 | /* HP */ |
| 7947 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7948 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 7949 | /* Subwoofer */ |
| 7950 | {0x17, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 7951 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 7952 | |
| 7953 | /* enable unsolicited event */ |
| 7954 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 7955 | /* {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN}, */ |
| 7956 | |
| 7957 | { } /* end */ |
| 7958 | }; |
| 7959 | |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 7960 | static struct hda_verb alc883_clevo_m720_verbs[] = { |
Jiang zhe | 368c7a9 | 2008-03-04 11:20:33 +0100 | [diff] [blame] | 7961 | /* HP */ |
| 7962 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7963 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 7964 | /* Int speaker */ |
| 7965 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 7966 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 7967 | |
| 7968 | /* enable unsolicited event */ |
| 7969 | {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] | 7970 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN}, |
Jiang zhe | 368c7a9 | 2008-03-04 11:20:33 +0100 | [diff] [blame] | 7971 | |
| 7972 | { } /* end */ |
| 7973 | }; |
| 7974 | |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 7975 | static struct hda_verb alc883_2ch_fujitsu_pi2515_verbs[] = { |
| 7976 | /* HP */ |
| 7977 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7978 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 7979 | /* Subwoofer */ |
| 7980 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 7981 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 7982 | |
| 7983 | /* enable unsolicited event */ |
| 7984 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 7985 | |
| 7986 | { } /* end */ |
| 7987 | }; |
| 7988 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 7989 | static struct hda_verb alc883_tagra_verbs[] = { |
| 7990 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7991 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 7992 | |
| 7993 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 7994 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 7995 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 7996 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */ |
| 7997 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */ |
| 7998 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 7999 | |
| 8000 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 8001 | {0x01, AC_VERB_SET_GPIO_MASK, 0x03}, |
| 8002 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x03}, |
| 8003 | {0x01, AC_VERB_SET_GPIO_DATA, 0x03}, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8004 | |
| 8005 | { } /* end */ |
| 8006 | }; |
| 8007 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 8008 | static struct hda_verb alc883_lenovo_101e_verbs[] = { |
| 8009 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8010 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_FRONT_EVENT|AC_USRSP_EN}, |
| 8011 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT|AC_USRSP_EN}, |
| 8012 | { } /* end */ |
| 8013 | }; |
| 8014 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8015 | static struct hda_verb alc883_lenovo_nb0763_verbs[] = { |
| 8016 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8017 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 8018 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 8019 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 8020 | { } /* end */ |
| 8021 | }; |
| 8022 | |
| 8023 | static struct hda_verb alc888_lenovo_ms7195_verbs[] = { |
| 8024 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8025 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8026 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8027 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_FRONT_EVENT | AC_USRSP_EN}, |
| 8028 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 8029 | { } /* end */ |
| 8030 | }; |
| 8031 | |
Kailang Yang | 189609a | 2007-08-20 11:31:23 +0200 | [diff] [blame] | 8032 | static struct hda_verb alc883_haier_w66_verbs[] = { |
| 8033 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8034 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8035 | |
| 8036 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 8037 | |
| 8038 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8039 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 8040 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 8041 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 8042 | { } /* end */ |
| 8043 | }; |
| 8044 | |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 8045 | static struct hda_verb alc888_lenovo_sky_verbs[] = { |
| 8046 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8047 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8048 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8049 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8050 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8051 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 8052 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8053 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 8054 | { } /* end */ |
| 8055 | }; |
| 8056 | |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 8057 | static struct hda_verb alc888_3st_hp_verbs[] = { |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 8058 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front: output 0 (0x0c) */ |
Herton Ronaldo Krzesinski | f32a19e | 2008-03-18 09:27:08 +0100 | [diff] [blame] | 8059 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Rear : output 1 (0x0d) */ |
| 8060 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* CLFE : output 2 (0x0e) */ |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 8061 | { } |
| 8062 | }; |
| 8063 | |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 8064 | static struct hda_verb alc888_6st_dell_verbs[] = { |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 8065 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 8066 | { } |
| 8067 | }; |
| 8068 | |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 8069 | static struct hda_verb alc888_3st_hp_2ch_init[] = { |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 8070 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 8071 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 8072 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 8073 | { 0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 8074 | { } |
| 8075 | }; |
| 8076 | |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 8077 | static struct hda_verb alc888_3st_hp_6ch_init[] = { |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 8078 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 8079 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 8080 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 8081 | { 0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 8082 | { } |
| 8083 | }; |
| 8084 | |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 8085 | static struct hda_channel_mode alc888_3st_hp_modes[2] = { |
| 8086 | { 2, alc888_3st_hp_2ch_init }, |
| 8087 | { 6, alc888_3st_hp_6ch_init }, |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 8088 | }; |
| 8089 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8090 | /* toggle front-jack and RCA according to the hp-jack state */ |
| 8091 | static void alc888_lenovo_ms7195_front_automute(struct hda_codec *codec) |
| 8092 | { |
| 8093 | unsigned int present; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 8094 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8095 | present = snd_hda_codec_read(codec, 0x1b, 0, |
| 8096 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 8097 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 8098 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
| 8099 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 8100 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8101 | } |
| 8102 | |
| 8103 | /* toggle RCA according to the front-jack state */ |
| 8104 | static void alc888_lenovo_ms7195_rca_automute(struct hda_codec *codec) |
| 8105 | { |
| 8106 | unsigned int present; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 8107 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8108 | present = snd_hda_codec_read(codec, 0x14, 0, |
| 8109 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 8110 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 8111 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8112 | } |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 8113 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8114 | static void alc883_lenovo_ms7195_unsol_event(struct hda_codec *codec, |
| 8115 | unsigned int res) |
| 8116 | { |
| 8117 | if ((res >> 26) == ALC880_HP_EVENT) |
| 8118 | alc888_lenovo_ms7195_front_automute(codec); |
| 8119 | if ((res >> 26) == ALC880_FRONT_EVENT) |
| 8120 | alc888_lenovo_ms7195_rca_automute(codec); |
| 8121 | } |
| 8122 | |
| 8123 | static struct hda_verb alc883_medion_md2_verbs[] = { |
| 8124 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8125 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8126 | |
| 8127 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 8128 | |
| 8129 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 8130 | { } /* end */ |
| 8131 | }; |
| 8132 | |
| 8133 | /* toggle speaker-output according to the hp-jack state */ |
| 8134 | static void alc883_medion_md2_automute(struct hda_codec *codec) |
| 8135 | { |
| 8136 | unsigned int present; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 8137 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8138 | present = snd_hda_codec_read(codec, 0x14, 0, |
| 8139 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 8140 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 8141 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8142 | } |
| 8143 | |
| 8144 | static void alc883_medion_md2_unsol_event(struct hda_codec *codec, |
| 8145 | unsigned int res) |
| 8146 | { |
| 8147 | if ((res >> 26) == ALC880_HP_EVENT) |
| 8148 | alc883_medion_md2_automute(codec); |
| 8149 | } |
| 8150 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8151 | /* toggle speaker-output according to the hp-jack state */ |
| 8152 | static void alc883_tagra_automute(struct hda_codec *codec) |
| 8153 | { |
| 8154 | unsigned int present; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 8155 | unsigned char bits; |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8156 | |
| 8157 | present = snd_hda_codec_read(codec, 0x14, 0, |
| 8158 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 8159 | bits = present ? HDA_AMP_MUTE : 0; |
| 8160 | snd_hda_codec_amp_stereo(codec, 0x1b, HDA_OUTPUT, 0, |
| 8161 | HDA_AMP_MUTE, bits); |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 8162 | snd_hda_codec_write_cache(codec, 1, 0, AC_VERB_SET_GPIO_DATA, |
| 8163 | present ? 1 : 3); |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8164 | } |
| 8165 | |
| 8166 | static void alc883_tagra_unsol_event(struct hda_codec *codec, unsigned int res) |
| 8167 | { |
| 8168 | if ((res >> 26) == ALC880_HP_EVENT) |
| 8169 | alc883_tagra_automute(codec); |
| 8170 | } |
| 8171 | |
Jiang zhe | 368c7a9 | 2008-03-04 11:20:33 +0100 | [diff] [blame] | 8172 | /* toggle speaker-output according to the hp-jack state */ |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 8173 | static void alc883_clevo_m720_hp_automute(struct hda_codec *codec) |
Jiang zhe | 368c7a9 | 2008-03-04 11:20:33 +0100 | [diff] [blame] | 8174 | { |
| 8175 | unsigned int present; |
| 8176 | unsigned char bits; |
| 8177 | |
| 8178 | present = snd_hda_codec_read(codec, 0x15, 0, AC_VERB_GET_PIN_SENSE, 0) |
| 8179 | & AC_PINSENSE_PRESENCE; |
| 8180 | bits = present ? HDA_AMP_MUTE : 0; |
| 8181 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 8182 | HDA_AMP_MUTE, bits); |
| 8183 | } |
| 8184 | |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 8185 | static void alc883_clevo_m720_mic_automute(struct hda_codec *codec) |
| 8186 | { |
| 8187 | unsigned int present; |
| 8188 | |
| 8189 | present = snd_hda_codec_read(codec, 0x18, 0, |
| 8190 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 8191 | snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, 1, |
| 8192 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
| 8193 | } |
| 8194 | |
| 8195 | static void alc883_clevo_m720_automute(struct hda_codec *codec) |
| 8196 | { |
| 8197 | alc883_clevo_m720_hp_automute(codec); |
| 8198 | alc883_clevo_m720_mic_automute(codec); |
| 8199 | } |
| 8200 | |
| 8201 | static void alc883_clevo_m720_unsol_event(struct hda_codec *codec, |
Jiang zhe | 368c7a9 | 2008-03-04 11:20:33 +0100 | [diff] [blame] | 8202 | unsigned int res) |
| 8203 | { |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 8204 | switch (res >> 26) { |
| 8205 | case ALC880_HP_EVENT: |
| 8206 | alc883_clevo_m720_hp_automute(codec); |
| 8207 | break; |
| 8208 | case ALC880_MIC_EVENT: |
| 8209 | alc883_clevo_m720_mic_automute(codec); |
| 8210 | break; |
| 8211 | } |
Jiang zhe | 368c7a9 | 2008-03-04 11:20:33 +0100 | [diff] [blame] | 8212 | } |
| 8213 | |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 8214 | /* toggle speaker-output according to the hp-jack state */ |
| 8215 | static void alc883_2ch_fujitsu_pi2515_automute(struct hda_codec *codec) |
| 8216 | { |
| 8217 | unsigned int present; |
| 8218 | unsigned char bits; |
| 8219 | |
| 8220 | present = snd_hda_codec_read(codec, 0x14, 0, AC_VERB_GET_PIN_SENSE, 0) |
| 8221 | & AC_PINSENSE_PRESENCE; |
| 8222 | bits = present ? HDA_AMP_MUTE : 0; |
| 8223 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 8224 | HDA_AMP_MUTE, bits); |
| 8225 | } |
| 8226 | |
| 8227 | static void alc883_2ch_fujitsu_pi2515_unsol_event(struct hda_codec *codec, |
| 8228 | unsigned int res) |
| 8229 | { |
| 8230 | if ((res >> 26) == ALC880_HP_EVENT) |
| 8231 | alc883_2ch_fujitsu_pi2515_automute(codec); |
| 8232 | } |
| 8233 | |
Kailang Yang | 189609a | 2007-08-20 11:31:23 +0200 | [diff] [blame] | 8234 | static void alc883_haier_w66_automute(struct hda_codec *codec) |
| 8235 | { |
| 8236 | unsigned int present; |
| 8237 | unsigned char bits; |
| 8238 | |
| 8239 | present = snd_hda_codec_read(codec, 0x1b, 0, |
| 8240 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 8241 | bits = present ? 0x80 : 0; |
| 8242 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 8243 | 0x80, bits); |
| 8244 | } |
| 8245 | |
| 8246 | static void alc883_haier_w66_unsol_event(struct hda_codec *codec, |
| 8247 | unsigned int res) |
| 8248 | { |
| 8249 | if ((res >> 26) == ALC880_HP_EVENT) |
| 8250 | alc883_haier_w66_automute(codec); |
| 8251 | } |
| 8252 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 8253 | static void alc883_lenovo_101e_ispeaker_automute(struct hda_codec *codec) |
| 8254 | { |
| 8255 | unsigned int present; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 8256 | unsigned char bits; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 8257 | |
| 8258 | present = snd_hda_codec_read(codec, 0x14, 0, |
| 8259 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 8260 | bits = present ? HDA_AMP_MUTE : 0; |
| 8261 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 8262 | HDA_AMP_MUTE, bits); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 8263 | } |
| 8264 | |
| 8265 | static void alc883_lenovo_101e_all_automute(struct hda_codec *codec) |
| 8266 | { |
| 8267 | unsigned int present; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 8268 | unsigned char bits; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 8269 | |
| 8270 | present = snd_hda_codec_read(codec, 0x1b, 0, |
| 8271 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 8272 | bits = present ? HDA_AMP_MUTE : 0; |
| 8273 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 8274 | HDA_AMP_MUTE, bits); |
| 8275 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 8276 | HDA_AMP_MUTE, bits); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 8277 | } |
| 8278 | |
| 8279 | static void alc883_lenovo_101e_unsol_event(struct hda_codec *codec, |
| 8280 | unsigned int res) |
| 8281 | { |
| 8282 | if ((res >> 26) == ALC880_HP_EVENT) |
| 8283 | alc883_lenovo_101e_all_automute(codec); |
| 8284 | if ((res >> 26) == ALC880_FRONT_EVENT) |
| 8285 | alc883_lenovo_101e_ispeaker_automute(codec); |
| 8286 | } |
| 8287 | |
Takashi Iwai | 676a9b5 | 2007-08-16 15:23:35 +0200 | [diff] [blame] | 8288 | /* toggle speaker-output according to the hp-jack state */ |
| 8289 | static void alc883_acer_aspire_automute(struct hda_codec *codec) |
| 8290 | { |
| 8291 | unsigned int present; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 8292 | |
Takashi Iwai | 676a9b5 | 2007-08-16 15:23:35 +0200 | [diff] [blame] | 8293 | present = snd_hda_codec_read(codec, 0x14, 0, |
| 8294 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 8295 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 8296 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
| 8297 | snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0, |
| 8298 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
| 8299 | } |
| 8300 | |
| 8301 | static void alc883_acer_aspire_unsol_event(struct hda_codec *codec, |
| 8302 | unsigned int res) |
| 8303 | { |
| 8304 | if ((res >> 26) == ALC880_HP_EVENT) |
| 8305 | alc883_acer_aspire_automute(codec); |
| 8306 | } |
| 8307 | |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 8308 | static struct hda_verb alc883_acer_eapd_verbs[] = { |
| 8309 | /* HP Pin: output 0 (0x0c) */ |
| 8310 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 8311 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8312 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8313 | /* Front Pin: output 0 (0x0c) */ |
Takashi Iwai | 676a9b5 | 2007-08-16 15:23:35 +0200 | [diff] [blame] | 8314 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 8315 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 8316 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 8317 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8318 | /* eanable EAPD on medion laptop */ |
| 8319 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 8320 | {0x20, AC_VERB_SET_PROC_COEF, 0x3050}, |
Takashi Iwai | 676a9b5 | 2007-08-16 15:23:35 +0200 | [diff] [blame] | 8321 | /* enable unsolicited event */ |
| 8322 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 8323 | { } |
| 8324 | }; |
| 8325 | |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 8326 | static void alc888_6st_dell_front_automute(struct hda_codec *codec) |
| 8327 | { |
| 8328 | unsigned int present; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 8329 | |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 8330 | present = snd_hda_codec_read(codec, 0x1b, 0, |
| 8331 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 8332 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 8333 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
| 8334 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 8335 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
| 8336 | snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0, |
| 8337 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
| 8338 | snd_hda_codec_amp_stereo(codec, 0x17, HDA_OUTPUT, 0, |
| 8339 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
| 8340 | } |
| 8341 | |
| 8342 | static void alc888_6st_dell_unsol_event(struct hda_codec *codec, |
| 8343 | unsigned int res) |
| 8344 | { |
| 8345 | switch (res >> 26) { |
| 8346 | case ALC880_HP_EVENT: |
Takashi Iwai | 939778a | 2009-02-05 15:57:55 +0100 | [diff] [blame] | 8347 | /* printk(KERN_DEBUG "hp_event\n"); */ |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 8348 | alc888_6st_dell_front_automute(codec); |
| 8349 | break; |
| 8350 | } |
| 8351 | } |
| 8352 | |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 8353 | static void alc888_lenovo_sky_front_automute(struct hda_codec *codec) |
| 8354 | { |
| 8355 | unsigned int mute; |
| 8356 | unsigned int present; |
| 8357 | |
| 8358 | snd_hda_codec_read(codec, 0x1b, 0, AC_VERB_SET_PIN_SENSE, 0); |
| 8359 | present = snd_hda_codec_read(codec, 0x1b, 0, |
| 8360 | AC_VERB_GET_PIN_SENSE, 0); |
| 8361 | present = (present & 0x80000000) != 0; |
| 8362 | if (present) { |
| 8363 | /* mute internal speaker */ |
| 8364 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 8365 | HDA_AMP_MUTE, HDA_AMP_MUTE); |
| 8366 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 8367 | HDA_AMP_MUTE, HDA_AMP_MUTE); |
| 8368 | snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0, |
| 8369 | HDA_AMP_MUTE, HDA_AMP_MUTE); |
| 8370 | snd_hda_codec_amp_stereo(codec, 0x17, HDA_OUTPUT, 0, |
| 8371 | HDA_AMP_MUTE, HDA_AMP_MUTE); |
| 8372 | snd_hda_codec_amp_stereo(codec, 0x1a, HDA_OUTPUT, 0, |
| 8373 | HDA_AMP_MUTE, HDA_AMP_MUTE); |
| 8374 | } else { |
| 8375 | /* unmute internal speaker if necessary */ |
| 8376 | mute = snd_hda_codec_amp_read(codec, 0x1b, 0, HDA_OUTPUT, 0); |
| 8377 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 8378 | HDA_AMP_MUTE, mute); |
| 8379 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 8380 | HDA_AMP_MUTE, mute); |
| 8381 | snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0, |
| 8382 | HDA_AMP_MUTE, mute); |
| 8383 | snd_hda_codec_amp_stereo(codec, 0x17, HDA_OUTPUT, 0, |
| 8384 | HDA_AMP_MUTE, mute); |
| 8385 | snd_hda_codec_amp_stereo(codec, 0x1a, HDA_OUTPUT, 0, |
| 8386 | HDA_AMP_MUTE, mute); |
| 8387 | } |
| 8388 | } |
| 8389 | |
| 8390 | static void alc883_lenovo_sky_unsol_event(struct hda_codec *codec, |
| 8391 | unsigned int res) |
| 8392 | { |
| 8393 | if ((res >> 26) == ALC880_HP_EVENT) |
| 8394 | alc888_lenovo_sky_front_automute(codec); |
| 8395 | } |
| 8396 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8397 | /* |
| 8398 | * generic initialization of ADC, input mixers and output mixers |
| 8399 | */ |
| 8400 | static struct hda_verb alc883_auto_init_verbs[] = { |
| 8401 | /* |
| 8402 | * Unmute ADC0-2 and set the default input to mic-in |
| 8403 | */ |
| 8404 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8405 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8406 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8407 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8408 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 8409 | /* 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] | 8410 | * mixer widget |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 8411 | * Note: PASD motherboards uses the Line In 2 as the input for |
| 8412 | * front panel mic (mic 2) |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8413 | */ |
| 8414 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 8415 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8416 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 8417 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 8418 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 8419 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8420 | |
| 8421 | /* |
| 8422 | * Set up output mixers (0x0c - 0x0f) |
| 8423 | */ |
| 8424 | /* set vol=0 to output mixers */ |
| 8425 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 8426 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 8427 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 8428 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 8429 | /* set up input amps for analog loopback */ |
| 8430 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 8431 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8432 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8433 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8434 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8435 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8436 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8437 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8438 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8439 | {0x26, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8440 | {0x26, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8441 | |
| 8442 | /* FIXME: use matrix-type input source selection */ |
| 8443 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 8444 | /* Input mixer1 */ |
| 8445 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8446 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8447 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 8448 | /* {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, */ |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8449 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)}, |
| 8450 | /* Input mixer2 */ |
| 8451 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8452 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8453 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 8454 | /* {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, */ |
Andy Shevchenko | e3cde64 | 2007-12-03 16:50:58 +0100 | [diff] [blame] | 8455 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)}, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8456 | |
| 8457 | { } |
| 8458 | }; |
| 8459 | |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 8460 | static struct hda_verb alc888_asus_m90v_verbs[] = { |
| 8461 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8462 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8463 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8464 | /* enable unsolicited event */ |
| 8465 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 8466 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN}, |
| 8467 | { } /* end */ |
| 8468 | }; |
| 8469 | |
| 8470 | static void alc883_nb_mic_automute(struct hda_codec *codec) |
| 8471 | { |
| 8472 | unsigned int present; |
| 8473 | |
| 8474 | present = snd_hda_codec_read(codec, 0x18, 0, |
| 8475 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 8476 | snd_hda_codec_write(codec, 0x23, 0, AC_VERB_SET_AMP_GAIN_MUTE, |
| 8477 | 0x7000 | (0x00 << 8) | (present ? 0 : 0x80)); |
| 8478 | snd_hda_codec_write(codec, 0x23, 0, AC_VERB_SET_AMP_GAIN_MUTE, |
| 8479 | 0x7000 | (0x01 << 8) | (present ? 0x80 : 0)); |
| 8480 | } |
| 8481 | |
| 8482 | static void alc883_M90V_speaker_automute(struct hda_codec *codec) |
| 8483 | { |
| 8484 | unsigned int present; |
| 8485 | unsigned char bits; |
| 8486 | |
| 8487 | present = snd_hda_codec_read(codec, 0x1b, 0, |
| 8488 | AC_VERB_GET_PIN_SENSE, 0) |
| 8489 | & AC_PINSENSE_PRESENCE; |
| 8490 | bits = present ? 0 : PIN_OUT; |
| 8491 | snd_hda_codec_write(codec, 0x14, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 8492 | bits); |
| 8493 | snd_hda_codec_write(codec, 0x15, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 8494 | bits); |
| 8495 | snd_hda_codec_write(codec, 0x16, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 8496 | bits); |
| 8497 | } |
| 8498 | |
| 8499 | static void alc883_mode2_unsol_event(struct hda_codec *codec, |
| 8500 | unsigned int res) |
| 8501 | { |
| 8502 | switch (res >> 26) { |
| 8503 | case ALC880_HP_EVENT: |
| 8504 | alc883_M90V_speaker_automute(codec); |
| 8505 | break; |
| 8506 | case ALC880_MIC_EVENT: |
| 8507 | alc883_nb_mic_automute(codec); |
| 8508 | break; |
| 8509 | } |
| 8510 | } |
| 8511 | |
| 8512 | static void alc883_mode2_inithook(struct hda_codec *codec) |
| 8513 | { |
| 8514 | alc883_M90V_speaker_automute(codec); |
| 8515 | alc883_nb_mic_automute(codec); |
| 8516 | } |
| 8517 | |
| 8518 | static struct hda_verb alc888_asus_eee1601_verbs[] = { |
| 8519 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 8520 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 8521 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8522 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8523 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 8524 | {0x20, AC_VERB_SET_COEF_INDEX, 0x0b}, |
| 8525 | {0x20, AC_VERB_SET_PROC_COEF, 0x0838}, |
| 8526 | /* enable unsolicited event */ |
| 8527 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 8528 | { } /* end */ |
| 8529 | }; |
| 8530 | |
| 8531 | static void alc883_eee1601_speaker_automute(struct hda_codec *codec) |
| 8532 | { |
| 8533 | unsigned int present; |
| 8534 | unsigned char bits; |
| 8535 | |
| 8536 | present = snd_hda_codec_read(codec, 0x14, 0, |
| 8537 | AC_VERB_GET_PIN_SENSE, 0) |
| 8538 | & AC_PINSENSE_PRESENCE; |
| 8539 | bits = present ? 0 : PIN_OUT; |
| 8540 | snd_hda_codec_write(codec, 0x1b, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 8541 | bits); |
| 8542 | } |
| 8543 | |
| 8544 | static void alc883_eee1601_unsol_event(struct hda_codec *codec, |
| 8545 | unsigned int res) |
| 8546 | { |
| 8547 | switch (res >> 26) { |
| 8548 | case ALC880_HP_EVENT: |
| 8549 | alc883_eee1601_speaker_automute(codec); |
| 8550 | break; |
| 8551 | } |
| 8552 | } |
| 8553 | |
| 8554 | static void alc883_eee1601_inithook(struct hda_codec *codec) |
| 8555 | { |
| 8556 | alc883_eee1601_speaker_automute(codec); |
| 8557 | } |
| 8558 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 8559 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 8560 | #define alc883_loopbacks alc880_loopbacks |
| 8561 | #endif |
| 8562 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8563 | /* pcm configuration: identiacal with ALC880 */ |
| 8564 | #define alc883_pcm_analog_playback alc880_pcm_analog_playback |
| 8565 | #define alc883_pcm_analog_capture alc880_pcm_analog_capture |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 8566 | #define alc883_pcm_analog_alt_capture alc880_pcm_analog_alt_capture |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8567 | #define alc883_pcm_digital_playback alc880_pcm_digital_playback |
| 8568 | #define alc883_pcm_digital_capture alc880_pcm_digital_capture |
| 8569 | |
| 8570 | /* |
| 8571 | * configuration and preset |
| 8572 | */ |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 8573 | static const char *alc883_models[ALC883_MODEL_LAST] = { |
| 8574 | [ALC883_3ST_2ch_DIG] = "3stack-dig", |
| 8575 | [ALC883_3ST_6ch_DIG] = "3stack-6ch-dig", |
| 8576 | [ALC883_3ST_6ch] = "3stack-6ch", |
| 8577 | [ALC883_6ST_DIG] = "6stack-dig", |
| 8578 | [ALC883_TARGA_DIG] = "targa-dig", |
| 8579 | [ALC883_TARGA_2ch_DIG] = "targa-2ch-dig", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 8580 | [ALC883_ACER] = "acer", |
Tobin Davis | 2880a86 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 8581 | [ALC883_ACER_ASPIRE] = "acer-aspire", |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 8582 | [ALC888_ACER_ASPIRE_4930G] = "acer-aspire-4930g", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 8583 | [ALC883_MEDION] = "medion", |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8584 | [ALC883_MEDION_MD2] = "medion-md2", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 8585 | [ALC883_LAPTOP_EAPD] = "laptop-eapd", |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 8586 | [ALC883_LENOVO_101E_2ch] = "lenovo-101e", |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8587 | [ALC883_LENOVO_NB0763] = "lenovo-nb0763", |
| 8588 | [ALC888_LENOVO_MS7195_DIG] = "lenovo-ms7195-dig", |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 8589 | [ALC888_LENOVO_SKY] = "lenovo-sky", |
Kailang Yang | 189609a | 2007-08-20 11:31:23 +0200 | [diff] [blame] | 8590 | [ALC883_HAIER_W66] = "haier-w66", |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 8591 | [ALC888_3ST_HP] = "3stack-hp", |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 8592 | [ALC888_6ST_DELL] = "6stack-dell", |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 8593 | [ALC883_MITAC] = "mitac", |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 8594 | [ALC883_CLEVO_M720] = "clevo-m720", |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 8595 | [ALC883_FUJITSU_PI2515] = "fujitsu-pi2515", |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 8596 | [ALC888_FUJITSU_XA3530] = "fujitsu-xa3530", |
Jiang zhe | 17bba1b | 2008-06-04 12:11:07 +0200 | [diff] [blame] | 8597 | [ALC883_3ST_6ch_INTEL] = "3stack-6ch-intel", |
Wu Fengguang | 3ab9093 | 2008-11-17 09:51:09 +0100 | [diff] [blame] | 8598 | [ALC1200_ASUS_P5Q] = "asus-p5q", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 8599 | [ALC883_AUTO] = "auto", |
| 8600 | }; |
| 8601 | |
| 8602 | static struct snd_pci_quirk alc883_cfg_tbl[] = { |
| 8603 | SND_PCI_QUIRK(0x1019, 0x6668, "ECS", ALC883_3ST_6ch_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 8604 | SND_PCI_QUIRK(0x1025, 0x006c, "Acer Aspire 9810", ALC883_ACER_ASPIRE), |
Takashi Iwai | 69e5028 | 2008-11-03 10:07:43 +0100 | [diff] [blame] | 8605 | SND_PCI_QUIRK(0x1025, 0x0090, "Acer Aspire", ALC883_ACER_ASPIRE), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 8606 | SND_PCI_QUIRK(0x1025, 0x0110, "Acer Aspire", ALC883_ACER_ASPIRE), |
| 8607 | SND_PCI_QUIRK(0x1025, 0x0112, "Acer Aspire 9303", ALC883_ACER_ASPIRE), |
Jaroslav Kysela | 0b18cb1 | 2008-07-28 17:07:07 +0200 | [diff] [blame] | 8608 | SND_PCI_QUIRK(0x1025, 0x0121, "Acer Aspire 5920G", ALC883_ACER_ASPIRE), |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 8609 | SND_PCI_QUIRK(0x1025, 0x013e, "Acer Aspire 4930G", |
| 8610 | ALC888_ACER_ASPIRE_4930G), |
Lukasz Wojnilowicz | a8e4f9d | 2009-01-08 12:00:49 +0100 | [diff] [blame] | 8611 | SND_PCI_QUIRK(0x1025, 0x013f, "Acer Aspire 5930G", |
| 8612 | ALC888_ACER_ASPIRE_4930G), |
Takashi Iwai | b3bdb30 | 2009-02-18 13:16:26 +0100 | [diff] [blame] | 8613 | SND_PCI_QUIRK(0x1025, 0x0157, "Acer X3200", ALC883_AUTO), |
Takashi Iwai | 9468350 | 2009-02-13 09:31:20 +0100 | [diff] [blame] | 8614 | SND_PCI_QUIRK(0x1025, 0x0158, "Acer AX1700-U3700A", ALC883_AUTO), |
Lukasz Wojnilowicz | a8e4f9d | 2009-01-08 12:00:49 +0100 | [diff] [blame] | 8615 | SND_PCI_QUIRK(0x1025, 0x015e, "Acer Aspire 6930G", |
| 8616 | ALC888_ACER_ASPIRE_4930G), |
Juan Jesus Garcia de Soria | cc374c4 | 2009-02-23 08:11:59 +0100 | [diff] [blame] | 8617 | SND_PCI_QUIRK(0x1025, 0x0166, "Acer Aspire 6530G", |
| 8618 | ALC888_ACER_ASPIRE_4930G), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 8619 | /* default Acer */ |
| 8620 | SND_PCI_QUIRK_VENDOR(0x1025, "Acer laptop", ALC883_ACER), |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 8621 | SND_PCI_QUIRK(0x1028, 0x020d, "Dell Inspiron 530", ALC888_6ST_DELL), |
Tobin Davis | febe337 | 2007-06-12 11:27:46 +0200 | [diff] [blame] | 8622 | SND_PCI_QUIRK(0x103c, 0x2a3d, "HP Pavillion", ALC883_6ST_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 8623 | SND_PCI_QUIRK(0x103c, 0x2a4f, "HP Samba", ALC888_3ST_HP), |
| 8624 | SND_PCI_QUIRK(0x103c, 0x2a60, "HP Lucknow", ALC888_3ST_HP), |
Herton Ronaldo Krzesinski | 5d85f8d | 2008-03-20 12:13:46 +0100 | [diff] [blame] | 8625 | SND_PCI_QUIRK(0x103c, 0x2a61, "HP Nettle", ALC883_6ST_DIG), |
Chris Bagwell | 06bf3e1 | 2009-01-01 10:32:08 +0100 | [diff] [blame] | 8626 | SND_PCI_QUIRK(0x103c, 0x2a66, "HP Acacia", ALC888_3ST_HP), |
Kailang Yang | a01c30c | 2008-10-15 11:14:58 +0200 | [diff] [blame] | 8627 | SND_PCI_QUIRK(0x1043, 0x1873, "Asus M90V", ALC888_ASUS_M90V), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 8628 | 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] | 8629 | SND_PCI_QUIRK(0x1043, 0x8284, "Asus Z37E", ALC883_6ST_DIG), |
Wu Fengguang | 3ab9093 | 2008-11-17 09:51:09 +0100 | [diff] [blame] | 8630 | SND_PCI_QUIRK(0x1043, 0x82fe, "Asus P5Q-EM HDMI", ALC1200_ASUS_P5Q), |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 8631 | SND_PCI_QUIRK(0x1043, 0x835f, "Asus Eee 1601", ALC888_ASUS_EEE1601), |
Travis Place | 97ec710 | 2008-05-23 18:31:46 +0200 | [diff] [blame] | 8632 | SND_PCI_QUIRK(0x105b, 0x0ce8, "Foxconn P35AX-S", ALC883_6ST_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 8633 | SND_PCI_QUIRK(0x105b, 0x6668, "Foxconn", ALC883_6ST_DIG), |
Luke Yelavich | 2de686d | 2009-01-16 15:08:02 +1100 | [diff] [blame] | 8634 | SND_PCI_QUIRK(0x1071, 0x8227, "Mitac 82801H", ALC883_MITAC), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 8635 | SND_PCI_QUIRK(0x1071, 0x8253, "Mitac 8252d", ALC883_MITAC), |
| 8636 | SND_PCI_QUIRK(0x1071, 0x8258, "Evesham Voyaeger", ALC883_LAPTOP_EAPD), |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 8637 | SND_PCI_QUIRK(0x10f1, 0x2350, "TYAN-S2350", ALC888_6ST_DELL), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 8638 | SND_PCI_QUIRK(0x108e, 0x534d, NULL, ALC883_3ST_6ch), |
Tobin Davis | 57b14f2 | 2007-04-18 23:05:36 +0200 | [diff] [blame] | 8639 | SND_PCI_QUIRK(0x1458, 0xa002, "MSI", ALC883_6ST_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 8640 | SND_PCI_QUIRK(0x1462, 0x0349, "MSI", ALC883_TARGA_2ch_DIG), |
| 8641 | SND_PCI_QUIRK(0x1462, 0x040d, "MSI", ALC883_TARGA_2ch_DIG), |
| 8642 | SND_PCI_QUIRK(0x1462, 0x0579, "MSI", ALC883_TARGA_2ch_DIG), |
Jiang zhe | 4383fae | 2008-04-14 12:58:57 +0200 | [diff] [blame] | 8643 | SND_PCI_QUIRK(0x1462, 0x2fb3, "MSI", ALC883_TARGA_2ch_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 8644 | SND_PCI_QUIRK(0x1462, 0x3729, "MSI S420", ALC883_TARGA_DIG), |
Pascal Terjan | 8280823 | 2008-03-04 11:33:28 +0100 | [diff] [blame] | 8645 | SND_PCI_QUIRK(0x1462, 0x3783, "NEC S970", ALC883_TARGA_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 8646 | SND_PCI_QUIRK(0x1462, 0x3b7f, "MSI", ALC883_TARGA_2ch_DIG), |
| 8647 | SND_PCI_QUIRK(0x1462, 0x3ef9, "MSI", ALC883_TARGA_DIG), |
| 8648 | SND_PCI_QUIRK(0x1462, 0x3fc1, "MSI", ALC883_TARGA_DIG), |
| 8649 | SND_PCI_QUIRK(0x1462, 0x3fc3, "MSI", ALC883_TARGA_DIG), |
| 8650 | SND_PCI_QUIRK(0x1462, 0x3fcc, "MSI", ALC883_TARGA_DIG), |
| 8651 | SND_PCI_QUIRK(0x1462, 0x3fdf, "MSI", ALC883_TARGA_DIG), |
| 8652 | SND_PCI_QUIRK(0x1462, 0x4314, "MSI", ALC883_TARGA_DIG), |
| 8653 | SND_PCI_QUIRK(0x1462, 0x4319, "MSI", ALC883_TARGA_DIG), |
| 8654 | SND_PCI_QUIRK(0x1462, 0x4324, "MSI", ALC883_TARGA_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 8655 | SND_PCI_QUIRK(0x1462, 0x6668, "MSI", ALC883_6ST_DIG), |
| 8656 | SND_PCI_QUIRK(0x1462, 0x7187, "MSI", ALC883_6ST_DIG), |
Tobin Davis | 799f88a | 2007-05-29 14:29:08 +0200 | [diff] [blame] | 8657 | SND_PCI_QUIRK(0x1462, 0x7250, "MSI", ALC883_6ST_DIG), |
Takashi Iwai | ee09543 | 2008-11-25 15:03:38 +0100 | [diff] [blame] | 8658 | SND_PCI_QUIRK(0x1462, 0x7260, "MSI 7260", ALC883_TARGA_DIG), |
Herton Ronaldo Krzesinski | 86d34b7 | 2008-03-18 09:27:59 +0100 | [diff] [blame] | 8659 | SND_PCI_QUIRK(0x1462, 0x7267, "MSI", ALC883_3ST_6ch_DIG), |
Leonard Norrgard | 2a296cb | 2007-01-08 11:28:22 +0100 | [diff] [blame] | 8660 | SND_PCI_QUIRK(0x1462, 0x7280, "MSI", ALC883_6ST_DIG), |
Tobin Davis | 2dcd522 | 2007-07-10 17:04:57 +0200 | [diff] [blame] | 8661 | SND_PCI_QUIRK(0x1462, 0x7327, "MSI", ALC883_6ST_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 8662 | SND_PCI_QUIRK(0x1462, 0xa422, "MSI", ALC883_TARGA_2ch_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 8663 | SND_PCI_QUIRK(0x147b, 0x1083, "Abit IP35-PRO", ALC883_6ST_DIG), |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 8664 | SND_PCI_QUIRK(0x1558, 0x0721, "Clevo laptop M720R", ALC883_CLEVO_M720), |
| 8665 | SND_PCI_QUIRK(0x1558, 0x0722, "Clevo laptop M720SR", ALC883_CLEVO_M720), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 8666 | SND_PCI_QUIRK_VENDOR(0x1558, "Clevo laptop", ALC883_LAPTOP_EAPD), |
Daniel T Chen | e60623b | 2007-05-29 03:41:55 -0400 | [diff] [blame] | 8667 | SND_PCI_QUIRK(0x15d9, 0x8780, "Supermicro PDSBA", ALC883_3ST_6ch), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 8668 | SND_PCI_QUIRK(0x161f, 0x2054, "Medion laptop", ALC883_MEDION), |
Takashi Iwai | f67d817 | 2009-02-04 23:30:19 +0100 | [diff] [blame] | 8669 | SND_PCI_QUIRK(0x1734, 0x1107, "FSC AMILO Xi2550", |
| 8670 | ALC883_FUJITSU_PI2515), |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 8671 | SND_PCI_QUIRK(0x1734, 0x1108, "Fujitsu AMILO Pi2515", ALC883_FUJITSU_PI2515), |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 8672 | SND_PCI_QUIRK(0x1734, 0x113d, "Fujitsu AMILO Xa3530", |
| 8673 | ALC888_FUJITSU_XA3530), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8674 | SND_PCI_QUIRK(0x17aa, 0x101e, "Lenovo 101e", ALC883_LENOVO_101E_2ch), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8675 | SND_PCI_QUIRK(0x17aa, 0x2085, "Lenovo NB0763", ALC883_LENOVO_NB0763), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 8676 | SND_PCI_QUIRK(0x17aa, 0x3bfc, "Lenovo NB0763", ALC883_LENOVO_NB0763), |
| 8677 | SND_PCI_QUIRK(0x17aa, 0x3bfd, "Lenovo NB0763", ALC883_LENOVO_NB0763), |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 8678 | SND_PCI_QUIRK(0x17aa, 0x101d, "Lenovo Sky", ALC888_LENOVO_SKY), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8679 | SND_PCI_QUIRK(0x17c0, 0x4071, "MEDION MD2", ALC883_MEDION_MD2), |
Takashi Iwai | 959973b | 2008-11-05 11:30:56 +0100 | [diff] [blame] | 8680 | SND_PCI_QUIRK(0x17c0, 0x4085, "MEDION MD96630", ALC888_LENOVO_MS7195_DIG), |
Andrew Paprocki | 0b167bf | 2008-02-03 10:15:44 +0100 | [diff] [blame] | 8681 | SND_PCI_QUIRK(0x17f2, 0x5000, "Albatron KI690-AM2", ALC883_6ST_DIG), |
Kailang Yang | 189609a | 2007-08-20 11:31:23 +0200 | [diff] [blame] | 8682 | SND_PCI_QUIRK(0x1991, 0x5625, "Haier W66", ALC883_HAIER_W66), |
Jiang zhe | 17bba1b | 2008-06-04 12:11:07 +0200 | [diff] [blame] | 8683 | SND_PCI_QUIRK(0x8086, 0x0001, "DG33BUC", ALC883_3ST_6ch_INTEL), |
| 8684 | SND_PCI_QUIRK(0x8086, 0x0002, "DG33FBC", ALC883_3ST_6ch_INTEL), |
Luke Yelavich | 2de686d | 2009-01-16 15:08:02 +1100 | [diff] [blame] | 8685 | SND_PCI_QUIRK(0x8086, 0x2503, "82801H", ALC883_MITAC), |
Wu Fengguang | 4b55899 | 2009-01-12 09:18:58 +0800 | [diff] [blame] | 8686 | SND_PCI_QUIRK(0x8086, 0x0022, "DX58SO", ALC883_3ST_6ch_INTEL), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 8687 | SND_PCI_QUIRK(0x8086, 0xd601, "D102GGC", ALC883_3ST_6ch), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8688 | {} |
| 8689 | }; |
| 8690 | |
Wu Fengguang | b25c9da | 2009-02-06 15:02:27 +0800 | [diff] [blame] | 8691 | static hda_nid_t alc1200_slave_dig_outs[] = { |
| 8692 | ALC883_DIGOUT_NID, 0, |
| 8693 | }; |
| 8694 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8695 | static struct alc_config_preset alc883_presets[] = { |
| 8696 | [ALC883_3ST_2ch_DIG] = { |
| 8697 | .mixers = { alc883_3ST_2ch_mixer }, |
| 8698 | .init_verbs = { alc883_init_verbs }, |
| 8699 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 8700 | .dac_nids = alc883_dac_nids, |
| 8701 | .dig_out_nid = ALC883_DIGOUT_NID, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8702 | .dig_in_nid = ALC883_DIGIN_NID, |
| 8703 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 8704 | .channel_mode = alc883_3ST_2ch_modes, |
| 8705 | .input_mux = &alc883_capture_source, |
| 8706 | }, |
| 8707 | [ALC883_3ST_6ch_DIG] = { |
| 8708 | .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer }, |
| 8709 | .init_verbs = { alc883_init_verbs }, |
| 8710 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 8711 | .dac_nids = alc883_dac_nids, |
| 8712 | .dig_out_nid = ALC883_DIGOUT_NID, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8713 | .dig_in_nid = ALC883_DIGIN_NID, |
| 8714 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes), |
| 8715 | .channel_mode = alc883_3ST_6ch_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 8716 | .need_dac_fix = 1, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8717 | .input_mux = &alc883_capture_source, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 8718 | }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8719 | [ALC883_3ST_6ch] = { |
| 8720 | .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer }, |
| 8721 | .init_verbs = { alc883_init_verbs }, |
| 8722 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 8723 | .dac_nids = alc883_dac_nids, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8724 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes), |
| 8725 | .channel_mode = alc883_3ST_6ch_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 8726 | .need_dac_fix = 1, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8727 | .input_mux = &alc883_capture_source, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 8728 | }, |
Jiang zhe | 17bba1b | 2008-06-04 12:11:07 +0200 | [diff] [blame] | 8729 | [ALC883_3ST_6ch_INTEL] = { |
| 8730 | .mixers = { alc883_3ST_6ch_intel_mixer, alc883_chmode_mixer }, |
| 8731 | .init_verbs = { alc883_init_verbs }, |
| 8732 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 8733 | .dac_nids = alc883_dac_nids, |
| 8734 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 8735 | .dig_in_nid = ALC883_DIGIN_NID, |
| 8736 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_intel_modes), |
| 8737 | .channel_mode = alc883_3ST_6ch_intel_modes, |
| 8738 | .need_dac_fix = 1, |
| 8739 | .input_mux = &alc883_3stack_6ch_intel, |
| 8740 | }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8741 | [ALC883_6ST_DIG] = { |
| 8742 | .mixers = { alc883_base_mixer, alc883_chmode_mixer }, |
| 8743 | .init_verbs = { alc883_init_verbs }, |
| 8744 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 8745 | .dac_nids = alc883_dac_nids, |
| 8746 | .dig_out_nid = ALC883_DIGOUT_NID, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8747 | .dig_in_nid = ALC883_DIGIN_NID, |
| 8748 | .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes), |
| 8749 | .channel_mode = alc883_sixstack_modes, |
| 8750 | .input_mux = &alc883_capture_source, |
| 8751 | }, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8752 | [ALC883_TARGA_DIG] = { |
| 8753 | .mixers = { alc883_tagra_mixer, alc883_chmode_mixer }, |
| 8754 | .init_verbs = { alc883_init_verbs, alc883_tagra_verbs}, |
| 8755 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 8756 | .dac_nids = alc883_dac_nids, |
| 8757 | .dig_out_nid = ALC883_DIGOUT_NID, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8758 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes), |
| 8759 | .channel_mode = alc883_3ST_6ch_modes, |
| 8760 | .need_dac_fix = 1, |
| 8761 | .input_mux = &alc883_capture_source, |
| 8762 | .unsol_event = alc883_tagra_unsol_event, |
| 8763 | .init_hook = alc883_tagra_automute, |
| 8764 | }, |
| 8765 | [ALC883_TARGA_2ch_DIG] = { |
| 8766 | .mixers = { alc883_tagra_2ch_mixer}, |
| 8767 | .init_verbs = { alc883_init_verbs, alc883_tagra_verbs}, |
| 8768 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 8769 | .dac_nids = alc883_dac_nids, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 8770 | .adc_nids = alc883_adc_nids_alt, |
| 8771 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_alt), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8772 | .dig_out_nid = ALC883_DIGOUT_NID, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8773 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 8774 | .channel_mode = alc883_3ST_2ch_modes, |
| 8775 | .input_mux = &alc883_capture_source, |
| 8776 | .unsol_event = alc883_tagra_unsol_event, |
| 8777 | .init_hook = alc883_tagra_automute, |
| 8778 | }, |
Vladimir Avdonin | bab282b9 | 2006-08-22 13:31:58 +0200 | [diff] [blame] | 8779 | [ALC883_ACER] = { |
Takashi Iwai | 676a9b5 | 2007-08-16 15:23:35 +0200 | [diff] [blame] | 8780 | .mixers = { alc883_base_mixer }, |
Vladimir Avdonin | bab282b9 | 2006-08-22 13:31:58 +0200 | [diff] [blame] | 8781 | /* On TravelMate laptops, GPIO 0 enables the internal speaker |
| 8782 | * and the headphone jack. Turn this on and rely on the |
| 8783 | * standard mute methods whenever the user wants to turn |
| 8784 | * these outputs off. |
| 8785 | */ |
| 8786 | .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs }, |
| 8787 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 8788 | .dac_nids = alc883_dac_nids, |
Vladimir Avdonin | bab282b9 | 2006-08-22 13:31:58 +0200 | [diff] [blame] | 8789 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 8790 | .channel_mode = alc883_3ST_2ch_modes, |
| 8791 | .input_mux = &alc883_capture_source, |
| 8792 | }, |
Tobin Davis | 2880a86 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 8793 | [ALC883_ACER_ASPIRE] = { |
Takashi Iwai | 676a9b5 | 2007-08-16 15:23:35 +0200 | [diff] [blame] | 8794 | .mixers = { alc883_acer_aspire_mixer }, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 8795 | .init_verbs = { alc883_init_verbs, alc883_acer_eapd_verbs }, |
Tobin Davis | 2880a86 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 8796 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 8797 | .dac_nids = alc883_dac_nids, |
| 8798 | .dig_out_nid = ALC883_DIGOUT_NID, |
Tobin Davis | 2880a86 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 8799 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 8800 | .channel_mode = alc883_3ST_2ch_modes, |
| 8801 | .input_mux = &alc883_capture_source, |
Takashi Iwai | 676a9b5 | 2007-08-16 15:23:35 +0200 | [diff] [blame] | 8802 | .unsol_event = alc883_acer_aspire_unsol_event, |
| 8803 | .init_hook = alc883_acer_aspire_automute, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 8804 | }, |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 8805 | [ALC888_ACER_ASPIRE_4930G] = { |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 8806 | .mixers = { alc888_base_mixer, |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 8807 | alc883_chmode_mixer }, |
| 8808 | .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs, |
| 8809 | alc888_acer_aspire_4930g_verbs }, |
| 8810 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 8811 | .dac_nids = alc883_dac_nids, |
| 8812 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev), |
| 8813 | .adc_nids = alc883_adc_nids_rev, |
| 8814 | .capsrc_nids = alc883_capsrc_nids_rev, |
| 8815 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 8816 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes), |
| 8817 | .channel_mode = alc883_3ST_6ch_modes, |
| 8818 | .need_dac_fix = 1, |
| 8819 | .num_mux_defs = |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 8820 | ARRAY_SIZE(alc888_2_capture_sources), |
| 8821 | .input_mux = alc888_2_capture_sources, |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 8822 | .unsol_event = alc888_acer_aspire_4930g_unsol_event, |
| 8823 | .init_hook = alc888_acer_aspire_4930g_automute, |
| 8824 | }, |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 8825 | [ALC883_MEDION] = { |
| 8826 | .mixers = { alc883_fivestack_mixer, |
| 8827 | alc883_chmode_mixer }, |
| 8828 | .init_verbs = { alc883_init_verbs, |
Andrew L. Neporada | b373bde | 2006-11-07 11:37:08 +0100 | [diff] [blame] | 8829 | alc883_medion_eapd_verbs }, |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 8830 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 8831 | .dac_nids = alc883_dac_nids, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 8832 | .adc_nids = alc883_adc_nids_alt, |
| 8833 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_alt), |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 8834 | .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes), |
| 8835 | .channel_mode = alc883_sixstack_modes, |
| 8836 | .input_mux = &alc883_capture_source, |
Andrew L. Neporada | b373bde | 2006-11-07 11:37:08 +0100 | [diff] [blame] | 8837 | }, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8838 | [ALC883_MEDION_MD2] = { |
| 8839 | .mixers = { alc883_medion_md2_mixer}, |
| 8840 | .init_verbs = { alc883_init_verbs, alc883_medion_md2_verbs}, |
| 8841 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 8842 | .dac_nids = alc883_dac_nids, |
| 8843 | .dig_out_nid = ALC883_DIGOUT_NID, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8844 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 8845 | .channel_mode = alc883_3ST_2ch_modes, |
| 8846 | .input_mux = &alc883_capture_source, |
| 8847 | .unsol_event = alc883_medion_md2_unsol_event, |
| 8848 | .init_hook = alc883_medion_md2_automute, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 8849 | }, |
Andrew L. Neporada | b373bde | 2006-11-07 11:37:08 +0100 | [diff] [blame] | 8850 | [ALC883_LAPTOP_EAPD] = { |
Takashi Iwai | 676a9b5 | 2007-08-16 15:23:35 +0200 | [diff] [blame] | 8851 | .mixers = { alc883_base_mixer }, |
Andrew L. Neporada | b373bde | 2006-11-07 11:37:08 +0100 | [diff] [blame] | 8852 | .init_verbs = { alc883_init_verbs, alc882_eapd_verbs }, |
| 8853 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 8854 | .dac_nids = alc883_dac_nids, |
Andrew L. Neporada | b373bde | 2006-11-07 11:37:08 +0100 | [diff] [blame] | 8855 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 8856 | .channel_mode = alc883_3ST_2ch_modes, |
| 8857 | .input_mux = &alc883_capture_source, |
| 8858 | }, |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 8859 | [ALC883_CLEVO_M720] = { |
| 8860 | .mixers = { alc883_clevo_m720_mixer }, |
| 8861 | .init_verbs = { alc883_init_verbs, alc883_clevo_m720_verbs }, |
Jiang zhe | 368c7a9 | 2008-03-04 11:20:33 +0100 | [diff] [blame] | 8862 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 8863 | .dac_nids = alc883_dac_nids, |
| 8864 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 8865 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 8866 | .channel_mode = alc883_3ST_2ch_modes, |
| 8867 | .input_mux = &alc883_capture_source, |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 8868 | .unsol_event = alc883_clevo_m720_unsol_event, |
| 8869 | .init_hook = alc883_clevo_m720_automute, |
Jiang zhe | 368c7a9 | 2008-03-04 11:20:33 +0100 | [diff] [blame] | 8870 | }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 8871 | [ALC883_LENOVO_101E_2ch] = { |
| 8872 | .mixers = { alc883_lenovo_101e_2ch_mixer}, |
| 8873 | .init_verbs = { alc883_init_verbs, alc883_lenovo_101e_verbs}, |
| 8874 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 8875 | .dac_nids = alc883_dac_nids, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 8876 | .adc_nids = alc883_adc_nids_alt, |
| 8877 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_alt), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 8878 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 8879 | .channel_mode = alc883_3ST_2ch_modes, |
| 8880 | .input_mux = &alc883_lenovo_101e_capture_source, |
| 8881 | .unsol_event = alc883_lenovo_101e_unsol_event, |
| 8882 | .init_hook = alc883_lenovo_101e_all_automute, |
| 8883 | }, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8884 | [ALC883_LENOVO_NB0763] = { |
| 8885 | .mixers = { alc883_lenovo_nb0763_mixer }, |
| 8886 | .init_verbs = { alc883_init_verbs, alc883_lenovo_nb0763_verbs}, |
| 8887 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 8888 | .dac_nids = alc883_dac_nids, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8889 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 8890 | .channel_mode = alc883_3ST_2ch_modes, |
| 8891 | .need_dac_fix = 1, |
| 8892 | .input_mux = &alc883_lenovo_nb0763_capture_source, |
| 8893 | .unsol_event = alc883_medion_md2_unsol_event, |
| 8894 | .init_hook = alc883_medion_md2_automute, |
| 8895 | }, |
| 8896 | [ALC888_LENOVO_MS7195_DIG] = { |
| 8897 | .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer }, |
| 8898 | .init_verbs = { alc883_init_verbs, alc888_lenovo_ms7195_verbs}, |
| 8899 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 8900 | .dac_nids = alc883_dac_nids, |
| 8901 | .dig_out_nid = ALC883_DIGOUT_NID, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8902 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes), |
| 8903 | .channel_mode = alc883_3ST_6ch_modes, |
| 8904 | .need_dac_fix = 1, |
| 8905 | .input_mux = &alc883_capture_source, |
| 8906 | .unsol_event = alc883_lenovo_ms7195_unsol_event, |
| 8907 | .init_hook = alc888_lenovo_ms7195_front_automute, |
Kailang Yang | 189609a | 2007-08-20 11:31:23 +0200 | [diff] [blame] | 8908 | }, |
| 8909 | [ALC883_HAIER_W66] = { |
| 8910 | .mixers = { alc883_tagra_2ch_mixer}, |
| 8911 | .init_verbs = { alc883_init_verbs, alc883_haier_w66_verbs}, |
| 8912 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 8913 | .dac_nids = alc883_dac_nids, |
| 8914 | .dig_out_nid = ALC883_DIGOUT_NID, |
Kailang Yang | 189609a | 2007-08-20 11:31:23 +0200 | [diff] [blame] | 8915 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 8916 | .channel_mode = alc883_3ST_2ch_modes, |
| 8917 | .input_mux = &alc883_capture_source, |
| 8918 | .unsol_event = alc883_haier_w66_unsol_event, |
| 8919 | .init_hook = alc883_haier_w66_automute, |
Herton Ronaldo Krzesinski | eea6419 | 2008-03-20 12:14:59 +0100 | [diff] [blame] | 8920 | }, |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 8921 | [ALC888_3ST_HP] = { |
Herton Ronaldo Krzesinski | eea6419 | 2008-03-20 12:14:59 +0100 | [diff] [blame] | 8922 | .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer }, |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 8923 | .init_verbs = { alc883_init_verbs, alc888_3st_hp_verbs }, |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 8924 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 8925 | .dac_nids = alc883_dac_nids, |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 8926 | .num_channel_mode = ARRAY_SIZE(alc888_3st_hp_modes), |
| 8927 | .channel_mode = alc888_3st_hp_modes, |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 8928 | .need_dac_fix = 1, |
| 8929 | .input_mux = &alc883_capture_source, |
| 8930 | }, |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 8931 | [ALC888_6ST_DELL] = { |
Herton Ronaldo Krzesinski | f24dbdc | 2008-03-20 12:14:28 +0100 | [diff] [blame] | 8932 | .mixers = { alc883_base_mixer, alc883_chmode_mixer }, |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 8933 | .init_verbs = { alc883_init_verbs, alc888_6st_dell_verbs }, |
| 8934 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 8935 | .dac_nids = alc883_dac_nids, |
| 8936 | .dig_out_nid = ALC883_DIGOUT_NID, |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 8937 | .dig_in_nid = ALC883_DIGIN_NID, |
| 8938 | .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes), |
| 8939 | .channel_mode = alc883_sixstack_modes, |
| 8940 | .input_mux = &alc883_capture_source, |
| 8941 | .unsol_event = alc888_6st_dell_unsol_event, |
| 8942 | .init_hook = alc888_6st_dell_front_automute, |
| 8943 | }, |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 8944 | [ALC883_MITAC] = { |
| 8945 | .mixers = { alc883_mitac_mixer }, |
| 8946 | .init_verbs = { alc883_init_verbs, alc883_mitac_verbs }, |
| 8947 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 8948 | .dac_nids = alc883_dac_nids, |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 8949 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 8950 | .channel_mode = alc883_3ST_2ch_modes, |
| 8951 | .input_mux = &alc883_capture_source, |
| 8952 | .unsol_event = alc883_mitac_unsol_event, |
| 8953 | .init_hook = alc883_mitac_automute, |
| 8954 | }, |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 8955 | [ALC883_FUJITSU_PI2515] = { |
| 8956 | .mixers = { alc883_2ch_fujitsu_pi2515_mixer }, |
| 8957 | .init_verbs = { alc883_init_verbs, |
| 8958 | alc883_2ch_fujitsu_pi2515_verbs}, |
| 8959 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 8960 | .dac_nids = alc883_dac_nids, |
| 8961 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 8962 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 8963 | .channel_mode = alc883_3ST_2ch_modes, |
| 8964 | .input_mux = &alc883_fujitsu_pi2515_capture_source, |
| 8965 | .unsol_event = alc883_2ch_fujitsu_pi2515_unsol_event, |
| 8966 | .init_hook = alc883_2ch_fujitsu_pi2515_automute, |
| 8967 | }, |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 8968 | [ALC888_FUJITSU_XA3530] = { |
| 8969 | .mixers = { alc888_base_mixer, alc883_chmode_mixer }, |
| 8970 | .init_verbs = { alc883_init_verbs, |
| 8971 | alc888_fujitsu_xa3530_verbs }, |
| 8972 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 8973 | .dac_nids = alc883_dac_nids, |
| 8974 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev), |
| 8975 | .adc_nids = alc883_adc_nids_rev, |
| 8976 | .capsrc_nids = alc883_capsrc_nids_rev, |
| 8977 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 8978 | .num_channel_mode = ARRAY_SIZE(alc888_4ST_8ch_intel_modes), |
| 8979 | .channel_mode = alc888_4ST_8ch_intel_modes, |
| 8980 | .num_mux_defs = |
| 8981 | ARRAY_SIZE(alc888_2_capture_sources), |
| 8982 | .input_mux = alc888_2_capture_sources, |
| 8983 | .unsol_event = alc888_fujitsu_xa3530_unsol_event, |
| 8984 | .init_hook = alc888_fujitsu_xa3530_automute, |
| 8985 | }, |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 8986 | [ALC888_LENOVO_SKY] = { |
| 8987 | .mixers = { alc888_lenovo_sky_mixer, alc883_chmode_mixer }, |
| 8988 | .init_verbs = { alc883_init_verbs, alc888_lenovo_sky_verbs}, |
| 8989 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 8990 | .dac_nids = alc883_dac_nids, |
| 8991 | .dig_out_nid = ALC883_DIGOUT_NID, |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 8992 | .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes), |
| 8993 | .channel_mode = alc883_sixstack_modes, |
| 8994 | .need_dac_fix = 1, |
| 8995 | .input_mux = &alc883_lenovo_sky_capture_source, |
| 8996 | .unsol_event = alc883_lenovo_sky_unsol_event, |
| 8997 | .init_hook = alc888_lenovo_sky_front_automute, |
| 8998 | }, |
| 8999 | [ALC888_ASUS_M90V] = { |
| 9000 | .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer }, |
| 9001 | .init_verbs = { alc883_init_verbs, alc888_asus_m90v_verbs }, |
| 9002 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9003 | .dac_nids = alc883_dac_nids, |
| 9004 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 9005 | .dig_in_nid = ALC883_DIGIN_NID, |
| 9006 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes), |
| 9007 | .channel_mode = alc883_3ST_6ch_modes, |
| 9008 | .need_dac_fix = 1, |
| 9009 | .input_mux = &alc883_fujitsu_pi2515_capture_source, |
| 9010 | .unsol_event = alc883_mode2_unsol_event, |
| 9011 | .init_hook = alc883_mode2_inithook, |
| 9012 | }, |
| 9013 | [ALC888_ASUS_EEE1601] = { |
| 9014 | .mixers = { alc883_asus_eee1601_mixer }, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 9015 | .cap_mixer = alc883_asus_eee1601_cap_mixer, |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 9016 | .init_verbs = { alc883_init_verbs, alc888_asus_eee1601_verbs }, |
| 9017 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9018 | .dac_nids = alc883_dac_nids, |
| 9019 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 9020 | .dig_in_nid = ALC883_DIGIN_NID, |
| 9021 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 9022 | .channel_mode = alc883_3ST_2ch_modes, |
| 9023 | .need_dac_fix = 1, |
| 9024 | .input_mux = &alc883_asus_eee1601_capture_source, |
| 9025 | .unsol_event = alc883_eee1601_unsol_event, |
| 9026 | .init_hook = alc883_eee1601_inithook, |
| 9027 | }, |
Wu Fengguang | 3ab9093 | 2008-11-17 09:51:09 +0100 | [diff] [blame] | 9028 | [ALC1200_ASUS_P5Q] = { |
| 9029 | .mixers = { alc883_base_mixer, alc883_chmode_mixer }, |
| 9030 | .init_verbs = { alc883_init_verbs }, |
| 9031 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9032 | .dac_nids = alc883_dac_nids, |
| 9033 | .dig_out_nid = ALC1200_DIGOUT_NID, |
| 9034 | .dig_in_nid = ALC883_DIGIN_NID, |
Wu Fengguang | b25c9da | 2009-02-06 15:02:27 +0800 | [diff] [blame] | 9035 | .slave_dig_outs = alc1200_slave_dig_outs, |
Wu Fengguang | 3ab9093 | 2008-11-17 09:51:09 +0100 | [diff] [blame] | 9036 | .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes), |
| 9037 | .channel_mode = alc883_sixstack_modes, |
| 9038 | .input_mux = &alc883_capture_source, |
| 9039 | }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9040 | }; |
| 9041 | |
| 9042 | |
| 9043 | /* |
| 9044 | * BIOS auto configuration |
| 9045 | */ |
| 9046 | static void alc883_auto_set_output_and_unmute(struct hda_codec *codec, |
| 9047 | hda_nid_t nid, int pin_type, |
| 9048 | int dac_idx) |
| 9049 | { |
| 9050 | /* set as output */ |
| 9051 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9052 | int idx; |
| 9053 | |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 9054 | alc_set_pin_output(codec, nid, pin_type); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9055 | if (spec->multiout.dac_nids[dac_idx] == 0x25) |
| 9056 | idx = 4; |
| 9057 | else |
| 9058 | idx = spec->multiout.dac_nids[dac_idx] - 2; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9059 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_CONNECT_SEL, idx); |
| 9060 | |
| 9061 | } |
| 9062 | |
| 9063 | static void alc883_auto_init_multi_out(struct hda_codec *codec) |
| 9064 | { |
| 9065 | struct alc_spec *spec = codec->spec; |
| 9066 | int i; |
| 9067 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 9068 | alc_subsystem_id(codec, 0x15, 0x1b, 0x14); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9069 | for (i = 0; i <= HDA_SIDE; i++) { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9070 | hda_nid_t nid = spec->autocfg.line_out_pins[i]; |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 9071 | int pin_type = get_pin_type(spec->autocfg.line_out_type); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9072 | if (nid) |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 9073 | alc883_auto_set_output_and_unmute(codec, nid, pin_type, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9074 | i); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9075 | } |
| 9076 | } |
| 9077 | |
| 9078 | static void alc883_auto_init_hp_out(struct hda_codec *codec) |
| 9079 | { |
| 9080 | struct alc_spec *spec = codec->spec; |
| 9081 | hda_nid_t pin; |
| 9082 | |
Takashi Iwai | eb06ed8 | 2006-09-20 17:10:27 +0200 | [diff] [blame] | 9083 | pin = spec->autocfg.hp_pins[0]; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9084 | if (pin) /* connect to front */ |
| 9085 | /* use dac 0 */ |
| 9086 | alc883_auto_set_output_and_unmute(codec, pin, PIN_HP, 0); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 9087 | pin = spec->autocfg.speaker_pins[0]; |
| 9088 | if (pin) |
| 9089 | alc883_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9090 | } |
| 9091 | |
| 9092 | #define alc883_is_input_pin(nid) alc880_is_input_pin(nid) |
| 9093 | #define ALC883_PIN_CD_NID ALC880_PIN_CD_NID |
| 9094 | |
| 9095 | static void alc883_auto_init_analog_input(struct hda_codec *codec) |
| 9096 | { |
| 9097 | struct alc_spec *spec = codec->spec; |
| 9098 | int i; |
| 9099 | |
| 9100 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
| 9101 | hda_nid_t nid = spec->autocfg.input_pins[i]; |
| 9102 | if (alc883_is_input_pin(nid)) { |
| 9103 | snd_hda_codec_write(codec, nid, 0, |
| 9104 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 9105 | (i <= AUTO_PIN_FRONT_MIC ? |
| 9106 | PIN_VREF80 : PIN_IN)); |
| 9107 | if (nid != ALC883_PIN_CD_NID) |
| 9108 | snd_hda_codec_write(codec, nid, 0, |
| 9109 | AC_VERB_SET_AMP_GAIN_MUTE, |
| 9110 | AMP_OUT_MUTE); |
| 9111 | } |
| 9112 | } |
| 9113 | } |
| 9114 | |
Takashi Iwai | f511b01 | 2008-08-15 16:46:42 +0200 | [diff] [blame] | 9115 | #define alc883_auto_init_input_src alc882_auto_init_input_src |
| 9116 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9117 | /* almost identical with ALC880 parser... */ |
| 9118 | static int alc883_parse_auto_config(struct hda_codec *codec) |
| 9119 | { |
| 9120 | struct alc_spec *spec = codec->spec; |
| 9121 | int err = alc880_parse_auto_config(codec); |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 9122 | struct auto_pin_cfg *cfg = &spec->autocfg; |
| 9123 | int i; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9124 | |
| 9125 | if (err < 0) |
| 9126 | return err; |
Takashi Iwai | 776e184 | 2007-08-29 15:07:11 +0200 | [diff] [blame] | 9127 | else if (!err) |
| 9128 | return 0; /* no config found */ |
| 9129 | |
| 9130 | err = alc_auto_add_mic_boost(codec); |
| 9131 | if (err < 0) |
| 9132 | return err; |
| 9133 | |
| 9134 | /* hack - override the init verbs */ |
| 9135 | spec->init_verbs[0] = alc883_auto_init_verbs; |
Takashi Iwai | 776e184 | 2007-08-29 15:07:11 +0200 | [diff] [blame] | 9136 | |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 9137 | /* setup input_mux for ALC889 */ |
| 9138 | if (codec->vendor_id == 0x10ec0889) { |
| 9139 | /* digital-mic input pin is excluded in alc880_auto_create..() |
| 9140 | * because it's under 0x18 |
| 9141 | */ |
| 9142 | if (cfg->input_pins[AUTO_PIN_MIC] == 0x12 || |
| 9143 | cfg->input_pins[AUTO_PIN_FRONT_MIC] == 0x12) { |
| 9144 | struct hda_input_mux *imux = &spec->private_imux[0]; |
| 9145 | for (i = 1; i < 3; i++) |
| 9146 | memcpy(&spec->private_imux[i], |
| 9147 | &spec->private_imux[0], |
| 9148 | sizeof(spec->private_imux[0])); |
| 9149 | imux->items[imux->num_items].label = "Int DMic"; |
| 9150 | imux->items[imux->num_items].index = 0x0b; |
| 9151 | imux->num_items++; |
| 9152 | spec->num_mux_defs = 3; |
| 9153 | spec->input_mux = spec->private_imux; |
| 9154 | } |
| 9155 | } |
| 9156 | |
Takashi Iwai | 776e184 | 2007-08-29 15:07:11 +0200 | [diff] [blame] | 9157 | return 1; /* config found */ |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9158 | } |
| 9159 | |
| 9160 | /* additional initialization for auto-configuration model */ |
| 9161 | static void alc883_auto_init(struct hda_codec *codec) |
| 9162 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 9163 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9164 | alc883_auto_init_multi_out(codec); |
| 9165 | alc883_auto_init_hp_out(codec); |
| 9166 | alc883_auto_init_analog_input(codec); |
Takashi Iwai | f511b01 | 2008-08-15 16:46:42 +0200 | [diff] [blame] | 9167 | alc883_auto_init_input_src(codec); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 9168 | if (spec->unsol_event) |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 9169 | alc_inithook(codec); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9170 | } |
| 9171 | |
| 9172 | static int patch_alc883(struct hda_codec *codec) |
| 9173 | { |
| 9174 | struct alc_spec *spec; |
| 9175 | int err, board_config; |
| 9176 | |
| 9177 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
| 9178 | if (spec == NULL) |
| 9179 | return -ENOMEM; |
| 9180 | |
| 9181 | codec->spec = spec; |
| 9182 | |
Takashi Iwai | 2c3bf9a | 2008-06-04 12:39:38 +0200 | [diff] [blame] | 9183 | alc_fix_pll_init(codec, 0x20, 0x0a, 10); |
| 9184 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 9185 | board_config = snd_hda_check_board_config(codec, ALC883_MODEL_LAST, |
| 9186 | alc883_models, |
| 9187 | alc883_cfg_tbl); |
| 9188 | if (board_config < 0) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9189 | printk(KERN_INFO "hda_codec: Unknown model for ALC883, " |
| 9190 | "trying auto-probe from BIOS...\n"); |
| 9191 | board_config = ALC883_AUTO; |
| 9192 | } |
| 9193 | |
| 9194 | if (board_config == ALC883_AUTO) { |
| 9195 | /* automatic parse from the BIOS config */ |
| 9196 | err = alc883_parse_auto_config(codec); |
| 9197 | if (err < 0) { |
| 9198 | alc_free(codec); |
| 9199 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9200 | } else if (!err) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9201 | printk(KERN_INFO |
| 9202 | "hda_codec: Cannot set up configuration " |
| 9203 | "from BIOS. Using base mode...\n"); |
| 9204 | board_config = ALC883_3ST_2ch_DIG; |
| 9205 | } |
| 9206 | } |
| 9207 | |
Kusanagi Kouichi | 680cd53 | 2009-02-05 00:00:58 +0900 | [diff] [blame] | 9208 | err = snd_hda_attach_beep_device(codec, 0x1); |
| 9209 | if (err < 0) { |
| 9210 | alc_free(codec); |
| 9211 | return err; |
| 9212 | } |
| 9213 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9214 | if (board_config != ALC883_AUTO) |
| 9215 | setup_preset(spec, &alc883_presets[board_config]); |
| 9216 | |
Kailang Yang | 2f89328 | 2008-05-27 12:14:47 +0200 | [diff] [blame] | 9217 | switch (codec->vendor_id) { |
| 9218 | case 0x10ec0888: |
Kailang Yang | 4442608 | 2008-10-15 11:18:05 +0200 | [diff] [blame] | 9219 | if (codec->revision_id == 0x100101) { |
| 9220 | spec->stream_name_analog = "ALC1200 Analog"; |
| 9221 | spec->stream_name_digital = "ALC1200 Digital"; |
| 9222 | } else { |
| 9223 | spec->stream_name_analog = "ALC888 Analog"; |
| 9224 | spec->stream_name_digital = "ALC888 Digital"; |
| 9225 | } |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 9226 | if (!spec->num_adc_nids) { |
| 9227 | spec->num_adc_nids = ARRAY_SIZE(alc883_adc_nids); |
| 9228 | spec->adc_nids = alc883_adc_nids; |
| 9229 | } |
| 9230 | if (!spec->capsrc_nids) |
| 9231 | spec->capsrc_nids = alc883_capsrc_nids; |
| 9232 | spec->capture_style = CAPT_MIX; /* matrix-style capture */ |
Kailang Yang | 2f89328 | 2008-05-27 12:14:47 +0200 | [diff] [blame] | 9233 | break; |
| 9234 | case 0x10ec0889: |
| 9235 | spec->stream_name_analog = "ALC889 Analog"; |
| 9236 | spec->stream_name_digital = "ALC889 Digital"; |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 9237 | if (!spec->num_adc_nids) { |
| 9238 | spec->num_adc_nids = ARRAY_SIZE(alc889_adc_nids); |
| 9239 | spec->adc_nids = alc889_adc_nids; |
| 9240 | } |
| 9241 | if (!spec->capsrc_nids) |
| 9242 | spec->capsrc_nids = alc889_capsrc_nids; |
| 9243 | spec->capture_style = CAPT_1MUX_MIX; /* 1mux/Nmix-style |
| 9244 | capture */ |
Kailang Yang | 2f89328 | 2008-05-27 12:14:47 +0200 | [diff] [blame] | 9245 | break; |
| 9246 | default: |
| 9247 | spec->stream_name_analog = "ALC883 Analog"; |
| 9248 | spec->stream_name_digital = "ALC883 Digital"; |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 9249 | if (!spec->num_adc_nids) { |
| 9250 | spec->num_adc_nids = ARRAY_SIZE(alc883_adc_nids); |
| 9251 | spec->adc_nids = alc883_adc_nids; |
| 9252 | } |
| 9253 | if (!spec->capsrc_nids) |
| 9254 | spec->capsrc_nids = alc883_capsrc_nids; |
| 9255 | spec->capture_style = CAPT_MIX; /* matrix-style capture */ |
Kailang Yang | 2f89328 | 2008-05-27 12:14:47 +0200 | [diff] [blame] | 9256 | break; |
| 9257 | } |
| 9258 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9259 | spec->stream_analog_playback = &alc883_pcm_analog_playback; |
| 9260 | spec->stream_analog_capture = &alc883_pcm_analog_capture; |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 9261 | spec->stream_analog_alt_capture = &alc883_pcm_analog_alt_capture; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9262 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9263 | spec->stream_digital_playback = &alc883_pcm_digital_playback; |
| 9264 | spec->stream_digital_capture = &alc883_pcm_digital_capture; |
| 9265 | |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 9266 | if (!spec->cap_mixer) |
| 9267 | set_capture_mixer(spec); |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 9268 | set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9269 | |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 9270 | spec->vmaster_nid = 0x0c; |
| 9271 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9272 | codec->patch_ops = alc_patch_ops; |
| 9273 | if (board_config == ALC883_AUTO) |
| 9274 | spec->init_hook = alc883_auto_init; |
Kailang Yang | f9423e7 | 2008-05-27 12:32:25 +0200 | [diff] [blame] | 9275 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 9276 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 9277 | if (!spec->loopback.amplist) |
| 9278 | spec->loopback.amplist = alc883_loopbacks; |
| 9279 | #endif |
Takashi Iwai | daead53 | 2008-11-28 12:55:36 +0100 | [diff] [blame] | 9280 | codec->proc_widget_hook = print_realtek_coef; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9281 | |
| 9282 | return 0; |
| 9283 | } |
| 9284 | |
| 9285 | /* |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9286 | * ALC262 support |
| 9287 | */ |
| 9288 | |
| 9289 | #define ALC262_DIGOUT_NID ALC880_DIGOUT_NID |
| 9290 | #define ALC262_DIGIN_NID ALC880_DIGIN_NID |
| 9291 | |
| 9292 | #define alc262_dac_nids alc260_dac_nids |
| 9293 | #define alc262_adc_nids alc882_adc_nids |
| 9294 | #define alc262_adc_nids_alt alc882_adc_nids_alt |
Takashi Iwai | 88c71a9 | 2008-02-14 17:27:17 +0100 | [diff] [blame] | 9295 | #define alc262_capsrc_nids alc882_capsrc_nids |
| 9296 | #define alc262_capsrc_nids_alt alc882_capsrc_nids_alt |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9297 | |
| 9298 | #define alc262_modes alc260_modes |
Takashi Iwai | c5f2ea0 | 2005-12-06 18:54:31 +0100 | [diff] [blame] | 9299 | #define alc262_capture_source alc882_capture_source |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9300 | |
Kailang Yang | 4e555fe | 2008-08-26 13:05:55 +0200 | [diff] [blame] | 9301 | static hda_nid_t alc262_dmic_adc_nids[1] = { |
| 9302 | /* ADC0 */ |
| 9303 | 0x09 |
| 9304 | }; |
| 9305 | |
| 9306 | static hda_nid_t alc262_dmic_capsrc_nids[1] = { 0x22 }; |
| 9307 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9308 | static struct snd_kcontrol_new alc262_base_mixer[] = { |
| 9309 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 9310 | HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 9311 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 9312 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 9313 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 9314 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 9315 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 9316 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Takashi Iwai | cc69d12 | 2007-02-15 19:29:26 +0100 | [diff] [blame] | 9317 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9318 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 9319 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
Takashi Iwai | cc69d12 | 2007-02-15 19:29:26 +0100 | [diff] [blame] | 9320 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9321 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0D, 0x0, HDA_OUTPUT), |
| 9322 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 9323 | HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 9324 | HDA_CODEC_MUTE_MONO("Mono Playback Switch", 0x16, 2, 0x0, HDA_OUTPUT), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9325 | { } /* end */ |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 9326 | }; |
| 9327 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 9328 | static struct snd_kcontrol_new alc262_hippo1_mixer[] = { |
| 9329 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 9330 | HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 9331 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 9332 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 9333 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 9334 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 9335 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 9336 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Takashi Iwai | cc69d12 | 2007-02-15 19:29:26 +0100 | [diff] [blame] | 9337 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 9338 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 9339 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
Takashi Iwai | cc69d12 | 2007-02-15 19:29:26 +0100 | [diff] [blame] | 9340 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 9341 | /*HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0D, 0x0, HDA_OUTPUT),*/ |
| 9342 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 9343 | { } /* end */ |
| 9344 | }; |
| 9345 | |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 9346 | /* update HP, line and mono-out pins according to the master switch */ |
| 9347 | static void alc262_hp_master_update(struct hda_codec *codec) |
| 9348 | { |
| 9349 | struct alc_spec *spec = codec->spec; |
| 9350 | int val = spec->master_sw; |
| 9351 | |
| 9352 | /* HP & line-out */ |
| 9353 | snd_hda_codec_write_cache(codec, 0x1b, 0, |
| 9354 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 9355 | val ? PIN_HP : 0); |
| 9356 | snd_hda_codec_write_cache(codec, 0x15, 0, |
| 9357 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 9358 | val ? PIN_HP : 0); |
| 9359 | /* mono (speaker) depending on the HP jack sense */ |
| 9360 | val = val && !spec->jack_present; |
| 9361 | snd_hda_codec_write_cache(codec, 0x16, 0, |
| 9362 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 9363 | val ? PIN_OUT : 0); |
| 9364 | } |
| 9365 | |
| 9366 | static void alc262_hp_bpc_automute(struct hda_codec *codec) |
| 9367 | { |
| 9368 | struct alc_spec *spec = codec->spec; |
| 9369 | unsigned int presence; |
| 9370 | presence = snd_hda_codec_read(codec, 0x1b, 0, |
| 9371 | AC_VERB_GET_PIN_SENSE, 0); |
| 9372 | spec->jack_present = !!(presence & AC_PINSENSE_PRESENCE); |
| 9373 | alc262_hp_master_update(codec); |
| 9374 | } |
| 9375 | |
| 9376 | static void alc262_hp_bpc_unsol_event(struct hda_codec *codec, unsigned int res) |
| 9377 | { |
| 9378 | if ((res >> 26) != ALC880_HP_EVENT) |
| 9379 | return; |
| 9380 | alc262_hp_bpc_automute(codec); |
| 9381 | } |
| 9382 | |
| 9383 | static void alc262_hp_wildwest_automute(struct hda_codec *codec) |
| 9384 | { |
| 9385 | struct alc_spec *spec = codec->spec; |
| 9386 | unsigned int presence; |
| 9387 | presence = snd_hda_codec_read(codec, 0x15, 0, |
| 9388 | AC_VERB_GET_PIN_SENSE, 0); |
| 9389 | spec->jack_present = !!(presence & AC_PINSENSE_PRESENCE); |
| 9390 | alc262_hp_master_update(codec); |
| 9391 | } |
| 9392 | |
| 9393 | static void alc262_hp_wildwest_unsol_event(struct hda_codec *codec, |
| 9394 | unsigned int res) |
| 9395 | { |
| 9396 | if ((res >> 26) != ALC880_HP_EVENT) |
| 9397 | return; |
| 9398 | alc262_hp_wildwest_automute(codec); |
| 9399 | } |
| 9400 | |
| 9401 | static int alc262_hp_master_sw_get(struct snd_kcontrol *kcontrol, |
| 9402 | struct snd_ctl_elem_value *ucontrol) |
| 9403 | { |
| 9404 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 9405 | struct alc_spec *spec = codec->spec; |
| 9406 | *ucontrol->value.integer.value = spec->master_sw; |
| 9407 | return 0; |
| 9408 | } |
| 9409 | |
| 9410 | static int alc262_hp_master_sw_put(struct snd_kcontrol *kcontrol, |
| 9411 | struct snd_ctl_elem_value *ucontrol) |
| 9412 | { |
| 9413 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 9414 | struct alc_spec *spec = codec->spec; |
| 9415 | int val = !!*ucontrol->value.integer.value; |
| 9416 | |
| 9417 | if (val == spec->master_sw) |
| 9418 | return 0; |
| 9419 | spec->master_sw = val; |
| 9420 | alc262_hp_master_update(codec); |
| 9421 | return 1; |
| 9422 | } |
| 9423 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9424 | static struct snd_kcontrol_new alc262_HP_BPC_mixer[] = { |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 9425 | { |
| 9426 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 9427 | .name = "Master Playback Switch", |
| 9428 | .info = snd_ctl_boolean_mono_info, |
| 9429 | .get = alc262_hp_master_sw_get, |
| 9430 | .put = alc262_hp_master_sw_put, |
| 9431 | }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9432 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 9433 | HDA_CODEC_MUTE("Front Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 9434 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 9435 | HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0e, 2, 0x0, |
| 9436 | HDA_OUTPUT), |
| 9437 | HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x16, 2, 0x0, |
| 9438 | HDA_OUTPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9439 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 9440 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Takashi Iwai | cc69d12 | 2007-02-15 19:29:26 +0100 | [diff] [blame] | 9441 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9442 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 9443 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
Takashi Iwai | cc69d12 | 2007-02-15 19:29:26 +0100 | [diff] [blame] | 9444 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9445 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 9446 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 9447 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 9448 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9449 | HDA_CODEC_VOLUME("AUX IN Playback Volume", 0x0b, 0x06, HDA_INPUT), |
| 9450 | HDA_CODEC_MUTE("AUX IN Playback Switch", 0x0b, 0x06, HDA_INPUT), |
| 9451 | { } /* end */ |
| 9452 | }; |
| 9453 | |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 9454 | static struct snd_kcontrol_new alc262_HP_BPC_WildWest_mixer[] = { |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 9455 | { |
| 9456 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 9457 | .name = "Master Playback Switch", |
| 9458 | .info = snd_ctl_boolean_mono_info, |
| 9459 | .get = alc262_hp_master_sw_get, |
| 9460 | .put = alc262_hp_master_sw_put, |
| 9461 | }, |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 9462 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 9463 | HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 9464 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 9465 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 9466 | HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0e, 2, 0x0, |
| 9467 | HDA_OUTPUT), |
| 9468 | HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x16, 2, 0x0, |
| 9469 | HDA_OUTPUT), |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 9470 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 9471 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x02, HDA_INPUT), |
Takashi Iwai | cc69d12 | 2007-02-15 19:29:26 +0100 | [diff] [blame] | 9472 | HDA_CODEC_VOLUME("Front Mic Boost", 0x1a, 0, HDA_INPUT), |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 9473 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 9474 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 9475 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 9476 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 9477 | { } /* end */ |
| 9478 | }; |
| 9479 | |
| 9480 | static struct snd_kcontrol_new alc262_HP_BPC_WildWest_option_mixer[] = { |
| 9481 | HDA_CODEC_VOLUME("Rear Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 9482 | HDA_CODEC_MUTE("Rear Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Takashi Iwai | cc69d12 | 2007-02-15 19:29:26 +0100 | [diff] [blame] | 9483 | HDA_CODEC_VOLUME("Rear Mic Boost", 0x18, 0, HDA_INPUT), |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 9484 | { } /* end */ |
| 9485 | }; |
| 9486 | |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 9487 | /* mute/unmute internal speaker according to the hp jack and mute state */ |
| 9488 | static void alc262_hp_t5735_automute(struct hda_codec *codec, int force) |
| 9489 | { |
| 9490 | struct alc_spec *spec = codec->spec; |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 9491 | |
| 9492 | if (force || !spec->sense_updated) { |
| 9493 | unsigned int present; |
| 9494 | present = snd_hda_codec_read(codec, 0x15, 0, |
| 9495 | AC_VERB_GET_PIN_SENSE, 0); |
Takashi Iwai | 4bb2613 | 2008-01-28 18:12:42 +0100 | [diff] [blame] | 9496 | spec->jack_present = (present & AC_PINSENSE_PRESENCE) != 0; |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 9497 | spec->sense_updated = 1; |
| 9498 | } |
Takashi Iwai | 4bb2613 | 2008-01-28 18:12:42 +0100 | [diff] [blame] | 9499 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_OUTPUT, 0, HDA_AMP_MUTE, |
| 9500 | spec->jack_present ? HDA_AMP_MUTE : 0); |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 9501 | } |
| 9502 | |
| 9503 | static void alc262_hp_t5735_unsol_event(struct hda_codec *codec, |
| 9504 | unsigned int res) |
| 9505 | { |
| 9506 | if ((res >> 26) != ALC880_HP_EVENT) |
| 9507 | return; |
| 9508 | alc262_hp_t5735_automute(codec, 1); |
| 9509 | } |
| 9510 | |
| 9511 | static void alc262_hp_t5735_init_hook(struct hda_codec *codec) |
| 9512 | { |
| 9513 | alc262_hp_t5735_automute(codec, 1); |
| 9514 | } |
| 9515 | |
| 9516 | static struct snd_kcontrol_new alc262_hp_t5735_mixer[] = { |
Takashi Iwai | 86cd929 | 2008-01-28 18:09:56 +0100 | [diff] [blame] | 9517 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 9518 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 9519 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 9520 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 9521 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 9522 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 9523 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 9524 | { } /* end */ |
| 9525 | }; |
| 9526 | |
| 9527 | static struct hda_verb alc262_hp_t5735_verbs[] = { |
| 9528 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 9529 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 9530 | |
| 9531 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 9532 | { } |
| 9533 | }; |
| 9534 | |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 9535 | static struct snd_kcontrol_new alc262_hp_rp5700_mixer[] = { |
Takashi Iwai | f2f48e1 | 2008-01-28 18:14:43 +0100 | [diff] [blame] | 9536 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 9537 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
Takashi Iwai | 86cd929 | 2008-01-28 18:09:56 +0100 | [diff] [blame] | 9538 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0e, 0x0, HDA_OUTPUT), |
| 9539 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x16, 0x0, HDA_OUTPUT), |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 9540 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 9541 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 9542 | { } /* end */ |
| 9543 | }; |
| 9544 | |
| 9545 | static struct hda_verb alc262_hp_rp5700_verbs[] = { |
| 9546 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 9547 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 9548 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 9549 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 9550 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 9551 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 9552 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 9553 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 9554 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x00 << 8))}, |
| 9555 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x00 << 8))}, |
| 9556 | {} |
| 9557 | }; |
| 9558 | |
| 9559 | static struct hda_input_mux alc262_hp_rp5700_capture_source = { |
| 9560 | .num_items = 1, |
| 9561 | .items = { |
| 9562 | { "Line", 0x1 }, |
| 9563 | }, |
| 9564 | }; |
| 9565 | |
Takashi Iwai | 0724ea2 | 2007-08-23 00:31:43 +0200 | [diff] [blame] | 9566 | /* bind hp and internal speaker mute (with plug check) */ |
| 9567 | static int alc262_sony_master_sw_put(struct snd_kcontrol *kcontrol, |
| 9568 | struct snd_ctl_elem_value *ucontrol) |
| 9569 | { |
| 9570 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 9571 | long *valp = ucontrol->value.integer.value; |
| 9572 | int change; |
| 9573 | |
| 9574 | /* change hp mute */ |
| 9575 | change = snd_hda_codec_amp_update(codec, 0x15, 0, HDA_OUTPUT, 0, |
| 9576 | HDA_AMP_MUTE, |
| 9577 | valp[0] ? 0 : HDA_AMP_MUTE); |
| 9578 | change |= snd_hda_codec_amp_update(codec, 0x15, 1, HDA_OUTPUT, 0, |
| 9579 | HDA_AMP_MUTE, |
| 9580 | valp[1] ? 0 : HDA_AMP_MUTE); |
| 9581 | if (change) { |
| 9582 | /* change speaker according to HP jack state */ |
| 9583 | struct alc_spec *spec = codec->spec; |
| 9584 | unsigned int mute; |
| 9585 | if (spec->jack_present) |
| 9586 | mute = HDA_AMP_MUTE; |
| 9587 | else |
| 9588 | mute = snd_hda_codec_amp_read(codec, 0x15, 0, |
| 9589 | HDA_OUTPUT, 0); |
| 9590 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 9591 | HDA_AMP_MUTE, mute); |
| 9592 | } |
| 9593 | return change; |
| 9594 | } |
Takashi Iwai | 5b31954 | 2007-07-26 11:49:22 +0200 | [diff] [blame] | 9595 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 9596 | static struct snd_kcontrol_new alc262_sony_mixer[] = { |
Takashi Iwai | 0724ea2 | 2007-08-23 00:31:43 +0200 | [diff] [blame] | 9597 | HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 9598 | { |
| 9599 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 9600 | .name = "Master Playback Switch", |
| 9601 | .info = snd_hda_mixer_amp_switch_info, |
| 9602 | .get = snd_hda_mixer_amp_switch_get, |
| 9603 | .put = alc262_sony_master_sw_put, |
| 9604 | .private_value = HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT), |
| 9605 | }, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 9606 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 9607 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 9608 | HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 9609 | HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 9610 | { } /* end */ |
| 9611 | }; |
| 9612 | |
Kailang Yang | 83c3421 | 2007-07-05 11:43:05 +0200 | [diff] [blame] | 9613 | static struct snd_kcontrol_new alc262_benq_t31_mixer[] = { |
| 9614 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 9615 | HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 9616 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 9617 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 9618 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 9619 | HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 9620 | HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 9621 | { } /* end */ |
| 9622 | }; |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 9623 | |
Tony Vroon | ba340e8 | 2009-02-02 19:01:30 +0000 | [diff] [blame] | 9624 | static struct snd_kcontrol_new alc262_tyan_mixer[] = { |
| 9625 | HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 9626 | HDA_BIND_MUTE("Master Playback Switch", 0x0c, 2, HDA_INPUT), |
| 9627 | HDA_CODEC_VOLUME("Aux Playback Volume", 0x0b, 0x06, HDA_INPUT), |
| 9628 | HDA_CODEC_MUTE("Aux Playback Switch", 0x0b, 0x06, HDA_INPUT), |
| 9629 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 9630 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 9631 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 9632 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 9633 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 9634 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 9635 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 9636 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
| 9637 | { } /* end */ |
| 9638 | }; |
| 9639 | |
| 9640 | static struct hda_verb alc262_tyan_verbs[] = { |
| 9641 | /* Headphone automute */ |
| 9642 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 9643 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 9644 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 9645 | |
| 9646 | /* P11 AUX_IN, white 4-pin connector */ |
| 9647 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 9648 | {0x14, AC_VERB_SET_CONFIG_DEFAULT_BYTES_1, 0xe1}, |
| 9649 | {0x14, AC_VERB_SET_CONFIG_DEFAULT_BYTES_2, 0x93}, |
| 9650 | {0x14, AC_VERB_SET_CONFIG_DEFAULT_BYTES_3, 0x19}, |
| 9651 | |
| 9652 | {} |
| 9653 | }; |
| 9654 | |
| 9655 | /* unsolicited event for HP jack sensing */ |
| 9656 | static void alc262_tyan_automute(struct hda_codec *codec) |
| 9657 | { |
| 9658 | unsigned int mute; |
| 9659 | unsigned int present; |
| 9660 | |
| 9661 | snd_hda_codec_read(codec, 0x1b, 0, AC_VERB_SET_PIN_SENSE, 0); |
| 9662 | present = snd_hda_codec_read(codec, 0x1b, 0, |
| 9663 | AC_VERB_GET_PIN_SENSE, 0); |
| 9664 | present = (present & 0x80000000) != 0; |
| 9665 | if (present) { |
| 9666 | /* mute line output on ATX panel */ |
| 9667 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 9668 | HDA_AMP_MUTE, HDA_AMP_MUTE); |
| 9669 | } else { |
| 9670 | /* unmute line output if necessary */ |
| 9671 | mute = snd_hda_codec_amp_read(codec, 0x1b, 0, HDA_OUTPUT, 0); |
| 9672 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 9673 | HDA_AMP_MUTE, mute); |
| 9674 | } |
| 9675 | } |
| 9676 | |
| 9677 | static void alc262_tyan_unsol_event(struct hda_codec *codec, |
| 9678 | unsigned int res) |
| 9679 | { |
| 9680 | if ((res >> 26) != ALC880_HP_EVENT) |
| 9681 | return; |
| 9682 | alc262_tyan_automute(codec); |
| 9683 | } |
| 9684 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9685 | #define alc262_capture_mixer alc882_capture_mixer |
| 9686 | #define alc262_capture_alt_mixer alc882_capture_alt_mixer |
| 9687 | |
| 9688 | /* |
| 9689 | * generic initialization of ADC, input mixers and output mixers |
| 9690 | */ |
| 9691 | static struct hda_verb alc262_init_verbs[] = { |
| 9692 | /* |
| 9693 | * Unmute ADC0-2 and set the default input to mic-in |
| 9694 | */ |
| 9695 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 9696 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9697 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 9698 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9699 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 9700 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9701 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 9702 | /* 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] | 9703 | * mixer widget |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9704 | * Note: PASD motherboards uses the Line In 2 as the input for |
| 9705 | * front panel mic (mic 2) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9706 | */ |
| 9707 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 9708 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 9709 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 9710 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 9711 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 9712 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9713 | |
| 9714 | /* |
| 9715 | * Set up output mixers (0x0c - 0x0e) |
| 9716 | */ |
| 9717 | /* set vol=0 to output mixers */ |
| 9718 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 9719 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 9720 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 9721 | /* set up input amps for analog loopback */ |
| 9722 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 9723 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9724 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 9725 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9726 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 9727 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9728 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 9729 | |
| 9730 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, |
| 9731 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0}, |
| 9732 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, |
| 9733 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 9734 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 9735 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 9736 | |
| 9737 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
| 9738 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
| 9739 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
| 9740 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
| 9741 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 9742 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9743 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 9744 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 9745 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9746 | /* FIXME: use matrix-type input source selection */ |
| 9747 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 9748 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ |
| 9749 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 9750 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 9751 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 9752 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 9753 | /* Input mixer2 */ |
| 9754 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 9755 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 9756 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 9757 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 9758 | /* Input mixer3 */ |
| 9759 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 9760 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 9761 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9762 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9763 | |
| 9764 | { } |
| 9765 | }; |
| 9766 | |
Kailang Yang | 4e555fe | 2008-08-26 13:05:55 +0200 | [diff] [blame] | 9767 | static struct hda_verb alc262_eapd_verbs[] = { |
| 9768 | {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 9769 | {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 9770 | { } |
| 9771 | }; |
| 9772 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 9773 | static struct hda_verb alc262_hippo_unsol_verbs[] = { |
| 9774 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 9775 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 9776 | {} |
| 9777 | }; |
| 9778 | |
| 9779 | static struct hda_verb alc262_hippo1_unsol_verbs[] = { |
| 9780 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0}, |
| 9781 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 9782 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
| 9783 | |
| 9784 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 9785 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 9786 | {} |
| 9787 | }; |
| 9788 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 9789 | static struct hda_verb alc262_sony_unsol_verbs[] = { |
| 9790 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0}, |
| 9791 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 9792 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, // Front Mic |
| 9793 | |
| 9794 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 9795 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Akio Idehara | 7b1e879 | 2008-06-09 22:46:07 +0900 | [diff] [blame] | 9796 | {} |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 9797 | }; |
| 9798 | |
Kailang Yang | 4e555fe | 2008-08-26 13:05:55 +0200 | [diff] [blame] | 9799 | static struct hda_input_mux alc262_dmic_capture_source = { |
| 9800 | .num_items = 2, |
| 9801 | .items = { |
| 9802 | { "Int DMic", 0x9 }, |
| 9803 | { "Mic", 0x0 }, |
| 9804 | }, |
| 9805 | }; |
| 9806 | |
| 9807 | static struct snd_kcontrol_new alc262_toshiba_s06_mixer[] = { |
| 9808 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 9809 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 9810 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 9811 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 9812 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Kailang Yang | 4e555fe | 2008-08-26 13:05:55 +0200 | [diff] [blame] | 9813 | { } /* end */ |
| 9814 | }; |
| 9815 | |
| 9816 | static struct hda_verb alc262_toshiba_s06_verbs[] = { |
| 9817 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 9818 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 9819 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 9820 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 9821 | {0x22, AC_VERB_SET_CONNECT_SEL, 0x09}, |
| 9822 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 9823 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 9824 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 9825 | {} |
| 9826 | }; |
| 9827 | |
| 9828 | static void alc262_dmic_automute(struct hda_codec *codec) |
| 9829 | { |
| 9830 | unsigned int present; |
| 9831 | |
| 9832 | present = snd_hda_codec_read(codec, 0x18, 0, |
| 9833 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 9834 | snd_hda_codec_write(codec, 0x22, 0, |
| 9835 | AC_VERB_SET_CONNECT_SEL, present ? 0x0 : 0x09); |
| 9836 | } |
| 9837 | |
| 9838 | /* toggle speaker-output according to the hp-jack state */ |
| 9839 | static void alc262_toshiba_s06_speaker_automute(struct hda_codec *codec) |
| 9840 | { |
| 9841 | unsigned int present; |
| 9842 | unsigned char bits; |
| 9843 | |
| 9844 | present = snd_hda_codec_read(codec, 0x15, 0, |
| 9845 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 9846 | bits = present ? 0 : PIN_OUT; |
| 9847 | snd_hda_codec_write(codec, 0x14, 0, |
| 9848 | AC_VERB_SET_PIN_WIDGET_CONTROL, bits); |
| 9849 | } |
| 9850 | |
| 9851 | |
| 9852 | |
| 9853 | /* unsolicited event for HP jack sensing */ |
| 9854 | static void alc262_toshiba_s06_unsol_event(struct hda_codec *codec, |
| 9855 | unsigned int res) |
| 9856 | { |
| 9857 | if ((res >> 26) == ALC880_HP_EVENT) |
| 9858 | alc262_toshiba_s06_speaker_automute(codec); |
| 9859 | if ((res >> 26) == ALC880_MIC_EVENT) |
| 9860 | alc262_dmic_automute(codec); |
| 9861 | |
| 9862 | } |
| 9863 | |
| 9864 | static void alc262_toshiba_s06_init_hook(struct hda_codec *codec) |
| 9865 | { |
| 9866 | alc262_toshiba_s06_speaker_automute(codec); |
| 9867 | alc262_dmic_automute(codec); |
| 9868 | } |
| 9869 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 9870 | /* mute/unmute internal speaker according to the hp jack and mute state */ |
Takashi Iwai | 5b31954 | 2007-07-26 11:49:22 +0200 | [diff] [blame] | 9871 | static void alc262_hippo_automute(struct hda_codec *codec) |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 9872 | { |
| 9873 | struct alc_spec *spec = codec->spec; |
| 9874 | unsigned int mute; |
Takashi Iwai | 5b31954 | 2007-07-26 11:49:22 +0200 | [diff] [blame] | 9875 | unsigned int present; |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 9876 | |
Takashi Iwai | 5b31954 | 2007-07-26 11:49:22 +0200 | [diff] [blame] | 9877 | /* need to execute and sync at first */ |
| 9878 | snd_hda_codec_read(codec, 0x15, 0, AC_VERB_SET_PIN_SENSE, 0); |
| 9879 | present = snd_hda_codec_read(codec, 0x15, 0, |
| 9880 | AC_VERB_GET_PIN_SENSE, 0); |
| 9881 | spec->jack_present = (present & 0x80000000) != 0; |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 9882 | if (spec->jack_present) { |
| 9883 | /* mute internal speaker */ |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 9884 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 9885 | HDA_AMP_MUTE, HDA_AMP_MUTE); |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 9886 | } else { |
| 9887 | /* unmute internal speaker if necessary */ |
| 9888 | mute = snd_hda_codec_amp_read(codec, 0x15, 0, HDA_OUTPUT, 0); |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 9889 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 9890 | HDA_AMP_MUTE, mute); |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 9891 | } |
| 9892 | } |
| 9893 | |
| 9894 | /* unsolicited event for HP jack sensing */ |
| 9895 | static void alc262_hippo_unsol_event(struct hda_codec *codec, |
| 9896 | unsigned int res) |
| 9897 | { |
| 9898 | if ((res >> 26) != ALC880_HP_EVENT) |
| 9899 | return; |
Takashi Iwai | 5b31954 | 2007-07-26 11:49:22 +0200 | [diff] [blame] | 9900 | alc262_hippo_automute(codec); |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 9901 | } |
| 9902 | |
Takashi Iwai | 5b31954 | 2007-07-26 11:49:22 +0200 | [diff] [blame] | 9903 | static void alc262_hippo1_automute(struct hda_codec *codec) |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 9904 | { |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 9905 | unsigned int mute; |
Takashi Iwai | 5b31954 | 2007-07-26 11:49:22 +0200 | [diff] [blame] | 9906 | unsigned int present; |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 9907 | |
Takashi Iwai | 5b31954 | 2007-07-26 11:49:22 +0200 | [diff] [blame] | 9908 | snd_hda_codec_read(codec, 0x1b, 0, AC_VERB_SET_PIN_SENSE, 0); |
| 9909 | present = snd_hda_codec_read(codec, 0x1b, 0, |
| 9910 | AC_VERB_GET_PIN_SENSE, 0); |
| 9911 | present = (present & 0x80000000) != 0; |
| 9912 | if (present) { |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 9913 | /* mute internal speaker */ |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 9914 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 9915 | HDA_AMP_MUTE, HDA_AMP_MUTE); |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 9916 | } else { |
| 9917 | /* unmute internal speaker if necessary */ |
| 9918 | mute = snd_hda_codec_amp_read(codec, 0x1b, 0, HDA_OUTPUT, 0); |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 9919 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 9920 | HDA_AMP_MUTE, mute); |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 9921 | } |
| 9922 | } |
| 9923 | |
| 9924 | /* unsolicited event for HP jack sensing */ |
| 9925 | static void alc262_hippo1_unsol_event(struct hda_codec *codec, |
| 9926 | unsigned int res) |
| 9927 | { |
| 9928 | if ((res >> 26) != ALC880_HP_EVENT) |
| 9929 | return; |
Takashi Iwai | 5b31954 | 2007-07-26 11:49:22 +0200 | [diff] [blame] | 9930 | alc262_hippo1_automute(codec); |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 9931 | } |
| 9932 | |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 9933 | /* |
Pascal Terjan | e8f9ae2 | 2008-08-04 14:36:05 +0200 | [diff] [blame] | 9934 | * nec model |
| 9935 | * 0x15 = headphone |
| 9936 | * 0x16 = internal speaker |
| 9937 | * 0x18 = external mic |
| 9938 | */ |
| 9939 | |
| 9940 | static struct snd_kcontrol_new alc262_nec_mixer[] = { |
| 9941 | HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 9942 | HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x16, 0, 0x0, HDA_OUTPUT), |
| 9943 | |
| 9944 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 9945 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 9946 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 9947 | |
| 9948 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 9949 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 9950 | { } /* end */ |
| 9951 | }; |
| 9952 | |
| 9953 | static struct hda_verb alc262_nec_verbs[] = { |
| 9954 | /* Unmute Speaker */ |
| 9955 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 9956 | |
| 9957 | /* Headphone */ |
| 9958 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 9959 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 9960 | |
| 9961 | /* External mic to headphone */ |
| 9962 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 9963 | /* External mic to speaker */ |
| 9964 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 9965 | {} |
| 9966 | }; |
| 9967 | |
| 9968 | /* |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 9969 | * fujitsu model |
Tony Vroon | 5d9fab2 | 2008-03-14 17:09:18 +0100 | [diff] [blame] | 9970 | * 0x14 = headphone/spdif-out, 0x15 = internal speaker, |
| 9971 | * 0x1b = port replicator headphone out |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 9972 | */ |
| 9973 | |
| 9974 | #define ALC_HP_EVENT 0x37 |
| 9975 | |
| 9976 | static struct hda_verb alc262_fujitsu_unsol_verbs[] = { |
| 9977 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT}, |
| 9978 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Tony Vroon | 5d9fab2 | 2008-03-14 17:09:18 +0100 | [diff] [blame] | 9979 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT}, |
| 9980 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 9981 | {} |
| 9982 | }; |
| 9983 | |
Jiang zhe | 0e31daf | 2008-03-20 12:12:39 +0100 | [diff] [blame] | 9984 | static struct hda_verb alc262_lenovo_3000_unsol_verbs[] = { |
| 9985 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT}, |
| 9986 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 9987 | {} |
| 9988 | }; |
| 9989 | |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 9990 | static struct hda_input_mux alc262_fujitsu_capture_source = { |
Takashi Iwai | 39d3ed3 | 2007-10-12 15:03:48 +0200 | [diff] [blame] | 9991 | .num_items = 3, |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 9992 | .items = { |
| 9993 | { "Mic", 0x0 }, |
Takashi Iwai | 39d3ed3 | 2007-10-12 15:03:48 +0200 | [diff] [blame] | 9994 | { "Int Mic", 0x1 }, |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 9995 | { "CD", 0x4 }, |
| 9996 | }, |
| 9997 | }; |
| 9998 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9999 | static struct hda_input_mux alc262_HP_capture_source = { |
| 10000 | .num_items = 5, |
| 10001 | .items = { |
| 10002 | { "Mic", 0x0 }, |
zhejiang | accbe49 | 2007-08-31 12:36:05 +0200 | [diff] [blame] | 10003 | { "Front Mic", 0x1 }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10004 | { "Line", 0x2 }, |
| 10005 | { "CD", 0x4 }, |
| 10006 | { "AUX IN", 0x6 }, |
| 10007 | }, |
| 10008 | }; |
| 10009 | |
zhejiang | accbe49 | 2007-08-31 12:36:05 +0200 | [diff] [blame] | 10010 | static struct hda_input_mux alc262_HP_D7000_capture_source = { |
| 10011 | .num_items = 4, |
| 10012 | .items = { |
| 10013 | { "Mic", 0x0 }, |
| 10014 | { "Front Mic", 0x2 }, |
| 10015 | { "Line", 0x1 }, |
| 10016 | { "CD", 0x4 }, |
| 10017 | }, |
| 10018 | }; |
| 10019 | |
Takashi Iwai | ebc7a40 | 2008-05-20 09:23:05 +0200 | [diff] [blame] | 10020 | /* mute/unmute internal speaker according to the hp jacks and mute state */ |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 10021 | static void alc262_fujitsu_automute(struct hda_codec *codec, int force) |
| 10022 | { |
| 10023 | struct alc_spec *spec = codec->spec; |
| 10024 | unsigned int mute; |
| 10025 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10026 | if (force || !spec->sense_updated) { |
Takashi Iwai | ebc7a40 | 2008-05-20 09:23:05 +0200 | [diff] [blame] | 10027 | unsigned int present; |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 10028 | /* need to execute and sync at first */ |
| 10029 | 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] | 10030 | /* check laptop HP jack */ |
| 10031 | present = snd_hda_codec_read(codec, 0x14, 0, |
| 10032 | AC_VERB_GET_PIN_SENSE, 0); |
| 10033 | /* need to execute and sync at first */ |
| 10034 | snd_hda_codec_read(codec, 0x1b, 0, AC_VERB_SET_PIN_SENSE, 0); |
| 10035 | /* check docking HP jack */ |
| 10036 | present |= snd_hda_codec_read(codec, 0x1b, 0, |
| 10037 | AC_VERB_GET_PIN_SENSE, 0); |
| 10038 | if (present & AC_PINSENSE_PRESENCE) |
| 10039 | spec->jack_present = 1; |
| 10040 | else |
| 10041 | spec->jack_present = 0; |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 10042 | spec->sense_updated = 1; |
| 10043 | } |
Takashi Iwai | ebc7a40 | 2008-05-20 09:23:05 +0200 | [diff] [blame] | 10044 | /* unmute internal speaker only if both HPs are unplugged and |
| 10045 | * master switch is on |
| 10046 | */ |
| 10047 | if (spec->jack_present) |
| 10048 | mute = HDA_AMP_MUTE; |
| 10049 | else |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 10050 | mute = snd_hda_codec_amp_read(codec, 0x14, 0, HDA_OUTPUT, 0); |
Takashi Iwai | ebc7a40 | 2008-05-20 09:23:05 +0200 | [diff] [blame] | 10051 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 10052 | HDA_AMP_MUTE, mute); |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 10053 | } |
| 10054 | |
| 10055 | /* unsolicited event for HP jack sensing */ |
| 10056 | static void alc262_fujitsu_unsol_event(struct hda_codec *codec, |
| 10057 | unsigned int res) |
| 10058 | { |
| 10059 | if ((res >> 26) != ALC_HP_EVENT) |
| 10060 | return; |
| 10061 | alc262_fujitsu_automute(codec, 1); |
| 10062 | } |
| 10063 | |
Takashi Iwai | ebc7a40 | 2008-05-20 09:23:05 +0200 | [diff] [blame] | 10064 | static void alc262_fujitsu_init_hook(struct hda_codec *codec) |
| 10065 | { |
| 10066 | alc262_fujitsu_automute(codec, 1); |
| 10067 | } |
| 10068 | |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 10069 | /* bind volumes of both NID 0x0c and 0x0d */ |
Takashi Iwai | cca3b37 | 2007-08-10 17:12:15 +0200 | [diff] [blame] | 10070 | static struct hda_bind_ctls alc262_fujitsu_bind_master_vol = { |
| 10071 | .ops = &snd_hda_bind_vol, |
| 10072 | .values = { |
| 10073 | HDA_COMPOSE_AMP_VAL(0x0c, 3, 0, HDA_OUTPUT), |
| 10074 | HDA_COMPOSE_AMP_VAL(0x0d, 3, 0, HDA_OUTPUT), |
| 10075 | 0 |
| 10076 | }, |
| 10077 | }; |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 10078 | |
Jiang zhe | 0e31daf | 2008-03-20 12:12:39 +0100 | [diff] [blame] | 10079 | /* mute/unmute internal speaker according to the hp jack and mute state */ |
| 10080 | static void alc262_lenovo_3000_automute(struct hda_codec *codec, int force) |
| 10081 | { |
| 10082 | struct alc_spec *spec = codec->spec; |
| 10083 | unsigned int mute; |
| 10084 | |
| 10085 | if (force || !spec->sense_updated) { |
| 10086 | unsigned int present_int_hp; |
| 10087 | /* need to execute and sync at first */ |
| 10088 | snd_hda_codec_read(codec, 0x1b, 0, AC_VERB_SET_PIN_SENSE, 0); |
| 10089 | present_int_hp = snd_hda_codec_read(codec, 0x1b, 0, |
| 10090 | AC_VERB_GET_PIN_SENSE, 0); |
| 10091 | spec->jack_present = (present_int_hp & 0x80000000) != 0; |
| 10092 | spec->sense_updated = 1; |
| 10093 | } |
| 10094 | if (spec->jack_present) { |
| 10095 | /* mute internal speaker */ |
| 10096 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 10097 | HDA_AMP_MUTE, HDA_AMP_MUTE); |
| 10098 | snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0, |
| 10099 | HDA_AMP_MUTE, HDA_AMP_MUTE); |
| 10100 | } else { |
| 10101 | /* unmute internal speaker if necessary */ |
| 10102 | mute = snd_hda_codec_amp_read(codec, 0x1b, 0, HDA_OUTPUT, 0); |
| 10103 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 10104 | HDA_AMP_MUTE, mute); |
| 10105 | snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0, |
| 10106 | HDA_AMP_MUTE, mute); |
| 10107 | } |
| 10108 | } |
| 10109 | |
| 10110 | /* unsolicited event for HP jack sensing */ |
| 10111 | static void alc262_lenovo_3000_unsol_event(struct hda_codec *codec, |
| 10112 | unsigned int res) |
| 10113 | { |
| 10114 | if ((res >> 26) != ALC_HP_EVENT) |
| 10115 | return; |
| 10116 | alc262_lenovo_3000_automute(codec, 1); |
| 10117 | } |
| 10118 | |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 10119 | /* bind hp and internal speaker mute (with plug check) */ |
| 10120 | static int alc262_fujitsu_master_sw_put(struct snd_kcontrol *kcontrol, |
| 10121 | struct snd_ctl_elem_value *ucontrol) |
| 10122 | { |
| 10123 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 10124 | long *valp = ucontrol->value.integer.value; |
| 10125 | int change; |
| 10126 | |
Tony Vroon | 5d9fab2 | 2008-03-14 17:09:18 +0100 | [diff] [blame] | 10127 | change = snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 10128 | HDA_AMP_MUTE, |
| 10129 | valp ? 0 : HDA_AMP_MUTE); |
| 10130 | change |= snd_hda_codec_amp_stereo(codec, 0x1b, HDA_OUTPUT, 0, |
| 10131 | HDA_AMP_MUTE, |
| 10132 | valp ? 0 : HDA_AMP_MUTE); |
| 10133 | |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 10134 | if (change) |
| 10135 | alc262_fujitsu_automute(codec, 0); |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 10136 | return change; |
| 10137 | } |
| 10138 | |
| 10139 | static struct snd_kcontrol_new alc262_fujitsu_mixer[] = { |
Takashi Iwai | cca3b37 | 2007-08-10 17:12:15 +0200 | [diff] [blame] | 10140 | HDA_BIND_VOL("Master Playback Volume", &alc262_fujitsu_bind_master_vol), |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 10141 | { |
| 10142 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 10143 | .name = "Master Playback Switch", |
| 10144 | .info = snd_hda_mixer_amp_switch_info, |
| 10145 | .get = snd_hda_mixer_amp_switch_get, |
| 10146 | .put = alc262_fujitsu_master_sw_put, |
| 10147 | .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), |
| 10148 | }, |
| 10149 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 10150 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 10151 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 10152 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 10153 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Takashi Iwai | 39d3ed3 | 2007-10-12 15:03:48 +0200 | [diff] [blame] | 10154 | HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT), |
| 10155 | HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 10156 | HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 10157 | { } /* end */ |
| 10158 | }; |
| 10159 | |
Jiang zhe | 0e31daf | 2008-03-20 12:12:39 +0100 | [diff] [blame] | 10160 | /* bind hp and internal speaker mute (with plug check) */ |
| 10161 | static int alc262_lenovo_3000_master_sw_put(struct snd_kcontrol *kcontrol, |
| 10162 | struct snd_ctl_elem_value *ucontrol) |
| 10163 | { |
| 10164 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 10165 | long *valp = ucontrol->value.integer.value; |
| 10166 | int change; |
| 10167 | |
| 10168 | change = snd_hda_codec_amp_stereo(codec, 0x1b, HDA_OUTPUT, 0, |
| 10169 | HDA_AMP_MUTE, |
| 10170 | valp ? 0 : HDA_AMP_MUTE); |
| 10171 | |
| 10172 | if (change) |
| 10173 | alc262_lenovo_3000_automute(codec, 0); |
| 10174 | return change; |
| 10175 | } |
| 10176 | |
| 10177 | static struct snd_kcontrol_new alc262_lenovo_3000_mixer[] = { |
| 10178 | HDA_BIND_VOL("Master Playback Volume", &alc262_fujitsu_bind_master_vol), |
| 10179 | { |
| 10180 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 10181 | .name = "Master Playback Switch", |
| 10182 | .info = snd_hda_mixer_amp_switch_info, |
| 10183 | .get = snd_hda_mixer_amp_switch_get, |
| 10184 | .put = alc262_lenovo_3000_master_sw_put, |
| 10185 | .private_value = HDA_COMPOSE_AMP_VAL(0x1b, 3, 0, HDA_OUTPUT), |
| 10186 | }, |
| 10187 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 10188 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 10189 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 10190 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 10191 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 10192 | HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT), |
| 10193 | HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 10194 | HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 10195 | { } /* end */ |
| 10196 | }; |
| 10197 | |
Hiroshi Miura | 9f99a63 | 2008-08-28 16:09:06 +0200 | [diff] [blame] | 10198 | static struct snd_kcontrol_new alc262_toshiba_rx1_mixer[] = { |
| 10199 | HDA_BIND_VOL("Master Playback Volume", &alc262_fujitsu_bind_master_vol), |
| 10200 | { |
| 10201 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 10202 | .name = "Master Playback Switch", |
| 10203 | .info = snd_hda_mixer_amp_switch_info, |
| 10204 | .get = snd_hda_mixer_amp_switch_get, |
| 10205 | .put = alc262_sony_master_sw_put, |
| 10206 | .private_value = HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT), |
| 10207 | }, |
| 10208 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 10209 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 10210 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 10211 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 10212 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 10213 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
| 10214 | { } /* end */ |
| 10215 | }; |
| 10216 | |
Takashi Iwai | 304dcaa | 2006-07-25 14:51:16 +0200 | [diff] [blame] | 10217 | /* additional init verbs for Benq laptops */ |
| 10218 | static struct hda_verb alc262_EAPD_verbs[] = { |
| 10219 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 10220 | {0x20, AC_VERB_SET_PROC_COEF, 0x3070}, |
| 10221 | {} |
| 10222 | }; |
| 10223 | |
Kailang Yang | 83c3421 | 2007-07-05 11:43:05 +0200 | [diff] [blame] | 10224 | static struct hda_verb alc262_benq_t31_EAPD_verbs[] = { |
| 10225 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 10226 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 10227 | |
| 10228 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 10229 | {0x20, AC_VERB_SET_PROC_COEF, 0x3050}, |
| 10230 | {} |
| 10231 | }; |
| 10232 | |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 10233 | /* Samsung Q1 Ultra Vista model setup */ |
| 10234 | static struct snd_kcontrol_new alc262_ultra_mixer[] = { |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 10235 | HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 10236 | HDA_BIND_MUTE("Master Playback Switch", 0x0c, 2, HDA_INPUT), |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 10237 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 10238 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 10239 | HDA_CODEC_VOLUME("Mic Boost", 0x19, 0, HDA_INPUT), |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 10240 | HDA_CODEC_VOLUME("Headphone Mic Boost", 0x15, 0, HDA_INPUT), |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 10241 | { } /* end */ |
| 10242 | }; |
| 10243 | |
| 10244 | static struct hda_verb alc262_ultra_verbs[] = { |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 10245 | /* output mixer */ |
| 10246 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 10247 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 10248 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 10249 | /* speaker */ |
| 10250 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 10251 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 10252 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10253 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 10254 | /* HP */ |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 10255 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 10256 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 10257 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10258 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 10259 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 10260 | /* internal mic */ |
| 10261 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 10262 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 10263 | /* ADC, choose mic */ |
| 10264 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 10265 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 10266 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 10267 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 10268 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 10269 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 10270 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, |
| 10271 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, |
| 10272 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, |
| 10273 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(8)}, |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 10274 | {} |
| 10275 | }; |
| 10276 | |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 10277 | /* mute/unmute internal speaker according to the hp jack and mute state */ |
| 10278 | static void alc262_ultra_automute(struct hda_codec *codec) |
| 10279 | { |
| 10280 | struct alc_spec *spec = codec->spec; |
| 10281 | unsigned int mute; |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 10282 | |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 10283 | mute = 0; |
| 10284 | /* auto-mute only when HP is used as HP */ |
| 10285 | if (!spec->cur_mux[0]) { |
| 10286 | unsigned int present; |
| 10287 | /* need to execute and sync at first */ |
| 10288 | snd_hda_codec_read(codec, 0x15, 0, AC_VERB_SET_PIN_SENSE, 0); |
| 10289 | present = snd_hda_codec_read(codec, 0x15, 0, |
| 10290 | AC_VERB_GET_PIN_SENSE, 0); |
| 10291 | spec->jack_present = (present & AC_PINSENSE_PRESENCE) != 0; |
| 10292 | if (spec->jack_present) |
| 10293 | mute = HDA_AMP_MUTE; |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 10294 | } |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 10295 | /* mute/unmute internal speaker */ |
| 10296 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 10297 | HDA_AMP_MUTE, mute); |
| 10298 | /* mute/unmute HP */ |
| 10299 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 10300 | HDA_AMP_MUTE, mute ? 0 : HDA_AMP_MUTE); |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 10301 | } |
| 10302 | |
| 10303 | /* unsolicited event for HP jack sensing */ |
| 10304 | static void alc262_ultra_unsol_event(struct hda_codec *codec, |
| 10305 | unsigned int res) |
| 10306 | { |
| 10307 | if ((res >> 26) != ALC880_HP_EVENT) |
| 10308 | return; |
| 10309 | alc262_ultra_automute(codec); |
| 10310 | } |
| 10311 | |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 10312 | static struct hda_input_mux alc262_ultra_capture_source = { |
| 10313 | .num_items = 2, |
| 10314 | .items = { |
| 10315 | { "Mic", 0x1 }, |
| 10316 | { "Headphone", 0x7 }, |
| 10317 | }, |
| 10318 | }; |
| 10319 | |
| 10320 | static int alc262_ultra_mux_enum_put(struct snd_kcontrol *kcontrol, |
| 10321 | struct snd_ctl_elem_value *ucontrol) |
| 10322 | { |
| 10323 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 10324 | struct alc_spec *spec = codec->spec; |
| 10325 | int ret; |
| 10326 | |
Takashi Iwai | 54cbc9a | 2008-10-31 15:24:04 +0100 | [diff] [blame] | 10327 | ret = alc_mux_enum_put(kcontrol, ucontrol); |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 10328 | if (!ret) |
| 10329 | return 0; |
| 10330 | /* reprogram the HP pin as mic or HP according to the input source */ |
| 10331 | snd_hda_codec_write_cache(codec, 0x15, 0, |
| 10332 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 10333 | spec->cur_mux[0] ? PIN_VREF80 : PIN_HP); |
| 10334 | alc262_ultra_automute(codec); /* mute/unmute HP */ |
| 10335 | return ret; |
| 10336 | } |
| 10337 | |
| 10338 | static struct snd_kcontrol_new alc262_ultra_capture_mixer[] = { |
| 10339 | HDA_CODEC_VOLUME("Capture Volume", 0x07, 0x0, HDA_INPUT), |
| 10340 | HDA_CODEC_MUTE("Capture Switch", 0x07, 0x0, HDA_INPUT), |
| 10341 | { |
| 10342 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 10343 | .name = "Capture Source", |
Takashi Iwai | 54cbc9a | 2008-10-31 15:24:04 +0100 | [diff] [blame] | 10344 | .info = alc_mux_enum_info, |
| 10345 | .get = alc_mux_enum_get, |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 10346 | .put = alc262_ultra_mux_enum_put, |
| 10347 | }, |
| 10348 | { } /* end */ |
| 10349 | }; |
| 10350 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10351 | /* add playback controls from the parsed DAC table */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10352 | static int alc262_auto_create_multi_out_ctls(struct alc_spec *spec, |
| 10353 | const struct auto_pin_cfg *cfg) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10354 | { |
| 10355 | hda_nid_t nid; |
| 10356 | int err; |
| 10357 | |
| 10358 | spec->multiout.num_dacs = 1; /* only use one dac */ |
| 10359 | spec->multiout.dac_nids = spec->private_dac_nids; |
| 10360 | spec->multiout.dac_nids[0] = 2; |
| 10361 | |
| 10362 | nid = cfg->line_out_pins[0]; |
| 10363 | if (nid) { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10364 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 10365 | "Front Playback Volume", |
| 10366 | HDA_COMPOSE_AMP_VAL(0x0c, 3, 0, HDA_OUTPUT)); |
| 10367 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10368 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10369 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, |
| 10370 | "Front Playback Switch", |
| 10371 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT)); |
| 10372 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10373 | return err; |
| 10374 | } |
| 10375 | |
Takashi Iwai | 82bc955 | 2006-03-21 11:24:42 +0100 | [diff] [blame] | 10376 | nid = cfg->speaker_pins[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10377 | if (nid) { |
| 10378 | if (nid == 0x16) { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10379 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 10380 | "Speaker Playback Volume", |
| 10381 | HDA_COMPOSE_AMP_VAL(0x0e, 2, 0, |
| 10382 | HDA_OUTPUT)); |
| 10383 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10384 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10385 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, |
| 10386 | "Speaker Playback Switch", |
| 10387 | HDA_COMPOSE_AMP_VAL(nid, 2, 0, |
| 10388 | HDA_OUTPUT)); |
| 10389 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10390 | return err; |
| 10391 | } else { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10392 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, |
| 10393 | "Speaker Playback Switch", |
| 10394 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, |
| 10395 | HDA_OUTPUT)); |
| 10396 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10397 | return err; |
| 10398 | } |
| 10399 | } |
Takashi Iwai | eb06ed8 | 2006-09-20 17:10:27 +0200 | [diff] [blame] | 10400 | nid = cfg->hp_pins[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10401 | if (nid) { |
| 10402 | /* spec->multiout.hp_nid = 2; */ |
| 10403 | if (nid == 0x16) { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10404 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 10405 | "Headphone Playback Volume", |
| 10406 | HDA_COMPOSE_AMP_VAL(0x0e, 2, 0, |
| 10407 | HDA_OUTPUT)); |
| 10408 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10409 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10410 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, |
| 10411 | "Headphone Playback Switch", |
| 10412 | HDA_COMPOSE_AMP_VAL(nid, 2, 0, |
| 10413 | HDA_OUTPUT)); |
| 10414 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10415 | return err; |
| 10416 | } else { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10417 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, |
| 10418 | "Headphone Playback Switch", |
| 10419 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, |
| 10420 | HDA_OUTPUT)); |
| 10421 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10422 | return err; |
| 10423 | } |
| 10424 | } |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10425 | return 0; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10426 | } |
| 10427 | |
| 10428 | /* identical with ALC880 */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10429 | #define alc262_auto_create_analog_input_ctls \ |
| 10430 | alc880_auto_create_analog_input_ctls |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10431 | |
| 10432 | /* |
| 10433 | * generic initialization of ADC, input mixers and output mixers |
| 10434 | */ |
| 10435 | static struct hda_verb alc262_volume_init_verbs[] = { |
| 10436 | /* |
| 10437 | * Unmute ADC0-2 and set the default input to mic-in |
| 10438 | */ |
| 10439 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 10440 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10441 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 10442 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10443 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 10444 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10445 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 10446 | /* 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] | 10447 | * mixer widget |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10448 | * Note: PASD motherboards uses the Line In 2 as the input for |
| 10449 | * front panel mic (mic 2) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10450 | */ |
| 10451 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 10452 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 10453 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 10454 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 10455 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 10456 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10457 | |
| 10458 | /* |
| 10459 | * Set up output mixers (0x0c - 0x0f) |
| 10460 | */ |
| 10461 | /* set vol=0 to output mixers */ |
| 10462 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 10463 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 10464 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 10465 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10466 | /* set up input amps for analog loopback */ |
| 10467 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 10468 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10469 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 10470 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10471 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 10472 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10473 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 10474 | |
| 10475 | /* FIXME: use matrix-type input source selection */ |
| 10476 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 10477 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ |
| 10478 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 10479 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 10480 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 10481 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 10482 | /* Input mixer2 */ |
| 10483 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 10484 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 10485 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 10486 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 10487 | /* Input mixer3 */ |
| 10488 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 10489 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 10490 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 10491 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 10492 | |
| 10493 | { } |
| 10494 | }; |
| 10495 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10496 | static struct hda_verb alc262_HP_BPC_init_verbs[] = { |
| 10497 | /* |
| 10498 | * Unmute ADC0-2 and set the default input to mic-in |
| 10499 | */ |
| 10500 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 10501 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10502 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 10503 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10504 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 10505 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10506 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 10507 | /* 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] | 10508 | * mixer widget |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10509 | * Note: PASD motherboards uses the Line In 2 as the input for |
| 10510 | * front panel mic (mic 2) |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10511 | */ |
| 10512 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 10513 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 10514 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 10515 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 10516 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 10517 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 10518 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, |
| 10519 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 10520 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10521 | /* |
| 10522 | * Set up output mixers (0x0c - 0x0e) |
| 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}, |
| 10528 | |
| 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 | |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 10538 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10539 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 10540 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 10541 | |
| 10542 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 10543 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 10544 | |
| 10545 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 10546 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 10547 | |
| 10548 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 10549 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 10550 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 10551 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 10552 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 10553 | |
| 10554 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x7023 }, |
| 10555 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
| 10556 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
| 10557 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, 0x7023 }, |
| 10558 | {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
| 10559 | {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
| 10560 | |
| 10561 | |
| 10562 | /* FIXME: use matrix-type input source selection */ |
| 10563 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 10564 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ |
| 10565 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 10566 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))}, |
| 10567 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))}, |
| 10568 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))}, |
| 10569 | /* Input mixer2 */ |
| 10570 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 10571 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))}, |
| 10572 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))}, |
| 10573 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))}, |
| 10574 | /* Input mixer3 */ |
| 10575 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 10576 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))}, |
| 10577 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))}, |
| 10578 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))}, |
| 10579 | |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 10580 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 10581 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10582 | { } |
| 10583 | }; |
| 10584 | |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 10585 | static struct hda_verb alc262_HP_BPC_WildWest_init_verbs[] = { |
| 10586 | /* |
| 10587 | * Unmute ADC0-2 and set the default input to mic-in |
| 10588 | */ |
| 10589 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 10590 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10591 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 10592 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10593 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 10594 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10595 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 10596 | /* 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] | 10597 | * mixer widget |
| 10598 | * Note: PASD motherboards uses the Line In 2 as the input for front |
| 10599 | * panel mic (mic 2) |
| 10600 | */ |
| 10601 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 10602 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 10603 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 10604 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 10605 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 10606 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 10607 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, |
| 10608 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, |
| 10609 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 10610 | /* |
| 10611 | * Set up output mixers (0x0c - 0x0e) |
| 10612 | */ |
| 10613 | /* set vol=0 to output mixers */ |
| 10614 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 10615 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 10616 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 10617 | |
| 10618 | /* set up input amps for analog loopback */ |
| 10619 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 10620 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10621 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 10622 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10623 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 10624 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10625 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 10626 | |
| 10627 | |
| 10628 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, /* HP */ |
| 10629 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, /* Mono */ |
| 10630 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* rear MIC */ |
| 10631 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, /* Line in */ |
| 10632 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* Front MIC */ |
| 10633 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, /* Line out */ |
| 10634 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, /* CD in */ |
| 10635 | |
| 10636 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 10637 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 10638 | |
| 10639 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 10640 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 10641 | |
| 10642 | /* {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x7023 }, */ |
| 10643 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
| 10644 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
| 10645 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, 0x7023 }, |
| 10646 | {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
| 10647 | {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
| 10648 | |
| 10649 | /* FIXME: use matrix-type input source selection */ |
| 10650 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 10651 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ |
| 10652 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, /*rear MIC*/ |
| 10653 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, /*Line in*/ |
| 10654 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))}, /*F MIC*/ |
| 10655 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))}, /*Front*/ |
| 10656 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))}, /*CD*/ |
| 10657 | /* {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */ |
| 10658 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x07 << 8))}, /*HP*/ |
| 10659 | /* Input mixer2 */ |
| 10660 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 10661 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 10662 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))}, |
| 10663 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))}, |
| 10664 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))}, |
| 10665 | /* {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */ |
| 10666 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x07 << 8))}, |
| 10667 | /* Input mixer3 */ |
| 10668 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 10669 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 10670 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))}, |
| 10671 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))}, |
| 10672 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))}, |
| 10673 | /* {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */ |
| 10674 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x07 << 8))}, |
| 10675 | |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 10676 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 10677 | |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 10678 | { } |
| 10679 | }; |
| 10680 | |
Hiroshi Miura | 9f99a63 | 2008-08-28 16:09:06 +0200 | [diff] [blame] | 10681 | static struct hda_verb alc262_toshiba_rx1_unsol_verbs[] = { |
| 10682 | |
| 10683 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, /* Front Speaker */ |
| 10684 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 10685 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 10686 | |
| 10687 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* MIC jack */ |
| 10688 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* Front MIC */ |
| 10689 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0) }, |
| 10690 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0) }, |
| 10691 | |
| 10692 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, /* HP jack */ |
| 10693 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 10694 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 10695 | {} |
| 10696 | }; |
| 10697 | |
| 10698 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 10699 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 10700 | #define alc262_loopbacks alc880_loopbacks |
| 10701 | #endif |
| 10702 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10703 | /* pcm configuration: identiacal with ALC880 */ |
| 10704 | #define alc262_pcm_analog_playback alc880_pcm_analog_playback |
| 10705 | #define alc262_pcm_analog_capture alc880_pcm_analog_capture |
| 10706 | #define alc262_pcm_digital_playback alc880_pcm_digital_playback |
| 10707 | #define alc262_pcm_digital_capture alc880_pcm_digital_capture |
| 10708 | |
| 10709 | /* |
| 10710 | * BIOS auto configuration |
| 10711 | */ |
| 10712 | static int alc262_parse_auto_config(struct hda_codec *codec) |
| 10713 | { |
| 10714 | struct alc_spec *spec = codec->spec; |
| 10715 | int err; |
| 10716 | static hda_nid_t alc262_ignore[] = { 0x1d, 0 }; |
| 10717 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10718 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 10719 | alc262_ignore); |
| 10720 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10721 | return err; |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 10722 | if (!spec->autocfg.line_outs) { |
Takashi Iwai | 0852d7a | 2009-02-11 11:35:15 +0100 | [diff] [blame] | 10723 | if (spec->autocfg.dig_outs || spec->autocfg.dig_in_pin) { |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 10724 | spec->multiout.max_channels = 2; |
| 10725 | spec->no_analog = 1; |
| 10726 | goto dig_only; |
| 10727 | } |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10728 | return 0; /* can't find valid BIOS pin config */ |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 10729 | } |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10730 | err = alc262_auto_create_multi_out_ctls(spec, &spec->autocfg); |
| 10731 | if (err < 0) |
| 10732 | return err; |
| 10733 | err = alc262_auto_create_analog_input_ctls(spec, &spec->autocfg); |
| 10734 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10735 | return err; |
| 10736 | |
| 10737 | spec->multiout.max_channels = spec->multiout.num_dacs * 2; |
| 10738 | |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 10739 | dig_only: |
Takashi Iwai | 0852d7a | 2009-02-11 11:35:15 +0100 | [diff] [blame] | 10740 | if (spec->autocfg.dig_outs) { |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10741 | spec->multiout.dig_out_nid = ALC262_DIGOUT_NID; |
Takashi Iwai | 0852d7a | 2009-02-11 11:35:15 +0100 | [diff] [blame] | 10742 | spec->dig_out_type = spec->autocfg.dig_out_type[0]; |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 10743 | } |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10744 | if (spec->autocfg.dig_in_pin) |
| 10745 | spec->dig_in_nid = ALC262_DIGIN_NID; |
| 10746 | |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 10747 | if (spec->kctls.list) |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 10748 | add_mixer(spec, spec->kctls.list); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10749 | |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 10750 | add_verb(spec, alc262_volume_init_verbs); |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 10751 | spec->num_mux_defs = 1; |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 10752 | spec->input_mux = &spec->private_imux[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10753 | |
Takashi Iwai | 776e184 | 2007-08-29 15:07:11 +0200 | [diff] [blame] | 10754 | err = alc_auto_add_mic_boost(codec); |
| 10755 | if (err < 0) |
| 10756 | return err; |
| 10757 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10758 | return 1; |
| 10759 | } |
| 10760 | |
| 10761 | #define alc262_auto_init_multi_out alc882_auto_init_multi_out |
| 10762 | #define alc262_auto_init_hp_out alc882_auto_init_hp_out |
| 10763 | #define alc262_auto_init_analog_input alc882_auto_init_analog_input |
Takashi Iwai | f511b01 | 2008-08-15 16:46:42 +0200 | [diff] [blame] | 10764 | #define alc262_auto_init_input_src alc882_auto_init_input_src |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10765 | |
| 10766 | |
| 10767 | /* init callback for auto-configuration model -- overriding the default init */ |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 10768 | static void alc262_auto_init(struct hda_codec *codec) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10769 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 10770 | struct alc_spec *spec = codec->spec; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10771 | alc262_auto_init_multi_out(codec); |
| 10772 | alc262_auto_init_hp_out(codec); |
| 10773 | alc262_auto_init_analog_input(codec); |
Takashi Iwai | f511b01 | 2008-08-15 16:46:42 +0200 | [diff] [blame] | 10774 | alc262_auto_init_input_src(codec); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 10775 | if (spec->unsol_event) |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 10776 | alc_inithook(codec); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10777 | } |
| 10778 | |
| 10779 | /* |
| 10780 | * configuration and preset |
| 10781 | */ |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 10782 | static const char *alc262_models[ALC262_MODEL_LAST] = { |
| 10783 | [ALC262_BASIC] = "basic", |
| 10784 | [ALC262_HIPPO] = "hippo", |
| 10785 | [ALC262_HIPPO_1] = "hippo_1", |
| 10786 | [ALC262_FUJITSU] = "fujitsu", |
| 10787 | [ALC262_HP_BPC] = "hp-bpc", |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 10788 | [ALC262_HP_BPC_D7000_WL]= "hp-bpc-d7000", |
Takashi Iwai | 61dc35d | 2007-11-14 12:26:44 +0100 | [diff] [blame] | 10789 | [ALC262_HP_TC_T5735] = "hp-tc-t5735", |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 10790 | [ALC262_HP_RP5700] = "hp-rp5700", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 10791 | [ALC262_BENQ_ED8] = "benq", |
Takashi Iwai | 0f40502 | 2007-07-06 12:24:11 +0200 | [diff] [blame] | 10792 | [ALC262_BENQ_T31] = "benq-t31", |
| 10793 | [ALC262_SONY_ASSAMD] = "sony-assamd", |
Takashi Iwai | 2922c9a | 2008-08-27 18:12:42 +0200 | [diff] [blame] | 10794 | [ALC262_TOSHIBA_S06] = "toshiba-s06", |
Hiroshi Miura | 9f99a63 | 2008-08-28 16:09:06 +0200 | [diff] [blame] | 10795 | [ALC262_TOSHIBA_RX1] = "toshiba-rx1", |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 10796 | [ALC262_ULTRA] = "ultra", |
Jiang zhe | 0e31daf | 2008-03-20 12:12:39 +0100 | [diff] [blame] | 10797 | [ALC262_LENOVO_3000] = "lenovo-3000", |
Pascal Terjan | e8f9ae2 | 2008-08-04 14:36:05 +0200 | [diff] [blame] | 10798 | [ALC262_NEC] = "nec", |
Tony Vroon | ba340e8 | 2009-02-02 19:01:30 +0000 | [diff] [blame] | 10799 | [ALC262_TYAN] = "tyan", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 10800 | [ALC262_AUTO] = "auto", |
| 10801 | }; |
| 10802 | |
| 10803 | static struct snd_pci_quirk alc262_cfg_tbl[] = { |
| 10804 | SND_PCI_QUIRK(0x1002, 0x437b, "Hippo", ALC262_HIPPO), |
Pascal Terjan | e8f9ae2 | 2008-08-04 14:36:05 +0200 | [diff] [blame] | 10805 | SND_PCI_QUIRK(0x1033, 0x8895, "NEC Versa S9100", ALC262_NEC), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 10806 | SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x1200, "HP xw series", |
| 10807 | ALC262_HP_BPC), |
| 10808 | SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x1300, "HP xw series", |
| 10809 | ALC262_HP_BPC), |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 10810 | SND_PCI_QUIRK(0x103c, 0x2800, "HP D7000", ALC262_HP_BPC_D7000_WL), |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 10811 | SND_PCI_QUIRK(0x103c, 0x2801, "HP D7000", ALC262_HP_BPC_D7000_WF), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 10812 | SND_PCI_QUIRK(0x103c, 0x2802, "HP D7000", ALC262_HP_BPC_D7000_WL), |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 10813 | SND_PCI_QUIRK(0x103c, 0x2803, "HP D7000", ALC262_HP_BPC_D7000_WF), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 10814 | SND_PCI_QUIRK(0x103c, 0x2804, "HP D7000", ALC262_HP_BPC_D7000_WL), |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 10815 | SND_PCI_QUIRK(0x103c, 0x2805, "HP D7000", ALC262_HP_BPC_D7000_WF), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 10816 | SND_PCI_QUIRK(0x103c, 0x2806, "HP D7000", ALC262_HP_BPC_D7000_WL), |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 10817 | SND_PCI_QUIRK(0x103c, 0x2807, "HP D7000", ALC262_HP_BPC_D7000_WF), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 10818 | SND_PCI_QUIRK(0x103c, 0x280c, "HP xw4400", ALC262_HP_BPC), |
| 10819 | SND_PCI_QUIRK(0x103c, 0x3014, "HP xw6400", ALC262_HP_BPC), |
| 10820 | SND_PCI_QUIRK(0x103c, 0x3015, "HP xw8400", ALC262_HP_BPC), |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 10821 | SND_PCI_QUIRK(0x103c, 0x302f, "HP Thin Client T5735", |
| 10822 | ALC262_HP_TC_T5735), |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 10823 | SND_PCI_QUIRK(0x103c, 0x2817, "HP RP5700", ALC262_HP_RP5700), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 10824 | SND_PCI_QUIRK(0x104d, 0x1f00, "Sony ASSAMD", ALC262_SONY_ASSAMD), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 10825 | SND_PCI_QUIRK(0x104d, 0x8203, "Sony UX-90", ALC262_HIPPO), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 10826 | SND_PCI_QUIRK(0x104d, 0x820f, "Sony ASSAMD", ALC262_SONY_ASSAMD), |
Takashi Iwai | f872a91 | 2009-02-26 00:57:01 +0100 | [diff] [blame^] | 10827 | SND_PCI_QUIRK_MASK(0x104d, 0xff00, 0x9000, "Sony VAIO", |
| 10828 | ALC262_SONY_ASSAMD), |
Akio Idehara | 36ca6e1 | 2008-06-09 22:57:40 +0900 | [diff] [blame] | 10829 | SND_PCI_QUIRK(0x1179, 0x0001, "Toshiba dynabook SS RX1", |
Hiroshi Miura | 9f99a63 | 2008-08-28 16:09:06 +0200 | [diff] [blame] | 10830 | ALC262_TOSHIBA_RX1), |
Kailang Yang | 80ffe86 | 2008-10-15 11:23:27 +0200 | [diff] [blame] | 10831 | SND_PCI_QUIRK(0x1179, 0xff7b, "Toshiba S06", ALC262_TOSHIBA_S06), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 10832 | SND_PCI_QUIRK(0x10cf, 0x1397, "Fujitsu", ALC262_FUJITSU), |
Tony Vroon | 3f1eeae | 2008-02-25 16:44:13 +0100 | [diff] [blame] | 10833 | SND_PCI_QUIRK(0x10cf, 0x142d, "Fujitsu Lifebook E8410", ALC262_FUJITSU), |
Tony Vroon | ba340e8 | 2009-02-02 19:01:30 +0000 | [diff] [blame] | 10834 | SND_PCI_QUIRK(0x10f1, 0x2915, "Tyan Thunder n6650W", ALC262_TYAN), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 10835 | SND_PCI_QUIRK_MASK(0x144d, 0xff00, 0xc032, "Samsung Q1", |
| 10836 | ALC262_ULTRA), |
Luke Yelavich | 3e420e7 | 2008-12-16 12:37:47 +1100 | [diff] [blame] | 10837 | SND_PCI_QUIRK(0x144d, 0xc510, "Samsung Q45", ALC262_HIPPO), |
Jiang zhe | 0e31daf | 2008-03-20 12:12:39 +0100 | [diff] [blame] | 10838 | SND_PCI_QUIRK(0x17aa, 0x384e, "Lenovo 3000 y410", ALC262_LENOVO_3000), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 10839 | SND_PCI_QUIRK(0x17ff, 0x0560, "Benq ED8", ALC262_BENQ_ED8), |
Kailang Yang | 83c3421 | 2007-07-05 11:43:05 +0200 | [diff] [blame] | 10840 | SND_PCI_QUIRK(0x17ff, 0x058d, "Benq T31-16", ALC262_BENQ_T31), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 10841 | SND_PCI_QUIRK(0x17ff, 0x058f, "Benq Hippo", ALC262_HIPPO_1), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10842 | {} |
| 10843 | }; |
| 10844 | |
| 10845 | static struct alc_config_preset alc262_presets[] = { |
| 10846 | [ALC262_BASIC] = { |
| 10847 | .mixers = { alc262_base_mixer }, |
| 10848 | .init_verbs = { alc262_init_verbs }, |
| 10849 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 10850 | .dac_nids = alc262_dac_nids, |
| 10851 | .hp_nid = 0x03, |
| 10852 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 10853 | .channel_mode = alc262_modes, |
Takashi Iwai | a3bcba3 | 2005-12-06 19:05:29 +0100 | [diff] [blame] | 10854 | .input_mux = &alc262_capture_source, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10855 | }, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 10856 | [ALC262_HIPPO] = { |
| 10857 | .mixers = { alc262_base_mixer }, |
| 10858 | .init_verbs = { alc262_init_verbs, alc262_hippo_unsol_verbs}, |
| 10859 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 10860 | .dac_nids = alc262_dac_nids, |
| 10861 | .hp_nid = 0x03, |
| 10862 | .dig_out_nid = ALC262_DIGOUT_NID, |
| 10863 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 10864 | .channel_mode = alc262_modes, |
| 10865 | .input_mux = &alc262_capture_source, |
| 10866 | .unsol_event = alc262_hippo_unsol_event, |
Takashi Iwai | 5b31954 | 2007-07-26 11:49:22 +0200 | [diff] [blame] | 10867 | .init_hook = alc262_hippo_automute, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 10868 | }, |
| 10869 | [ALC262_HIPPO_1] = { |
| 10870 | .mixers = { alc262_hippo1_mixer }, |
| 10871 | .init_verbs = { alc262_init_verbs, alc262_hippo1_unsol_verbs}, |
| 10872 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 10873 | .dac_nids = alc262_dac_nids, |
| 10874 | .hp_nid = 0x02, |
| 10875 | .dig_out_nid = ALC262_DIGOUT_NID, |
| 10876 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 10877 | .channel_mode = alc262_modes, |
| 10878 | .input_mux = &alc262_capture_source, |
| 10879 | .unsol_event = alc262_hippo1_unsol_event, |
Takashi Iwai | 5b31954 | 2007-07-26 11:49:22 +0200 | [diff] [blame] | 10880 | .init_hook = alc262_hippo1_automute, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 10881 | }, |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 10882 | [ALC262_FUJITSU] = { |
| 10883 | .mixers = { alc262_fujitsu_mixer }, |
Takashi Iwai | 39d3ed3 | 2007-10-12 15:03:48 +0200 | [diff] [blame] | 10884 | .init_verbs = { alc262_init_verbs, alc262_EAPD_verbs, |
| 10885 | alc262_fujitsu_unsol_verbs }, |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 10886 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 10887 | .dac_nids = alc262_dac_nids, |
| 10888 | .hp_nid = 0x03, |
| 10889 | .dig_out_nid = ALC262_DIGOUT_NID, |
| 10890 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 10891 | .channel_mode = alc262_modes, |
| 10892 | .input_mux = &alc262_fujitsu_capture_source, |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 10893 | .unsol_event = alc262_fujitsu_unsol_event, |
Takashi Iwai | ebc7a40 | 2008-05-20 09:23:05 +0200 | [diff] [blame] | 10894 | .init_hook = alc262_fujitsu_init_hook, |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 10895 | }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10896 | [ALC262_HP_BPC] = { |
| 10897 | .mixers = { alc262_HP_BPC_mixer }, |
| 10898 | .init_verbs = { alc262_HP_BPC_init_verbs }, |
| 10899 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 10900 | .dac_nids = alc262_dac_nids, |
| 10901 | .hp_nid = 0x03, |
| 10902 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 10903 | .channel_mode = alc262_modes, |
| 10904 | .input_mux = &alc262_HP_capture_source, |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 10905 | .unsol_event = alc262_hp_bpc_unsol_event, |
| 10906 | .init_hook = alc262_hp_bpc_automute, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10907 | }, |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 10908 | [ALC262_HP_BPC_D7000_WF] = { |
| 10909 | .mixers = { alc262_HP_BPC_WildWest_mixer }, |
| 10910 | .init_verbs = { alc262_HP_BPC_WildWest_init_verbs }, |
| 10911 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 10912 | .dac_nids = alc262_dac_nids, |
| 10913 | .hp_nid = 0x03, |
| 10914 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 10915 | .channel_mode = alc262_modes, |
zhejiang | accbe49 | 2007-08-31 12:36:05 +0200 | [diff] [blame] | 10916 | .input_mux = &alc262_HP_D7000_capture_source, |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 10917 | .unsol_event = alc262_hp_wildwest_unsol_event, |
| 10918 | .init_hook = alc262_hp_wildwest_automute, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10919 | }, |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 10920 | [ALC262_HP_BPC_D7000_WL] = { |
| 10921 | .mixers = { alc262_HP_BPC_WildWest_mixer, |
| 10922 | alc262_HP_BPC_WildWest_option_mixer }, |
| 10923 | .init_verbs = { alc262_HP_BPC_WildWest_init_verbs }, |
| 10924 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 10925 | .dac_nids = alc262_dac_nids, |
| 10926 | .hp_nid = 0x03, |
| 10927 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 10928 | .channel_mode = alc262_modes, |
zhejiang | accbe49 | 2007-08-31 12:36:05 +0200 | [diff] [blame] | 10929 | .input_mux = &alc262_HP_D7000_capture_source, |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 10930 | .unsol_event = alc262_hp_wildwest_unsol_event, |
| 10931 | .init_hook = alc262_hp_wildwest_automute, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10932 | }, |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 10933 | [ALC262_HP_TC_T5735] = { |
| 10934 | .mixers = { alc262_hp_t5735_mixer }, |
| 10935 | .init_verbs = { alc262_init_verbs, alc262_hp_t5735_verbs }, |
| 10936 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 10937 | .dac_nids = alc262_dac_nids, |
| 10938 | .hp_nid = 0x03, |
| 10939 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 10940 | .channel_mode = alc262_modes, |
| 10941 | .input_mux = &alc262_capture_source, |
| 10942 | .unsol_event = alc262_hp_t5735_unsol_event, |
| 10943 | .init_hook = alc262_hp_t5735_init_hook, |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 10944 | }, |
| 10945 | [ALC262_HP_RP5700] = { |
| 10946 | .mixers = { alc262_hp_rp5700_mixer }, |
| 10947 | .init_verbs = { alc262_init_verbs, alc262_hp_rp5700_verbs }, |
| 10948 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 10949 | .dac_nids = alc262_dac_nids, |
| 10950 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 10951 | .channel_mode = alc262_modes, |
| 10952 | .input_mux = &alc262_hp_rp5700_capture_source, |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 10953 | }, |
Takashi Iwai | 304dcaa | 2006-07-25 14:51:16 +0200 | [diff] [blame] | 10954 | [ALC262_BENQ_ED8] = { |
| 10955 | .mixers = { alc262_base_mixer }, |
| 10956 | .init_verbs = { alc262_init_verbs, alc262_EAPD_verbs }, |
| 10957 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 10958 | .dac_nids = alc262_dac_nids, |
| 10959 | .hp_nid = 0x03, |
| 10960 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 10961 | .channel_mode = alc262_modes, |
| 10962 | .input_mux = &alc262_capture_source, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10963 | }, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 10964 | [ALC262_SONY_ASSAMD] = { |
| 10965 | .mixers = { alc262_sony_mixer }, |
| 10966 | .init_verbs = { alc262_init_verbs, alc262_sony_unsol_verbs}, |
| 10967 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 10968 | .dac_nids = alc262_dac_nids, |
| 10969 | .hp_nid = 0x02, |
| 10970 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 10971 | .channel_mode = alc262_modes, |
| 10972 | .input_mux = &alc262_capture_source, |
| 10973 | .unsol_event = alc262_hippo_unsol_event, |
Takashi Iwai | 5b31954 | 2007-07-26 11:49:22 +0200 | [diff] [blame] | 10974 | .init_hook = alc262_hippo_automute, |
Kailang Yang | 83c3421 | 2007-07-05 11:43:05 +0200 | [diff] [blame] | 10975 | }, |
| 10976 | [ALC262_BENQ_T31] = { |
| 10977 | .mixers = { alc262_benq_t31_mixer }, |
| 10978 | .init_verbs = { alc262_init_verbs, alc262_benq_t31_EAPD_verbs, alc262_hippo_unsol_verbs }, |
| 10979 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 10980 | .dac_nids = alc262_dac_nids, |
| 10981 | .hp_nid = 0x03, |
| 10982 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 10983 | .channel_mode = alc262_modes, |
| 10984 | .input_mux = &alc262_capture_source, |
| 10985 | .unsol_event = alc262_hippo_unsol_event, |
Takashi Iwai | 5b31954 | 2007-07-26 11:49:22 +0200 | [diff] [blame] | 10986 | .init_hook = alc262_hippo_automute, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 10987 | }, |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 10988 | [ALC262_ULTRA] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 10989 | .mixers = { alc262_ultra_mixer }, |
| 10990 | .cap_mixer = alc262_ultra_capture_mixer, |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 10991 | .init_verbs = { alc262_ultra_verbs }, |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 10992 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 10993 | .dac_nids = alc262_dac_nids, |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 10994 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 10995 | .channel_mode = alc262_modes, |
| 10996 | .input_mux = &alc262_ultra_capture_source, |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 10997 | .adc_nids = alc262_adc_nids, /* ADC0 */ |
| 10998 | .capsrc_nids = alc262_capsrc_nids, |
| 10999 | .num_adc_nids = 1, /* single ADC */ |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 11000 | .unsol_event = alc262_ultra_unsol_event, |
| 11001 | .init_hook = alc262_ultra_automute, |
| 11002 | }, |
Jiang zhe | 0e31daf | 2008-03-20 12:12:39 +0100 | [diff] [blame] | 11003 | [ALC262_LENOVO_3000] = { |
| 11004 | .mixers = { alc262_lenovo_3000_mixer }, |
| 11005 | .init_verbs = { alc262_init_verbs, alc262_EAPD_verbs, |
| 11006 | alc262_lenovo_3000_unsol_verbs }, |
| 11007 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 11008 | .dac_nids = alc262_dac_nids, |
| 11009 | .hp_nid = 0x03, |
| 11010 | .dig_out_nid = ALC262_DIGOUT_NID, |
| 11011 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 11012 | .channel_mode = alc262_modes, |
| 11013 | .input_mux = &alc262_fujitsu_capture_source, |
| 11014 | .unsol_event = alc262_lenovo_3000_unsol_event, |
| 11015 | }, |
Pascal Terjan | e8f9ae2 | 2008-08-04 14:36:05 +0200 | [diff] [blame] | 11016 | [ALC262_NEC] = { |
| 11017 | .mixers = { alc262_nec_mixer }, |
| 11018 | .init_verbs = { alc262_nec_verbs }, |
| 11019 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 11020 | .dac_nids = alc262_dac_nids, |
| 11021 | .hp_nid = 0x03, |
| 11022 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 11023 | .channel_mode = alc262_modes, |
| 11024 | .input_mux = &alc262_capture_source, |
| 11025 | }, |
Kailang Yang | 4e555fe | 2008-08-26 13:05:55 +0200 | [diff] [blame] | 11026 | [ALC262_TOSHIBA_S06] = { |
| 11027 | .mixers = { alc262_toshiba_s06_mixer }, |
| 11028 | .init_verbs = { alc262_init_verbs, alc262_toshiba_s06_verbs, |
| 11029 | alc262_eapd_verbs }, |
| 11030 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 11031 | .capsrc_nids = alc262_dmic_capsrc_nids, |
| 11032 | .dac_nids = alc262_dac_nids, |
| 11033 | .adc_nids = alc262_dmic_adc_nids, /* ADC0 */ |
| 11034 | .dig_out_nid = ALC262_DIGOUT_NID, |
| 11035 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 11036 | .channel_mode = alc262_modes, |
| 11037 | .input_mux = &alc262_dmic_capture_source, |
| 11038 | .unsol_event = alc262_toshiba_s06_unsol_event, |
| 11039 | .init_hook = alc262_toshiba_s06_init_hook, |
| 11040 | }, |
Hiroshi Miura | 9f99a63 | 2008-08-28 16:09:06 +0200 | [diff] [blame] | 11041 | [ALC262_TOSHIBA_RX1] = { |
| 11042 | .mixers = { alc262_toshiba_rx1_mixer }, |
| 11043 | .init_verbs = { alc262_init_verbs, alc262_toshiba_rx1_unsol_verbs }, |
| 11044 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 11045 | .dac_nids = alc262_dac_nids, |
| 11046 | .hp_nid = 0x03, |
| 11047 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 11048 | .channel_mode = alc262_modes, |
| 11049 | .input_mux = &alc262_capture_source, |
| 11050 | .unsol_event = alc262_hippo_unsol_event, |
| 11051 | .init_hook = alc262_hippo_automute, |
| 11052 | }, |
Tony Vroon | ba340e8 | 2009-02-02 19:01:30 +0000 | [diff] [blame] | 11053 | [ALC262_TYAN] = { |
| 11054 | .mixers = { alc262_tyan_mixer }, |
| 11055 | .init_verbs = { alc262_init_verbs, alc262_tyan_verbs}, |
| 11056 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 11057 | .dac_nids = alc262_dac_nids, |
| 11058 | .hp_nid = 0x02, |
| 11059 | .dig_out_nid = ALC262_DIGOUT_NID, |
| 11060 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 11061 | .channel_mode = alc262_modes, |
| 11062 | .input_mux = &alc262_capture_source, |
| 11063 | .unsol_event = alc262_tyan_unsol_event, |
| 11064 | .init_hook = alc262_tyan_automute, |
| 11065 | }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11066 | }; |
| 11067 | |
| 11068 | static int patch_alc262(struct hda_codec *codec) |
| 11069 | { |
| 11070 | struct alc_spec *spec; |
| 11071 | int board_config; |
| 11072 | int err; |
| 11073 | |
Robert P. J. Day | dc041e0 | 2006-12-19 14:44:15 +0100 | [diff] [blame] | 11074 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11075 | if (spec == NULL) |
| 11076 | return -ENOMEM; |
| 11077 | |
| 11078 | codec->spec = spec; |
| 11079 | #if 0 |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11080 | /* pshou 07/11/05 set a zero PCM sample to DAC when FIFO is |
| 11081 | * under-run |
| 11082 | */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11083 | { |
| 11084 | int tmp; |
| 11085 | snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_COEF_INDEX, 7); |
| 11086 | tmp = snd_hda_codec_read(codec, 0x20, 0, AC_VERB_GET_PROC_COEF, 0); |
| 11087 | snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_COEF_INDEX, 7); |
| 11088 | snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_PROC_COEF, tmp | 0x80); |
| 11089 | } |
| 11090 | #endif |
| 11091 | |
Takashi Iwai | 2c3bf9a | 2008-06-04 12:39:38 +0200 | [diff] [blame] | 11092 | alc_fix_pll_init(codec, 0x20, 0x0a, 10); |
| 11093 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 11094 | board_config = snd_hda_check_board_config(codec, ALC262_MODEL_LAST, |
| 11095 | alc262_models, |
| 11096 | alc262_cfg_tbl); |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 11097 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 11098 | if (board_config < 0) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11099 | printk(KERN_INFO "hda_codec: Unknown model for ALC262, " |
| 11100 | "trying auto-probe from BIOS...\n"); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11101 | board_config = ALC262_AUTO; |
| 11102 | } |
| 11103 | |
| 11104 | if (board_config == ALC262_AUTO) { |
| 11105 | /* automatic parse from the BIOS config */ |
| 11106 | err = alc262_parse_auto_config(codec); |
| 11107 | if (err < 0) { |
| 11108 | alc_free(codec); |
| 11109 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11110 | } else if (!err) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11111 | printk(KERN_INFO |
| 11112 | "hda_codec: Cannot set up configuration " |
| 11113 | "from BIOS. Using base mode...\n"); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11114 | board_config = ALC262_BASIC; |
| 11115 | } |
| 11116 | } |
| 11117 | |
Takashi Iwai | 07eba61 | 2009-02-19 08:06:35 +0100 | [diff] [blame] | 11118 | if (!spec->no_analog) { |
| 11119 | err = snd_hda_attach_beep_device(codec, 0x1); |
| 11120 | if (err < 0) { |
| 11121 | alc_free(codec); |
| 11122 | return err; |
| 11123 | } |
Kusanagi Kouichi | 680cd53 | 2009-02-05 00:00:58 +0900 | [diff] [blame] | 11124 | } |
| 11125 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11126 | if (board_config != ALC262_AUTO) |
| 11127 | setup_preset(spec, &alc262_presets[board_config]); |
| 11128 | |
| 11129 | spec->stream_name_analog = "ALC262 Analog"; |
| 11130 | spec->stream_analog_playback = &alc262_pcm_analog_playback; |
| 11131 | spec->stream_analog_capture = &alc262_pcm_analog_capture; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 11132 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11133 | spec->stream_name_digital = "ALC262 Digital"; |
| 11134 | spec->stream_digital_playback = &alc262_pcm_digital_playback; |
| 11135 | spec->stream_digital_capture = &alc262_pcm_digital_capture; |
| 11136 | |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 11137 | spec->capture_style = CAPT_MIX; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11138 | if (!spec->adc_nids && spec->input_mux) { |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11139 | /* check whether NID 0x07 is valid */ |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 11140 | unsigned int wcap = get_wcaps(codec, 0x07); |
| 11141 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11142 | /* get type */ |
| 11143 | wcap = (wcap & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11144 | if (wcap != AC_WID_AUD_IN) { |
| 11145 | spec->adc_nids = alc262_adc_nids_alt; |
| 11146 | spec->num_adc_nids = ARRAY_SIZE(alc262_adc_nids_alt); |
Takashi Iwai | 88c71a9 | 2008-02-14 17:27:17 +0100 | [diff] [blame] | 11147 | spec->capsrc_nids = alc262_capsrc_nids_alt; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11148 | } else { |
| 11149 | spec->adc_nids = alc262_adc_nids; |
| 11150 | spec->num_adc_nids = ARRAY_SIZE(alc262_adc_nids); |
Takashi Iwai | 88c71a9 | 2008-02-14 17:27:17 +0100 | [diff] [blame] | 11151 | spec->capsrc_nids = alc262_capsrc_nids; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11152 | } |
| 11153 | } |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 11154 | if (!spec->cap_mixer && !spec->no_analog) |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 11155 | set_capture_mixer(spec); |
Takashi Iwai | 07eba61 | 2009-02-19 08:06:35 +0100 | [diff] [blame] | 11156 | if (!spec->no_analog) |
| 11157 | set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11158 | |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 11159 | spec->vmaster_nid = 0x0c; |
| 11160 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11161 | codec->patch_ops = alc_patch_ops; |
| 11162 | if (board_config == ALC262_AUTO) |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 11163 | spec->init_hook = alc262_auto_init; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 11164 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 11165 | if (!spec->loopback.amplist) |
| 11166 | spec->loopback.amplist = alc262_loopbacks; |
| 11167 | #endif |
Takashi Iwai | daead53 | 2008-11-28 12:55:36 +0100 | [diff] [blame] | 11168 | codec->proc_widget_hook = print_realtek_coef; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 11169 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11170 | return 0; |
| 11171 | } |
| 11172 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11173 | /* |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11174 | * ALC268 channel source setting (2 channel) |
| 11175 | */ |
| 11176 | #define ALC268_DIGOUT_NID ALC880_DIGOUT_NID |
| 11177 | #define alc268_modes alc260_modes |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 11178 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11179 | static hda_nid_t alc268_dac_nids[2] = { |
| 11180 | /* front, hp */ |
| 11181 | 0x02, 0x03 |
| 11182 | }; |
| 11183 | |
| 11184 | static hda_nid_t alc268_adc_nids[2] = { |
| 11185 | /* ADC0-1 */ |
| 11186 | 0x08, 0x07 |
| 11187 | }; |
| 11188 | |
| 11189 | static hda_nid_t alc268_adc_nids_alt[1] = { |
| 11190 | /* ADC0 */ |
| 11191 | 0x08 |
| 11192 | }; |
| 11193 | |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 11194 | static hda_nid_t alc268_capsrc_nids[2] = { 0x23, 0x24 }; |
| 11195 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11196 | static struct snd_kcontrol_new alc268_base_mixer[] = { |
| 11197 | /* output mixer control */ |
| 11198 | HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT), |
| 11199 | HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 11200 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x3, 0x0, HDA_OUTPUT), |
| 11201 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
Takashi Iwai | 33bf17a | 2007-08-21 11:51:42 +0200 | [diff] [blame] | 11202 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 11203 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
| 11204 | HDA_CODEC_VOLUME("Line In Boost", 0x1a, 0, HDA_INPUT), |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11205 | { } |
| 11206 | }; |
| 11207 | |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 11208 | /* bind Beep switches of both NID 0x0f and 0x10 */ |
| 11209 | static struct hda_bind_ctls alc268_bind_beep_sw = { |
| 11210 | .ops = &snd_hda_bind_sw, |
| 11211 | .values = { |
| 11212 | HDA_COMPOSE_AMP_VAL(0x0f, 3, 1, HDA_INPUT), |
| 11213 | HDA_COMPOSE_AMP_VAL(0x10, 3, 1, HDA_INPUT), |
| 11214 | 0 |
| 11215 | }, |
| 11216 | }; |
| 11217 | |
| 11218 | static struct snd_kcontrol_new alc268_beep_mixer[] = { |
| 11219 | HDA_CODEC_VOLUME("Beep Playback Volume", 0x1d, 0x0, HDA_INPUT), |
| 11220 | HDA_BIND_SW("Beep Playback Switch", &alc268_bind_beep_sw), |
| 11221 | { } |
| 11222 | }; |
| 11223 | |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 11224 | static struct hda_verb alc268_eapd_verbs[] = { |
| 11225 | {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 11226 | {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 11227 | { } |
| 11228 | }; |
| 11229 | |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 11230 | /* Toshiba specific */ |
| 11231 | #define alc268_toshiba_automute alc262_hippo_automute |
| 11232 | |
| 11233 | static struct hda_verb alc268_toshiba_verbs[] = { |
| 11234 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 11235 | { } /* end */ |
| 11236 | }; |
| 11237 | |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 11238 | static struct hda_input_mux alc268_acer_lc_capture_source = { |
| 11239 | .num_items = 2, |
| 11240 | .items = { |
| 11241 | { "i-Mic", 0x6 }, |
| 11242 | { "E-Mic", 0x0 }, |
| 11243 | }, |
| 11244 | }; |
| 11245 | |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 11246 | /* Acer specific */ |
Takashi Iwai | 889c439 | 2007-08-23 18:56:52 +0200 | [diff] [blame] | 11247 | /* bind volumes of both NID 0x02 and 0x03 */ |
Takashi Iwai | 6bc9685 | 2007-08-17 09:02:12 +0200 | [diff] [blame] | 11248 | static struct hda_bind_ctls alc268_acer_bind_master_vol = { |
| 11249 | .ops = &snd_hda_bind_vol, |
| 11250 | .values = { |
| 11251 | HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT), |
| 11252 | HDA_COMPOSE_AMP_VAL(0x03, 3, 0, HDA_OUTPUT), |
| 11253 | 0 |
| 11254 | }, |
| 11255 | }; |
| 11256 | |
Takashi Iwai | 889c439 | 2007-08-23 18:56:52 +0200 | [diff] [blame] | 11257 | /* mute/unmute internal speaker according to the hp jack and mute state */ |
| 11258 | static void alc268_acer_automute(struct hda_codec *codec, int force) |
| 11259 | { |
| 11260 | struct alc_spec *spec = codec->spec; |
| 11261 | unsigned int mute; |
| 11262 | |
| 11263 | if (force || !spec->sense_updated) { |
| 11264 | unsigned int present; |
| 11265 | present = snd_hda_codec_read(codec, 0x14, 0, |
| 11266 | AC_VERB_GET_PIN_SENSE, 0); |
| 11267 | spec->jack_present = (present & 0x80000000) != 0; |
| 11268 | spec->sense_updated = 1; |
| 11269 | } |
| 11270 | if (spec->jack_present) |
| 11271 | mute = HDA_AMP_MUTE; /* mute internal speaker */ |
| 11272 | else /* unmute internal speaker if necessary */ |
| 11273 | mute = snd_hda_codec_amp_read(codec, 0x14, 0, HDA_OUTPUT, 0); |
| 11274 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 11275 | HDA_AMP_MUTE, mute); |
| 11276 | } |
| 11277 | |
| 11278 | |
| 11279 | /* bind hp and internal speaker mute (with plug check) */ |
| 11280 | static int alc268_acer_master_sw_put(struct snd_kcontrol *kcontrol, |
| 11281 | struct snd_ctl_elem_value *ucontrol) |
| 11282 | { |
| 11283 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 11284 | long *valp = ucontrol->value.integer.value; |
| 11285 | int change; |
| 11286 | |
| 11287 | change = snd_hda_codec_amp_update(codec, 0x14, 0, HDA_OUTPUT, 0, |
| 11288 | HDA_AMP_MUTE, |
| 11289 | valp[0] ? 0 : HDA_AMP_MUTE); |
| 11290 | change |= snd_hda_codec_amp_update(codec, 0x14, 1, HDA_OUTPUT, 0, |
| 11291 | HDA_AMP_MUTE, |
| 11292 | valp[1] ? 0 : HDA_AMP_MUTE); |
| 11293 | if (change) |
| 11294 | alc268_acer_automute(codec, 0); |
| 11295 | return change; |
| 11296 | } |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 11297 | |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 11298 | static struct snd_kcontrol_new alc268_acer_aspire_one_mixer[] = { |
| 11299 | /* output mixer control */ |
| 11300 | HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol), |
| 11301 | { |
| 11302 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 11303 | .name = "Master Playback Switch", |
| 11304 | .info = snd_hda_mixer_amp_switch_info, |
| 11305 | .get = snd_hda_mixer_amp_switch_get, |
| 11306 | .put = alc268_acer_master_sw_put, |
| 11307 | .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), |
| 11308 | }, |
| 11309 | HDA_CODEC_VOLUME("Mic Boost Capture Volume", 0x18, 0, HDA_INPUT), |
| 11310 | { } |
| 11311 | }; |
| 11312 | |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 11313 | static struct snd_kcontrol_new alc268_acer_mixer[] = { |
| 11314 | /* output mixer control */ |
| 11315 | HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol), |
| 11316 | { |
| 11317 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 11318 | .name = "Master Playback Switch", |
| 11319 | .info = snd_hda_mixer_amp_switch_info, |
| 11320 | .get = snd_hda_mixer_amp_switch_get, |
| 11321 | .put = alc268_acer_master_sw_put, |
| 11322 | .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), |
| 11323 | }, |
Takashi Iwai | 33bf17a | 2007-08-21 11:51:42 +0200 | [diff] [blame] | 11324 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 11325 | HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT), |
| 11326 | HDA_CODEC_VOLUME("Line In Boost", 0x1a, 0, HDA_INPUT), |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 11327 | { } |
| 11328 | }; |
| 11329 | |
Takashi Iwai | c238b4f | 2008-11-05 14:57:20 +0100 | [diff] [blame] | 11330 | static struct snd_kcontrol_new alc268_acer_dmic_mixer[] = { |
| 11331 | /* output mixer control */ |
| 11332 | HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol), |
| 11333 | { |
| 11334 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 11335 | .name = "Master Playback Switch", |
| 11336 | .info = snd_hda_mixer_amp_switch_info, |
| 11337 | .get = snd_hda_mixer_amp_switch_get, |
| 11338 | .put = alc268_acer_master_sw_put, |
| 11339 | .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), |
| 11340 | }, |
| 11341 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 11342 | HDA_CODEC_VOLUME("Line In Boost", 0x1a, 0, HDA_INPUT), |
| 11343 | { } |
| 11344 | }; |
| 11345 | |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 11346 | static struct hda_verb alc268_acer_aspire_one_verbs[] = { |
| 11347 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 11348 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 11349 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 11350 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 11351 | {0x23, AC_VERB_SET_CONNECT_SEL, 0x06}, |
| 11352 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, 0xa017}, |
| 11353 | { } |
| 11354 | }; |
| 11355 | |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 11356 | static struct hda_verb alc268_acer_verbs[] = { |
Takashi Iwai | 0ccb541 | 2008-03-06 16:58:35 +0100 | [diff] [blame] | 11357 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, /* internal dmic? */ |
| 11358 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 11359 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 11360 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | 0ccb541 | 2008-03-06 16:58:35 +0100 | [diff] [blame] | 11361 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 11362 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 11363 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 11364 | { } |
| 11365 | }; |
| 11366 | |
| 11367 | /* unsolicited event for HP jack sensing */ |
| 11368 | static void alc268_toshiba_unsol_event(struct hda_codec *codec, |
| 11369 | unsigned int res) |
| 11370 | { |
Takashi Iwai | 889c439 | 2007-08-23 18:56:52 +0200 | [diff] [blame] | 11371 | if ((res >> 26) != ALC880_HP_EVENT) |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 11372 | return; |
| 11373 | alc268_toshiba_automute(codec); |
| 11374 | } |
| 11375 | |
| 11376 | static void alc268_acer_unsol_event(struct hda_codec *codec, |
| 11377 | unsigned int res) |
| 11378 | { |
Takashi Iwai | 889c439 | 2007-08-23 18:56:52 +0200 | [diff] [blame] | 11379 | if ((res >> 26) != ALC880_HP_EVENT) |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 11380 | return; |
| 11381 | alc268_acer_automute(codec, 1); |
| 11382 | } |
| 11383 | |
Takashi Iwai | 889c439 | 2007-08-23 18:56:52 +0200 | [diff] [blame] | 11384 | static void alc268_acer_init_hook(struct hda_codec *codec) |
| 11385 | { |
| 11386 | alc268_acer_automute(codec, 1); |
| 11387 | } |
| 11388 | |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 11389 | /* toggle speaker-output according to the hp-jack state */ |
| 11390 | static void alc268_aspire_one_speaker_automute(struct hda_codec *codec) |
| 11391 | { |
| 11392 | unsigned int present; |
| 11393 | unsigned char bits; |
| 11394 | |
| 11395 | present = snd_hda_codec_read(codec, 0x15, 0, |
| 11396 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 11397 | bits = present ? AMP_IN_MUTE(0) : 0; |
| 11398 | snd_hda_codec_amp_stereo(codec, 0x0f, HDA_INPUT, 0, |
| 11399 | AMP_IN_MUTE(0), bits); |
| 11400 | snd_hda_codec_amp_stereo(codec, 0x0f, HDA_INPUT, 1, |
| 11401 | AMP_IN_MUTE(0), bits); |
| 11402 | } |
| 11403 | |
| 11404 | |
| 11405 | static void alc268_acer_mic_automute(struct hda_codec *codec) |
| 11406 | { |
| 11407 | unsigned int present; |
| 11408 | |
| 11409 | present = snd_hda_codec_read(codec, 0x18, 0, |
| 11410 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 11411 | snd_hda_codec_write(codec, 0x23, 0, AC_VERB_SET_CONNECT_SEL, |
| 11412 | present ? 0x0 : 0x6); |
| 11413 | } |
| 11414 | |
| 11415 | static void alc268_acer_lc_unsol_event(struct hda_codec *codec, |
| 11416 | unsigned int res) |
| 11417 | { |
| 11418 | if ((res >> 26) == ALC880_HP_EVENT) |
| 11419 | alc268_aspire_one_speaker_automute(codec); |
| 11420 | if ((res >> 26) == ALC880_MIC_EVENT) |
| 11421 | alc268_acer_mic_automute(codec); |
| 11422 | } |
| 11423 | |
| 11424 | static void alc268_acer_lc_init_hook(struct hda_codec *codec) |
| 11425 | { |
| 11426 | alc268_aspire_one_speaker_automute(codec); |
| 11427 | alc268_acer_mic_automute(codec); |
| 11428 | } |
| 11429 | |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 11430 | static struct snd_kcontrol_new alc268_dell_mixer[] = { |
| 11431 | /* output mixer control */ |
| 11432 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 11433 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 11434 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 11435 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 11436 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 11437 | HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT), |
| 11438 | { } |
| 11439 | }; |
| 11440 | |
| 11441 | static struct hda_verb alc268_dell_verbs[] = { |
| 11442 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 11443 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 11444 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 11445 | { } |
| 11446 | }; |
| 11447 | |
| 11448 | /* mute/unmute internal speaker according to the hp jack and mute state */ |
| 11449 | static void alc268_dell_automute(struct hda_codec *codec) |
| 11450 | { |
| 11451 | unsigned int present; |
| 11452 | unsigned int mute; |
| 11453 | |
| 11454 | present = snd_hda_codec_read(codec, 0x15, 0, AC_VERB_GET_PIN_SENSE, 0); |
| 11455 | if (present & 0x80000000) |
| 11456 | mute = HDA_AMP_MUTE; |
| 11457 | else |
| 11458 | mute = snd_hda_codec_amp_read(codec, 0x15, 0, HDA_OUTPUT, 0); |
| 11459 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 11460 | HDA_AMP_MUTE, mute); |
| 11461 | } |
| 11462 | |
| 11463 | static void alc268_dell_unsol_event(struct hda_codec *codec, |
| 11464 | unsigned int res) |
| 11465 | { |
| 11466 | if ((res >> 26) != ALC880_HP_EVENT) |
| 11467 | return; |
| 11468 | alc268_dell_automute(codec); |
| 11469 | } |
| 11470 | |
| 11471 | #define alc268_dell_init_hook alc268_dell_automute |
| 11472 | |
Herton Ronaldo Krzesinski | eb5a662 | 2008-04-14 13:46:28 +0200 | [diff] [blame] | 11473 | static struct snd_kcontrol_new alc267_quanta_il1_mixer[] = { |
| 11474 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x2, 0x0, HDA_OUTPUT), |
| 11475 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 11476 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x3, 0x0, HDA_OUTPUT), |
| 11477 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 11478 | HDA_CODEC_VOLUME("Mic Capture Volume", 0x23, 0x0, HDA_OUTPUT), |
| 11479 | HDA_BIND_MUTE("Mic Capture Switch", 0x23, 2, HDA_OUTPUT), |
| 11480 | HDA_CODEC_VOLUME("Ext Mic Boost", 0x18, 0, HDA_INPUT), |
| 11481 | HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT), |
| 11482 | { } |
| 11483 | }; |
| 11484 | |
| 11485 | static struct hda_verb alc267_quanta_il1_verbs[] = { |
| 11486 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 11487 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN}, |
| 11488 | { } |
| 11489 | }; |
| 11490 | |
| 11491 | static void alc267_quanta_il1_hp_automute(struct hda_codec *codec) |
| 11492 | { |
| 11493 | unsigned int present; |
| 11494 | |
| 11495 | present = snd_hda_codec_read(codec, 0x15, 0, AC_VERB_GET_PIN_SENSE, 0) |
| 11496 | & AC_PINSENSE_PRESENCE; |
| 11497 | snd_hda_codec_write(codec, 0x14, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 11498 | present ? 0 : PIN_OUT); |
| 11499 | } |
| 11500 | |
| 11501 | static void alc267_quanta_il1_mic_automute(struct hda_codec *codec) |
| 11502 | { |
| 11503 | unsigned int present; |
| 11504 | |
| 11505 | present = snd_hda_codec_read(codec, 0x18, 0, |
| 11506 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 11507 | snd_hda_codec_write(codec, 0x23, 0, |
| 11508 | AC_VERB_SET_CONNECT_SEL, |
| 11509 | present ? 0x00 : 0x01); |
| 11510 | } |
| 11511 | |
| 11512 | static void alc267_quanta_il1_automute(struct hda_codec *codec) |
| 11513 | { |
| 11514 | alc267_quanta_il1_hp_automute(codec); |
| 11515 | alc267_quanta_il1_mic_automute(codec); |
| 11516 | } |
| 11517 | |
| 11518 | static void alc267_quanta_il1_unsol_event(struct hda_codec *codec, |
| 11519 | unsigned int res) |
| 11520 | { |
| 11521 | switch (res >> 26) { |
| 11522 | case ALC880_HP_EVENT: |
| 11523 | alc267_quanta_il1_hp_automute(codec); |
| 11524 | break; |
| 11525 | case ALC880_MIC_EVENT: |
| 11526 | alc267_quanta_il1_mic_automute(codec); |
| 11527 | break; |
| 11528 | } |
| 11529 | } |
| 11530 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11531 | /* |
| 11532 | * generic initialization of ADC, input mixers and output mixers |
| 11533 | */ |
| 11534 | static struct hda_verb alc268_base_init_verbs[] = { |
| 11535 | /* Unmute DAC0-1 and set vol = 0 */ |
| 11536 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11537 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11538 | |
| 11539 | /* |
| 11540 | * Set up output mixers (0x0c - 0x0e) |
| 11541 | */ |
| 11542 | /* set vol=0 to output mixers */ |
| 11543 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11544 | {0x0e, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 11545 | |
| 11546 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11547 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11548 | |
| 11549 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, |
| 11550 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0}, |
| 11551 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, |
| 11552 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 11553 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 11554 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 11555 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 11556 | {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 11557 | |
| 11558 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 11559 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 11560 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 11561 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11562 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 11563 | |
| 11564 | /* set PCBEEP vol = 0, mute connections */ |
| 11565 | {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11566 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 11567 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11568 | |
Jiang Zhe | a9b3aa8 | 2007-12-20 13:13:13 +0100 | [diff] [blame] | 11569 | /* Unmute Selector 23h,24h and set the default input to mic-in */ |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 11570 | |
Jiang Zhe | a9b3aa8 | 2007-12-20 13:13:13 +0100 | [diff] [blame] | 11571 | {0x23, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 11572 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 11573 | {0x24, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 11574 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11575 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11576 | { } |
| 11577 | }; |
| 11578 | |
| 11579 | /* |
| 11580 | * generic initialization of ADC, input mixers and output mixers |
| 11581 | */ |
| 11582 | static struct hda_verb alc268_volume_init_verbs[] = { |
| 11583 | /* set output DAC */ |
Takashi Iwai | 4cfb91c | 2009-01-23 12:53:09 +0100 | [diff] [blame] | 11584 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 11585 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11586 | |
| 11587 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 11588 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 11589 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 11590 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 11591 | {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 11592 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11593 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11594 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11595 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11596 | |
| 11597 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11598 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11599 | |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 11600 | /* set PCBEEP vol = 0, mute connections */ |
| 11601 | {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11602 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 11603 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11604 | |
| 11605 | { } |
| 11606 | }; |
| 11607 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11608 | static struct snd_kcontrol_new alc268_capture_alt_mixer[] = { |
| 11609 | HDA_CODEC_VOLUME("Capture Volume", 0x23, 0x0, HDA_OUTPUT), |
| 11610 | HDA_CODEC_MUTE("Capture Switch", 0x23, 0x0, HDA_OUTPUT), |
| 11611 | { |
| 11612 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 11613 | /* The multiple "Capture Source" controls confuse alsamixer |
| 11614 | * So call somewhat different.. |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11615 | */ |
| 11616 | /* .name = "Capture Source", */ |
| 11617 | .name = "Input Source", |
| 11618 | .count = 1, |
Takashi Iwai | 54cbc9a | 2008-10-31 15:24:04 +0100 | [diff] [blame] | 11619 | .info = alc_mux_enum_info, |
| 11620 | .get = alc_mux_enum_get, |
| 11621 | .put = alc_mux_enum_put, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11622 | }, |
| 11623 | { } /* end */ |
| 11624 | }; |
| 11625 | |
| 11626 | static struct snd_kcontrol_new alc268_capture_mixer[] = { |
| 11627 | HDA_CODEC_VOLUME("Capture Volume", 0x23, 0x0, HDA_OUTPUT), |
| 11628 | HDA_CODEC_MUTE("Capture Switch", 0x23, 0x0, HDA_OUTPUT), |
| 11629 | HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x24, 0x0, HDA_OUTPUT), |
| 11630 | HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x24, 0x0, HDA_OUTPUT), |
| 11631 | { |
| 11632 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 11633 | /* The multiple "Capture Source" controls confuse alsamixer |
| 11634 | * So call somewhat different.. |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11635 | */ |
| 11636 | /* .name = "Capture Source", */ |
| 11637 | .name = "Input Source", |
| 11638 | .count = 2, |
Takashi Iwai | 54cbc9a | 2008-10-31 15:24:04 +0100 | [diff] [blame] | 11639 | .info = alc_mux_enum_info, |
| 11640 | .get = alc_mux_enum_get, |
| 11641 | .put = alc_mux_enum_put, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11642 | }, |
| 11643 | { } /* end */ |
| 11644 | }; |
| 11645 | |
| 11646 | static struct hda_input_mux alc268_capture_source = { |
| 11647 | .num_items = 4, |
| 11648 | .items = { |
| 11649 | { "Mic", 0x0 }, |
| 11650 | { "Front Mic", 0x1 }, |
| 11651 | { "Line", 0x2 }, |
| 11652 | { "CD", 0x3 }, |
| 11653 | }, |
| 11654 | }; |
| 11655 | |
Takashi Iwai | 0ccb541 | 2008-03-06 16:58:35 +0100 | [diff] [blame] | 11656 | static struct hda_input_mux alc268_acer_capture_source = { |
| 11657 | .num_items = 3, |
| 11658 | .items = { |
| 11659 | { "Mic", 0x0 }, |
Takashi Iwai | c238b4f | 2008-11-05 14:57:20 +0100 | [diff] [blame] | 11660 | { "Internal Mic", 0x1 }, |
| 11661 | { "Line", 0x2 }, |
| 11662 | }, |
| 11663 | }; |
| 11664 | |
| 11665 | static struct hda_input_mux alc268_acer_dmic_capture_source = { |
| 11666 | .num_items = 3, |
| 11667 | .items = { |
| 11668 | { "Mic", 0x0 }, |
Takashi Iwai | 0ccb541 | 2008-03-06 16:58:35 +0100 | [diff] [blame] | 11669 | { "Internal Mic", 0x6 }, |
| 11670 | { "Line", 0x2 }, |
| 11671 | }, |
| 11672 | }; |
| 11673 | |
Jonathan Woithe | 86c53bd | 2008-01-08 12:33:19 +0100 | [diff] [blame] | 11674 | #ifdef CONFIG_SND_DEBUG |
| 11675 | static struct snd_kcontrol_new alc268_test_mixer[] = { |
Jonathan Woithe | 86c53bd | 2008-01-08 12:33:19 +0100 | [diff] [blame] | 11676 | /* Volume widgets */ |
| 11677 | HDA_CODEC_VOLUME("LOUT1 Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 11678 | HDA_CODEC_VOLUME("LOUT2 Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 11679 | HDA_BIND_MUTE_MONO("Mono sum Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 11680 | HDA_BIND_MUTE("LINE-OUT sum Playback Switch", 0x0f, 2, HDA_INPUT), |
| 11681 | HDA_BIND_MUTE("HP-OUT sum Playback Switch", 0x10, 2, HDA_INPUT), |
| 11682 | HDA_BIND_MUTE("LINE-OUT Playback Switch", 0x14, 2, HDA_OUTPUT), |
| 11683 | HDA_BIND_MUTE("HP-OUT Playback Switch", 0x15, 2, HDA_OUTPUT), |
| 11684 | HDA_BIND_MUTE("Mono Playback Switch", 0x16, 2, HDA_OUTPUT), |
| 11685 | HDA_CODEC_VOLUME("MIC1 Capture Volume", 0x18, 0x0, HDA_INPUT), |
| 11686 | HDA_BIND_MUTE("MIC1 Capture Switch", 0x18, 2, HDA_OUTPUT), |
| 11687 | HDA_CODEC_VOLUME("MIC2 Capture Volume", 0x19, 0x0, HDA_INPUT), |
| 11688 | HDA_CODEC_VOLUME("LINE1 Capture Volume", 0x1a, 0x0, HDA_INPUT), |
| 11689 | HDA_BIND_MUTE("LINE1 Capture Switch", 0x1a, 2, HDA_OUTPUT), |
Takashi Iwai | f0747ee | 2008-01-15 11:41:41 +0100 | [diff] [blame] | 11690 | /* The below appears problematic on some hardwares */ |
| 11691 | /*HDA_CODEC_VOLUME("PCBEEP Playback Volume", 0x1d, 0x0, HDA_INPUT),*/ |
Jonathan Woithe | 86c53bd | 2008-01-08 12:33:19 +0100 | [diff] [blame] | 11692 | HDA_CODEC_VOLUME("PCM-IN1 Capture Volume", 0x23, 0x0, HDA_OUTPUT), |
| 11693 | HDA_BIND_MUTE("PCM-IN1 Capture Switch", 0x23, 2, HDA_OUTPUT), |
| 11694 | HDA_CODEC_VOLUME("PCM-IN2 Capture Volume", 0x24, 0x0, HDA_OUTPUT), |
| 11695 | HDA_BIND_MUTE("PCM-IN2 Capture Switch", 0x24, 2, HDA_OUTPUT), |
| 11696 | |
| 11697 | /* Modes for retasking pin widgets */ |
| 11698 | ALC_PIN_MODE("LINE-OUT pin mode", 0x14, ALC_PIN_DIR_INOUT), |
| 11699 | ALC_PIN_MODE("HP-OUT pin mode", 0x15, ALC_PIN_DIR_INOUT), |
| 11700 | ALC_PIN_MODE("MIC1 pin mode", 0x18, ALC_PIN_DIR_INOUT), |
| 11701 | ALC_PIN_MODE("LINE1 pin mode", 0x1a, ALC_PIN_DIR_INOUT), |
| 11702 | |
| 11703 | /* Controls for GPIO pins, assuming they are configured as outputs */ |
| 11704 | ALC_GPIO_DATA_SWITCH("GPIO pin 0", 0x01, 0x01), |
| 11705 | ALC_GPIO_DATA_SWITCH("GPIO pin 1", 0x01, 0x02), |
| 11706 | ALC_GPIO_DATA_SWITCH("GPIO pin 2", 0x01, 0x04), |
| 11707 | ALC_GPIO_DATA_SWITCH("GPIO pin 3", 0x01, 0x08), |
| 11708 | |
| 11709 | /* Switches to allow the digital SPDIF output pin to be enabled. |
| 11710 | * The ALC268 does not have an SPDIF input. |
| 11711 | */ |
| 11712 | ALC_SPDIF_CTRL_SWITCH("SPDIF Playback Switch", 0x06, 0x01), |
| 11713 | |
| 11714 | /* A switch allowing EAPD to be enabled. Some laptops seem to use |
| 11715 | * this output to turn on an external amplifier. |
| 11716 | */ |
| 11717 | ALC_EAPD_CTRL_SWITCH("LINE-OUT EAPD Enable Switch", 0x0f, 0x02), |
| 11718 | ALC_EAPD_CTRL_SWITCH("HP-OUT EAPD Enable Switch", 0x10, 0x02), |
| 11719 | |
| 11720 | { } /* end */ |
| 11721 | }; |
| 11722 | #endif |
| 11723 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11724 | /* create input playback/capture controls for the given pin */ |
| 11725 | static int alc268_new_analog_output(struct alc_spec *spec, hda_nid_t nid, |
| 11726 | const char *ctlname, int idx) |
| 11727 | { |
| 11728 | char name[32]; |
| 11729 | int err; |
| 11730 | |
| 11731 | sprintf(name, "%s Playback Volume", ctlname); |
| 11732 | if (nid == 0x14) { |
| 11733 | err = add_control(spec, ALC_CTL_WIDGET_VOL, name, |
| 11734 | HDA_COMPOSE_AMP_VAL(0x02, 3, idx, |
| 11735 | HDA_OUTPUT)); |
| 11736 | if (err < 0) |
| 11737 | return err; |
| 11738 | } else if (nid == 0x15) { |
| 11739 | err = add_control(spec, ALC_CTL_WIDGET_VOL, name, |
| 11740 | HDA_COMPOSE_AMP_VAL(0x03, 3, idx, |
| 11741 | HDA_OUTPUT)); |
| 11742 | if (err < 0) |
| 11743 | return err; |
| 11744 | } else |
| 11745 | return -1; |
| 11746 | sprintf(name, "%s Playback Switch", ctlname); |
| 11747 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, name, |
| 11748 | HDA_COMPOSE_AMP_VAL(nid, 3, idx, HDA_OUTPUT)); |
| 11749 | if (err < 0) |
| 11750 | return err; |
| 11751 | return 0; |
| 11752 | } |
| 11753 | |
| 11754 | /* add playback controls from the parsed DAC table */ |
| 11755 | static int alc268_auto_create_multi_out_ctls(struct alc_spec *spec, |
| 11756 | const struct auto_pin_cfg *cfg) |
| 11757 | { |
| 11758 | hda_nid_t nid; |
| 11759 | int err; |
| 11760 | |
| 11761 | spec->multiout.num_dacs = 2; /* only use one dac */ |
| 11762 | spec->multiout.dac_nids = spec->private_dac_nids; |
| 11763 | spec->multiout.dac_nids[0] = 2; |
| 11764 | spec->multiout.dac_nids[1] = 3; |
| 11765 | |
| 11766 | nid = cfg->line_out_pins[0]; |
| 11767 | if (nid) |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 11768 | alc268_new_analog_output(spec, nid, "Front", 0); |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11769 | |
| 11770 | nid = cfg->speaker_pins[0]; |
| 11771 | if (nid == 0x1d) { |
| 11772 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 11773 | "Speaker Playback Volume", |
| 11774 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_INPUT)); |
| 11775 | if (err < 0) |
| 11776 | return err; |
| 11777 | } |
| 11778 | nid = cfg->hp_pins[0]; |
| 11779 | if (nid) |
| 11780 | alc268_new_analog_output(spec, nid, "Headphone", 0); |
| 11781 | |
| 11782 | nid = cfg->line_out_pins[1] | cfg->line_out_pins[2]; |
| 11783 | if (nid == 0x16) { |
| 11784 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, |
| 11785 | "Mono Playback Switch", |
| 11786 | HDA_COMPOSE_AMP_VAL(nid, 2, 0, HDA_INPUT)); |
| 11787 | if (err < 0) |
| 11788 | return err; |
| 11789 | } |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 11790 | return 0; |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11791 | } |
| 11792 | |
| 11793 | /* create playback/capture controls for input pins */ |
| 11794 | static int alc268_auto_create_analog_input_ctls(struct alc_spec *spec, |
| 11795 | const struct auto_pin_cfg *cfg) |
| 11796 | { |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 11797 | struct hda_input_mux *imux = &spec->private_imux[0]; |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11798 | int i, idx1; |
| 11799 | |
| 11800 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
| 11801 | switch(cfg->input_pins[i]) { |
| 11802 | case 0x18: |
| 11803 | idx1 = 0; /* Mic 1 */ |
| 11804 | break; |
| 11805 | case 0x19: |
| 11806 | idx1 = 1; /* Mic 2 */ |
| 11807 | break; |
| 11808 | case 0x1a: |
| 11809 | idx1 = 2; /* Line In */ |
| 11810 | break; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 11811 | case 0x1c: |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11812 | idx1 = 3; /* CD */ |
| 11813 | break; |
Takashi Iwai | 7194cae | 2008-03-06 16:58:17 +0100 | [diff] [blame] | 11814 | case 0x12: |
| 11815 | case 0x13: |
| 11816 | idx1 = 6; /* digital mics */ |
| 11817 | break; |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11818 | default: |
| 11819 | continue; |
| 11820 | } |
| 11821 | imux->items[imux->num_items].label = auto_pin_cfg_labels[i]; |
| 11822 | imux->items[imux->num_items].index = idx1; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 11823 | imux->num_items++; |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11824 | } |
| 11825 | return 0; |
| 11826 | } |
| 11827 | |
| 11828 | static void alc268_auto_init_mono_speaker_out(struct hda_codec *codec) |
| 11829 | { |
| 11830 | struct alc_spec *spec = codec->spec; |
| 11831 | hda_nid_t speaker_nid = spec->autocfg.speaker_pins[0]; |
| 11832 | hda_nid_t hp_nid = spec->autocfg.hp_pins[0]; |
| 11833 | hda_nid_t line_nid = spec->autocfg.line_out_pins[0]; |
| 11834 | unsigned int dac_vol1, dac_vol2; |
| 11835 | |
| 11836 | if (speaker_nid) { |
| 11837 | snd_hda_codec_write(codec, speaker_nid, 0, |
| 11838 | AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT); |
| 11839 | snd_hda_codec_write(codec, 0x0f, 0, |
| 11840 | AC_VERB_SET_AMP_GAIN_MUTE, |
| 11841 | AMP_IN_UNMUTE(1)); |
| 11842 | snd_hda_codec_write(codec, 0x10, 0, |
| 11843 | AC_VERB_SET_AMP_GAIN_MUTE, |
| 11844 | AMP_IN_UNMUTE(1)); |
| 11845 | } else { |
| 11846 | snd_hda_codec_write(codec, 0x0f, 0, |
| 11847 | AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)); |
| 11848 | snd_hda_codec_write(codec, 0x10, 0, |
| 11849 | AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)); |
| 11850 | } |
| 11851 | |
| 11852 | dac_vol1 = dac_vol2 = 0xb000 | 0x40; /* set max volume */ |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 11853 | if (line_nid == 0x14) |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11854 | dac_vol2 = AMP_OUT_ZERO; |
| 11855 | else if (line_nid == 0x15) |
| 11856 | dac_vol1 = AMP_OUT_ZERO; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 11857 | if (hp_nid == 0x14) |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11858 | dac_vol2 = AMP_OUT_ZERO; |
| 11859 | else if (hp_nid == 0x15) |
| 11860 | dac_vol1 = AMP_OUT_ZERO; |
| 11861 | if (line_nid != 0x16 || hp_nid != 0x16 || |
| 11862 | spec->autocfg.line_out_pins[1] != 0x16 || |
| 11863 | spec->autocfg.line_out_pins[2] != 0x16) |
| 11864 | dac_vol1 = dac_vol2 = AMP_OUT_ZERO; |
| 11865 | |
| 11866 | snd_hda_codec_write(codec, 0x02, 0, |
| 11867 | AC_VERB_SET_AMP_GAIN_MUTE, dac_vol1); |
| 11868 | snd_hda_codec_write(codec, 0x03, 0, |
| 11869 | AC_VERB_SET_AMP_GAIN_MUTE, dac_vol2); |
| 11870 | } |
| 11871 | |
| 11872 | /* pcm configuration: identiacal with ALC880 */ |
| 11873 | #define alc268_pcm_analog_playback alc880_pcm_analog_playback |
| 11874 | #define alc268_pcm_analog_capture alc880_pcm_analog_capture |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 11875 | #define alc268_pcm_analog_alt_capture alc880_pcm_analog_alt_capture |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11876 | #define alc268_pcm_digital_playback alc880_pcm_digital_playback |
| 11877 | |
| 11878 | /* |
| 11879 | * BIOS auto configuration |
| 11880 | */ |
| 11881 | static int alc268_parse_auto_config(struct hda_codec *codec) |
| 11882 | { |
| 11883 | struct alc_spec *spec = codec->spec; |
| 11884 | int err; |
| 11885 | static hda_nid_t alc268_ignore[] = { 0 }; |
| 11886 | |
| 11887 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 11888 | alc268_ignore); |
| 11889 | if (err < 0) |
| 11890 | return err; |
Takashi Iwai | 7e0e44d | 2009-02-19 08:15:49 +0100 | [diff] [blame] | 11891 | if (!spec->autocfg.line_outs) { |
| 11892 | if (spec->autocfg.dig_outs || spec->autocfg.dig_in_pin) { |
| 11893 | spec->multiout.max_channels = 2; |
| 11894 | spec->no_analog = 1; |
| 11895 | goto dig_only; |
| 11896 | } |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11897 | return 0; /* can't find valid BIOS pin config */ |
Takashi Iwai | 7e0e44d | 2009-02-19 08:15:49 +0100 | [diff] [blame] | 11898 | } |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11899 | err = alc268_auto_create_multi_out_ctls(spec, &spec->autocfg); |
| 11900 | if (err < 0) |
| 11901 | return err; |
| 11902 | err = alc268_auto_create_analog_input_ctls(spec, &spec->autocfg); |
| 11903 | if (err < 0) |
| 11904 | return err; |
| 11905 | |
| 11906 | spec->multiout.max_channels = 2; |
| 11907 | |
Takashi Iwai | 7e0e44d | 2009-02-19 08:15:49 +0100 | [diff] [blame] | 11908 | dig_only: |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11909 | /* digital only support output */ |
Takashi Iwai | 7e0e44d | 2009-02-19 08:15:49 +0100 | [diff] [blame] | 11910 | if (spec->autocfg.dig_outs) { |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11911 | spec->multiout.dig_out_nid = ALC268_DIGOUT_NID; |
Takashi Iwai | 7e0e44d | 2009-02-19 08:15:49 +0100 | [diff] [blame] | 11912 | spec->dig_out_type = spec->autocfg.dig_out_type[0]; |
| 11913 | } |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 11914 | if (spec->kctls.list) |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 11915 | add_mixer(spec, spec->kctls.list); |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11916 | |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 11917 | if (spec->autocfg.speaker_pins[0] != 0x1d) |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 11918 | add_mixer(spec, alc268_beep_mixer); |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 11919 | |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 11920 | add_verb(spec, alc268_volume_init_verbs); |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11921 | spec->num_mux_defs = 1; |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 11922 | spec->input_mux = &spec->private_imux[0]; |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11923 | |
Takashi Iwai | 776e184 | 2007-08-29 15:07:11 +0200 | [diff] [blame] | 11924 | err = alc_auto_add_mic_boost(codec); |
| 11925 | if (err < 0) |
| 11926 | return err; |
| 11927 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11928 | return 1; |
| 11929 | } |
| 11930 | |
| 11931 | #define alc268_auto_init_multi_out alc882_auto_init_multi_out |
| 11932 | #define alc268_auto_init_hp_out alc882_auto_init_hp_out |
| 11933 | #define alc268_auto_init_analog_input alc882_auto_init_analog_input |
| 11934 | |
| 11935 | /* init callback for auto-configuration model -- overriding the default init */ |
| 11936 | static void alc268_auto_init(struct hda_codec *codec) |
| 11937 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 11938 | struct alc_spec *spec = codec->spec; |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11939 | alc268_auto_init_multi_out(codec); |
| 11940 | alc268_auto_init_hp_out(codec); |
| 11941 | alc268_auto_init_mono_speaker_out(codec); |
| 11942 | alc268_auto_init_analog_input(codec); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 11943 | if (spec->unsol_event) |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 11944 | alc_inithook(codec); |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11945 | } |
| 11946 | |
| 11947 | /* |
| 11948 | * configuration and preset |
| 11949 | */ |
| 11950 | static const char *alc268_models[ALC268_MODEL_LAST] = { |
Herton Ronaldo Krzesinski | eb5a662 | 2008-04-14 13:46:28 +0200 | [diff] [blame] | 11951 | [ALC267_QUANTA_IL1] = "quanta-il1", |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11952 | [ALC268_3ST] = "3stack", |
Takashi Iwai | 983f8ae | 2007-08-15 16:44:04 +0200 | [diff] [blame] | 11953 | [ALC268_TOSHIBA] = "toshiba", |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 11954 | [ALC268_ACER] = "acer", |
Takashi Iwai | c238b4f | 2008-11-05 14:57:20 +0100 | [diff] [blame] | 11955 | [ALC268_ACER_DMIC] = "acer-dmic", |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 11956 | [ALC268_ACER_ASPIRE_ONE] = "acer-aspire", |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 11957 | [ALC268_DELL] = "dell", |
Mirco Tischler | f12462c | 2008-02-04 12:33:59 +0100 | [diff] [blame] | 11958 | [ALC268_ZEPTO] = "zepto", |
Jonathan Woithe | 86c53bd | 2008-01-08 12:33:19 +0100 | [diff] [blame] | 11959 | #ifdef CONFIG_SND_DEBUG |
| 11960 | [ALC268_TEST] = "test", |
| 11961 | #endif |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11962 | [ALC268_AUTO] = "auto", |
| 11963 | }; |
| 11964 | |
| 11965 | static struct snd_pci_quirk alc268_cfg_tbl[] = { |
Takashi Iwai | a0b8f7d | 2008-04-22 19:39:49 +0200 | [diff] [blame] | 11966 | SND_PCI_QUIRK(0x1025, 0x011e, "Acer Aspire 5720z", ALC268_ACER), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 11967 | SND_PCI_QUIRK(0x1025, 0x0126, "Acer", ALC268_ACER), |
Andy Shevchenko | dafc835 | 2008-01-25 11:53:50 +0100 | [diff] [blame] | 11968 | SND_PCI_QUIRK(0x1025, 0x012e, "Acer Aspire 5310", ALC268_ACER), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 11969 | SND_PCI_QUIRK(0x1025, 0x0130, "Acer Extensa 5210", ALC268_ACER), |
Andy Shevchenko | 29a52c2 | 2008-01-24 17:29:00 +0100 | [diff] [blame] | 11970 | SND_PCI_QUIRK(0x1025, 0x0136, "Acer Aspire 5315", ALC268_ACER), |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 11971 | SND_PCI_QUIRK(0x1025, 0x015b, "Acer Aspire One", |
| 11972 | ALC268_ACER_ASPIRE_ONE), |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 11973 | SND_PCI_QUIRK(0x1028, 0x0253, "Dell OEM", ALC268_DELL), |
Takashi Iwai | 57d1392 | 2009-01-08 15:52:09 +0100 | [diff] [blame] | 11974 | SND_PCI_QUIRK(0x1028, 0x02b0, "Dell Inspiron Mini9", ALC268_DELL), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 11975 | SND_PCI_QUIRK(0x103c, 0x30cc, "TOSHIBA", ALC268_TOSHIBA), |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11976 | SND_PCI_QUIRK(0x1043, 0x1205, "ASUS W7J", ALC268_3ST), |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 11977 | SND_PCI_QUIRK(0x1179, 0xff10, "TOSHIBA A205", ALC268_TOSHIBA), |
Takashi Iwai | 8e7f00f | 2007-09-07 10:58:58 +0200 | [diff] [blame] | 11978 | SND_PCI_QUIRK(0x1179, 0xff50, "TOSHIBA A305", ALC268_TOSHIBA), |
Travis Place | 2346d0c | 2008-09-01 08:24:00 +0200 | [diff] [blame] | 11979 | SND_PCI_QUIRK(0x1179, 0xff64, "TOSHIBA L305", ALC268_TOSHIBA), |
Tony Vroon | 378bd6a | 2008-06-04 12:08:30 +0200 | [diff] [blame] | 11980 | SND_PCI_QUIRK(0x14c0, 0x0025, "COMPAL IFL90/JFL-92", ALC268_TOSHIBA), |
Takashi Iwai | b875bf3 | 2007-09-06 15:00:27 +0200 | [diff] [blame] | 11981 | SND_PCI_QUIRK(0x152d, 0x0763, "Diverse (CPR2000)", ALC268_ACER), |
Herton Ronaldo Krzesinski | eb5a662 | 2008-04-14 13:46:28 +0200 | [diff] [blame] | 11982 | SND_PCI_QUIRK(0x152d, 0x0771, "Quanta IL1", ALC267_QUANTA_IL1), |
Mirco Tischler | f12462c | 2008-02-04 12:33:59 +0100 | [diff] [blame] | 11983 | SND_PCI_QUIRK(0x1170, 0x0040, "ZEPTO", ALC268_ZEPTO), |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11984 | {} |
| 11985 | }; |
| 11986 | |
| 11987 | static struct alc_config_preset alc268_presets[] = { |
Herton Ronaldo Krzesinski | eb5a662 | 2008-04-14 13:46:28 +0200 | [diff] [blame] | 11988 | [ALC267_QUANTA_IL1] = { |
Takashi Iwai | 22971e3 | 2009-02-10 11:56:44 +0100 | [diff] [blame] | 11989 | .mixers = { alc267_quanta_il1_mixer, alc268_beep_mixer }, |
Herton Ronaldo Krzesinski | eb5a662 | 2008-04-14 13:46:28 +0200 | [diff] [blame] | 11990 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, |
| 11991 | alc267_quanta_il1_verbs }, |
| 11992 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), |
| 11993 | .dac_nids = alc268_dac_nids, |
| 11994 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), |
| 11995 | .adc_nids = alc268_adc_nids_alt, |
| 11996 | .hp_nid = 0x03, |
| 11997 | .num_channel_mode = ARRAY_SIZE(alc268_modes), |
| 11998 | .channel_mode = alc268_modes, |
| 11999 | .input_mux = &alc268_capture_source, |
| 12000 | .unsol_event = alc267_quanta_il1_unsol_event, |
| 12001 | .init_hook = alc267_quanta_il1_automute, |
| 12002 | }, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12003 | [ALC268_3ST] = { |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 12004 | .mixers = { alc268_base_mixer, alc268_capture_alt_mixer, |
| 12005 | alc268_beep_mixer }, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12006 | .init_verbs = { alc268_base_init_verbs }, |
| 12007 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), |
| 12008 | .dac_nids = alc268_dac_nids, |
| 12009 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), |
| 12010 | .adc_nids = alc268_adc_nids_alt, |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 12011 | .capsrc_nids = alc268_capsrc_nids, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12012 | .hp_nid = 0x03, |
| 12013 | .dig_out_nid = ALC268_DIGOUT_NID, |
| 12014 | .num_channel_mode = ARRAY_SIZE(alc268_modes), |
| 12015 | .channel_mode = alc268_modes, |
| 12016 | .input_mux = &alc268_capture_source, |
| 12017 | }, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 12018 | [ALC268_TOSHIBA] = { |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 12019 | .mixers = { alc268_base_mixer, alc268_capture_alt_mixer, |
| 12020 | alc268_beep_mixer }, |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 12021 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, |
| 12022 | alc268_toshiba_verbs }, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 12023 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), |
| 12024 | .dac_nids = alc268_dac_nids, |
| 12025 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), |
| 12026 | .adc_nids = alc268_adc_nids_alt, |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 12027 | .capsrc_nids = alc268_capsrc_nids, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 12028 | .hp_nid = 0x03, |
| 12029 | .num_channel_mode = ARRAY_SIZE(alc268_modes), |
| 12030 | .channel_mode = alc268_modes, |
| 12031 | .input_mux = &alc268_capture_source, |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 12032 | .unsol_event = alc268_toshiba_unsol_event, |
| 12033 | .init_hook = alc268_toshiba_automute, |
| 12034 | }, |
| 12035 | [ALC268_ACER] = { |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 12036 | .mixers = { alc268_acer_mixer, alc268_capture_alt_mixer, |
| 12037 | alc268_beep_mixer }, |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 12038 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, |
| 12039 | alc268_acer_verbs }, |
| 12040 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), |
| 12041 | .dac_nids = alc268_dac_nids, |
| 12042 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), |
| 12043 | .adc_nids = alc268_adc_nids_alt, |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 12044 | .capsrc_nids = alc268_capsrc_nids, |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 12045 | .hp_nid = 0x02, |
| 12046 | .num_channel_mode = ARRAY_SIZE(alc268_modes), |
| 12047 | .channel_mode = alc268_modes, |
Takashi Iwai | 0ccb541 | 2008-03-06 16:58:35 +0100 | [diff] [blame] | 12048 | .input_mux = &alc268_acer_capture_source, |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 12049 | .unsol_event = alc268_acer_unsol_event, |
Takashi Iwai | 889c439 | 2007-08-23 18:56:52 +0200 | [diff] [blame] | 12050 | .init_hook = alc268_acer_init_hook, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 12051 | }, |
Takashi Iwai | c238b4f | 2008-11-05 14:57:20 +0100 | [diff] [blame] | 12052 | [ALC268_ACER_DMIC] = { |
| 12053 | .mixers = { alc268_acer_dmic_mixer, alc268_capture_alt_mixer, |
| 12054 | alc268_beep_mixer }, |
| 12055 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, |
| 12056 | alc268_acer_verbs }, |
| 12057 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), |
| 12058 | .dac_nids = alc268_dac_nids, |
| 12059 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), |
| 12060 | .adc_nids = alc268_adc_nids_alt, |
| 12061 | .capsrc_nids = alc268_capsrc_nids, |
| 12062 | .hp_nid = 0x02, |
| 12063 | .num_channel_mode = ARRAY_SIZE(alc268_modes), |
| 12064 | .channel_mode = alc268_modes, |
| 12065 | .input_mux = &alc268_acer_dmic_capture_source, |
| 12066 | .unsol_event = alc268_acer_unsol_event, |
| 12067 | .init_hook = alc268_acer_init_hook, |
| 12068 | }, |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 12069 | [ALC268_ACER_ASPIRE_ONE] = { |
| 12070 | .mixers = { alc268_acer_aspire_one_mixer, |
Takashi Iwai | 22971e3 | 2009-02-10 11:56:44 +0100 | [diff] [blame] | 12071 | alc268_beep_mixer, |
| 12072 | alc268_capture_alt_mixer }, |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 12073 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, |
| 12074 | alc268_acer_aspire_one_verbs }, |
| 12075 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), |
| 12076 | .dac_nids = alc268_dac_nids, |
| 12077 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), |
| 12078 | .adc_nids = alc268_adc_nids_alt, |
| 12079 | .capsrc_nids = alc268_capsrc_nids, |
| 12080 | .hp_nid = 0x03, |
| 12081 | .num_channel_mode = ARRAY_SIZE(alc268_modes), |
| 12082 | .channel_mode = alc268_modes, |
| 12083 | .input_mux = &alc268_acer_lc_capture_source, |
| 12084 | .unsol_event = alc268_acer_lc_unsol_event, |
| 12085 | .init_hook = alc268_acer_lc_init_hook, |
| 12086 | }, |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 12087 | [ALC268_DELL] = { |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 12088 | .mixers = { alc268_dell_mixer, alc268_beep_mixer }, |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 12089 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, |
| 12090 | alc268_dell_verbs }, |
| 12091 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), |
| 12092 | .dac_nids = alc268_dac_nids, |
| 12093 | .hp_nid = 0x02, |
| 12094 | .num_channel_mode = ARRAY_SIZE(alc268_modes), |
| 12095 | .channel_mode = alc268_modes, |
| 12096 | .unsol_event = alc268_dell_unsol_event, |
| 12097 | .init_hook = alc268_dell_init_hook, |
| 12098 | .input_mux = &alc268_capture_source, |
| 12099 | }, |
Mirco Tischler | f12462c | 2008-02-04 12:33:59 +0100 | [diff] [blame] | 12100 | [ALC268_ZEPTO] = { |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 12101 | .mixers = { alc268_base_mixer, alc268_capture_alt_mixer, |
| 12102 | alc268_beep_mixer }, |
Mirco Tischler | f12462c | 2008-02-04 12:33:59 +0100 | [diff] [blame] | 12103 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, |
| 12104 | alc268_toshiba_verbs }, |
| 12105 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), |
| 12106 | .dac_nids = alc268_dac_nids, |
| 12107 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), |
| 12108 | .adc_nids = alc268_adc_nids_alt, |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 12109 | .capsrc_nids = alc268_capsrc_nids, |
Mirco Tischler | f12462c | 2008-02-04 12:33:59 +0100 | [diff] [blame] | 12110 | .hp_nid = 0x03, |
| 12111 | .dig_out_nid = ALC268_DIGOUT_NID, |
| 12112 | .num_channel_mode = ARRAY_SIZE(alc268_modes), |
| 12113 | .channel_mode = alc268_modes, |
| 12114 | .input_mux = &alc268_capture_source, |
| 12115 | .unsol_event = alc268_toshiba_unsol_event, |
| 12116 | .init_hook = alc268_toshiba_automute |
| 12117 | }, |
Jonathan Woithe | 86c53bd | 2008-01-08 12:33:19 +0100 | [diff] [blame] | 12118 | #ifdef CONFIG_SND_DEBUG |
| 12119 | [ALC268_TEST] = { |
| 12120 | .mixers = { alc268_test_mixer, alc268_capture_mixer }, |
| 12121 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, |
| 12122 | alc268_volume_init_verbs }, |
| 12123 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), |
| 12124 | .dac_nids = alc268_dac_nids, |
| 12125 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), |
| 12126 | .adc_nids = alc268_adc_nids_alt, |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 12127 | .capsrc_nids = alc268_capsrc_nids, |
Jonathan Woithe | 86c53bd | 2008-01-08 12:33:19 +0100 | [diff] [blame] | 12128 | .hp_nid = 0x03, |
| 12129 | .dig_out_nid = ALC268_DIGOUT_NID, |
| 12130 | .num_channel_mode = ARRAY_SIZE(alc268_modes), |
| 12131 | .channel_mode = alc268_modes, |
| 12132 | .input_mux = &alc268_capture_source, |
| 12133 | }, |
| 12134 | #endif |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12135 | }; |
| 12136 | |
| 12137 | static int patch_alc268(struct hda_codec *codec) |
| 12138 | { |
| 12139 | struct alc_spec *spec; |
| 12140 | int board_config; |
Takashi Iwai | 22971e3 | 2009-02-10 11:56:44 +0100 | [diff] [blame] | 12141 | int i, has_beep, err; |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12142 | |
| 12143 | spec = kcalloc(1, sizeof(*spec), GFP_KERNEL); |
| 12144 | if (spec == NULL) |
| 12145 | return -ENOMEM; |
| 12146 | |
| 12147 | codec->spec = spec; |
| 12148 | |
| 12149 | board_config = snd_hda_check_board_config(codec, ALC268_MODEL_LAST, |
| 12150 | alc268_models, |
| 12151 | alc268_cfg_tbl); |
| 12152 | |
| 12153 | if (board_config < 0 || board_config >= ALC268_MODEL_LAST) { |
| 12154 | printk(KERN_INFO "hda_codec: Unknown model for ALC268, " |
| 12155 | "trying auto-probe from BIOS...\n"); |
| 12156 | board_config = ALC268_AUTO; |
| 12157 | } |
| 12158 | |
| 12159 | if (board_config == ALC268_AUTO) { |
| 12160 | /* automatic parse from the BIOS config */ |
| 12161 | err = alc268_parse_auto_config(codec); |
| 12162 | if (err < 0) { |
| 12163 | alc_free(codec); |
| 12164 | return err; |
| 12165 | } else if (!err) { |
| 12166 | printk(KERN_INFO |
| 12167 | "hda_codec: Cannot set up configuration " |
| 12168 | "from BIOS. Using base mode...\n"); |
| 12169 | board_config = ALC268_3ST; |
| 12170 | } |
| 12171 | } |
| 12172 | |
| 12173 | if (board_config != ALC268_AUTO) |
| 12174 | setup_preset(spec, &alc268_presets[board_config]); |
| 12175 | |
Kailang Yang | 2f89328 | 2008-05-27 12:14:47 +0200 | [diff] [blame] | 12176 | if (codec->vendor_id == 0x10ec0267) { |
| 12177 | spec->stream_name_analog = "ALC267 Analog"; |
| 12178 | spec->stream_name_digital = "ALC267 Digital"; |
| 12179 | } else { |
| 12180 | spec->stream_name_analog = "ALC268 Analog"; |
| 12181 | spec->stream_name_digital = "ALC268 Digital"; |
| 12182 | } |
| 12183 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12184 | spec->stream_analog_playback = &alc268_pcm_analog_playback; |
| 12185 | spec->stream_analog_capture = &alc268_pcm_analog_capture; |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 12186 | spec->stream_analog_alt_capture = &alc268_pcm_analog_alt_capture; |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12187 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12188 | spec->stream_digital_playback = &alc268_pcm_digital_playback; |
| 12189 | |
Takashi Iwai | 22971e3 | 2009-02-10 11:56:44 +0100 | [diff] [blame] | 12190 | has_beep = 0; |
| 12191 | for (i = 0; i < spec->num_mixers; i++) { |
| 12192 | if (spec->mixers[i] == alc268_beep_mixer) { |
| 12193 | has_beep = 1; |
| 12194 | break; |
| 12195 | } |
| 12196 | } |
| 12197 | |
| 12198 | if (has_beep) { |
| 12199 | err = snd_hda_attach_beep_device(codec, 0x1); |
| 12200 | if (err < 0) { |
| 12201 | alc_free(codec); |
| 12202 | return err; |
| 12203 | } |
| 12204 | if (!query_amp_caps(codec, 0x1d, HDA_INPUT)) |
| 12205 | /* override the amp caps for beep generator */ |
| 12206 | snd_hda_override_amp_caps(codec, 0x1d, HDA_INPUT, |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 12207 | (0x0c << AC_AMPCAP_OFFSET_SHIFT) | |
| 12208 | (0x0c << AC_AMPCAP_NUM_STEPS_SHIFT) | |
| 12209 | (0x07 << AC_AMPCAP_STEP_SIZE_SHIFT) | |
| 12210 | (0 << AC_AMPCAP_MUTE_SHIFT)); |
Takashi Iwai | 22971e3 | 2009-02-10 11:56:44 +0100 | [diff] [blame] | 12211 | } |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 12212 | |
Takashi Iwai | 7e0e44d | 2009-02-19 08:15:49 +0100 | [diff] [blame] | 12213 | if (!spec->no_analog && !spec->adc_nids && spec->input_mux) { |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 12214 | /* check whether NID 0x07 is valid */ |
| 12215 | unsigned int wcap = get_wcaps(codec, 0x07); |
Takashi Iwai | 85860c0 | 2008-02-19 15:00:15 +0100 | [diff] [blame] | 12216 | int i; |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12217 | |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 12218 | /* get type */ |
| 12219 | wcap = (wcap & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT; |
Takashi Iwai | 67ebcb0 | 2008-02-19 15:03:57 +0100 | [diff] [blame] | 12220 | if (wcap != AC_WID_AUD_IN || spec->input_mux->num_items == 1) { |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 12221 | spec->adc_nids = alc268_adc_nids_alt; |
| 12222 | spec->num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt); |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 12223 | add_mixer(spec, alc268_capture_alt_mixer); |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 12224 | } else { |
| 12225 | spec->adc_nids = alc268_adc_nids; |
| 12226 | spec->num_adc_nids = ARRAY_SIZE(alc268_adc_nids); |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 12227 | add_mixer(spec, alc268_capture_mixer); |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12228 | } |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 12229 | spec->capsrc_nids = alc268_capsrc_nids; |
Takashi Iwai | 85860c0 | 2008-02-19 15:00:15 +0100 | [diff] [blame] | 12230 | /* set default input source */ |
| 12231 | for (i = 0; i < spec->num_adc_nids; i++) |
| 12232 | snd_hda_codec_write_cache(codec, alc268_capsrc_nids[i], |
| 12233 | 0, AC_VERB_SET_CONNECT_SEL, |
| 12234 | spec->input_mux->items[0].index); |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12235 | } |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 12236 | |
| 12237 | spec->vmaster_nid = 0x02; |
| 12238 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12239 | codec->patch_ops = alc_patch_ops; |
| 12240 | if (board_config == ALC268_AUTO) |
| 12241 | spec->init_hook = alc268_auto_init; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 12242 | |
Takashi Iwai | daead53 | 2008-11-28 12:55:36 +0100 | [diff] [blame] | 12243 | codec->proc_widget_hook = print_realtek_coef; |
| 12244 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12245 | return 0; |
| 12246 | } |
| 12247 | |
| 12248 | /* |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 12249 | * ALC269 channel source setting (2 channel) |
| 12250 | */ |
| 12251 | #define ALC269_DIGOUT_NID ALC880_DIGOUT_NID |
| 12252 | |
| 12253 | #define alc269_dac_nids alc260_dac_nids |
| 12254 | |
| 12255 | static hda_nid_t alc269_adc_nids[1] = { |
| 12256 | /* ADC1 */ |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 12257 | 0x08, |
| 12258 | }; |
| 12259 | |
Takashi Iwai | e01bf50 | 2008-08-21 16:25:07 +0200 | [diff] [blame] | 12260 | static hda_nid_t alc269_capsrc_nids[1] = { |
| 12261 | 0x23, |
| 12262 | }; |
| 12263 | |
| 12264 | /* NOTE: ADC2 (0x07) is connected from a recording *MIXER* (0x24), |
| 12265 | * not a mux! |
| 12266 | */ |
| 12267 | |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 12268 | static struct hda_input_mux alc269_eeepc_dmic_capture_source = { |
| 12269 | .num_items = 2, |
| 12270 | .items = { |
| 12271 | { "i-Mic", 0x5 }, |
| 12272 | { "e-Mic", 0x0 }, |
| 12273 | }, |
| 12274 | }; |
| 12275 | |
| 12276 | static struct hda_input_mux alc269_eeepc_amic_capture_source = { |
| 12277 | .num_items = 2, |
| 12278 | .items = { |
| 12279 | { "i-Mic", 0x1 }, |
| 12280 | { "e-Mic", 0x0 }, |
| 12281 | }, |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 12282 | }; |
| 12283 | |
| 12284 | #define alc269_modes alc260_modes |
| 12285 | #define alc269_capture_source alc880_lg_lw_capture_source |
| 12286 | |
| 12287 | static struct snd_kcontrol_new alc269_base_mixer[] = { |
| 12288 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 12289 | HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 12290 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 12291 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 12292 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 12293 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 12294 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 12295 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 12296 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 12297 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
| 12298 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 12299 | HDA_CODEC_MUTE_MONO("Mono Playback Switch", 0x16, 2, 0x0, HDA_OUTPUT), |
| 12300 | { } /* end */ |
| 12301 | }; |
| 12302 | |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 12303 | static struct snd_kcontrol_new alc269_quanta_fl1_mixer[] = { |
| 12304 | /* output mixer control */ |
| 12305 | HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol), |
| 12306 | { |
| 12307 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 12308 | .name = "Master Playback Switch", |
| 12309 | .info = snd_hda_mixer_amp_switch_info, |
| 12310 | .get = snd_hda_mixer_amp_switch_get, |
| 12311 | .put = alc268_acer_master_sw_put, |
| 12312 | .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), |
| 12313 | }, |
| 12314 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 12315 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 12316 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 12317 | HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 12318 | HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 12319 | HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT), |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 12320 | { } |
| 12321 | }; |
| 12322 | |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 12323 | static struct snd_kcontrol_new alc269_lifebook_mixer[] = { |
| 12324 | /* output mixer control */ |
| 12325 | HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol), |
| 12326 | { |
| 12327 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 12328 | .name = "Master Playback Switch", |
| 12329 | .info = snd_hda_mixer_amp_switch_info, |
| 12330 | .get = snd_hda_mixer_amp_switch_get, |
| 12331 | .put = alc268_acer_master_sw_put, |
| 12332 | .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), |
| 12333 | }, |
| 12334 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 12335 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 12336 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 12337 | HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 12338 | HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 12339 | HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT), |
| 12340 | HDA_CODEC_VOLUME("Dock Mic Playback Volume", 0x0b, 0x03, HDA_INPUT), |
| 12341 | HDA_CODEC_MUTE("Dock Mic Playback Switch", 0x0b, 0x03, HDA_INPUT), |
| 12342 | HDA_CODEC_VOLUME("Dock Mic Boost", 0x1b, 0, HDA_INPUT), |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 12343 | { } |
| 12344 | }; |
| 12345 | |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 12346 | /* bind volumes of both NID 0x0c and 0x0d */ |
| 12347 | static struct hda_bind_ctls alc269_epc_bind_vol = { |
| 12348 | .ops = &snd_hda_bind_vol, |
| 12349 | .values = { |
| 12350 | HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT), |
| 12351 | HDA_COMPOSE_AMP_VAL(0x03, 3, 0, HDA_OUTPUT), |
| 12352 | 0 |
| 12353 | }, |
| 12354 | }; |
| 12355 | |
| 12356 | static struct snd_kcontrol_new alc269_eeepc_mixer[] = { |
| 12357 | HDA_CODEC_MUTE("iSpeaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 12358 | HDA_BIND_VOL("LineOut Playback Volume", &alc269_epc_bind_vol), |
| 12359 | HDA_CODEC_MUTE("LineOut Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 12360 | { } /* end */ |
| 12361 | }; |
| 12362 | |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 12363 | /* capture mixer elements */ |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 12364 | static struct snd_kcontrol_new alc269_epc_capture_mixer[] = { |
| 12365 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 12366 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
Takashi Iwai | 26f5df2 | 2008-11-03 17:39:46 +0100 | [diff] [blame] | 12367 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 12368 | { } /* end */ |
| 12369 | }; |
| 12370 | |
| 12371 | /* FSC amilo */ |
| 12372 | static struct snd_kcontrol_new alc269_fujitsu_mixer[] = { |
| 12373 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 12374 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 12375 | HDA_BIND_VOL("PCM Playback Volume", &alc269_epc_bind_vol), |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 12376 | { } /* end */ |
| 12377 | }; |
| 12378 | |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 12379 | static struct hda_verb alc269_quanta_fl1_verbs[] = { |
| 12380 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 12381 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 12382 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 12383 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 12384 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 12385 | {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 12386 | { } |
| 12387 | }; |
| 12388 | |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 12389 | static struct hda_verb alc269_lifebook_verbs[] = { |
| 12390 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 12391 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 12392 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 12393 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 12394 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 12395 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 12396 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 12397 | {0x1a, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 12398 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 12399 | {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 12400 | { } |
| 12401 | }; |
| 12402 | |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 12403 | /* toggle speaker-output according to the hp-jack state */ |
| 12404 | static void alc269_quanta_fl1_speaker_automute(struct hda_codec *codec) |
| 12405 | { |
| 12406 | unsigned int present; |
| 12407 | unsigned char bits; |
| 12408 | |
| 12409 | present = snd_hda_codec_read(codec, 0x15, 0, |
| 12410 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 12411 | bits = present ? AMP_IN_MUTE(0) : 0; |
| 12412 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0, |
| 12413 | AMP_IN_MUTE(0), bits); |
| 12414 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1, |
| 12415 | AMP_IN_MUTE(0), bits); |
| 12416 | |
| 12417 | snd_hda_codec_write(codec, 0x20, 0, |
| 12418 | AC_VERB_SET_COEF_INDEX, 0x0c); |
| 12419 | snd_hda_codec_write(codec, 0x20, 0, |
| 12420 | AC_VERB_SET_PROC_COEF, 0x680); |
| 12421 | |
| 12422 | snd_hda_codec_write(codec, 0x20, 0, |
| 12423 | AC_VERB_SET_COEF_INDEX, 0x0c); |
| 12424 | snd_hda_codec_write(codec, 0x20, 0, |
| 12425 | AC_VERB_SET_PROC_COEF, 0x480); |
| 12426 | } |
| 12427 | |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 12428 | /* toggle speaker-output according to the hp-jacks state */ |
| 12429 | static void alc269_lifebook_speaker_automute(struct hda_codec *codec) |
| 12430 | { |
| 12431 | unsigned int present; |
| 12432 | unsigned char bits; |
| 12433 | |
| 12434 | /* Check laptop headphone socket */ |
| 12435 | present = snd_hda_codec_read(codec, 0x15, 0, |
| 12436 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 12437 | |
| 12438 | /* Check port replicator headphone socket */ |
| 12439 | present |= snd_hda_codec_read(codec, 0x1a, 0, |
| 12440 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 12441 | |
| 12442 | bits = present ? AMP_IN_MUTE(0) : 0; |
| 12443 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0, |
| 12444 | AMP_IN_MUTE(0), bits); |
| 12445 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1, |
| 12446 | AMP_IN_MUTE(0), bits); |
| 12447 | |
| 12448 | snd_hda_codec_write(codec, 0x20, 0, |
| 12449 | AC_VERB_SET_COEF_INDEX, 0x0c); |
| 12450 | snd_hda_codec_write(codec, 0x20, 0, |
| 12451 | AC_VERB_SET_PROC_COEF, 0x680); |
| 12452 | |
| 12453 | snd_hda_codec_write(codec, 0x20, 0, |
| 12454 | AC_VERB_SET_COEF_INDEX, 0x0c); |
| 12455 | snd_hda_codec_write(codec, 0x20, 0, |
| 12456 | AC_VERB_SET_PROC_COEF, 0x480); |
| 12457 | } |
| 12458 | |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 12459 | static void alc269_quanta_fl1_mic_automute(struct hda_codec *codec) |
| 12460 | { |
| 12461 | unsigned int present; |
| 12462 | |
| 12463 | present = snd_hda_codec_read(codec, 0x18, 0, |
| 12464 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 12465 | snd_hda_codec_write(codec, 0x23, 0, |
| 12466 | AC_VERB_SET_CONNECT_SEL, present ? 0x0 : 0x1); |
| 12467 | } |
| 12468 | |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 12469 | static void alc269_lifebook_mic_autoswitch(struct hda_codec *codec) |
| 12470 | { |
| 12471 | unsigned int present_laptop; |
| 12472 | unsigned int present_dock; |
| 12473 | |
| 12474 | present_laptop = snd_hda_codec_read(codec, 0x18, 0, |
| 12475 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 12476 | |
| 12477 | present_dock = snd_hda_codec_read(codec, 0x1b, 0, |
| 12478 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 12479 | |
| 12480 | /* Laptop mic port overrides dock mic port, design decision */ |
| 12481 | if (present_dock) |
| 12482 | snd_hda_codec_write(codec, 0x23, 0, |
| 12483 | AC_VERB_SET_CONNECT_SEL, 0x3); |
| 12484 | if (present_laptop) |
| 12485 | snd_hda_codec_write(codec, 0x23, 0, |
| 12486 | AC_VERB_SET_CONNECT_SEL, 0x0); |
| 12487 | if (!present_dock && !present_laptop) |
| 12488 | snd_hda_codec_write(codec, 0x23, 0, |
| 12489 | AC_VERB_SET_CONNECT_SEL, 0x1); |
| 12490 | } |
| 12491 | |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 12492 | static void alc269_quanta_fl1_unsol_event(struct hda_codec *codec, |
| 12493 | unsigned int res) |
| 12494 | { |
| 12495 | if ((res >> 26) == ALC880_HP_EVENT) |
| 12496 | alc269_quanta_fl1_speaker_automute(codec); |
| 12497 | if ((res >> 26) == ALC880_MIC_EVENT) |
| 12498 | alc269_quanta_fl1_mic_automute(codec); |
| 12499 | } |
| 12500 | |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 12501 | static void alc269_lifebook_unsol_event(struct hda_codec *codec, |
| 12502 | unsigned int res) |
| 12503 | { |
| 12504 | if ((res >> 26) == ALC880_HP_EVENT) |
| 12505 | alc269_lifebook_speaker_automute(codec); |
| 12506 | if ((res >> 26) == ALC880_MIC_EVENT) |
| 12507 | alc269_lifebook_mic_autoswitch(codec); |
| 12508 | } |
| 12509 | |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 12510 | static void alc269_quanta_fl1_init_hook(struct hda_codec *codec) |
| 12511 | { |
| 12512 | alc269_quanta_fl1_speaker_automute(codec); |
| 12513 | alc269_quanta_fl1_mic_automute(codec); |
| 12514 | } |
| 12515 | |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 12516 | static void alc269_lifebook_init_hook(struct hda_codec *codec) |
| 12517 | { |
| 12518 | alc269_lifebook_speaker_automute(codec); |
| 12519 | alc269_lifebook_mic_autoswitch(codec); |
| 12520 | } |
| 12521 | |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 12522 | static struct hda_verb alc269_eeepc_dmic_init_verbs[] = { |
| 12523 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 12524 | {0x23, AC_VERB_SET_CONNECT_SEL, 0x05}, |
| 12525 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, 0xb026 }, |
| 12526 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7019 | (0x00 << 8))}, |
| 12527 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 12528 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 12529 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 12530 | {} |
| 12531 | }; |
| 12532 | |
| 12533 | static struct hda_verb alc269_eeepc_amic_init_verbs[] = { |
| 12534 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 12535 | {0x23, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 12536 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, 0xb026 }, |
| 12537 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x701b | (0x00 << 8))}, |
| 12538 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 12539 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 12540 | {} |
| 12541 | }; |
| 12542 | |
| 12543 | /* toggle speaker-output according to the hp-jack state */ |
| 12544 | static void alc269_speaker_automute(struct hda_codec *codec) |
| 12545 | { |
| 12546 | unsigned int present; |
| 12547 | unsigned char bits; |
| 12548 | |
| 12549 | present = snd_hda_codec_read(codec, 0x15, 0, |
| 12550 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 12551 | bits = present ? AMP_IN_MUTE(0) : 0; |
| 12552 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0, |
| 12553 | AMP_IN_MUTE(0), bits); |
| 12554 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1, |
| 12555 | AMP_IN_MUTE(0), bits); |
| 12556 | } |
| 12557 | |
| 12558 | static void alc269_eeepc_dmic_automute(struct hda_codec *codec) |
| 12559 | { |
| 12560 | unsigned int present; |
| 12561 | |
| 12562 | present = snd_hda_codec_read(codec, 0x18, 0, |
| 12563 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 12564 | snd_hda_codec_write(codec, 0x23, 0, |
| 12565 | AC_VERB_SET_CONNECT_SEL, (present ? 0 : 5)); |
| 12566 | } |
| 12567 | |
| 12568 | static void alc269_eeepc_amic_automute(struct hda_codec *codec) |
| 12569 | { |
| 12570 | unsigned int present; |
| 12571 | |
| 12572 | present = snd_hda_codec_read(codec, 0x18, 0, |
| 12573 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 12574 | snd_hda_codec_write(codec, 0x24, 0, AC_VERB_SET_AMP_GAIN_MUTE, |
| 12575 | 0x7000 | (0x00 << 8) | (present ? 0 : 0x80)); |
| 12576 | snd_hda_codec_write(codec, 0x24, 0, AC_VERB_SET_AMP_GAIN_MUTE, |
| 12577 | 0x7000 | (0x01 << 8) | (present ? 0x80 : 0)); |
| 12578 | } |
| 12579 | |
| 12580 | /* unsolicited event for HP jack sensing */ |
| 12581 | static void alc269_eeepc_dmic_unsol_event(struct hda_codec *codec, |
| 12582 | unsigned int res) |
| 12583 | { |
| 12584 | if ((res >> 26) == ALC880_HP_EVENT) |
| 12585 | alc269_speaker_automute(codec); |
| 12586 | |
| 12587 | if ((res >> 26) == ALC880_MIC_EVENT) |
| 12588 | alc269_eeepc_dmic_automute(codec); |
| 12589 | } |
| 12590 | |
| 12591 | static void alc269_eeepc_dmic_inithook(struct hda_codec *codec) |
| 12592 | { |
| 12593 | alc269_speaker_automute(codec); |
| 12594 | alc269_eeepc_dmic_automute(codec); |
| 12595 | } |
| 12596 | |
| 12597 | /* unsolicited event for HP jack sensing */ |
| 12598 | static void alc269_eeepc_amic_unsol_event(struct hda_codec *codec, |
| 12599 | unsigned int res) |
| 12600 | { |
| 12601 | if ((res >> 26) == ALC880_HP_EVENT) |
| 12602 | alc269_speaker_automute(codec); |
| 12603 | |
| 12604 | if ((res >> 26) == ALC880_MIC_EVENT) |
| 12605 | alc269_eeepc_amic_automute(codec); |
| 12606 | } |
| 12607 | |
| 12608 | static void alc269_eeepc_amic_inithook(struct hda_codec *codec) |
| 12609 | { |
| 12610 | alc269_speaker_automute(codec); |
| 12611 | alc269_eeepc_amic_automute(codec); |
| 12612 | } |
| 12613 | |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 12614 | /* |
| 12615 | * generic initialization of ADC, input mixers and output mixers |
| 12616 | */ |
| 12617 | static struct hda_verb alc269_init_verbs[] = { |
| 12618 | /* |
| 12619 | * Unmute ADC0 and set the default input to mic-in |
| 12620 | */ |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 12621 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 12622 | |
| 12623 | /* Mute input amps (PCBeep, Line In, Mic 1 & Mic 2) of the |
| 12624 | * analog-loopback mixer widget |
| 12625 | * Note: PASD motherboards uses the Line In 2 as the input for |
| 12626 | * front panel mic (mic 2) |
| 12627 | */ |
| 12628 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
| 12629 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 12630 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 12631 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 12632 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 12633 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 12634 | |
| 12635 | /* |
| 12636 | * Set up output mixers (0x0c - 0x0e) |
| 12637 | */ |
| 12638 | /* set vol=0 to output mixers */ |
| 12639 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 12640 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 12641 | |
| 12642 | /* set up input amps for analog loopback */ |
| 12643 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 12644 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12645 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 12646 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12647 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 12648 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12649 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 12650 | |
| 12651 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 12652 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 12653 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 12654 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 12655 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 12656 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 12657 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 12658 | |
| 12659 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 12660 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 12661 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 12662 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 12663 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 12664 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 12665 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 12666 | |
| 12667 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 12668 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 12669 | |
| 12670 | /* FIXME: use matrix-type input source selection */ |
| 12671 | /* Mixer elements: 0x18, 19, 1a, 1b, 1d, 0b */ |
| 12672 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 12673 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 12674 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 12675 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 12676 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 12677 | |
| 12678 | /* set EAPD */ |
| 12679 | {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 12680 | {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 12681 | { } |
| 12682 | }; |
| 12683 | |
| 12684 | /* add playback controls from the parsed DAC table */ |
| 12685 | static int alc269_auto_create_multi_out_ctls(struct alc_spec *spec, |
| 12686 | const struct auto_pin_cfg *cfg) |
| 12687 | { |
| 12688 | hda_nid_t nid; |
| 12689 | int err; |
| 12690 | |
| 12691 | spec->multiout.num_dacs = 1; /* only use one dac */ |
| 12692 | spec->multiout.dac_nids = spec->private_dac_nids; |
| 12693 | spec->multiout.dac_nids[0] = 2; |
| 12694 | |
| 12695 | nid = cfg->line_out_pins[0]; |
| 12696 | if (nid) { |
| 12697 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 12698 | "Front Playback Volume", |
| 12699 | HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT)); |
| 12700 | if (err < 0) |
| 12701 | return err; |
| 12702 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, |
| 12703 | "Front Playback Switch", |
| 12704 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT)); |
| 12705 | if (err < 0) |
| 12706 | return err; |
| 12707 | } |
| 12708 | |
| 12709 | nid = cfg->speaker_pins[0]; |
| 12710 | if (nid) { |
| 12711 | if (!cfg->line_out_pins[0]) { |
| 12712 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 12713 | "Speaker Playback Volume", |
| 12714 | HDA_COMPOSE_AMP_VAL(0x02, 3, 0, |
| 12715 | HDA_OUTPUT)); |
| 12716 | if (err < 0) |
| 12717 | return err; |
| 12718 | } |
| 12719 | if (nid == 0x16) { |
| 12720 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, |
| 12721 | "Speaker Playback Switch", |
| 12722 | HDA_COMPOSE_AMP_VAL(nid, 2, 0, |
| 12723 | HDA_OUTPUT)); |
| 12724 | if (err < 0) |
| 12725 | return err; |
| 12726 | } else { |
| 12727 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, |
| 12728 | "Speaker Playback Switch", |
| 12729 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, |
| 12730 | HDA_OUTPUT)); |
| 12731 | if (err < 0) |
| 12732 | return err; |
| 12733 | } |
| 12734 | } |
| 12735 | nid = cfg->hp_pins[0]; |
| 12736 | if (nid) { |
| 12737 | /* spec->multiout.hp_nid = 2; */ |
| 12738 | if (!cfg->line_out_pins[0] && !cfg->speaker_pins[0]) { |
| 12739 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 12740 | "Headphone Playback Volume", |
| 12741 | HDA_COMPOSE_AMP_VAL(0x02, 3, 0, |
| 12742 | HDA_OUTPUT)); |
| 12743 | if (err < 0) |
| 12744 | return err; |
| 12745 | } |
| 12746 | if (nid == 0x16) { |
| 12747 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, |
| 12748 | "Headphone Playback Switch", |
| 12749 | HDA_COMPOSE_AMP_VAL(nid, 2, 0, |
| 12750 | HDA_OUTPUT)); |
| 12751 | if (err < 0) |
| 12752 | return err; |
| 12753 | } else { |
| 12754 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, |
| 12755 | "Headphone Playback Switch", |
| 12756 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, |
| 12757 | HDA_OUTPUT)); |
| 12758 | if (err < 0) |
| 12759 | return err; |
| 12760 | } |
| 12761 | } |
| 12762 | return 0; |
| 12763 | } |
| 12764 | |
Takashi Iwai | ee956e0 | 2008-10-31 17:16:31 +0100 | [diff] [blame] | 12765 | static int alc269_auto_create_analog_input_ctls(struct alc_spec *spec, |
| 12766 | const struct auto_pin_cfg *cfg) |
| 12767 | { |
| 12768 | int err; |
| 12769 | |
| 12770 | err = alc880_auto_create_analog_input_ctls(spec, cfg); |
| 12771 | if (err < 0) |
| 12772 | return err; |
| 12773 | /* digital-mic input pin is excluded in alc880_auto_create..() |
| 12774 | * because it's under 0x18 |
| 12775 | */ |
| 12776 | if (cfg->input_pins[AUTO_PIN_MIC] == 0x12 || |
| 12777 | cfg->input_pins[AUTO_PIN_FRONT_MIC] == 0x12) { |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 12778 | struct hda_input_mux *imux = &spec->private_imux[0]; |
Takashi Iwai | ee956e0 | 2008-10-31 17:16:31 +0100 | [diff] [blame] | 12779 | imux->items[imux->num_items].label = "Int Mic"; |
| 12780 | imux->items[imux->num_items].index = 0x05; |
| 12781 | imux->num_items++; |
| 12782 | } |
| 12783 | return 0; |
| 12784 | } |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 12785 | |
| 12786 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 12787 | #define alc269_loopbacks alc880_loopbacks |
| 12788 | #endif |
| 12789 | |
| 12790 | /* pcm configuration: identiacal with ALC880 */ |
| 12791 | #define alc269_pcm_analog_playback alc880_pcm_analog_playback |
| 12792 | #define alc269_pcm_analog_capture alc880_pcm_analog_capture |
| 12793 | #define alc269_pcm_digital_playback alc880_pcm_digital_playback |
| 12794 | #define alc269_pcm_digital_capture alc880_pcm_digital_capture |
| 12795 | |
| 12796 | /* |
| 12797 | * BIOS auto configuration |
| 12798 | */ |
| 12799 | static int alc269_parse_auto_config(struct hda_codec *codec) |
| 12800 | { |
| 12801 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | cfb9fb5 | 2009-02-06 17:34:03 +0100 | [diff] [blame] | 12802 | int err; |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 12803 | static hda_nid_t alc269_ignore[] = { 0x1d, 0 }; |
| 12804 | |
| 12805 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 12806 | alc269_ignore); |
| 12807 | if (err < 0) |
| 12808 | return err; |
| 12809 | |
| 12810 | err = alc269_auto_create_multi_out_ctls(spec, &spec->autocfg); |
| 12811 | if (err < 0) |
| 12812 | return err; |
| 12813 | err = alc269_auto_create_analog_input_ctls(spec, &spec->autocfg); |
| 12814 | if (err < 0) |
| 12815 | return err; |
| 12816 | |
| 12817 | spec->multiout.max_channels = spec->multiout.num_dacs * 2; |
| 12818 | |
Takashi Iwai | 0852d7a | 2009-02-11 11:35:15 +0100 | [diff] [blame] | 12819 | if (spec->autocfg.dig_outs) |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 12820 | spec->multiout.dig_out_nid = ALC269_DIGOUT_NID; |
| 12821 | |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 12822 | if (spec->kctls.list) |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 12823 | add_mixer(spec, spec->kctls.list); |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 12824 | |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 12825 | add_verb(spec, alc269_init_verbs); |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 12826 | spec->num_mux_defs = 1; |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 12827 | spec->input_mux = &spec->private_imux[0]; |
Takashi Iwai | e01bf50 | 2008-08-21 16:25:07 +0200 | [diff] [blame] | 12828 | /* set default input source */ |
| 12829 | snd_hda_codec_write_cache(codec, alc269_capsrc_nids[0], |
| 12830 | 0, AC_VERB_SET_CONNECT_SEL, |
| 12831 | spec->input_mux->items[0].index); |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 12832 | |
| 12833 | err = alc_auto_add_mic_boost(codec); |
| 12834 | if (err < 0) |
| 12835 | return err; |
| 12836 | |
Takashi Iwai | 7e0e44d | 2009-02-19 08:15:49 +0100 | [diff] [blame] | 12837 | if (!spec->cap_mixer && !spec->no_analog) |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 12838 | set_capture_mixer(spec); |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 12839 | |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 12840 | return 1; |
| 12841 | } |
| 12842 | |
| 12843 | #define alc269_auto_init_multi_out alc882_auto_init_multi_out |
| 12844 | #define alc269_auto_init_hp_out alc882_auto_init_hp_out |
| 12845 | #define alc269_auto_init_analog_input alc882_auto_init_analog_input |
| 12846 | |
| 12847 | |
| 12848 | /* init callback for auto-configuration model -- overriding the default init */ |
| 12849 | static void alc269_auto_init(struct hda_codec *codec) |
| 12850 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 12851 | struct alc_spec *spec = codec->spec; |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 12852 | alc269_auto_init_multi_out(codec); |
| 12853 | alc269_auto_init_hp_out(codec); |
| 12854 | alc269_auto_init_analog_input(codec); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 12855 | if (spec->unsol_event) |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 12856 | alc_inithook(codec); |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 12857 | } |
| 12858 | |
| 12859 | /* |
| 12860 | * configuration and preset |
| 12861 | */ |
| 12862 | static const char *alc269_models[ALC269_MODEL_LAST] = { |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 12863 | [ALC269_BASIC] = "basic", |
Takashi Iwai | 2922c9a | 2008-08-27 18:12:42 +0200 | [diff] [blame] | 12864 | [ALC269_QUANTA_FL1] = "quanta", |
| 12865 | [ALC269_ASUS_EEEPC_P703] = "eeepc-p703", |
Takashi Iwai | 26f5df2 | 2008-11-03 17:39:46 +0100 | [diff] [blame] | 12866 | [ALC269_ASUS_EEEPC_P901] = "eeepc-p901", |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 12867 | [ALC269_FUJITSU] = "fujitsu", |
| 12868 | [ALC269_LIFEBOOK] = "lifebook" |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 12869 | }; |
| 12870 | |
| 12871 | static struct snd_pci_quirk alc269_cfg_tbl[] = { |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 12872 | SND_PCI_QUIRK(0x17aa, 0x3bf8, "Quanta FL1", ALC269_QUANTA_FL1), |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 12873 | SND_PCI_QUIRK(0x1043, 0x8330, "ASUS Eeepc P703 P900A", |
| 12874 | ALC269_ASUS_EEEPC_P703), |
| 12875 | SND_PCI_QUIRK(0x1043, 0x831a, "ASUS Eeepc P901", |
| 12876 | ALC269_ASUS_EEEPC_P901), |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 12877 | SND_PCI_QUIRK(0x1043, 0x834a, "ASUS Eeepc S101", |
| 12878 | ALC269_ASUS_EEEPC_P901), |
Takashi Iwai | 26f5df2 | 2008-11-03 17:39:46 +0100 | [diff] [blame] | 12879 | SND_PCI_QUIRK(0x1734, 0x115d, "FSC Amilo", ALC269_FUJITSU), |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 12880 | SND_PCI_QUIRK(0x10cf, 0x1475, "Lifebook ICH9M-based", ALC269_LIFEBOOK), |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 12881 | {} |
| 12882 | }; |
| 12883 | |
| 12884 | static struct alc_config_preset alc269_presets[] = { |
| 12885 | [ALC269_BASIC] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 12886 | .mixers = { alc269_base_mixer }, |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 12887 | .init_verbs = { alc269_init_verbs }, |
| 12888 | .num_dacs = ARRAY_SIZE(alc269_dac_nids), |
| 12889 | .dac_nids = alc269_dac_nids, |
| 12890 | .hp_nid = 0x03, |
| 12891 | .num_channel_mode = ARRAY_SIZE(alc269_modes), |
| 12892 | .channel_mode = alc269_modes, |
| 12893 | .input_mux = &alc269_capture_source, |
| 12894 | }, |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 12895 | [ALC269_QUANTA_FL1] = { |
| 12896 | .mixers = { alc269_quanta_fl1_mixer }, |
| 12897 | .init_verbs = { alc269_init_verbs, alc269_quanta_fl1_verbs }, |
| 12898 | .num_dacs = ARRAY_SIZE(alc269_dac_nids), |
| 12899 | .dac_nids = alc269_dac_nids, |
| 12900 | .hp_nid = 0x03, |
| 12901 | .num_channel_mode = ARRAY_SIZE(alc269_modes), |
| 12902 | .channel_mode = alc269_modes, |
| 12903 | .input_mux = &alc269_capture_source, |
| 12904 | .unsol_event = alc269_quanta_fl1_unsol_event, |
| 12905 | .init_hook = alc269_quanta_fl1_init_hook, |
| 12906 | }, |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 12907 | [ALC269_ASUS_EEEPC_P703] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 12908 | .mixers = { alc269_eeepc_mixer }, |
| 12909 | .cap_mixer = alc269_epc_capture_mixer, |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 12910 | .init_verbs = { alc269_init_verbs, |
| 12911 | alc269_eeepc_amic_init_verbs }, |
| 12912 | .num_dacs = ARRAY_SIZE(alc269_dac_nids), |
| 12913 | .dac_nids = alc269_dac_nids, |
| 12914 | .hp_nid = 0x03, |
| 12915 | .num_channel_mode = ARRAY_SIZE(alc269_modes), |
| 12916 | .channel_mode = alc269_modes, |
| 12917 | .input_mux = &alc269_eeepc_amic_capture_source, |
| 12918 | .unsol_event = alc269_eeepc_amic_unsol_event, |
| 12919 | .init_hook = alc269_eeepc_amic_inithook, |
| 12920 | }, |
| 12921 | [ALC269_ASUS_EEEPC_P901] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 12922 | .mixers = { alc269_eeepc_mixer }, |
| 12923 | .cap_mixer = alc269_epc_capture_mixer, |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 12924 | .init_verbs = { alc269_init_verbs, |
| 12925 | alc269_eeepc_dmic_init_verbs }, |
| 12926 | .num_dacs = ARRAY_SIZE(alc269_dac_nids), |
| 12927 | .dac_nids = alc269_dac_nids, |
| 12928 | .hp_nid = 0x03, |
| 12929 | .num_channel_mode = ARRAY_SIZE(alc269_modes), |
| 12930 | .channel_mode = alc269_modes, |
| 12931 | .input_mux = &alc269_eeepc_dmic_capture_source, |
| 12932 | .unsol_event = alc269_eeepc_dmic_unsol_event, |
| 12933 | .init_hook = alc269_eeepc_dmic_inithook, |
| 12934 | }, |
Takashi Iwai | 26f5df2 | 2008-11-03 17:39:46 +0100 | [diff] [blame] | 12935 | [ALC269_FUJITSU] = { |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 12936 | .mixers = { alc269_fujitsu_mixer }, |
Takashi Iwai | 26f5df2 | 2008-11-03 17:39:46 +0100 | [diff] [blame] | 12937 | .cap_mixer = alc269_epc_capture_mixer, |
| 12938 | .init_verbs = { alc269_init_verbs, |
| 12939 | alc269_eeepc_dmic_init_verbs }, |
| 12940 | .num_dacs = ARRAY_SIZE(alc269_dac_nids), |
| 12941 | .dac_nids = alc269_dac_nids, |
| 12942 | .hp_nid = 0x03, |
| 12943 | .num_channel_mode = ARRAY_SIZE(alc269_modes), |
| 12944 | .channel_mode = alc269_modes, |
| 12945 | .input_mux = &alc269_eeepc_dmic_capture_source, |
| 12946 | .unsol_event = alc269_eeepc_dmic_unsol_event, |
| 12947 | .init_hook = alc269_eeepc_dmic_inithook, |
| 12948 | }, |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 12949 | [ALC269_LIFEBOOK] = { |
| 12950 | .mixers = { alc269_lifebook_mixer }, |
| 12951 | .init_verbs = { alc269_init_verbs, alc269_lifebook_verbs }, |
| 12952 | .num_dacs = ARRAY_SIZE(alc269_dac_nids), |
| 12953 | .dac_nids = alc269_dac_nids, |
| 12954 | .hp_nid = 0x03, |
| 12955 | .num_channel_mode = ARRAY_SIZE(alc269_modes), |
| 12956 | .channel_mode = alc269_modes, |
| 12957 | .input_mux = &alc269_capture_source, |
| 12958 | .unsol_event = alc269_lifebook_unsol_event, |
| 12959 | .init_hook = alc269_lifebook_init_hook, |
| 12960 | }, |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 12961 | }; |
| 12962 | |
| 12963 | static int patch_alc269(struct hda_codec *codec) |
| 12964 | { |
| 12965 | struct alc_spec *spec; |
| 12966 | int board_config; |
| 12967 | int err; |
| 12968 | |
| 12969 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
| 12970 | if (spec == NULL) |
| 12971 | return -ENOMEM; |
| 12972 | |
| 12973 | codec->spec = spec; |
| 12974 | |
Takashi Iwai | 2c3bf9a | 2008-06-04 12:39:38 +0200 | [diff] [blame] | 12975 | alc_fix_pll_init(codec, 0x20, 0x04, 15); |
| 12976 | |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 12977 | board_config = snd_hda_check_board_config(codec, ALC269_MODEL_LAST, |
| 12978 | alc269_models, |
| 12979 | alc269_cfg_tbl); |
| 12980 | |
| 12981 | if (board_config < 0) { |
| 12982 | printk(KERN_INFO "hda_codec: Unknown model for ALC269, " |
| 12983 | "trying auto-probe from BIOS...\n"); |
| 12984 | board_config = ALC269_AUTO; |
| 12985 | } |
| 12986 | |
| 12987 | if (board_config == ALC269_AUTO) { |
| 12988 | /* automatic parse from the BIOS config */ |
| 12989 | err = alc269_parse_auto_config(codec); |
| 12990 | if (err < 0) { |
| 12991 | alc_free(codec); |
| 12992 | return err; |
| 12993 | } else if (!err) { |
| 12994 | printk(KERN_INFO |
| 12995 | "hda_codec: Cannot set up configuration " |
| 12996 | "from BIOS. Using base mode...\n"); |
| 12997 | board_config = ALC269_BASIC; |
| 12998 | } |
| 12999 | } |
| 13000 | |
Kusanagi Kouichi | 680cd53 | 2009-02-05 00:00:58 +0900 | [diff] [blame] | 13001 | err = snd_hda_attach_beep_device(codec, 0x1); |
| 13002 | if (err < 0) { |
| 13003 | alc_free(codec); |
| 13004 | return err; |
| 13005 | } |
| 13006 | |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 13007 | if (board_config != ALC269_AUTO) |
| 13008 | setup_preset(spec, &alc269_presets[board_config]); |
| 13009 | |
| 13010 | spec->stream_name_analog = "ALC269 Analog"; |
| 13011 | spec->stream_analog_playback = &alc269_pcm_analog_playback; |
| 13012 | spec->stream_analog_capture = &alc269_pcm_analog_capture; |
| 13013 | |
| 13014 | spec->stream_name_digital = "ALC269 Digital"; |
| 13015 | spec->stream_digital_playback = &alc269_pcm_digital_playback; |
| 13016 | spec->stream_digital_capture = &alc269_pcm_digital_capture; |
| 13017 | |
| 13018 | spec->adc_nids = alc269_adc_nids; |
| 13019 | spec->num_adc_nids = ARRAY_SIZE(alc269_adc_nids); |
Takashi Iwai | e01bf50 | 2008-08-21 16:25:07 +0200 | [diff] [blame] | 13020 | spec->capsrc_nids = alc269_capsrc_nids; |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 13021 | if (!spec->cap_mixer) |
| 13022 | set_capture_mixer(spec); |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 13023 | set_beep_amp(spec, 0x0b, 0x04, HDA_INPUT); |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 13024 | |
| 13025 | codec->patch_ops = alc_patch_ops; |
| 13026 | if (board_config == ALC269_AUTO) |
| 13027 | spec->init_hook = alc269_auto_init; |
| 13028 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 13029 | if (!spec->loopback.amplist) |
| 13030 | spec->loopback.amplist = alc269_loopbacks; |
| 13031 | #endif |
Takashi Iwai | daead53 | 2008-11-28 12:55:36 +0100 | [diff] [blame] | 13032 | codec->proc_widget_hook = print_realtek_coef; |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 13033 | |
| 13034 | return 0; |
| 13035 | } |
| 13036 | |
| 13037 | /* |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13038 | * ALC861 channel source setting (2/6 channel selection for 3-stack) |
| 13039 | */ |
| 13040 | |
| 13041 | /* |
| 13042 | * set the path ways for 2 channel output |
| 13043 | * need to set the codec line out and mic 1 pin widgets to inputs |
| 13044 | */ |
| 13045 | static struct hda_verb alc861_threestack_ch2_init[] = { |
| 13046 | /* set pin widget 1Ah (line in) for input */ |
| 13047 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13048 | /* set pin widget 18h (mic1/2) for input, for mic also enable |
| 13049 | * the vref |
| 13050 | */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13051 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 13052 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 13053 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c }, |
| 13054 | #if 0 |
| 13055 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/ |
| 13056 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8)) }, /*line-in*/ |
| 13057 | #endif |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13058 | { } /* end */ |
| 13059 | }; |
| 13060 | /* |
| 13061 | * 6ch mode |
| 13062 | * need to set the codec line out and mic 1 pin widgets to outputs |
| 13063 | */ |
| 13064 | static struct hda_verb alc861_threestack_ch6_init[] = { |
| 13065 | /* set pin widget 1Ah (line in) for output (Back Surround)*/ |
| 13066 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 13067 | /* set pin widget 18h (mic1) for output (CLFE)*/ |
| 13068 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 13069 | |
| 13070 | { 0x0c, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 13071 | { 0x0d, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13072 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 13073 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb080 }, |
| 13074 | #if 0 |
| 13075 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/ |
| 13076 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8)) }, /*line in*/ |
| 13077 | #endif |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13078 | { } /* end */ |
| 13079 | }; |
| 13080 | |
| 13081 | static struct hda_channel_mode alc861_threestack_modes[2] = { |
| 13082 | { 2, alc861_threestack_ch2_init }, |
| 13083 | { 6, alc861_threestack_ch6_init }, |
| 13084 | }; |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 13085 | /* Set mic1 as input and unmute the mixer */ |
| 13086 | static struct hda_verb alc861_uniwill_m31_ch2_init[] = { |
| 13087 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 13088 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/ |
| 13089 | { } /* end */ |
| 13090 | }; |
| 13091 | /* Set mic1 as output and mute mixer */ |
| 13092 | static struct hda_verb alc861_uniwill_m31_ch4_init[] = { |
| 13093 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 13094 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/ |
| 13095 | { } /* end */ |
| 13096 | }; |
| 13097 | |
| 13098 | static struct hda_channel_mode alc861_uniwill_m31_modes[2] = { |
| 13099 | { 2, alc861_uniwill_m31_ch2_init }, |
| 13100 | { 4, alc861_uniwill_m31_ch4_init }, |
| 13101 | }; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13102 | |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 13103 | /* Set mic1 and line-in as input and unmute the mixer */ |
| 13104 | static struct hda_verb alc861_asus_ch2_init[] = { |
| 13105 | /* set pin widget 1Ah (line in) for input */ |
| 13106 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13107 | /* set pin widget 18h (mic1/2) for input, for mic also enable |
| 13108 | * the vref |
| 13109 | */ |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 13110 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 13111 | |
| 13112 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c }, |
| 13113 | #if 0 |
| 13114 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/ |
| 13115 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8)) }, /*line-in*/ |
| 13116 | #endif |
| 13117 | { } /* end */ |
| 13118 | }; |
| 13119 | /* Set mic1 nad line-in as output and mute mixer */ |
| 13120 | static struct hda_verb alc861_asus_ch6_init[] = { |
| 13121 | /* set pin widget 1Ah (line in) for output (Back Surround)*/ |
| 13122 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 13123 | /* { 0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, */ |
| 13124 | /* set pin widget 18h (mic1) for output (CLFE)*/ |
| 13125 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 13126 | /* { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, */ |
| 13127 | { 0x0c, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 13128 | { 0x0d, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 13129 | |
| 13130 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb080 }, |
| 13131 | #if 0 |
| 13132 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/ |
| 13133 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8)) }, /*line in*/ |
| 13134 | #endif |
| 13135 | { } /* end */ |
| 13136 | }; |
| 13137 | |
| 13138 | static struct hda_channel_mode alc861_asus_modes[2] = { |
| 13139 | { 2, alc861_asus_ch2_init }, |
| 13140 | { 6, alc861_asus_ch6_init }, |
| 13141 | }; |
| 13142 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13143 | /* patch-ALC861 */ |
| 13144 | |
| 13145 | static struct snd_kcontrol_new alc861_base_mixer[] = { |
| 13146 | /* output mixer control */ |
| 13147 | HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT), |
| 13148 | HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT), |
| 13149 | HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT), |
| 13150 | HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT), |
| 13151 | HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), |
| 13152 | |
| 13153 | /*Input mixer control */ |
| 13154 | /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT), |
| 13155 | HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */ |
| 13156 | HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT), |
| 13157 | HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT), |
| 13158 | HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT), |
| 13159 | HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT), |
| 13160 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT), |
| 13161 | HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT), |
| 13162 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT), |
| 13163 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT), |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13164 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13165 | { } /* end */ |
| 13166 | }; |
| 13167 | |
| 13168 | static struct snd_kcontrol_new alc861_3ST_mixer[] = { |
| 13169 | /* output mixer control */ |
| 13170 | HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT), |
| 13171 | HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT), |
| 13172 | HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT), |
| 13173 | HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT), |
| 13174 | /*HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), */ |
| 13175 | |
| 13176 | /* Input mixer control */ |
| 13177 | /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT), |
| 13178 | HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */ |
| 13179 | HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT), |
| 13180 | HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT), |
| 13181 | HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT), |
| 13182 | HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT), |
| 13183 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT), |
| 13184 | HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT), |
| 13185 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT), |
| 13186 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT), |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13187 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13188 | { |
| 13189 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 13190 | .name = "Channel Mode", |
| 13191 | .info = alc_ch_mode_info, |
| 13192 | .get = alc_ch_mode_get, |
| 13193 | .put = alc_ch_mode_put, |
| 13194 | .private_value = ARRAY_SIZE(alc861_threestack_modes), |
| 13195 | }, |
| 13196 | { } /* end */ |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 13197 | }; |
| 13198 | |
Takashi Iwai | d1d985f | 2006-11-23 19:27:12 +0100 | [diff] [blame] | 13199 | static struct snd_kcontrol_new alc861_toshiba_mixer[] = { |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 13200 | /* output mixer control */ |
| 13201 | HDA_CODEC_MUTE("Master Playback Switch", 0x03, 0x0, HDA_OUTPUT), |
| 13202 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT), |
| 13203 | HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT), |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 13204 | |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 13205 | { } /* end */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13206 | }; |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 13207 | |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 13208 | static struct snd_kcontrol_new alc861_uniwill_m31_mixer[] = { |
| 13209 | /* output mixer control */ |
| 13210 | HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT), |
| 13211 | HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT), |
| 13212 | HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT), |
| 13213 | HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT), |
| 13214 | /*HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), */ |
| 13215 | |
| 13216 | /* Input mixer control */ |
| 13217 | /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT), |
| 13218 | HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */ |
| 13219 | HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT), |
| 13220 | HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT), |
| 13221 | HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT), |
| 13222 | HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT), |
| 13223 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT), |
| 13224 | HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT), |
| 13225 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT), |
| 13226 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT), |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13227 | |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 13228 | { |
| 13229 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 13230 | .name = "Channel Mode", |
| 13231 | .info = alc_ch_mode_info, |
| 13232 | .get = alc_ch_mode_get, |
| 13233 | .put = alc_ch_mode_put, |
| 13234 | .private_value = ARRAY_SIZE(alc861_uniwill_m31_modes), |
| 13235 | }, |
| 13236 | { } /* end */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13237 | }; |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 13238 | |
| 13239 | static struct snd_kcontrol_new alc861_asus_mixer[] = { |
| 13240 | /* output mixer control */ |
| 13241 | HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT), |
| 13242 | HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT), |
| 13243 | HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT), |
| 13244 | HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT), |
| 13245 | HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), |
| 13246 | |
| 13247 | /* Input mixer control */ |
| 13248 | HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT), |
| 13249 | HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 13250 | HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT), |
| 13251 | HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT), |
| 13252 | HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT), |
| 13253 | HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT), |
| 13254 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT), |
| 13255 | HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT), |
| 13256 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT), |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13257 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_OUTPUT), |
| 13258 | |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 13259 | { |
| 13260 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 13261 | .name = "Channel Mode", |
| 13262 | .info = alc_ch_mode_info, |
| 13263 | .get = alc_ch_mode_get, |
| 13264 | .put = alc_ch_mode_put, |
| 13265 | .private_value = ARRAY_SIZE(alc861_asus_modes), |
| 13266 | }, |
| 13267 | { } |
Takashi Iwai | 56bb0ca | 2006-11-22 11:52:52 +0100 | [diff] [blame] | 13268 | }; |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 13269 | |
Takashi Iwai | 56bb0ca | 2006-11-22 11:52:52 +0100 | [diff] [blame] | 13270 | /* additional mixer */ |
Takashi Iwai | d1d985f | 2006-11-23 19:27:12 +0100 | [diff] [blame] | 13271 | static struct snd_kcontrol_new alc861_asus_laptop_mixer[] = { |
Takashi Iwai | 56bb0ca | 2006-11-22 11:52:52 +0100 | [diff] [blame] | 13272 | HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT), |
| 13273 | HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT), |
Takashi Iwai | 56bb0ca | 2006-11-22 11:52:52 +0100 | [diff] [blame] | 13274 | { } |
| 13275 | }; |
| 13276 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13277 | /* |
| 13278 | * generic initialization of ADC, input mixers and output mixers |
| 13279 | */ |
| 13280 | static struct hda_verb alc861_base_init_verbs[] = { |
| 13281 | /* |
| 13282 | * Unmute ADC0 and set the default input to mic-in |
| 13283 | */ |
| 13284 | /* port-A for surround (rear panel) */ |
| 13285 | { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 13286 | { 0x0e, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 13287 | /* port-B for mic-in (rear panel) with vref */ |
| 13288 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 13289 | /* port-C for line-in (rear panel) */ |
| 13290 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 13291 | /* port-D for Front */ |
| 13292 | { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 13293 | { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 13294 | /* port-E for HP out (front panel) */ |
| 13295 | { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 }, |
| 13296 | /* route front PCM to HP */ |
Takashi Iwai | 9dece1d | 2006-11-16 17:12:49 +0100 | [diff] [blame] | 13297 | { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13298 | /* port-F for mic-in (front panel) with vref */ |
| 13299 | { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 13300 | /* port-G for CLFE (rear panel) */ |
| 13301 | { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 13302 | { 0x1f, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 13303 | /* port-H for side (rear panel) */ |
| 13304 | { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 13305 | { 0x20, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 13306 | /* CD-in */ |
| 13307 | { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 13308 | /* route front mic to ADC1*/ |
| 13309 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 13310 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 13311 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13312 | /* Unmute DAC0~3 & spdif out*/ |
| 13313 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 13314 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 13315 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 13316 | {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 13317 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 13318 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13319 | /* Unmute Mixer 14 (mic) 1c (Line in)*/ |
| 13320 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13321 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 13322 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13323 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 13324 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13325 | /* Unmute Stereo Mixer 15 */ |
| 13326 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13327 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 13328 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13329 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13330 | |
| 13331 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13332 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 13333 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13334 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 13335 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13336 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 13337 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13338 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13339 | /* hp used DAC 3 (Front) */ |
| 13340 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13341 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 13342 | |
| 13343 | { } |
| 13344 | }; |
| 13345 | |
| 13346 | static struct hda_verb alc861_threestack_init_verbs[] = { |
| 13347 | /* |
| 13348 | * Unmute ADC0 and set the default input to mic-in |
| 13349 | */ |
| 13350 | /* port-A for surround (rear panel) */ |
| 13351 | { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 13352 | /* port-B for mic-in (rear panel) with vref */ |
| 13353 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 13354 | /* port-C for line-in (rear panel) */ |
| 13355 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 13356 | /* port-D for Front */ |
| 13357 | { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 13358 | { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 13359 | /* port-E for HP out (front panel) */ |
| 13360 | { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 }, |
| 13361 | /* route front PCM to HP */ |
Takashi Iwai | 9dece1d | 2006-11-16 17:12:49 +0100 | [diff] [blame] | 13362 | { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13363 | /* port-F for mic-in (front panel) with vref */ |
| 13364 | { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 13365 | /* port-G for CLFE (rear panel) */ |
| 13366 | { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 13367 | /* port-H for side (rear panel) */ |
| 13368 | { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 13369 | /* CD-in */ |
| 13370 | { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 13371 | /* route front mic to ADC1*/ |
| 13372 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 13373 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13374 | /* Unmute DAC0~3 & spdif out*/ |
| 13375 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 13376 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 13377 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 13378 | {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 13379 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 13380 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13381 | /* Unmute Mixer 14 (mic) 1c (Line in)*/ |
| 13382 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13383 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 13384 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13385 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
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 Stereo Mixer 15 */ |
| 13388 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13389 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 13390 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13391 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13392 | |
| 13393 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13394 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 13395 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13396 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 13397 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13398 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 13399 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13400 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13401 | /* hp used DAC 3 (Front) */ |
| 13402 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13403 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 13404 | { } |
| 13405 | }; |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 13406 | |
| 13407 | static struct hda_verb alc861_uniwill_m31_init_verbs[] = { |
| 13408 | /* |
| 13409 | * Unmute ADC0 and set the default input to mic-in |
| 13410 | */ |
| 13411 | /* port-A for surround (rear panel) */ |
| 13412 | { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 13413 | /* port-B for mic-in (rear panel) with vref */ |
| 13414 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 13415 | /* port-C for line-in (rear panel) */ |
| 13416 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 13417 | /* port-D for Front */ |
| 13418 | { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 13419 | { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 13420 | /* port-E for HP out (front panel) */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13421 | /* this has to be set to VREF80 */ |
| 13422 | { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 13423 | /* route front PCM to HP */ |
Takashi Iwai | 9dece1d | 2006-11-16 17:12:49 +0100 | [diff] [blame] | 13424 | { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 13425 | /* port-F for mic-in (front panel) with vref */ |
| 13426 | { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 13427 | /* port-G for CLFE (rear panel) */ |
| 13428 | { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 13429 | /* port-H for side (rear panel) */ |
| 13430 | { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 13431 | /* CD-in */ |
| 13432 | { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 13433 | /* route front mic to ADC1*/ |
| 13434 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 13435 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13436 | /* Unmute DAC0~3 & spdif out*/ |
| 13437 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 13438 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 13439 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 13440 | {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 13441 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 13442 | |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 13443 | /* Unmute Mixer 14 (mic) 1c (Line in)*/ |
| 13444 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13445 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 13446 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13447 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 13448 | |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 13449 | /* Unmute Stereo Mixer 15 */ |
| 13450 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13451 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 13452 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13453 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */ |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 13454 | |
| 13455 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13456 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 13457 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13458 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 13459 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13460 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 13461 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13462 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13463 | /* hp used DAC 3 (Front) */ |
| 13464 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 13465 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 13466 | { } |
| 13467 | }; |
| 13468 | |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 13469 | static struct hda_verb alc861_asus_init_verbs[] = { |
| 13470 | /* |
| 13471 | * Unmute ADC0 and set the default input to mic-in |
| 13472 | */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13473 | /* port-A for surround (rear panel) |
| 13474 | * according to codec#0 this is the HP jack |
| 13475 | */ |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 13476 | { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 }, /* was 0x00 */ |
| 13477 | /* route front PCM to HP */ |
| 13478 | { 0x0e, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 13479 | /* port-B for mic-in (rear panel) with vref */ |
| 13480 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 13481 | /* port-C for line-in (rear panel) */ |
| 13482 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 13483 | /* port-D for Front */ |
| 13484 | { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 13485 | { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 13486 | /* port-E for HP out (front panel) */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13487 | /* this has to be set to VREF80 */ |
| 13488 | { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 13489 | /* route front PCM to HP */ |
Takashi Iwai | 9dece1d | 2006-11-16 17:12:49 +0100 | [diff] [blame] | 13490 | { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 13491 | /* port-F for mic-in (front panel) with vref */ |
| 13492 | { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 13493 | /* port-G for CLFE (rear panel) */ |
| 13494 | { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 13495 | /* port-H for side (rear panel) */ |
| 13496 | { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 13497 | /* CD-in */ |
| 13498 | { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 13499 | /* route front mic to ADC1*/ |
| 13500 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 13501 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13502 | /* Unmute DAC0~3 & spdif out*/ |
| 13503 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 13504 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 13505 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 13506 | {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 13507 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 13508 | /* Unmute Mixer 14 (mic) 1c (Line in)*/ |
| 13509 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13510 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 13511 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13512 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 13513 | |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 13514 | /* Unmute Stereo Mixer 15 */ |
| 13515 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13516 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 13517 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13518 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */ |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 13519 | |
| 13520 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13521 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 13522 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13523 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 13524 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13525 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 13526 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13527 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13528 | /* hp used DAC 3 (Front) */ |
| 13529 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 13530 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 13531 | { } |
| 13532 | }; |
| 13533 | |
Takashi Iwai | 56bb0ca | 2006-11-22 11:52:52 +0100 | [diff] [blame] | 13534 | /* additional init verbs for ASUS laptops */ |
| 13535 | static struct hda_verb alc861_asus_laptop_init_verbs[] = { |
| 13536 | { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x45 }, /* HP-out */ |
| 13537 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2) }, /* mute line-in */ |
| 13538 | { } |
| 13539 | }; |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 13540 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13541 | /* |
| 13542 | * generic initialization of ADC, input mixers and output mixers |
| 13543 | */ |
| 13544 | static struct hda_verb alc861_auto_init_verbs[] = { |
| 13545 | /* |
| 13546 | * Unmute ADC0 and set the default input to mic-in |
| 13547 | */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13548 | /* {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13549 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 13550 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13551 | /* Unmute DAC0~3 & spdif out*/ |
| 13552 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 13553 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 13554 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 13555 | {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 13556 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 13557 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13558 | /* Unmute Mixer 14 (mic) 1c (Line in)*/ |
| 13559 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13560 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 13561 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13562 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 13563 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13564 | /* Unmute Stereo Mixer 15 */ |
| 13565 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13566 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 13567 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 13568 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, |
| 13569 | |
| 13570 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13571 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 13572 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13573 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 13574 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13575 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 13576 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13577 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 13578 | |
| 13579 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 13580 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13581 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 13582 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13583 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 13584 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13585 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 13586 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13587 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13588 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, /* set Mic 1 */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13589 | |
| 13590 | { } |
| 13591 | }; |
| 13592 | |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 13593 | static struct hda_verb alc861_toshiba_init_verbs[] = { |
| 13594 | {0x0f, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13595 | |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 13596 | { } |
| 13597 | }; |
| 13598 | |
| 13599 | /* toggle speaker-output according to the hp-jack state */ |
| 13600 | static void alc861_toshiba_automute(struct hda_codec *codec) |
| 13601 | { |
| 13602 | unsigned int present; |
| 13603 | |
| 13604 | present = snd_hda_codec_read(codec, 0x0f, 0, |
| 13605 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 13606 | snd_hda_codec_amp_stereo(codec, 0x16, HDA_INPUT, 0, |
| 13607 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
| 13608 | snd_hda_codec_amp_stereo(codec, 0x1a, HDA_INPUT, 3, |
| 13609 | HDA_AMP_MUTE, present ? 0 : HDA_AMP_MUTE); |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 13610 | } |
| 13611 | |
| 13612 | static void alc861_toshiba_unsol_event(struct hda_codec *codec, |
| 13613 | unsigned int res) |
| 13614 | { |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 13615 | if ((res >> 26) == ALC880_HP_EVENT) |
| 13616 | alc861_toshiba_automute(codec); |
| 13617 | } |
| 13618 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13619 | /* pcm configuration: identiacal with ALC880 */ |
| 13620 | #define alc861_pcm_analog_playback alc880_pcm_analog_playback |
| 13621 | #define alc861_pcm_analog_capture alc880_pcm_analog_capture |
| 13622 | #define alc861_pcm_digital_playback alc880_pcm_digital_playback |
| 13623 | #define alc861_pcm_digital_capture alc880_pcm_digital_capture |
| 13624 | |
| 13625 | |
| 13626 | #define ALC861_DIGOUT_NID 0x07 |
| 13627 | |
| 13628 | static struct hda_channel_mode alc861_8ch_modes[1] = { |
| 13629 | { 8, NULL } |
| 13630 | }; |
| 13631 | |
| 13632 | static hda_nid_t alc861_dac_nids[4] = { |
| 13633 | /* front, surround, clfe, side */ |
| 13634 | 0x03, 0x06, 0x05, 0x04 |
| 13635 | }; |
| 13636 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 13637 | static hda_nid_t alc660_dac_nids[3] = { |
| 13638 | /* front, clfe, surround */ |
| 13639 | 0x03, 0x05, 0x06 |
| 13640 | }; |
| 13641 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13642 | static hda_nid_t alc861_adc_nids[1] = { |
| 13643 | /* ADC0-2 */ |
| 13644 | 0x08, |
| 13645 | }; |
| 13646 | |
| 13647 | static struct hda_input_mux alc861_capture_source = { |
| 13648 | .num_items = 5, |
| 13649 | .items = { |
| 13650 | { "Mic", 0x0 }, |
| 13651 | { "Front Mic", 0x3 }, |
| 13652 | { "Line", 0x1 }, |
| 13653 | { "CD", 0x4 }, |
| 13654 | { "Mixer", 0x5 }, |
| 13655 | }, |
| 13656 | }; |
| 13657 | |
| 13658 | /* fill in the dac_nids table from the parsed pin configuration */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13659 | static int alc861_auto_fill_dac_nids(struct alc_spec *spec, |
| 13660 | const struct auto_pin_cfg *cfg) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13661 | { |
| 13662 | int i; |
| 13663 | hda_nid_t nid; |
| 13664 | |
| 13665 | spec->multiout.dac_nids = spec->private_dac_nids; |
| 13666 | for (i = 0; i < cfg->line_outs; i++) { |
| 13667 | nid = cfg->line_out_pins[i]; |
| 13668 | if (nid) { |
| 13669 | if (i >= ARRAY_SIZE(alc861_dac_nids)) |
| 13670 | continue; |
| 13671 | spec->multiout.dac_nids[i] = alc861_dac_nids[i]; |
| 13672 | } |
| 13673 | } |
| 13674 | spec->multiout.num_dacs = cfg->line_outs; |
| 13675 | return 0; |
| 13676 | } |
| 13677 | |
| 13678 | /* add playback controls from the parsed DAC table */ |
| 13679 | static int alc861_auto_create_multi_out_ctls(struct alc_spec *spec, |
| 13680 | const struct auto_pin_cfg *cfg) |
| 13681 | { |
| 13682 | char name[32]; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13683 | static const char *chname[4] = { |
| 13684 | "Front", "Surround", NULL /*CLFE*/, "Side" |
| 13685 | }; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13686 | hda_nid_t nid; |
| 13687 | int i, idx, err; |
| 13688 | |
| 13689 | for (i = 0; i < cfg->line_outs; i++) { |
| 13690 | nid = spec->multiout.dac_nids[i]; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13691 | if (!nid) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13692 | continue; |
| 13693 | if (nid == 0x05) { |
| 13694 | /* Center/LFE */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13695 | err = add_control(spec, ALC_CTL_BIND_MUTE, |
| 13696 | "Center Playback Switch", |
| 13697 | HDA_COMPOSE_AMP_VAL(nid, 1, 0, |
| 13698 | HDA_OUTPUT)); |
| 13699 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13700 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13701 | err = add_control(spec, ALC_CTL_BIND_MUTE, |
| 13702 | "LFE Playback Switch", |
| 13703 | HDA_COMPOSE_AMP_VAL(nid, 2, 0, |
| 13704 | HDA_OUTPUT)); |
| 13705 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13706 | return err; |
| 13707 | } else { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13708 | for (idx = 0; idx < ARRAY_SIZE(alc861_dac_nids) - 1; |
| 13709 | idx++) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13710 | if (nid == alc861_dac_nids[idx]) |
| 13711 | break; |
| 13712 | sprintf(name, "%s Playback Switch", chname[idx]); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13713 | err = add_control(spec, ALC_CTL_BIND_MUTE, name, |
| 13714 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, |
| 13715 | HDA_OUTPUT)); |
| 13716 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13717 | return err; |
| 13718 | } |
| 13719 | } |
| 13720 | return 0; |
| 13721 | } |
| 13722 | |
| 13723 | static int alc861_auto_create_hp_ctls(struct alc_spec *spec, hda_nid_t pin) |
| 13724 | { |
| 13725 | int err; |
| 13726 | hda_nid_t nid; |
| 13727 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13728 | if (!pin) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13729 | return 0; |
| 13730 | |
| 13731 | if ((pin >= 0x0b && pin <= 0x10) || pin == 0x1f || pin == 0x20) { |
| 13732 | nid = 0x03; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13733 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, |
| 13734 | "Headphone Playback Switch", |
| 13735 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT)); |
| 13736 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13737 | return err; |
| 13738 | spec->multiout.hp_nid = nid; |
| 13739 | } |
| 13740 | return 0; |
| 13741 | } |
| 13742 | |
| 13743 | /* create playback/capture controls for input pins */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13744 | static int alc861_auto_create_analog_input_ctls(struct alc_spec *spec, |
| 13745 | const struct auto_pin_cfg *cfg) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13746 | { |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 13747 | struct hda_input_mux *imux = &spec->private_imux[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13748 | int i, err, idx, idx1; |
| 13749 | |
| 13750 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13751 | switch (cfg->input_pins[i]) { |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13752 | case 0x0c: |
| 13753 | idx1 = 1; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13754 | idx = 2; /* Line In */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13755 | break; |
| 13756 | case 0x0f: |
| 13757 | idx1 = 2; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13758 | idx = 2; /* Line In */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13759 | break; |
| 13760 | case 0x0d: |
| 13761 | idx1 = 0; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13762 | idx = 1; /* Mic In */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13763 | break; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13764 | case 0x10: |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13765 | idx1 = 3; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13766 | idx = 1; /* Mic In */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13767 | break; |
| 13768 | case 0x11: |
| 13769 | idx1 = 4; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13770 | idx = 0; /* CD */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13771 | break; |
| 13772 | default: |
| 13773 | continue; |
| 13774 | } |
| 13775 | |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 13776 | err = new_analog_input(spec, cfg->input_pins[i], |
| 13777 | auto_pin_cfg_labels[i], idx, 0x15); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13778 | if (err < 0) |
| 13779 | return err; |
| 13780 | |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 13781 | imux->items[imux->num_items].label = auto_pin_cfg_labels[i]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13782 | imux->items[imux->num_items].index = idx1; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13783 | imux->num_items++; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13784 | } |
| 13785 | return 0; |
| 13786 | } |
| 13787 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13788 | static void alc861_auto_set_output_and_unmute(struct hda_codec *codec, |
| 13789 | hda_nid_t nid, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13790 | int pin_type, int dac_idx) |
| 13791 | { |
Jacek Luczak | 564c5be | 2008-05-03 18:41:23 +0200 | [diff] [blame] | 13792 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 13793 | pin_type); |
| 13794 | snd_hda_codec_write(codec, dac_idx, 0, AC_VERB_SET_AMP_GAIN_MUTE, |
| 13795 | AMP_OUT_UNMUTE); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13796 | } |
| 13797 | |
| 13798 | static void alc861_auto_init_multi_out(struct hda_codec *codec) |
| 13799 | { |
| 13800 | struct alc_spec *spec = codec->spec; |
| 13801 | int i; |
| 13802 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13803 | alc_subsystem_id(codec, 0x0e, 0x0f, 0x0b); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13804 | for (i = 0; i < spec->autocfg.line_outs; i++) { |
| 13805 | hda_nid_t nid = spec->autocfg.line_out_pins[i]; |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 13806 | int pin_type = get_pin_type(spec->autocfg.line_out_type); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13807 | if (nid) |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 13808 | alc861_auto_set_output_and_unmute(codec, nid, pin_type, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13809 | spec->multiout.dac_nids[i]); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13810 | } |
| 13811 | } |
| 13812 | |
| 13813 | static void alc861_auto_init_hp_out(struct hda_codec *codec) |
| 13814 | { |
| 13815 | struct alc_spec *spec = codec->spec; |
| 13816 | hda_nid_t pin; |
| 13817 | |
Takashi Iwai | eb06ed8 | 2006-09-20 17:10:27 +0200 | [diff] [blame] | 13818 | pin = spec->autocfg.hp_pins[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13819 | if (pin) /* connect to front */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13820 | alc861_auto_set_output_and_unmute(codec, pin, PIN_HP, |
| 13821 | spec->multiout.dac_nids[0]); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 13822 | pin = spec->autocfg.speaker_pins[0]; |
| 13823 | if (pin) |
| 13824 | alc861_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13825 | } |
| 13826 | |
| 13827 | static void alc861_auto_init_analog_input(struct hda_codec *codec) |
| 13828 | { |
| 13829 | struct alc_spec *spec = codec->spec; |
| 13830 | int i; |
| 13831 | |
| 13832 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
| 13833 | hda_nid_t nid = spec->autocfg.input_pins[i]; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13834 | if (nid >= 0x0c && nid <= 0x11) { |
| 13835 | snd_hda_codec_write(codec, nid, 0, |
| 13836 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 13837 | i <= AUTO_PIN_FRONT_MIC ? |
| 13838 | PIN_VREF80 : PIN_IN); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13839 | } |
| 13840 | } |
| 13841 | } |
| 13842 | |
| 13843 | /* parse the BIOS configuration and set up the alc_spec */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13844 | /* return 1 if successful, 0 if the proper config is not found, |
| 13845 | * or a negative error code |
| 13846 | */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13847 | static int alc861_parse_auto_config(struct hda_codec *codec) |
| 13848 | { |
| 13849 | struct alc_spec *spec = codec->spec; |
| 13850 | int err; |
| 13851 | static hda_nid_t alc861_ignore[] = { 0x1d, 0 }; |
| 13852 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13853 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 13854 | alc861_ignore); |
| 13855 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13856 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13857 | if (!spec->autocfg.line_outs) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13858 | return 0; /* can't find valid BIOS pin config */ |
| 13859 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13860 | err = alc861_auto_fill_dac_nids(spec, &spec->autocfg); |
| 13861 | if (err < 0) |
| 13862 | return err; |
| 13863 | err = alc861_auto_create_multi_out_ctls(spec, &spec->autocfg); |
| 13864 | if (err < 0) |
| 13865 | return err; |
| 13866 | err = alc861_auto_create_hp_ctls(spec, spec->autocfg.hp_pins[0]); |
| 13867 | if (err < 0) |
| 13868 | return err; |
| 13869 | err = alc861_auto_create_analog_input_ctls(spec, &spec->autocfg); |
| 13870 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13871 | return err; |
| 13872 | |
| 13873 | spec->multiout.max_channels = spec->multiout.num_dacs * 2; |
| 13874 | |
Takashi Iwai | 0852d7a | 2009-02-11 11:35:15 +0100 | [diff] [blame] | 13875 | if (spec->autocfg.dig_outs) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13876 | spec->multiout.dig_out_nid = ALC861_DIGOUT_NID; |
| 13877 | |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 13878 | if (spec->kctls.list) |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 13879 | add_mixer(spec, spec->kctls.list); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13880 | |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 13881 | add_verb(spec, alc861_auto_init_verbs); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13882 | |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 13883 | spec->num_mux_defs = 1; |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 13884 | spec->input_mux = &spec->private_imux[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13885 | |
| 13886 | spec->adc_nids = alc861_adc_nids; |
| 13887 | spec->num_adc_nids = ARRAY_SIZE(alc861_adc_nids); |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 13888 | set_capture_mixer(spec); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13889 | |
| 13890 | return 1; |
| 13891 | } |
| 13892 | |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 13893 | /* additional initialization for auto-configuration model */ |
| 13894 | static void alc861_auto_init(struct hda_codec *codec) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13895 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 13896 | struct alc_spec *spec = codec->spec; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13897 | alc861_auto_init_multi_out(codec); |
| 13898 | alc861_auto_init_hp_out(codec); |
| 13899 | alc861_auto_init_analog_input(codec); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 13900 | if (spec->unsol_event) |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 13901 | alc_inithook(codec); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13902 | } |
| 13903 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 13904 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 13905 | static struct hda_amp_list alc861_loopbacks[] = { |
| 13906 | { 0x15, HDA_INPUT, 0 }, |
| 13907 | { 0x15, HDA_INPUT, 1 }, |
| 13908 | { 0x15, HDA_INPUT, 2 }, |
| 13909 | { 0x15, HDA_INPUT, 3 }, |
| 13910 | { } /* end */ |
| 13911 | }; |
| 13912 | #endif |
| 13913 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13914 | |
| 13915 | /* |
| 13916 | * configuration and preset |
| 13917 | */ |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 13918 | static const char *alc861_models[ALC861_MODEL_LAST] = { |
| 13919 | [ALC861_3ST] = "3stack", |
| 13920 | [ALC660_3ST] = "3stack-660", |
| 13921 | [ALC861_3ST_DIG] = "3stack-dig", |
| 13922 | [ALC861_6ST_DIG] = "6stack-dig", |
| 13923 | [ALC861_UNIWILL_M31] = "uniwill-m31", |
| 13924 | [ALC861_TOSHIBA] = "toshiba", |
| 13925 | [ALC861_ASUS] = "asus", |
| 13926 | [ALC861_ASUS_LAPTOP] = "asus-laptop", |
| 13927 | [ALC861_AUTO] = "auto", |
| 13928 | }; |
| 13929 | |
| 13930 | static struct snd_pci_quirk alc861_cfg_tbl[] = { |
Takashi Iwai | 687a47b | 2007-01-10 11:25:58 +0100 | [diff] [blame] | 13931 | SND_PCI_QUIRK(0x1043, 0x1205, "ASUS W7J", ALC861_3ST), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 13932 | SND_PCI_QUIRK(0x1043, 0x1335, "ASUS F2/3", ALC861_ASUS_LAPTOP), |
| 13933 | SND_PCI_QUIRK(0x1043, 0x1338, "ASUS F2/3", ALC861_ASUS_LAPTOP), |
| 13934 | SND_PCI_QUIRK(0x1043, 0x1393, "ASUS", ALC861_ASUS), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 13935 | SND_PCI_QUIRK(0x1043, 0x13d7, "ASUS A9rp", ALC861_ASUS_LAPTOP), |
Kailang Yang | 83c3421 | 2007-07-05 11:43:05 +0200 | [diff] [blame] | 13936 | SND_PCI_QUIRK(0x1043, 0x81cb, "ASUS P1-AH2", ALC861_3ST_DIG), |
Tobin Davis | ad5e773 | 2007-01-08 10:57:32 +0100 | [diff] [blame] | 13937 | SND_PCI_QUIRK(0x1179, 0xff00, "Toshiba", ALC861_TOSHIBA), |
Takashi Iwai | 341d4eb | 2007-07-09 17:53:18 +0200 | [diff] [blame] | 13938 | /* FIXME: the entry below breaks Toshiba A100 (model=auto works!) |
| 13939 | * Any other models that need this preset? |
| 13940 | */ |
| 13941 | /* SND_PCI_QUIRK(0x1179, 0xff10, "Toshiba", ALC861_TOSHIBA), */ |
Claudio Matsuoka | ef64adb | 2007-07-14 00:26:16 +0200 | [diff] [blame] | 13942 | SND_PCI_QUIRK(0x1462, 0x7254, "HP dx2200 (MSI MS-7254)", ALC861_3ST), |
| 13943 | SND_PCI_QUIRK(0x1462, 0x7297, "HP dx2250 (MSI MS-7297)", ALC861_3ST), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 13944 | SND_PCI_QUIRK(0x1584, 0x2b01, "Uniwill X40AIx", ALC861_UNIWILL_M31), |
| 13945 | SND_PCI_QUIRK(0x1584, 0x9072, "Uniwill m31", ALC861_UNIWILL_M31), |
| 13946 | SND_PCI_QUIRK(0x1584, 0x9075, "Airis Praxis N1212", ALC861_ASUS_LAPTOP), |
| 13947 | /* FIXME: the below seems conflict */ |
| 13948 | /* SND_PCI_QUIRK(0x1584, 0x9075, "Uniwill", ALC861_UNIWILL_M31), */ |
| 13949 | SND_PCI_QUIRK(0x1849, 0x0660, "Asrock 939SLI32", ALC660_3ST), |
| 13950 | SND_PCI_QUIRK(0x8086, 0xd600, "Intel", ALC861_3ST), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13951 | {} |
| 13952 | }; |
| 13953 | |
| 13954 | static struct alc_config_preset alc861_presets[] = { |
| 13955 | [ALC861_3ST] = { |
| 13956 | .mixers = { alc861_3ST_mixer }, |
| 13957 | .init_verbs = { alc861_threestack_init_verbs }, |
| 13958 | .num_dacs = ARRAY_SIZE(alc861_dac_nids), |
| 13959 | .dac_nids = alc861_dac_nids, |
| 13960 | .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes), |
| 13961 | .channel_mode = alc861_threestack_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 13962 | .need_dac_fix = 1, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13963 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
| 13964 | .adc_nids = alc861_adc_nids, |
| 13965 | .input_mux = &alc861_capture_source, |
| 13966 | }, |
| 13967 | [ALC861_3ST_DIG] = { |
| 13968 | .mixers = { alc861_base_mixer }, |
| 13969 | .init_verbs = { alc861_threestack_init_verbs }, |
| 13970 | .num_dacs = ARRAY_SIZE(alc861_dac_nids), |
| 13971 | .dac_nids = alc861_dac_nids, |
| 13972 | .dig_out_nid = ALC861_DIGOUT_NID, |
| 13973 | .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes), |
| 13974 | .channel_mode = alc861_threestack_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 13975 | .need_dac_fix = 1, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13976 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
| 13977 | .adc_nids = alc861_adc_nids, |
| 13978 | .input_mux = &alc861_capture_source, |
| 13979 | }, |
| 13980 | [ALC861_6ST_DIG] = { |
| 13981 | .mixers = { alc861_base_mixer }, |
| 13982 | .init_verbs = { alc861_base_init_verbs }, |
| 13983 | .num_dacs = ARRAY_SIZE(alc861_dac_nids), |
| 13984 | .dac_nids = alc861_dac_nids, |
| 13985 | .dig_out_nid = ALC861_DIGOUT_NID, |
| 13986 | .num_channel_mode = ARRAY_SIZE(alc861_8ch_modes), |
| 13987 | .channel_mode = alc861_8ch_modes, |
| 13988 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
| 13989 | .adc_nids = alc861_adc_nids, |
| 13990 | .input_mux = &alc861_capture_source, |
| 13991 | }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 13992 | [ALC660_3ST] = { |
| 13993 | .mixers = { alc861_3ST_mixer }, |
| 13994 | .init_verbs = { alc861_threestack_init_verbs }, |
| 13995 | .num_dacs = ARRAY_SIZE(alc660_dac_nids), |
| 13996 | .dac_nids = alc660_dac_nids, |
| 13997 | .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes), |
| 13998 | .channel_mode = alc861_threestack_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 13999 | .need_dac_fix = 1, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 14000 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
| 14001 | .adc_nids = alc861_adc_nids, |
| 14002 | .input_mux = &alc861_capture_source, |
| 14003 | }, |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 14004 | [ALC861_UNIWILL_M31] = { |
| 14005 | .mixers = { alc861_uniwill_m31_mixer }, |
| 14006 | .init_verbs = { alc861_uniwill_m31_init_verbs }, |
| 14007 | .num_dacs = ARRAY_SIZE(alc861_dac_nids), |
| 14008 | .dac_nids = alc861_dac_nids, |
| 14009 | .dig_out_nid = ALC861_DIGOUT_NID, |
| 14010 | .num_channel_mode = ARRAY_SIZE(alc861_uniwill_m31_modes), |
| 14011 | .channel_mode = alc861_uniwill_m31_modes, |
| 14012 | .need_dac_fix = 1, |
| 14013 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
| 14014 | .adc_nids = alc861_adc_nids, |
| 14015 | .input_mux = &alc861_capture_source, |
| 14016 | }, |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 14017 | [ALC861_TOSHIBA] = { |
| 14018 | .mixers = { alc861_toshiba_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14019 | .init_verbs = { alc861_base_init_verbs, |
| 14020 | alc861_toshiba_init_verbs }, |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 14021 | .num_dacs = ARRAY_SIZE(alc861_dac_nids), |
| 14022 | .dac_nids = alc861_dac_nids, |
| 14023 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 14024 | .channel_mode = alc883_3ST_2ch_modes, |
| 14025 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
| 14026 | .adc_nids = alc861_adc_nids, |
| 14027 | .input_mux = &alc861_capture_source, |
| 14028 | .unsol_event = alc861_toshiba_unsol_event, |
| 14029 | .init_hook = alc861_toshiba_automute, |
| 14030 | }, |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 14031 | [ALC861_ASUS] = { |
| 14032 | .mixers = { alc861_asus_mixer }, |
| 14033 | .init_verbs = { alc861_asus_init_verbs }, |
| 14034 | .num_dacs = ARRAY_SIZE(alc861_dac_nids), |
| 14035 | .dac_nids = alc861_dac_nids, |
| 14036 | .dig_out_nid = ALC861_DIGOUT_NID, |
| 14037 | .num_channel_mode = ARRAY_SIZE(alc861_asus_modes), |
| 14038 | .channel_mode = alc861_asus_modes, |
| 14039 | .need_dac_fix = 1, |
| 14040 | .hp_nid = 0x06, |
| 14041 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
| 14042 | .adc_nids = alc861_adc_nids, |
| 14043 | .input_mux = &alc861_capture_source, |
| 14044 | }, |
Takashi Iwai | 56bb0ca | 2006-11-22 11:52:52 +0100 | [diff] [blame] | 14045 | [ALC861_ASUS_LAPTOP] = { |
| 14046 | .mixers = { alc861_toshiba_mixer, alc861_asus_laptop_mixer }, |
| 14047 | .init_verbs = { alc861_asus_init_verbs, |
| 14048 | alc861_asus_laptop_init_verbs }, |
| 14049 | .num_dacs = ARRAY_SIZE(alc861_dac_nids), |
| 14050 | .dac_nids = alc861_dac_nids, |
| 14051 | .dig_out_nid = ALC861_DIGOUT_NID, |
| 14052 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 14053 | .channel_mode = alc883_3ST_2ch_modes, |
| 14054 | .need_dac_fix = 1, |
| 14055 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
| 14056 | .adc_nids = alc861_adc_nids, |
| 14057 | .input_mux = &alc861_capture_source, |
| 14058 | }, |
| 14059 | }; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14060 | |
| 14061 | |
| 14062 | static int patch_alc861(struct hda_codec *codec) |
| 14063 | { |
| 14064 | struct alc_spec *spec; |
| 14065 | int board_config; |
| 14066 | int err; |
| 14067 | |
Robert P. J. Day | dc041e0 | 2006-12-19 14:44:15 +0100 | [diff] [blame] | 14068 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14069 | if (spec == NULL) |
| 14070 | return -ENOMEM; |
| 14071 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14072 | codec->spec = spec; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14073 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 14074 | board_config = snd_hda_check_board_config(codec, ALC861_MODEL_LAST, |
| 14075 | alc861_models, |
| 14076 | alc861_cfg_tbl); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 14077 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 14078 | if (board_config < 0) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 14079 | printk(KERN_INFO "hda_codec: Unknown model for ALC861, " |
| 14080 | "trying auto-probe from BIOS...\n"); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14081 | board_config = ALC861_AUTO; |
| 14082 | } |
| 14083 | |
| 14084 | if (board_config == ALC861_AUTO) { |
| 14085 | /* automatic parse from the BIOS config */ |
| 14086 | err = alc861_parse_auto_config(codec); |
| 14087 | if (err < 0) { |
| 14088 | alc_free(codec); |
| 14089 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14090 | } else if (!err) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 14091 | printk(KERN_INFO |
| 14092 | "hda_codec: Cannot set up configuration " |
| 14093 | "from BIOS. Using base mode...\n"); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14094 | board_config = ALC861_3ST_DIG; |
| 14095 | } |
| 14096 | } |
| 14097 | |
Kusanagi Kouichi | 680cd53 | 2009-02-05 00:00:58 +0900 | [diff] [blame] | 14098 | err = snd_hda_attach_beep_device(codec, 0x23); |
| 14099 | if (err < 0) { |
| 14100 | alc_free(codec); |
| 14101 | return err; |
| 14102 | } |
| 14103 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14104 | if (board_config != ALC861_AUTO) |
| 14105 | setup_preset(spec, &alc861_presets[board_config]); |
| 14106 | |
| 14107 | spec->stream_name_analog = "ALC861 Analog"; |
| 14108 | spec->stream_analog_playback = &alc861_pcm_analog_playback; |
| 14109 | spec->stream_analog_capture = &alc861_pcm_analog_capture; |
| 14110 | |
| 14111 | spec->stream_name_digital = "ALC861 Digital"; |
| 14112 | spec->stream_digital_playback = &alc861_pcm_digital_playback; |
| 14113 | spec->stream_digital_capture = &alc861_pcm_digital_capture; |
| 14114 | |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 14115 | set_beep_amp(spec, 0x23, 0, HDA_OUTPUT); |
| 14116 | |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 14117 | spec->vmaster_nid = 0x03; |
| 14118 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14119 | codec->patch_ops = alc_patch_ops; |
| 14120 | if (board_config == ALC861_AUTO) |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 14121 | spec->init_hook = alc861_auto_init; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 14122 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 14123 | if (!spec->loopback.amplist) |
| 14124 | spec->loopback.amplist = alc861_loopbacks; |
| 14125 | #endif |
Takashi Iwai | daead53 | 2008-11-28 12:55:36 +0100 | [diff] [blame] | 14126 | codec->proc_widget_hook = print_realtek_coef; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 14127 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14128 | return 0; |
| 14129 | } |
| 14130 | |
| 14131 | /* |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14132 | * ALC861-VD support |
| 14133 | * |
| 14134 | * Based on ALC882 |
| 14135 | * |
| 14136 | * In addition, an independent DAC |
| 14137 | */ |
| 14138 | #define ALC861VD_DIGOUT_NID 0x06 |
| 14139 | |
| 14140 | static hda_nid_t alc861vd_dac_nids[4] = { |
| 14141 | /* front, surr, clfe, side surr */ |
| 14142 | 0x02, 0x03, 0x04, 0x05 |
| 14143 | }; |
| 14144 | |
| 14145 | /* dac_nids for ALC660vd are in a different order - according to |
| 14146 | * Realtek's driver. |
| 14147 | * This should probably tesult in a different mixer for 6stack models |
| 14148 | * of ALC660vd codecs, but for now there is only 3stack mixer |
| 14149 | * - and it is the same as in 861vd. |
| 14150 | * adc_nids in ALC660vd are (is) the same as in 861vd |
| 14151 | */ |
| 14152 | static hda_nid_t alc660vd_dac_nids[3] = { |
| 14153 | /* front, rear, clfe, rear_surr */ |
| 14154 | 0x02, 0x04, 0x03 |
| 14155 | }; |
| 14156 | |
| 14157 | static hda_nid_t alc861vd_adc_nids[1] = { |
| 14158 | /* ADC0 */ |
| 14159 | 0x09, |
| 14160 | }; |
| 14161 | |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 14162 | static hda_nid_t alc861vd_capsrc_nids[1] = { 0x22 }; |
| 14163 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14164 | /* input MUX */ |
| 14165 | /* FIXME: should be a matrix-type input source selection */ |
| 14166 | static struct hda_input_mux alc861vd_capture_source = { |
| 14167 | .num_items = 4, |
| 14168 | .items = { |
| 14169 | { "Mic", 0x0 }, |
| 14170 | { "Front Mic", 0x1 }, |
| 14171 | { "Line", 0x2 }, |
| 14172 | { "CD", 0x4 }, |
| 14173 | }, |
| 14174 | }; |
| 14175 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 14176 | static struct hda_input_mux alc861vd_dallas_capture_source = { |
Tobin Davis | b419f34 | 2008-03-07 11:57:51 +0100 | [diff] [blame] | 14177 | .num_items = 2, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 14178 | .items = { |
Tobin Davis | b419f34 | 2008-03-07 11:57:51 +0100 | [diff] [blame] | 14179 | { "Ext Mic", 0x0 }, |
| 14180 | { "Int Mic", 0x1 }, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 14181 | }, |
| 14182 | }; |
| 14183 | |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 14184 | static struct hda_input_mux alc861vd_hp_capture_source = { |
| 14185 | .num_items = 2, |
| 14186 | .items = { |
| 14187 | { "Front Mic", 0x0 }, |
| 14188 | { "ATAPI Mic", 0x1 }, |
| 14189 | }, |
| 14190 | }; |
| 14191 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14192 | /* |
| 14193 | * 2ch mode |
| 14194 | */ |
| 14195 | static struct hda_channel_mode alc861vd_3stack_2ch_modes[1] = { |
| 14196 | { 2, NULL } |
| 14197 | }; |
| 14198 | |
| 14199 | /* |
| 14200 | * 6ch mode |
| 14201 | */ |
| 14202 | static struct hda_verb alc861vd_6stack_ch6_init[] = { |
| 14203 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 14204 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 14205 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 14206 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 14207 | { } /* end */ |
| 14208 | }; |
| 14209 | |
| 14210 | /* |
| 14211 | * 8ch mode |
| 14212 | */ |
| 14213 | static struct hda_verb alc861vd_6stack_ch8_init[] = { |
| 14214 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 14215 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 14216 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 14217 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 14218 | { } /* end */ |
| 14219 | }; |
| 14220 | |
| 14221 | static struct hda_channel_mode alc861vd_6stack_modes[2] = { |
| 14222 | { 6, alc861vd_6stack_ch6_init }, |
| 14223 | { 8, alc861vd_6stack_ch8_init }, |
| 14224 | }; |
| 14225 | |
| 14226 | static struct snd_kcontrol_new alc861vd_chmode_mixer[] = { |
| 14227 | { |
| 14228 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 14229 | .name = "Channel Mode", |
| 14230 | .info = alc_ch_mode_info, |
| 14231 | .get = alc_ch_mode_get, |
| 14232 | .put = alc_ch_mode_put, |
| 14233 | }, |
| 14234 | { } /* end */ |
| 14235 | }; |
| 14236 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14237 | /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17 |
| 14238 | * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b |
| 14239 | */ |
| 14240 | static struct snd_kcontrol_new alc861vd_6st_mixer[] = { |
| 14241 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 14242 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 14243 | |
| 14244 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 14245 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
| 14246 | |
| 14247 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, |
| 14248 | HDA_OUTPUT), |
| 14249 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, |
| 14250 | HDA_OUTPUT), |
| 14251 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 14252 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 14253 | |
| 14254 | HDA_CODEC_VOLUME("Side Playback Volume", 0x05, 0x0, HDA_OUTPUT), |
| 14255 | HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT), |
| 14256 | |
| 14257 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 14258 | |
| 14259 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 14260 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 14261 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 14262 | |
| 14263 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
| 14264 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 14265 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 14266 | |
| 14267 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 14268 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 14269 | |
| 14270 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 14271 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 14272 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14273 | { } /* end */ |
| 14274 | }; |
| 14275 | |
| 14276 | static struct snd_kcontrol_new alc861vd_3st_mixer[] = { |
| 14277 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 14278 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 14279 | |
| 14280 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 14281 | |
| 14282 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 14283 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 14284 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 14285 | |
| 14286 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
| 14287 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 14288 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 14289 | |
| 14290 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 14291 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 14292 | |
| 14293 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 14294 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 14295 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14296 | { } /* end */ |
| 14297 | }; |
| 14298 | |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 14299 | static struct snd_kcontrol_new alc861vd_lenovo_mixer[] = { |
| 14300 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 14301 | /*HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),*/ |
| 14302 | HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 14303 | |
| 14304 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 14305 | |
| 14306 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 14307 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 14308 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 14309 | |
| 14310 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
| 14311 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 14312 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 14313 | |
| 14314 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 14315 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 14316 | |
| 14317 | { } /* end */ |
| 14318 | }; |
| 14319 | |
Tobin Davis | b419f34 | 2008-03-07 11:57:51 +0100 | [diff] [blame] | 14320 | /* Pin assignment: Speaker=0x14, HP = 0x15, |
| 14321 | * Ext Mic=0x18, Int Mic = 0x19, CD = 0x1c, PC Beep = 0x1d |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 14322 | */ |
| 14323 | static struct snd_kcontrol_new alc861vd_dallas_mixer[] = { |
Tobin Davis | b419f34 | 2008-03-07 11:57:51 +0100 | [diff] [blame] | 14324 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 14325 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0c, 2, HDA_INPUT), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 14326 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 14327 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT), |
Tobin Davis | b419f34 | 2008-03-07 11:57:51 +0100 | [diff] [blame] | 14328 | HDA_CODEC_VOLUME("Ext Mic Boost", 0x18, 0, HDA_INPUT), |
| 14329 | HDA_CODEC_VOLUME("Ext Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 14330 | HDA_CODEC_MUTE("Ext Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 14331 | HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT), |
| 14332 | HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 14333 | HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 14334 | { } /* end */ |
| 14335 | }; |
| 14336 | |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 14337 | /* Pin assignment: Speaker=0x14, Line-out = 0x15, |
| 14338 | * Front Mic=0x18, ATAPI Mic = 0x19, |
| 14339 | */ |
| 14340 | static struct snd_kcontrol_new alc861vd_hp_mixer[] = { |
| 14341 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 14342 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 14343 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 14344 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT), |
| 14345 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 14346 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 14347 | HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 14348 | HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 14349 | |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 14350 | { } /* end */ |
| 14351 | }; |
| 14352 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14353 | /* |
| 14354 | * generic initialization of ADC, input mixers and output mixers |
| 14355 | */ |
| 14356 | static struct hda_verb alc861vd_volume_init_verbs[] = { |
| 14357 | /* |
| 14358 | * Unmute ADC0 and set the default input to mic-in |
| 14359 | */ |
| 14360 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 14361 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14362 | |
| 14363 | /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of |
| 14364 | * the analog-loopback mixer widget |
| 14365 | */ |
| 14366 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 14367 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 14368 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 14369 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 14370 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 14371 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14372 | |
| 14373 | /* Capture mixer: unmute Mic, F-Mic, Line, CD inputs */ |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 14374 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14375 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 14376 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14377 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)}, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14378 | |
| 14379 | /* |
| 14380 | * Set up output mixers (0x02 - 0x05) |
| 14381 | */ |
| 14382 | /* set vol=0 to output mixers */ |
| 14383 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 14384 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 14385 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 14386 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 14387 | |
| 14388 | /* set up input amps for analog loopback */ |
| 14389 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 14390 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 14391 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 14392 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 14393 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 14394 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 14395 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 14396 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 14397 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 14398 | |
| 14399 | { } |
| 14400 | }; |
| 14401 | |
| 14402 | /* |
| 14403 | * 3-stack pin configuration: |
| 14404 | * front = 0x14, mic/clfe = 0x18, HP = 0x19, line/surr = 0x1a, f-mic = 0x1b |
| 14405 | */ |
| 14406 | static struct hda_verb alc861vd_3stack_init_verbs[] = { |
| 14407 | /* |
| 14408 | * Set pin mode and muting |
| 14409 | */ |
| 14410 | /* set front pin widgets 0x14 for output */ |
| 14411 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 14412 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 14413 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 14414 | |
| 14415 | /* Mic (rear) pin: input vref at 80% */ |
| 14416 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 14417 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 14418 | /* Front Mic pin: input vref at 80% */ |
| 14419 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 14420 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 14421 | /* Line In pin: input */ |
| 14422 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 14423 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 14424 | /* Line-2 In: Headphone output (output 0 - 0x0c) */ |
| 14425 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 14426 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 14427 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 14428 | /* CD pin widget for input */ |
| 14429 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 14430 | |
| 14431 | { } |
| 14432 | }; |
| 14433 | |
| 14434 | /* |
| 14435 | * 6-stack pin configuration: |
| 14436 | */ |
| 14437 | static struct hda_verb alc861vd_6stack_init_verbs[] = { |
| 14438 | /* |
| 14439 | * Set pin mode and muting |
| 14440 | */ |
| 14441 | /* set front pin widgets 0x14 for output */ |
| 14442 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 14443 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 14444 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 14445 | |
| 14446 | /* Rear Pin: output 1 (0x0d) */ |
| 14447 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 14448 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 14449 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 14450 | /* CLFE Pin: output 2 (0x0e) */ |
| 14451 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 14452 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 14453 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 14454 | /* Side Pin: output 3 (0x0f) */ |
| 14455 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 14456 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 14457 | {0x17, AC_VERB_SET_CONNECT_SEL, 0x03}, |
| 14458 | |
| 14459 | /* Mic (rear) pin: input vref at 80% */ |
| 14460 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 14461 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 14462 | /* Front Mic pin: input vref at 80% */ |
| 14463 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 14464 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 14465 | /* Line In pin: input */ |
| 14466 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 14467 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 14468 | /* Line-2 In: Headphone output (output 0 - 0x0c) */ |
| 14469 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 14470 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 14471 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 14472 | /* CD pin widget for input */ |
| 14473 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 14474 | |
| 14475 | { } |
| 14476 | }; |
| 14477 | |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 14478 | static struct hda_verb alc861vd_eapd_verbs[] = { |
| 14479 | {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 14480 | { } |
| 14481 | }; |
| 14482 | |
Kailang Yang | f9423e7 | 2008-05-27 12:32:25 +0200 | [diff] [blame] | 14483 | static struct hda_verb alc660vd_eapd_verbs[] = { |
| 14484 | {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 14485 | {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 14486 | { } |
| 14487 | }; |
| 14488 | |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 14489 | static struct hda_verb alc861vd_lenovo_unsol_verbs[] = { |
| 14490 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14491 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 14492 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, |
| 14493 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 14494 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 14495 | {} |
| 14496 | }; |
| 14497 | |
| 14498 | /* toggle speaker-output according to the hp-jack state */ |
| 14499 | static void alc861vd_lenovo_hp_automute(struct hda_codec *codec) |
| 14500 | { |
| 14501 | unsigned int present; |
| 14502 | unsigned char bits; |
| 14503 | |
| 14504 | present = snd_hda_codec_read(codec, 0x1b, 0, |
| 14505 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 14506 | bits = present ? HDA_AMP_MUTE : 0; |
| 14507 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 14508 | HDA_AMP_MUTE, bits); |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 14509 | } |
| 14510 | |
| 14511 | static void alc861vd_lenovo_mic_automute(struct hda_codec *codec) |
| 14512 | { |
| 14513 | unsigned int present; |
| 14514 | unsigned char bits; |
| 14515 | |
| 14516 | present = snd_hda_codec_read(codec, 0x18, 0, |
| 14517 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 14518 | bits = present ? HDA_AMP_MUTE : 0; |
| 14519 | snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, 1, |
| 14520 | HDA_AMP_MUTE, bits); |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 14521 | } |
| 14522 | |
| 14523 | static void alc861vd_lenovo_automute(struct hda_codec *codec) |
| 14524 | { |
| 14525 | alc861vd_lenovo_hp_automute(codec); |
| 14526 | alc861vd_lenovo_mic_automute(codec); |
| 14527 | } |
| 14528 | |
| 14529 | static void alc861vd_lenovo_unsol_event(struct hda_codec *codec, |
| 14530 | unsigned int res) |
| 14531 | { |
| 14532 | switch (res >> 26) { |
| 14533 | case ALC880_HP_EVENT: |
| 14534 | alc861vd_lenovo_hp_automute(codec); |
| 14535 | break; |
| 14536 | case ALC880_MIC_EVENT: |
| 14537 | alc861vd_lenovo_mic_automute(codec); |
| 14538 | break; |
| 14539 | } |
| 14540 | } |
| 14541 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 14542 | static struct hda_verb alc861vd_dallas_verbs[] = { |
| 14543 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 14544 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 14545 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 14546 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 14547 | |
| 14548 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14549 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 14550 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 14551 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 14552 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 14553 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 14554 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 14555 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 14556 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 14557 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 14558 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 14559 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 14560 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 14561 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 14562 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 14563 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 14564 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 14565 | |
| 14566 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50}, |
| 14567 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 14568 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50}, |
| 14569 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 14570 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 14571 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 14572 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 14573 | {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 14574 | |
| 14575 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14576 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 14577 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 14578 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 14579 | |
| 14580 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 14581 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 14582 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 14583 | |
| 14584 | { } /* end */ |
| 14585 | }; |
| 14586 | |
| 14587 | /* toggle speaker-output according to the hp-jack state */ |
| 14588 | static void alc861vd_dallas_automute(struct hda_codec *codec) |
| 14589 | { |
| 14590 | unsigned int present; |
| 14591 | |
| 14592 | present = snd_hda_codec_read(codec, 0x15, 0, |
| 14593 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 14594 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 14595 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 14596 | } |
| 14597 | |
| 14598 | static void alc861vd_dallas_unsol_event(struct hda_codec *codec, unsigned int res) |
| 14599 | { |
| 14600 | if ((res >> 26) == ALC880_HP_EVENT) |
| 14601 | alc861vd_dallas_automute(codec); |
| 14602 | } |
| 14603 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 14604 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 14605 | #define alc861vd_loopbacks alc880_loopbacks |
| 14606 | #endif |
| 14607 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14608 | /* pcm configuration: identiacal with ALC880 */ |
| 14609 | #define alc861vd_pcm_analog_playback alc880_pcm_analog_playback |
| 14610 | #define alc861vd_pcm_analog_capture alc880_pcm_analog_capture |
| 14611 | #define alc861vd_pcm_digital_playback alc880_pcm_digital_playback |
| 14612 | #define alc861vd_pcm_digital_capture alc880_pcm_digital_capture |
| 14613 | |
| 14614 | /* |
| 14615 | * configuration and preset |
| 14616 | */ |
| 14617 | static const char *alc861vd_models[ALC861VD_MODEL_LAST] = { |
| 14618 | [ALC660VD_3ST] = "3stack-660", |
Takashi Iwai | 983f8ae | 2007-08-15 16:44:04 +0200 | [diff] [blame] | 14619 | [ALC660VD_3ST_DIG] = "3stack-660-digout", |
Takashi Iwai | 13c9474 | 2008-11-05 08:06:08 +0100 | [diff] [blame] | 14620 | [ALC660VD_ASUS_V1S] = "asus-v1s", |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14621 | [ALC861VD_3ST] = "3stack", |
| 14622 | [ALC861VD_3ST_DIG] = "3stack-digout", |
| 14623 | [ALC861VD_6ST_DIG] = "6stack-digout", |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 14624 | [ALC861VD_LENOVO] = "lenovo", |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 14625 | [ALC861VD_DALLAS] = "dallas", |
Takashi Iwai | 983f8ae | 2007-08-15 16:44:04 +0200 | [diff] [blame] | 14626 | [ALC861VD_HP] = "hp", |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14627 | [ALC861VD_AUTO] = "auto", |
| 14628 | }; |
| 14629 | |
| 14630 | static struct snd_pci_quirk alc861vd_cfg_tbl[] = { |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 14631 | SND_PCI_QUIRK(0x1019, 0xa88d, "Realtek ALC660 demo", ALC660VD_3ST), |
| 14632 | SND_PCI_QUIRK(0x103c, 0x30bf, "HP TX1000", ALC861VD_HP), |
Takashi Iwai | 07e038b | 2007-02-15 18:23:41 +0100 | [diff] [blame] | 14633 | SND_PCI_QUIRK(0x1043, 0x12e2, "Asus z35m", ALC660VD_3ST), |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14634 | SND_PCI_QUIRK(0x1043, 0x1339, "Asus G1", ALC660VD_3ST), |
Takashi Iwai | 13c9474 | 2008-11-05 08:06:08 +0100 | [diff] [blame] | 14635 | SND_PCI_QUIRK(0x1043, 0x1633, "Asus V1Sn", ALC660VD_ASUS_V1S), |
Mike Crash | 6963f84 | 2007-06-25 12:12:51 +0200 | [diff] [blame] | 14636 | SND_PCI_QUIRK(0x1043, 0x81e7, "ASUS", ALC660VD_3ST_DIG), |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14637 | SND_PCI_QUIRK(0x10de, 0x03f0, "Realtek ALC660 demo", ALC660VD_3ST), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 14638 | SND_PCI_QUIRK(0x1179, 0xff00, "Toshiba A135", ALC861VD_LENOVO), |
Takashi Iwai | 38baf5a | 2007-08-16 17:52:43 +0200 | [diff] [blame] | 14639 | /*SND_PCI_QUIRK(0x1179, 0xff00, "DALLAS", ALC861VD_DALLAS),*/ /*lenovo*/ |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 14640 | SND_PCI_QUIRK(0x1179, 0xff01, "DALLAS", ALC861VD_DALLAS), |
Takashi Iwai | 542d7c6 | 2007-08-16 18:57:30 +0200 | [diff] [blame] | 14641 | SND_PCI_QUIRK(0x1179, 0xff03, "Toshiba P205", ALC861VD_LENOVO), |
Tobin Davis | b419f34 | 2008-03-07 11:57:51 +0100 | [diff] [blame] | 14642 | SND_PCI_QUIRK(0x1179, 0xff31, "Toshiba L30-149", ALC861VD_DALLAS), |
Takashi Iwai | 39c5d41 | 2007-08-15 16:24:17 +0200 | [diff] [blame] | 14643 | SND_PCI_QUIRK(0x1565, 0x820d, "Biostar NF61S SE", ALC861VD_6ST_DIG), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 14644 | SND_PCI_QUIRK_VENDOR(0x17aa, "Lenovo", ALC861VD_LENOVO), |
Tobin Davis | 625dc0b | 2007-07-30 21:42:10 +0200 | [diff] [blame] | 14645 | SND_PCI_QUIRK(0x1849, 0x0862, "ASRock K8NF6G-VSTA", ALC861VD_6ST_DIG), |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14646 | {} |
| 14647 | }; |
| 14648 | |
| 14649 | static struct alc_config_preset alc861vd_presets[] = { |
| 14650 | [ALC660VD_3ST] = { |
| 14651 | .mixers = { alc861vd_3st_mixer }, |
| 14652 | .init_verbs = { alc861vd_volume_init_verbs, |
| 14653 | alc861vd_3stack_init_verbs }, |
| 14654 | .num_dacs = ARRAY_SIZE(alc660vd_dac_nids), |
| 14655 | .dac_nids = alc660vd_dac_nids, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14656 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), |
| 14657 | .channel_mode = alc861vd_3stack_2ch_modes, |
| 14658 | .input_mux = &alc861vd_capture_source, |
| 14659 | }, |
Mike Crash | 6963f84 | 2007-06-25 12:12:51 +0200 | [diff] [blame] | 14660 | [ALC660VD_3ST_DIG] = { |
| 14661 | .mixers = { alc861vd_3st_mixer }, |
| 14662 | .init_verbs = { alc861vd_volume_init_verbs, |
| 14663 | alc861vd_3stack_init_verbs }, |
| 14664 | .num_dacs = ARRAY_SIZE(alc660vd_dac_nids), |
| 14665 | .dac_nids = alc660vd_dac_nids, |
| 14666 | .dig_out_nid = ALC861VD_DIGOUT_NID, |
Mike Crash | 6963f84 | 2007-06-25 12:12:51 +0200 | [diff] [blame] | 14667 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), |
| 14668 | .channel_mode = alc861vd_3stack_2ch_modes, |
| 14669 | .input_mux = &alc861vd_capture_source, |
| 14670 | }, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14671 | [ALC861VD_3ST] = { |
| 14672 | .mixers = { alc861vd_3st_mixer }, |
| 14673 | .init_verbs = { alc861vd_volume_init_verbs, |
| 14674 | alc861vd_3stack_init_verbs }, |
| 14675 | .num_dacs = ARRAY_SIZE(alc861vd_dac_nids), |
| 14676 | .dac_nids = alc861vd_dac_nids, |
| 14677 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), |
| 14678 | .channel_mode = alc861vd_3stack_2ch_modes, |
| 14679 | .input_mux = &alc861vd_capture_source, |
| 14680 | }, |
| 14681 | [ALC861VD_3ST_DIG] = { |
| 14682 | .mixers = { alc861vd_3st_mixer }, |
| 14683 | .init_verbs = { alc861vd_volume_init_verbs, |
| 14684 | alc861vd_3stack_init_verbs }, |
| 14685 | .num_dacs = ARRAY_SIZE(alc861vd_dac_nids), |
| 14686 | .dac_nids = alc861vd_dac_nids, |
| 14687 | .dig_out_nid = ALC861VD_DIGOUT_NID, |
| 14688 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), |
| 14689 | .channel_mode = alc861vd_3stack_2ch_modes, |
| 14690 | .input_mux = &alc861vd_capture_source, |
| 14691 | }, |
| 14692 | [ALC861VD_6ST_DIG] = { |
| 14693 | .mixers = { alc861vd_6st_mixer, alc861vd_chmode_mixer }, |
| 14694 | .init_verbs = { alc861vd_volume_init_verbs, |
| 14695 | alc861vd_6stack_init_verbs }, |
| 14696 | .num_dacs = ARRAY_SIZE(alc861vd_dac_nids), |
| 14697 | .dac_nids = alc861vd_dac_nids, |
| 14698 | .dig_out_nid = ALC861VD_DIGOUT_NID, |
| 14699 | .num_channel_mode = ARRAY_SIZE(alc861vd_6stack_modes), |
| 14700 | .channel_mode = alc861vd_6stack_modes, |
| 14701 | .input_mux = &alc861vd_capture_source, |
| 14702 | }, |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 14703 | [ALC861VD_LENOVO] = { |
| 14704 | .mixers = { alc861vd_lenovo_mixer }, |
| 14705 | .init_verbs = { alc861vd_volume_init_verbs, |
| 14706 | alc861vd_3stack_init_verbs, |
| 14707 | alc861vd_eapd_verbs, |
| 14708 | alc861vd_lenovo_unsol_verbs }, |
| 14709 | .num_dacs = ARRAY_SIZE(alc660vd_dac_nids), |
| 14710 | .dac_nids = alc660vd_dac_nids, |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 14711 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), |
| 14712 | .channel_mode = alc861vd_3stack_2ch_modes, |
| 14713 | .input_mux = &alc861vd_capture_source, |
| 14714 | .unsol_event = alc861vd_lenovo_unsol_event, |
| 14715 | .init_hook = alc861vd_lenovo_automute, |
| 14716 | }, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 14717 | [ALC861VD_DALLAS] = { |
| 14718 | .mixers = { alc861vd_dallas_mixer }, |
| 14719 | .init_verbs = { alc861vd_dallas_verbs }, |
| 14720 | .num_dacs = ARRAY_SIZE(alc861vd_dac_nids), |
| 14721 | .dac_nids = alc861vd_dac_nids, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 14722 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), |
| 14723 | .channel_mode = alc861vd_3stack_2ch_modes, |
| 14724 | .input_mux = &alc861vd_dallas_capture_source, |
| 14725 | .unsol_event = alc861vd_dallas_unsol_event, |
| 14726 | .init_hook = alc861vd_dallas_automute, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 14727 | }, |
| 14728 | [ALC861VD_HP] = { |
| 14729 | .mixers = { alc861vd_hp_mixer }, |
| 14730 | .init_verbs = { alc861vd_dallas_verbs, alc861vd_eapd_verbs }, |
| 14731 | .num_dacs = ARRAY_SIZE(alc861vd_dac_nids), |
| 14732 | .dac_nids = alc861vd_dac_nids, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 14733 | .dig_out_nid = ALC861VD_DIGOUT_NID, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 14734 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), |
| 14735 | .channel_mode = alc861vd_3stack_2ch_modes, |
| 14736 | .input_mux = &alc861vd_hp_capture_source, |
| 14737 | .unsol_event = alc861vd_dallas_unsol_event, |
| 14738 | .init_hook = alc861vd_dallas_automute, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 14739 | }, |
Takashi Iwai | 13c9474 | 2008-11-05 08:06:08 +0100 | [diff] [blame] | 14740 | [ALC660VD_ASUS_V1S] = { |
| 14741 | .mixers = { alc861vd_lenovo_mixer }, |
| 14742 | .init_verbs = { alc861vd_volume_init_verbs, |
| 14743 | alc861vd_3stack_init_verbs, |
| 14744 | alc861vd_eapd_verbs, |
| 14745 | alc861vd_lenovo_unsol_verbs }, |
| 14746 | .num_dacs = ARRAY_SIZE(alc660vd_dac_nids), |
| 14747 | .dac_nids = alc660vd_dac_nids, |
| 14748 | .dig_out_nid = ALC861VD_DIGOUT_NID, |
| 14749 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), |
| 14750 | .channel_mode = alc861vd_3stack_2ch_modes, |
| 14751 | .input_mux = &alc861vd_capture_source, |
| 14752 | .unsol_event = alc861vd_lenovo_unsol_event, |
| 14753 | .init_hook = alc861vd_lenovo_automute, |
| 14754 | }, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14755 | }; |
| 14756 | |
| 14757 | /* |
| 14758 | * BIOS auto configuration |
| 14759 | */ |
| 14760 | static void alc861vd_auto_set_output_and_unmute(struct hda_codec *codec, |
| 14761 | hda_nid_t nid, int pin_type, int dac_idx) |
| 14762 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 14763 | alc_set_pin_output(codec, nid, pin_type); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14764 | } |
| 14765 | |
| 14766 | static void alc861vd_auto_init_multi_out(struct hda_codec *codec) |
| 14767 | { |
| 14768 | struct alc_spec *spec = codec->spec; |
| 14769 | int i; |
| 14770 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 14771 | alc_subsystem_id(codec, 0x15, 0x1b, 0x14); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14772 | for (i = 0; i <= HDA_SIDE; i++) { |
| 14773 | hda_nid_t nid = spec->autocfg.line_out_pins[i]; |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 14774 | int pin_type = get_pin_type(spec->autocfg.line_out_type); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14775 | if (nid) |
| 14776 | alc861vd_auto_set_output_and_unmute(codec, nid, |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 14777 | pin_type, i); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14778 | } |
| 14779 | } |
| 14780 | |
| 14781 | |
| 14782 | static void alc861vd_auto_init_hp_out(struct hda_codec *codec) |
| 14783 | { |
| 14784 | struct alc_spec *spec = codec->spec; |
| 14785 | hda_nid_t pin; |
| 14786 | |
| 14787 | pin = spec->autocfg.hp_pins[0]; |
| 14788 | if (pin) /* connect to front and use dac 0 */ |
| 14789 | alc861vd_auto_set_output_and_unmute(codec, pin, PIN_HP, 0); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 14790 | pin = spec->autocfg.speaker_pins[0]; |
| 14791 | if (pin) |
| 14792 | alc861vd_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14793 | } |
| 14794 | |
| 14795 | #define alc861vd_is_input_pin(nid) alc880_is_input_pin(nid) |
| 14796 | #define ALC861VD_PIN_CD_NID ALC880_PIN_CD_NID |
| 14797 | |
| 14798 | static void alc861vd_auto_init_analog_input(struct hda_codec *codec) |
| 14799 | { |
| 14800 | struct alc_spec *spec = codec->spec; |
| 14801 | int i; |
| 14802 | |
| 14803 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
| 14804 | hda_nid_t nid = spec->autocfg.input_pins[i]; |
| 14805 | if (alc861vd_is_input_pin(nid)) { |
| 14806 | snd_hda_codec_write(codec, nid, 0, |
| 14807 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 14808 | i <= AUTO_PIN_FRONT_MIC ? |
| 14809 | PIN_VREF80 : PIN_IN); |
| 14810 | if (nid != ALC861VD_PIN_CD_NID) |
| 14811 | snd_hda_codec_write(codec, nid, 0, |
| 14812 | AC_VERB_SET_AMP_GAIN_MUTE, |
| 14813 | AMP_OUT_MUTE); |
| 14814 | } |
| 14815 | } |
| 14816 | } |
| 14817 | |
Takashi Iwai | f511b01 | 2008-08-15 16:46:42 +0200 | [diff] [blame] | 14818 | #define alc861vd_auto_init_input_src alc882_auto_init_input_src |
| 14819 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14820 | #define alc861vd_idx_to_mixer_vol(nid) ((nid) + 0x02) |
| 14821 | #define alc861vd_idx_to_mixer_switch(nid) ((nid) + 0x0c) |
| 14822 | |
| 14823 | /* add playback controls from the parsed DAC table */ |
| 14824 | /* Based on ALC880 version. But ALC861VD has separate, |
| 14825 | * different NIDs for mute/unmute switch and volume control */ |
| 14826 | static int alc861vd_auto_create_multi_out_ctls(struct alc_spec *spec, |
| 14827 | const struct auto_pin_cfg *cfg) |
| 14828 | { |
| 14829 | char name[32]; |
| 14830 | static const char *chname[4] = {"Front", "Surround", "CLFE", "Side"}; |
| 14831 | hda_nid_t nid_v, nid_s; |
| 14832 | int i, err; |
| 14833 | |
| 14834 | for (i = 0; i < cfg->line_outs; i++) { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14835 | if (!spec->multiout.dac_nids[i]) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14836 | continue; |
| 14837 | nid_v = alc861vd_idx_to_mixer_vol( |
| 14838 | alc880_dac_to_idx( |
| 14839 | spec->multiout.dac_nids[i])); |
| 14840 | nid_s = alc861vd_idx_to_mixer_switch( |
| 14841 | alc880_dac_to_idx( |
| 14842 | spec->multiout.dac_nids[i])); |
| 14843 | |
| 14844 | if (i == 2) { |
| 14845 | /* Center/LFE */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14846 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 14847 | "Center Playback Volume", |
| 14848 | HDA_COMPOSE_AMP_VAL(nid_v, 1, 0, |
| 14849 | HDA_OUTPUT)); |
| 14850 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14851 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14852 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 14853 | "LFE Playback Volume", |
| 14854 | HDA_COMPOSE_AMP_VAL(nid_v, 2, 0, |
| 14855 | HDA_OUTPUT)); |
| 14856 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14857 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14858 | err = add_control(spec, ALC_CTL_BIND_MUTE, |
| 14859 | "Center Playback Switch", |
| 14860 | HDA_COMPOSE_AMP_VAL(nid_s, 1, 2, |
| 14861 | HDA_INPUT)); |
| 14862 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14863 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14864 | err = add_control(spec, ALC_CTL_BIND_MUTE, |
| 14865 | "LFE Playback Switch", |
| 14866 | HDA_COMPOSE_AMP_VAL(nid_s, 2, 2, |
| 14867 | HDA_INPUT)); |
| 14868 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14869 | return err; |
| 14870 | } else { |
| 14871 | sprintf(name, "%s Playback Volume", chname[i]); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14872 | err = add_control(spec, ALC_CTL_WIDGET_VOL, name, |
| 14873 | HDA_COMPOSE_AMP_VAL(nid_v, 3, 0, |
| 14874 | HDA_OUTPUT)); |
| 14875 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14876 | return err; |
| 14877 | sprintf(name, "%s Playback Switch", chname[i]); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14878 | err = add_control(spec, ALC_CTL_BIND_MUTE, name, |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 14879 | HDA_COMPOSE_AMP_VAL(nid_s, 3, 2, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14880 | HDA_INPUT)); |
| 14881 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14882 | return err; |
| 14883 | } |
| 14884 | } |
| 14885 | return 0; |
| 14886 | } |
| 14887 | |
| 14888 | /* add playback controls for speaker and HP outputs */ |
| 14889 | /* Based on ALC880 version. But ALC861VD has separate, |
| 14890 | * different NIDs for mute/unmute switch and volume control */ |
| 14891 | static int alc861vd_auto_create_extra_out(struct alc_spec *spec, |
| 14892 | hda_nid_t pin, const char *pfx) |
| 14893 | { |
| 14894 | hda_nid_t nid_v, nid_s; |
| 14895 | int err; |
| 14896 | char name[32]; |
| 14897 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14898 | if (!pin) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14899 | return 0; |
| 14900 | |
| 14901 | if (alc880_is_fixed_pin(pin)) { |
| 14902 | nid_v = alc880_idx_to_dac(alc880_fixed_pin_idx(pin)); |
| 14903 | /* specify the DAC as the extra output */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14904 | if (!spec->multiout.hp_nid) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14905 | spec->multiout.hp_nid = nid_v; |
| 14906 | else |
| 14907 | spec->multiout.extra_out_nid[0] = nid_v; |
| 14908 | /* control HP volume/switch on the output mixer amp */ |
| 14909 | nid_v = alc861vd_idx_to_mixer_vol( |
| 14910 | alc880_fixed_pin_idx(pin)); |
| 14911 | nid_s = alc861vd_idx_to_mixer_switch( |
| 14912 | alc880_fixed_pin_idx(pin)); |
| 14913 | |
| 14914 | sprintf(name, "%s Playback Volume", pfx); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14915 | err = add_control(spec, ALC_CTL_WIDGET_VOL, name, |
| 14916 | HDA_COMPOSE_AMP_VAL(nid_v, 3, 0, HDA_OUTPUT)); |
| 14917 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14918 | return err; |
| 14919 | sprintf(name, "%s Playback Switch", pfx); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14920 | err = add_control(spec, ALC_CTL_BIND_MUTE, name, |
| 14921 | HDA_COMPOSE_AMP_VAL(nid_s, 3, 2, HDA_INPUT)); |
| 14922 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14923 | return err; |
| 14924 | } else if (alc880_is_multi_pin(pin)) { |
| 14925 | /* set manual connection */ |
| 14926 | /* we have only a switch on HP-out PIN */ |
| 14927 | sprintf(name, "%s Playback Switch", pfx); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14928 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, name, |
| 14929 | HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT)); |
| 14930 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14931 | return err; |
| 14932 | } |
| 14933 | return 0; |
| 14934 | } |
| 14935 | |
| 14936 | /* parse the BIOS configuration and set up the alc_spec |
| 14937 | * return 1 if successful, 0 if the proper config is not found, |
| 14938 | * or a negative error code |
| 14939 | * Based on ALC880 version - had to change it to override |
| 14940 | * alc880_auto_create_extra_out and alc880_auto_create_multi_out_ctls */ |
| 14941 | static int alc861vd_parse_auto_config(struct hda_codec *codec) |
| 14942 | { |
| 14943 | struct alc_spec *spec = codec->spec; |
| 14944 | int err; |
| 14945 | static hda_nid_t alc861vd_ignore[] = { 0x1d, 0 }; |
| 14946 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14947 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 14948 | alc861vd_ignore); |
| 14949 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14950 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14951 | if (!spec->autocfg.line_outs) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14952 | return 0; /* can't find valid BIOS pin config */ |
| 14953 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14954 | err = alc880_auto_fill_dac_nids(spec, &spec->autocfg); |
| 14955 | if (err < 0) |
| 14956 | return err; |
| 14957 | err = alc861vd_auto_create_multi_out_ctls(spec, &spec->autocfg); |
| 14958 | if (err < 0) |
| 14959 | return err; |
| 14960 | err = alc861vd_auto_create_extra_out(spec, |
| 14961 | spec->autocfg.speaker_pins[0], |
| 14962 | "Speaker"); |
| 14963 | if (err < 0) |
| 14964 | return err; |
| 14965 | err = alc861vd_auto_create_extra_out(spec, |
| 14966 | spec->autocfg.hp_pins[0], |
| 14967 | "Headphone"); |
| 14968 | if (err < 0) |
| 14969 | return err; |
| 14970 | err = alc880_auto_create_analog_input_ctls(spec, &spec->autocfg); |
| 14971 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14972 | return err; |
| 14973 | |
| 14974 | spec->multiout.max_channels = spec->multiout.num_dacs * 2; |
| 14975 | |
Takashi Iwai | 0852d7a | 2009-02-11 11:35:15 +0100 | [diff] [blame] | 14976 | if (spec->autocfg.dig_outs) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14977 | spec->multiout.dig_out_nid = ALC861VD_DIGOUT_NID; |
| 14978 | |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 14979 | if (spec->kctls.list) |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 14980 | add_mixer(spec, spec->kctls.list); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14981 | |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 14982 | add_verb(spec, alc861vd_volume_init_verbs); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14983 | |
| 14984 | spec->num_mux_defs = 1; |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 14985 | spec->input_mux = &spec->private_imux[0]; |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14986 | |
Takashi Iwai | 776e184 | 2007-08-29 15:07:11 +0200 | [diff] [blame] | 14987 | err = alc_auto_add_mic_boost(codec); |
| 14988 | if (err < 0) |
| 14989 | return err; |
| 14990 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14991 | return 1; |
| 14992 | } |
| 14993 | |
| 14994 | /* additional initialization for auto-configuration model */ |
| 14995 | static void alc861vd_auto_init(struct hda_codec *codec) |
| 14996 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 14997 | struct alc_spec *spec = codec->spec; |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14998 | alc861vd_auto_init_multi_out(codec); |
| 14999 | alc861vd_auto_init_hp_out(codec); |
| 15000 | alc861vd_auto_init_analog_input(codec); |
Takashi Iwai | f511b01 | 2008-08-15 16:46:42 +0200 | [diff] [blame] | 15001 | alc861vd_auto_init_input_src(codec); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 15002 | if (spec->unsol_event) |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 15003 | alc_inithook(codec); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15004 | } |
| 15005 | |
| 15006 | static int patch_alc861vd(struct hda_codec *codec) |
| 15007 | { |
| 15008 | struct alc_spec *spec; |
| 15009 | int err, board_config; |
| 15010 | |
| 15011 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
| 15012 | if (spec == NULL) |
| 15013 | return -ENOMEM; |
| 15014 | |
| 15015 | codec->spec = spec; |
| 15016 | |
| 15017 | board_config = snd_hda_check_board_config(codec, ALC861VD_MODEL_LAST, |
| 15018 | alc861vd_models, |
| 15019 | alc861vd_cfg_tbl); |
| 15020 | |
| 15021 | if (board_config < 0 || board_config >= ALC861VD_MODEL_LAST) { |
| 15022 | printk(KERN_INFO "hda_codec: Unknown model for ALC660VD/" |
| 15023 | "ALC861VD, trying auto-probe from BIOS...\n"); |
| 15024 | board_config = ALC861VD_AUTO; |
| 15025 | } |
| 15026 | |
| 15027 | if (board_config == ALC861VD_AUTO) { |
| 15028 | /* automatic parse from the BIOS config */ |
| 15029 | err = alc861vd_parse_auto_config(codec); |
| 15030 | if (err < 0) { |
| 15031 | alc_free(codec); |
| 15032 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15033 | } else if (!err) { |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15034 | printk(KERN_INFO |
| 15035 | "hda_codec: Cannot set up configuration " |
| 15036 | "from BIOS. Using base mode...\n"); |
| 15037 | board_config = ALC861VD_3ST; |
| 15038 | } |
| 15039 | } |
| 15040 | |
Kusanagi Kouichi | 680cd53 | 2009-02-05 00:00:58 +0900 | [diff] [blame] | 15041 | err = snd_hda_attach_beep_device(codec, 0x23); |
| 15042 | if (err < 0) { |
| 15043 | alc_free(codec); |
| 15044 | return err; |
| 15045 | } |
| 15046 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15047 | if (board_config != ALC861VD_AUTO) |
| 15048 | setup_preset(spec, &alc861vd_presets[board_config]); |
| 15049 | |
Kailang Yang | 2f89328 | 2008-05-27 12:14:47 +0200 | [diff] [blame] | 15050 | if (codec->vendor_id == 0x10ec0660) { |
| 15051 | spec->stream_name_analog = "ALC660-VD Analog"; |
| 15052 | spec->stream_name_digital = "ALC660-VD Digital"; |
Kailang Yang | f9423e7 | 2008-05-27 12:32:25 +0200 | [diff] [blame] | 15053 | /* always turn on EAPD */ |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 15054 | add_verb(spec, alc660vd_eapd_verbs); |
Kailang Yang | 2f89328 | 2008-05-27 12:14:47 +0200 | [diff] [blame] | 15055 | } else { |
| 15056 | spec->stream_name_analog = "ALC861VD Analog"; |
| 15057 | spec->stream_name_digital = "ALC861VD Digital"; |
| 15058 | } |
| 15059 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15060 | spec->stream_analog_playback = &alc861vd_pcm_analog_playback; |
| 15061 | spec->stream_analog_capture = &alc861vd_pcm_analog_capture; |
| 15062 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15063 | spec->stream_digital_playback = &alc861vd_pcm_digital_playback; |
| 15064 | spec->stream_digital_capture = &alc861vd_pcm_digital_capture; |
| 15065 | |
| 15066 | spec->adc_nids = alc861vd_adc_nids; |
| 15067 | spec->num_adc_nids = ARRAY_SIZE(alc861vd_adc_nids); |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 15068 | spec->capsrc_nids = alc861vd_capsrc_nids; |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 15069 | spec->capture_style = CAPT_MIX; |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15070 | |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 15071 | set_capture_mixer(spec); |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 15072 | set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15073 | |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 15074 | spec->vmaster_nid = 0x02; |
| 15075 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15076 | codec->patch_ops = alc_patch_ops; |
| 15077 | |
| 15078 | if (board_config == ALC861VD_AUTO) |
| 15079 | spec->init_hook = alc861vd_auto_init; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 15080 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 15081 | if (!spec->loopback.amplist) |
| 15082 | spec->loopback.amplist = alc861vd_loopbacks; |
| 15083 | #endif |
Takashi Iwai | daead53 | 2008-11-28 12:55:36 +0100 | [diff] [blame] | 15084 | codec->proc_widget_hook = print_realtek_coef; |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15085 | |
| 15086 | return 0; |
| 15087 | } |
| 15088 | |
| 15089 | /* |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15090 | * ALC662 support |
| 15091 | * |
| 15092 | * ALC662 is almost identical with ALC880 but has cleaner and more flexible |
| 15093 | * configuration. Each pin widget can choose any input DACs and a mixer. |
| 15094 | * Each ADC is connected from a mixer of all inputs. This makes possible |
| 15095 | * 6-channel independent captures. |
| 15096 | * |
| 15097 | * In addition, an independent DAC for the multi-playback (not used in this |
| 15098 | * driver yet). |
| 15099 | */ |
| 15100 | #define ALC662_DIGOUT_NID 0x06 |
| 15101 | #define ALC662_DIGIN_NID 0x0a |
| 15102 | |
| 15103 | static hda_nid_t alc662_dac_nids[4] = { |
| 15104 | /* front, rear, clfe, rear_surr */ |
| 15105 | 0x02, 0x03, 0x04 |
| 15106 | }; |
| 15107 | |
| 15108 | static hda_nid_t alc662_adc_nids[1] = { |
| 15109 | /* ADC1-2 */ |
| 15110 | 0x09, |
| 15111 | }; |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 15112 | |
Kailang Yang | 77a261b | 2008-02-19 11:38:05 +0100 | [diff] [blame] | 15113 | static hda_nid_t alc662_capsrc_nids[1] = { 0x22 }; |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 15114 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15115 | /* input MUX */ |
| 15116 | /* FIXME: should be a matrix-type input source selection */ |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15117 | static struct hda_input_mux alc662_capture_source = { |
| 15118 | .num_items = 4, |
| 15119 | .items = { |
| 15120 | { "Mic", 0x0 }, |
| 15121 | { "Front Mic", 0x1 }, |
| 15122 | { "Line", 0x2 }, |
| 15123 | { "CD", 0x4 }, |
| 15124 | }, |
| 15125 | }; |
| 15126 | |
| 15127 | static struct hda_input_mux alc662_lenovo_101e_capture_source = { |
| 15128 | .num_items = 2, |
| 15129 | .items = { |
| 15130 | { "Mic", 0x1 }, |
| 15131 | { "Line", 0x2 }, |
| 15132 | }, |
| 15133 | }; |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 15134 | |
| 15135 | static struct hda_input_mux alc662_eeepc_capture_source = { |
| 15136 | .num_items = 2, |
| 15137 | .items = { |
| 15138 | { "i-Mic", 0x1 }, |
| 15139 | { "e-Mic", 0x0 }, |
| 15140 | }, |
| 15141 | }; |
| 15142 | |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 15143 | static struct hda_input_mux alc663_capture_source = { |
| 15144 | .num_items = 3, |
| 15145 | .items = { |
| 15146 | { "Mic", 0x0 }, |
| 15147 | { "Front Mic", 0x1 }, |
| 15148 | { "Line", 0x2 }, |
| 15149 | }, |
| 15150 | }; |
| 15151 | |
| 15152 | static struct hda_input_mux alc663_m51va_capture_source = { |
| 15153 | .num_items = 2, |
| 15154 | .items = { |
| 15155 | { "Ext-Mic", 0x0 }, |
| 15156 | { "D-Mic", 0x9 }, |
| 15157 | }, |
| 15158 | }; |
| 15159 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15160 | /* |
| 15161 | * 2ch mode |
| 15162 | */ |
| 15163 | static struct hda_channel_mode alc662_3ST_2ch_modes[1] = { |
| 15164 | { 2, NULL } |
| 15165 | }; |
| 15166 | |
| 15167 | /* |
| 15168 | * 2ch mode |
| 15169 | */ |
| 15170 | static struct hda_verb alc662_3ST_ch2_init[] = { |
| 15171 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 15172 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 15173 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 15174 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 15175 | { } /* end */ |
| 15176 | }; |
| 15177 | |
| 15178 | /* |
| 15179 | * 6ch mode |
| 15180 | */ |
| 15181 | static struct hda_verb alc662_3ST_ch6_init[] = { |
| 15182 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 15183 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 15184 | { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 }, |
| 15185 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 15186 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 15187 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 15188 | { } /* end */ |
| 15189 | }; |
| 15190 | |
| 15191 | static struct hda_channel_mode alc662_3ST_6ch_modes[2] = { |
| 15192 | { 2, alc662_3ST_ch2_init }, |
| 15193 | { 6, alc662_3ST_ch6_init }, |
| 15194 | }; |
| 15195 | |
| 15196 | /* |
| 15197 | * 2ch mode |
| 15198 | */ |
| 15199 | static struct hda_verb alc662_sixstack_ch6_init[] = { |
| 15200 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 15201 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 15202 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 15203 | { } /* end */ |
| 15204 | }; |
| 15205 | |
| 15206 | /* |
| 15207 | * 6ch mode |
| 15208 | */ |
| 15209 | static struct hda_verb alc662_sixstack_ch8_init[] = { |
| 15210 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 15211 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 15212 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 15213 | { } /* end */ |
| 15214 | }; |
| 15215 | |
| 15216 | static struct hda_channel_mode alc662_5stack_modes[2] = { |
| 15217 | { 2, alc662_sixstack_ch6_init }, |
| 15218 | { 6, alc662_sixstack_ch8_init }, |
| 15219 | }; |
| 15220 | |
| 15221 | /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17 |
| 15222 | * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b |
| 15223 | */ |
| 15224 | |
| 15225 | static struct snd_kcontrol_new alc662_base_mixer[] = { |
| 15226 | /* output mixer control */ |
| 15227 | HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT), |
Herton Ronaldo Krzesinski | 7055ad8 | 2008-03-14 12:52:20 +0100 | [diff] [blame] | 15228 | HDA_CODEC_MUTE("Front Playback Switch", 0x0c, 0x0, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15229 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x3, 0x0, HDA_OUTPUT), |
Herton Ronaldo Krzesinski | 7055ad8 | 2008-03-14 12:52:20 +0100 | [diff] [blame] | 15230 | HDA_CODEC_MUTE("Surround Playback Switch", 0x0d, 0x0, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15231 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT), |
| 15232 | 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] | 15233 | HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x0e, 1, 0x0, HDA_INPUT), |
| 15234 | HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 0x0, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15235 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 15236 | |
| 15237 | /*Input mixer control */ |
| 15238 | HDA_CODEC_VOLUME("CD Playback Volume", 0xb, 0x4, HDA_INPUT), |
| 15239 | HDA_CODEC_MUTE("CD Playback Switch", 0xb, 0x4, HDA_INPUT), |
| 15240 | HDA_CODEC_VOLUME("Line Playback Volume", 0xb, 0x02, HDA_INPUT), |
| 15241 | HDA_CODEC_MUTE("Line Playback Switch", 0xb, 0x02, HDA_INPUT), |
| 15242 | HDA_CODEC_VOLUME("Mic Playback Volume", 0xb, 0x0, HDA_INPUT), |
| 15243 | HDA_CODEC_MUTE("Mic Playback Switch", 0xb, 0x0, HDA_INPUT), |
| 15244 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0xb, 0x01, HDA_INPUT), |
| 15245 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0xb, 0x01, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15246 | { } /* end */ |
| 15247 | }; |
| 15248 | |
| 15249 | static struct snd_kcontrol_new alc662_3ST_2ch_mixer[] = { |
| 15250 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
Herton Ronaldo Krzesinski | 7055ad8 | 2008-03-14 12:52:20 +0100 | [diff] [blame] | 15251 | HDA_CODEC_MUTE("Front Playback Switch", 0x0c, 0x0, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15252 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 15253 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 15254 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 15255 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 15256 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 15257 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 15258 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 15259 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 15260 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15261 | { } /* end */ |
| 15262 | }; |
| 15263 | |
| 15264 | static struct snd_kcontrol_new alc662_3ST_6ch_mixer[] = { |
| 15265 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
Herton Ronaldo Krzesinski | 7055ad8 | 2008-03-14 12:52:20 +0100 | [diff] [blame] | 15266 | HDA_CODEC_MUTE("Front Playback Switch", 0x0c, 0x0, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15267 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
Herton Ronaldo Krzesinski | 7055ad8 | 2008-03-14 12:52:20 +0100 | [diff] [blame] | 15268 | HDA_CODEC_MUTE("Surround Playback Switch", 0x0d, 0x0, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15269 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT), |
| 15270 | 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] | 15271 | HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x0e, 1, 0x0, HDA_INPUT), |
| 15272 | HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 0x0, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15273 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 15274 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 15275 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 15276 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 15277 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 15278 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 15279 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 15280 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 15281 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15282 | { } /* end */ |
| 15283 | }; |
| 15284 | |
| 15285 | static struct snd_kcontrol_new alc662_lenovo_101e_mixer[] = { |
| 15286 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 15287 | HDA_BIND_MUTE("Front Playback Switch", 0x02, 2, HDA_INPUT), |
Takashi Iwai | 86cd929 | 2008-01-28 18:09:56 +0100 | [diff] [blame] | 15288 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 15289 | HDA_BIND_MUTE("Speaker Playback Switch", 0x03, 2, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15290 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 15291 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 15292 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 15293 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 15294 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15295 | { } /* end */ |
| 15296 | }; |
| 15297 | |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 15298 | static struct snd_kcontrol_new alc662_eeepc_p701_mixer[] = { |
Takashi Iwai | 86cd929 | 2008-01-28 18:09:56 +0100 | [diff] [blame] | 15299 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 15300 | |
Herton Ronaldo Krzesinski | b481849 | 2008-02-23 11:34:12 +0100 | [diff] [blame] | 15301 | HDA_CODEC_VOLUME("Line-Out Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 15302 | HDA_CODEC_MUTE("Line-Out Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 15303 | |
| 15304 | HDA_CODEC_VOLUME("e-Mic Boost", 0x18, 0, HDA_INPUT), |
| 15305 | HDA_CODEC_VOLUME("e-Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 15306 | HDA_CODEC_MUTE("e-Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 15307 | |
| 15308 | HDA_CODEC_VOLUME("i-Mic Boost", 0x19, 0, HDA_INPUT), |
| 15309 | HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 15310 | HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 15311 | { } /* end */ |
| 15312 | }; |
| 15313 | |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 15314 | static struct snd_kcontrol_new alc662_eeepc_ep20_mixer[] = { |
Takashi Iwai | 31bffaa | 2008-02-27 16:10:44 +0100 | [diff] [blame] | 15315 | HDA_CODEC_VOLUME("Line-Out Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 15316 | HDA_CODEC_MUTE("Line-Out Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 15317 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 15318 | HDA_BIND_MUTE("Surround Playback Switch", 0x03, 2, HDA_INPUT), |
| 15319 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT), |
| 15320 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, HDA_OUTPUT), |
| 15321 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x04, 1, 2, HDA_INPUT), |
| 15322 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x04, 2, 2, HDA_INPUT), |
Takashi Iwai | 86cd929 | 2008-01-28 18:09:56 +0100 | [diff] [blame] | 15323 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 15324 | HDA_BIND_MUTE("MuteCtrl Playback Switch", 0x0c, 2, 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 | { } /* end */ |
| 15330 | }; |
| 15331 | |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 15332 | static struct hda_bind_ctls alc663_asus_bind_master_vol = { |
| 15333 | .ops = &snd_hda_bind_vol, |
| 15334 | .values = { |
| 15335 | HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT), |
| 15336 | HDA_COMPOSE_AMP_VAL(0x03, 3, 0, HDA_OUTPUT), |
| 15337 | 0 |
| 15338 | }, |
| 15339 | }; |
| 15340 | |
| 15341 | static struct hda_bind_ctls alc663_asus_one_bind_switch = { |
| 15342 | .ops = &snd_hda_bind_sw, |
| 15343 | .values = { |
| 15344 | HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), |
| 15345 | HDA_COMPOSE_AMP_VAL(0x21, 3, 0, HDA_OUTPUT), |
| 15346 | 0 |
| 15347 | }, |
| 15348 | }; |
| 15349 | |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 15350 | static struct snd_kcontrol_new alc663_m51va_mixer[] = { |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 15351 | HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol), |
| 15352 | HDA_BIND_SW("Master Playback Switch", &alc663_asus_one_bind_switch), |
| 15353 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 15354 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 15355 | { } /* end */ |
| 15356 | }; |
| 15357 | |
| 15358 | static struct hda_bind_ctls alc663_asus_tree_bind_switch = { |
| 15359 | .ops = &snd_hda_bind_sw, |
| 15360 | .values = { |
| 15361 | HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), |
| 15362 | HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT), |
| 15363 | HDA_COMPOSE_AMP_VAL(0x21, 3, 0, HDA_OUTPUT), |
| 15364 | 0 |
| 15365 | }, |
| 15366 | }; |
| 15367 | |
| 15368 | static struct snd_kcontrol_new alc663_two_hp_m1_mixer[] = { |
| 15369 | HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol), |
| 15370 | HDA_BIND_SW("Master Playback Switch", &alc663_asus_tree_bind_switch), |
| 15371 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 15372 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 15373 | HDA_CODEC_VOLUME("F-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 15374 | HDA_CODEC_MUTE("F-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 15375 | |
| 15376 | { } /* end */ |
| 15377 | }; |
| 15378 | |
| 15379 | static struct hda_bind_ctls alc663_asus_four_bind_switch = { |
| 15380 | .ops = &snd_hda_bind_sw, |
| 15381 | .values = { |
| 15382 | HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), |
| 15383 | HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT), |
| 15384 | HDA_COMPOSE_AMP_VAL(0x1b, 3, 0, HDA_OUTPUT), |
| 15385 | 0 |
| 15386 | }, |
| 15387 | }; |
| 15388 | |
| 15389 | static struct snd_kcontrol_new alc663_two_hp_m2_mixer[] = { |
| 15390 | HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol), |
| 15391 | HDA_BIND_SW("Master Playback Switch", &alc663_asus_four_bind_switch), |
| 15392 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 15393 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 15394 | HDA_CODEC_VOLUME("F-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 15395 | HDA_CODEC_MUTE("F-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 15396 | { } /* end */ |
| 15397 | }; |
| 15398 | |
| 15399 | static struct snd_kcontrol_new alc662_1bjd_mixer[] = { |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 15400 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 15401 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 15402 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 15403 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 15404 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 15405 | HDA_CODEC_VOLUME("F-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 15406 | HDA_CODEC_MUTE("F-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 15407 | { } /* end */ |
| 15408 | }; |
| 15409 | |
| 15410 | static struct hda_bind_ctls alc663_asus_two_bind_master_vol = { |
| 15411 | .ops = &snd_hda_bind_vol, |
| 15412 | .values = { |
| 15413 | HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT), |
| 15414 | HDA_COMPOSE_AMP_VAL(0x04, 3, 0, HDA_OUTPUT), |
| 15415 | 0 |
| 15416 | }, |
| 15417 | }; |
| 15418 | |
| 15419 | static struct hda_bind_ctls alc663_asus_two_bind_switch = { |
| 15420 | .ops = &snd_hda_bind_sw, |
| 15421 | .values = { |
| 15422 | HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), |
| 15423 | HDA_COMPOSE_AMP_VAL(0x16, 3, 0, HDA_OUTPUT), |
| 15424 | 0 |
| 15425 | }, |
| 15426 | }; |
| 15427 | |
| 15428 | static struct snd_kcontrol_new alc663_asus_21jd_clfe_mixer[] = { |
| 15429 | HDA_BIND_VOL("Master Playback Volume", |
| 15430 | &alc663_asus_two_bind_master_vol), |
| 15431 | HDA_BIND_SW("Master Playback Switch", &alc663_asus_two_bind_switch), |
| 15432 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 15433 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT), |
| 15434 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 15435 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 15436 | { } /* end */ |
| 15437 | }; |
| 15438 | |
| 15439 | static struct snd_kcontrol_new alc663_asus_15jd_clfe_mixer[] = { |
| 15440 | HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol), |
| 15441 | HDA_BIND_SW("Master Playback Switch", &alc663_asus_two_bind_switch), |
| 15442 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 15443 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 15444 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 15445 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 15446 | { } /* end */ |
| 15447 | }; |
| 15448 | |
| 15449 | static struct snd_kcontrol_new alc663_g71v_mixer[] = { |
| 15450 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 15451 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 15452 | HDA_CODEC_VOLUME("Front Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 15453 | HDA_CODEC_MUTE("Front Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 15454 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT), |
| 15455 | |
| 15456 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 15457 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 15458 | HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 15459 | HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 15460 | { } /* end */ |
| 15461 | }; |
| 15462 | |
| 15463 | static struct snd_kcontrol_new alc663_g50v_mixer[] = { |
| 15464 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 15465 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 15466 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT), |
| 15467 | |
| 15468 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 15469 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 15470 | HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 15471 | HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 15472 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 15473 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 15474 | { } /* end */ |
| 15475 | }; |
| 15476 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15477 | static struct snd_kcontrol_new alc662_chmode_mixer[] = { |
| 15478 | { |
| 15479 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 15480 | .name = "Channel Mode", |
| 15481 | .info = alc_ch_mode_info, |
| 15482 | .get = alc_ch_mode_get, |
| 15483 | .put = alc_ch_mode_put, |
| 15484 | }, |
| 15485 | { } /* end */ |
| 15486 | }; |
| 15487 | |
| 15488 | static struct hda_verb alc662_init_verbs[] = { |
| 15489 | /* ADC: mute amp left and right */ |
| 15490 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 15491 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 15492 | /* Front mixer: unmute input/output amp left and right (volume = 0) */ |
| 15493 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 15494 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 15495 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 15496 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 15497 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 15498 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15499 | |
Kailang Yang | b60dd39 | 2007-09-20 12:50:29 +0200 | [diff] [blame] | 15500 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15501 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15502 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15503 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15504 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15505 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15506 | |
| 15507 | /* Front Pin: output 0 (0x0c) */ |
| 15508 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 15509 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15510 | |
| 15511 | /* Rear Pin: output 1 (0x0d) */ |
| 15512 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 15513 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15514 | |
| 15515 | /* CLFE Pin: output 2 (0x0e) */ |
| 15516 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 15517 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15518 | |
| 15519 | /* Mic (rear) pin: input vref at 80% */ |
| 15520 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 15521 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 15522 | /* Front Mic pin: input vref at 80% */ |
| 15523 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 15524 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 15525 | /* Line In pin: input */ |
| 15526 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 15527 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 15528 | /* Line-2 In: Headphone output (output 0 - 0x0c) */ |
| 15529 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 15530 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15531 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 15532 | /* CD pin widget for input */ |
| 15533 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 15534 | |
| 15535 | /* FIXME: use matrix-type input source selection */ |
| 15536 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 15537 | /* Input mixer */ |
| 15538 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15539 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15540 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 15541 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)}, |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 15542 | |
| 15543 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15544 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15545 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 15546 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)}, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 15547 | |
| 15548 | /* always trun on EAPD */ |
| 15549 | {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 15550 | {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 15551 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15552 | { } |
| 15553 | }; |
| 15554 | |
| 15555 | static struct hda_verb alc662_sue_init_verbs[] = { |
| 15556 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_FRONT_EVENT}, |
| 15557 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_HP_EVENT}, |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 15558 | {} |
| 15559 | }; |
| 15560 | |
| 15561 | static struct hda_verb alc662_eeepc_sue_init_verbs[] = { |
| 15562 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 15563 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 15564 | {} |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15565 | }; |
| 15566 | |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 15567 | /* Set Unsolicited Event*/ |
| 15568 | static struct hda_verb alc662_eeepc_ep20_sue_init_verbs[] = { |
| 15569 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 15570 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 15571 | {} |
| 15572 | }; |
| 15573 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15574 | /* |
| 15575 | * generic initialization of ADC, input mixers and output mixers |
| 15576 | */ |
| 15577 | static struct hda_verb alc662_auto_init_verbs[] = { |
| 15578 | /* |
| 15579 | * Unmute ADC and set the default input to mic-in |
| 15580 | */ |
| 15581 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 15582 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15583 | |
| 15584 | /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback |
| 15585 | * mixer widget |
| 15586 | * Note: PASD motherboards uses the Line In 2 as the input for front |
| 15587 | * panel mic (mic 2) |
| 15588 | */ |
| 15589 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 15590 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 15591 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 15592 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 15593 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 15594 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15595 | |
| 15596 | /* |
| 15597 | * Set up output mixers (0x0c - 0x0f) |
| 15598 | */ |
| 15599 | /* set vol=0 to output mixers */ |
| 15600 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 15601 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 15602 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 15603 | |
| 15604 | /* set up input amps for analog loopback */ |
| 15605 | /* Amp Indices: DAC = 0, mixer = 1 */ |
Kailang Yang | b60dd39 | 2007-09-20 12:50:29 +0200 | [diff] [blame] | 15606 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15607 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15608 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15609 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15610 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15611 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15612 | |
| 15613 | |
| 15614 | /* FIXME: use matrix-type input source selection */ |
| 15615 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 15616 | /* Input mixer */ |
| 15617 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 15618 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15619 | { } |
| 15620 | }; |
| 15621 | |
Takashi Iwai | 24fb917 | 2008-09-02 14:48:20 +0200 | [diff] [blame] | 15622 | /* additional verbs for ALC663 */ |
| 15623 | static struct hda_verb alc663_auto_init_verbs[] = { |
| 15624 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15625 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15626 | { } |
| 15627 | }; |
| 15628 | |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 15629 | static struct hda_verb alc663_m51va_init_verbs[] = { |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 15630 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 15631 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 15632 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 15633 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 15634 | {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */ |
| 15635 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 15636 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)}, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 15637 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 15638 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 15639 | {} |
| 15640 | }; |
| 15641 | |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 15642 | static struct hda_verb alc663_21jd_amic_init_verbs[] = { |
| 15643 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 15644 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15645 | {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */ |
| 15646 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 15647 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15648 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 15649 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 15650 | {} |
| 15651 | }; |
| 15652 | |
| 15653 | static struct hda_verb alc662_1bjd_amic_init_verbs[] = { |
| 15654 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 15655 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 15656 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15657 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Headphone */ |
| 15658 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 15659 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15660 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 15661 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 15662 | {} |
| 15663 | }; |
| 15664 | |
| 15665 | static struct hda_verb alc663_15jd_amic_init_verbs[] = { |
| 15666 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 15667 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15668 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */ |
| 15669 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 15670 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15671 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 15672 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 15673 | {} |
| 15674 | }; |
| 15675 | |
| 15676 | static struct hda_verb alc663_two_hp_amic_m1_init_verbs[] = { |
| 15677 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 15678 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 15679 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15680 | {0x21, AC_VERB_SET_CONNECT_SEL, 0x0}, /* Headphone */ |
| 15681 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 15682 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15683 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x0}, /* Headphone */ |
| 15684 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 15685 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15686 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 15687 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 15688 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 15689 | {} |
| 15690 | }; |
| 15691 | |
| 15692 | static struct hda_verb alc663_two_hp_amic_m2_init_verbs[] = { |
| 15693 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 15694 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 15695 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15696 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */ |
| 15697 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 15698 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15699 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */ |
| 15700 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 15701 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15702 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 15703 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 15704 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 15705 | {} |
| 15706 | }; |
| 15707 | |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 15708 | static struct hda_verb alc663_g71v_init_verbs[] = { |
| 15709 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 15710 | /* {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, */ |
| 15711 | /* {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, */ /* Headphone */ |
| 15712 | |
| 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, 0x00}, /* Headphone */ |
| 15716 | |
| 15717 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_FRONT_EVENT}, |
| 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 alc663_g50v_init_verbs[] = { |
| 15724 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 15725 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15726 | {0x21, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Headphone */ |
| 15727 | |
| 15728 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 15729 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 15730 | {} |
| 15731 | }; |
| 15732 | |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 15733 | static struct hda_verb alc662_ecs_init_verbs[] = { |
| 15734 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, 0x701f}, |
| 15735 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 15736 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 15737 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 15738 | {} |
| 15739 | }; |
| 15740 | |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 15741 | static struct snd_kcontrol_new alc662_auto_capture_mixer[] = { |
| 15742 | HDA_CODEC_VOLUME("Capture Volume", 0x09, 0x0, HDA_INPUT), |
| 15743 | HDA_CODEC_MUTE("Capture Switch", 0x09, 0x0, HDA_INPUT), |
| 15744 | { } /* end */ |
| 15745 | }; |
| 15746 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15747 | static void alc662_lenovo_101e_ispeaker_automute(struct hda_codec *codec) |
| 15748 | { |
| 15749 | unsigned int present; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15750 | unsigned char bits; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15751 | |
| 15752 | present = snd_hda_codec_read(codec, 0x14, 0, |
| 15753 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 15754 | bits = present ? HDA_AMP_MUTE : 0; |
| 15755 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 15756 | HDA_AMP_MUTE, bits); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15757 | } |
| 15758 | |
| 15759 | static void alc662_lenovo_101e_all_automute(struct hda_codec *codec) |
| 15760 | { |
| 15761 | unsigned int present; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15762 | unsigned char bits; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15763 | |
| 15764 | present = snd_hda_codec_read(codec, 0x1b, 0, |
| 15765 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 15766 | bits = present ? HDA_AMP_MUTE : 0; |
| 15767 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 15768 | HDA_AMP_MUTE, bits); |
| 15769 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 15770 | HDA_AMP_MUTE, bits); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15771 | } |
| 15772 | |
| 15773 | static void alc662_lenovo_101e_unsol_event(struct hda_codec *codec, |
| 15774 | unsigned int res) |
| 15775 | { |
| 15776 | if ((res >> 26) == ALC880_HP_EVENT) |
| 15777 | alc662_lenovo_101e_all_automute(codec); |
| 15778 | if ((res >> 26) == ALC880_FRONT_EVENT) |
| 15779 | alc662_lenovo_101e_ispeaker_automute(codec); |
| 15780 | } |
| 15781 | |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 15782 | static void alc662_eeepc_mic_automute(struct hda_codec *codec) |
| 15783 | { |
| 15784 | unsigned int present; |
| 15785 | |
| 15786 | present = snd_hda_codec_read(codec, 0x18, 0, |
| 15787 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 15788 | snd_hda_codec_write(codec, 0x22, 0, AC_VERB_SET_AMP_GAIN_MUTE, |
| 15789 | 0x7000 | (0x00 << 8) | (present ? 0 : 0x80)); |
| 15790 | snd_hda_codec_write(codec, 0x23, 0, AC_VERB_SET_AMP_GAIN_MUTE, |
| 15791 | 0x7000 | (0x00 << 8) | (present ? 0 : 0x80)); |
| 15792 | snd_hda_codec_write(codec, 0x22, 0, AC_VERB_SET_AMP_GAIN_MUTE, |
| 15793 | 0x7000 | (0x01 << 8) | (present ? 0x80 : 0)); |
| 15794 | snd_hda_codec_write(codec, 0x23, 0, AC_VERB_SET_AMP_GAIN_MUTE, |
| 15795 | 0x7000 | (0x01 << 8) | (present ? 0x80 : 0)); |
| 15796 | } |
| 15797 | |
| 15798 | /* unsolicited event for HP jack sensing */ |
| 15799 | static void alc662_eeepc_unsol_event(struct hda_codec *codec, |
| 15800 | unsigned int res) |
| 15801 | { |
| 15802 | if ((res >> 26) == ALC880_HP_EVENT) |
| 15803 | alc262_hippo1_automute( codec ); |
| 15804 | |
| 15805 | if ((res >> 26) == ALC880_MIC_EVENT) |
| 15806 | alc662_eeepc_mic_automute(codec); |
| 15807 | } |
| 15808 | |
| 15809 | static void alc662_eeepc_inithook(struct hda_codec *codec) |
| 15810 | { |
| 15811 | alc262_hippo1_automute( codec ); |
| 15812 | alc662_eeepc_mic_automute(codec); |
| 15813 | } |
| 15814 | |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 15815 | static void alc662_eeepc_ep20_automute(struct hda_codec *codec) |
| 15816 | { |
| 15817 | unsigned int mute; |
| 15818 | unsigned int present; |
| 15819 | |
| 15820 | snd_hda_codec_read(codec, 0x14, 0, AC_VERB_SET_PIN_SENSE, 0); |
| 15821 | present = snd_hda_codec_read(codec, 0x14, 0, |
| 15822 | AC_VERB_GET_PIN_SENSE, 0); |
| 15823 | present = (present & 0x80000000) != 0; |
| 15824 | if (present) { |
| 15825 | /* mute internal speaker */ |
| 15826 | snd_hda_codec_amp_stereo(codec, 0x1b, HDA_OUTPUT, 0, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 15827 | HDA_AMP_MUTE, HDA_AMP_MUTE); |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 15828 | } else { |
| 15829 | /* unmute internal speaker if necessary */ |
| 15830 | mute = snd_hda_codec_amp_read(codec, 0x14, 0, HDA_OUTPUT, 0); |
| 15831 | snd_hda_codec_amp_stereo(codec, 0x1b, HDA_OUTPUT, 0, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 15832 | HDA_AMP_MUTE, mute); |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 15833 | } |
| 15834 | } |
| 15835 | |
| 15836 | /* unsolicited event for HP jack sensing */ |
| 15837 | static void alc662_eeepc_ep20_unsol_event(struct hda_codec *codec, |
| 15838 | unsigned int res) |
| 15839 | { |
| 15840 | if ((res >> 26) == ALC880_HP_EVENT) |
| 15841 | alc662_eeepc_ep20_automute(codec); |
| 15842 | } |
| 15843 | |
| 15844 | static void alc662_eeepc_ep20_inithook(struct hda_codec *codec) |
| 15845 | { |
| 15846 | alc662_eeepc_ep20_automute(codec); |
| 15847 | } |
| 15848 | |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 15849 | static void alc663_m51va_speaker_automute(struct hda_codec *codec) |
| 15850 | { |
| 15851 | unsigned int present; |
| 15852 | unsigned char bits; |
| 15853 | |
| 15854 | present = snd_hda_codec_read(codec, 0x21, 0, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 15855 | AC_VERB_GET_PIN_SENSE, 0) |
| 15856 | & AC_PINSENSE_PRESENCE; |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 15857 | bits = present ? HDA_AMP_MUTE : 0; |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 15858 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0, |
| 15859 | AMP_IN_MUTE(0), bits); |
| 15860 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1, |
| 15861 | AMP_IN_MUTE(0), bits); |
| 15862 | } |
| 15863 | |
| 15864 | static void alc663_21jd_two_speaker_automute(struct hda_codec *codec) |
| 15865 | { |
| 15866 | unsigned int present; |
| 15867 | unsigned char bits; |
| 15868 | |
| 15869 | present = snd_hda_codec_read(codec, 0x21, 0, |
| 15870 | AC_VERB_GET_PIN_SENSE, 0) |
| 15871 | & AC_PINSENSE_PRESENCE; |
| 15872 | bits = present ? HDA_AMP_MUTE : 0; |
| 15873 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0, |
| 15874 | AMP_IN_MUTE(0), bits); |
| 15875 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1, |
| 15876 | AMP_IN_MUTE(0), bits); |
| 15877 | snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 0, |
| 15878 | AMP_IN_MUTE(0), bits); |
| 15879 | snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 1, |
| 15880 | AMP_IN_MUTE(0), bits); |
| 15881 | } |
| 15882 | |
| 15883 | static void alc663_15jd_two_speaker_automute(struct hda_codec *codec) |
| 15884 | { |
| 15885 | unsigned int present; |
| 15886 | unsigned char bits; |
| 15887 | |
| 15888 | present = snd_hda_codec_read(codec, 0x15, 0, |
| 15889 | AC_VERB_GET_PIN_SENSE, 0) |
| 15890 | & AC_PINSENSE_PRESENCE; |
| 15891 | bits = present ? HDA_AMP_MUTE : 0; |
| 15892 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0, |
| 15893 | AMP_IN_MUTE(0), bits); |
| 15894 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1, |
| 15895 | AMP_IN_MUTE(0), bits); |
| 15896 | snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 0, |
| 15897 | AMP_IN_MUTE(0), bits); |
| 15898 | snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 1, |
| 15899 | AMP_IN_MUTE(0), bits); |
| 15900 | } |
| 15901 | |
| 15902 | static void alc662_f5z_speaker_automute(struct hda_codec *codec) |
| 15903 | { |
| 15904 | unsigned int present; |
| 15905 | unsigned char bits; |
| 15906 | |
| 15907 | present = snd_hda_codec_read(codec, 0x1b, 0, |
| 15908 | AC_VERB_GET_PIN_SENSE, 0) |
| 15909 | & AC_PINSENSE_PRESENCE; |
| 15910 | bits = present ? 0 : PIN_OUT; |
| 15911 | snd_hda_codec_write(codec, 0x14, 0, |
| 15912 | AC_VERB_SET_PIN_WIDGET_CONTROL, bits); |
| 15913 | } |
| 15914 | |
| 15915 | static void alc663_two_hp_m1_speaker_automute(struct hda_codec *codec) |
| 15916 | { |
| 15917 | unsigned int present1, present2; |
| 15918 | |
| 15919 | present1 = snd_hda_codec_read(codec, 0x21, 0, |
| 15920 | AC_VERB_GET_PIN_SENSE, 0) |
| 15921 | & AC_PINSENSE_PRESENCE; |
| 15922 | present2 = snd_hda_codec_read(codec, 0x15, 0, |
| 15923 | AC_VERB_GET_PIN_SENSE, 0) |
| 15924 | & AC_PINSENSE_PRESENCE; |
| 15925 | |
| 15926 | if (present1 || present2) { |
| 15927 | snd_hda_codec_write_cache(codec, 0x14, 0, |
| 15928 | AC_VERB_SET_PIN_WIDGET_CONTROL, 0); |
| 15929 | } else { |
| 15930 | snd_hda_codec_write_cache(codec, 0x14, 0, |
| 15931 | AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT); |
| 15932 | } |
| 15933 | } |
| 15934 | |
| 15935 | static void alc663_two_hp_m2_speaker_automute(struct hda_codec *codec) |
| 15936 | { |
| 15937 | unsigned int present1, present2; |
| 15938 | |
| 15939 | present1 = snd_hda_codec_read(codec, 0x1b, 0, |
| 15940 | AC_VERB_GET_PIN_SENSE, 0) |
| 15941 | & AC_PINSENSE_PRESENCE; |
| 15942 | present2 = snd_hda_codec_read(codec, 0x15, 0, |
| 15943 | AC_VERB_GET_PIN_SENSE, 0) |
| 15944 | & AC_PINSENSE_PRESENCE; |
| 15945 | |
| 15946 | if (present1 || present2) { |
| 15947 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0, |
| 15948 | AMP_IN_MUTE(0), AMP_IN_MUTE(0)); |
| 15949 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1, |
| 15950 | AMP_IN_MUTE(0), AMP_IN_MUTE(0)); |
| 15951 | } else { |
| 15952 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0, |
| 15953 | AMP_IN_MUTE(0), 0); |
| 15954 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1, |
| 15955 | AMP_IN_MUTE(0), 0); |
| 15956 | } |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 15957 | } |
| 15958 | |
| 15959 | static void alc663_m51va_mic_automute(struct hda_codec *codec) |
| 15960 | { |
| 15961 | unsigned int present; |
| 15962 | |
| 15963 | present = snd_hda_codec_read(codec, 0x18, 0, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 15964 | AC_VERB_GET_PIN_SENSE, 0) |
| 15965 | & AC_PINSENSE_PRESENCE; |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 15966 | 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] | 15967 | 0x7000 | (0x00 << 8) | (present ? 0 : 0x80)); |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 15968 | 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] | 15969 | 0x7000 | (0x00 << 8) | (present ? 0 : 0x80)); |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 15970 | 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] | 15971 | 0x7000 | (0x09 << 8) | (present ? 0x80 : 0)); |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 15972 | 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] | 15973 | 0x7000 | (0x09 << 8) | (present ? 0x80 : 0)); |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 15974 | } |
| 15975 | |
| 15976 | static void alc663_m51va_unsol_event(struct hda_codec *codec, |
| 15977 | unsigned int res) |
| 15978 | { |
| 15979 | switch (res >> 26) { |
| 15980 | case ALC880_HP_EVENT: |
| 15981 | alc663_m51va_speaker_automute(codec); |
| 15982 | break; |
| 15983 | case ALC880_MIC_EVENT: |
| 15984 | alc663_m51va_mic_automute(codec); |
| 15985 | break; |
| 15986 | } |
| 15987 | } |
| 15988 | |
| 15989 | static void alc663_m51va_inithook(struct hda_codec *codec) |
| 15990 | { |
| 15991 | alc663_m51va_speaker_automute(codec); |
| 15992 | alc663_m51va_mic_automute(codec); |
| 15993 | } |
| 15994 | |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 15995 | /* ***************** Mode1 ******************************/ |
| 15996 | static void alc663_mode1_unsol_event(struct hda_codec *codec, |
| 15997 | unsigned int res) |
| 15998 | { |
| 15999 | switch (res >> 26) { |
| 16000 | case ALC880_HP_EVENT: |
| 16001 | alc663_m51va_speaker_automute(codec); |
| 16002 | break; |
| 16003 | case ALC880_MIC_EVENT: |
| 16004 | alc662_eeepc_mic_automute(codec); |
| 16005 | break; |
| 16006 | } |
| 16007 | } |
| 16008 | |
| 16009 | static void alc663_mode1_inithook(struct hda_codec *codec) |
| 16010 | { |
| 16011 | alc663_m51va_speaker_automute(codec); |
| 16012 | alc662_eeepc_mic_automute(codec); |
| 16013 | } |
| 16014 | /* ***************** Mode2 ******************************/ |
| 16015 | static void alc662_mode2_unsol_event(struct hda_codec *codec, |
| 16016 | unsigned int res) |
| 16017 | { |
| 16018 | switch (res >> 26) { |
| 16019 | case ALC880_HP_EVENT: |
| 16020 | alc662_f5z_speaker_automute(codec); |
| 16021 | break; |
| 16022 | case ALC880_MIC_EVENT: |
| 16023 | alc662_eeepc_mic_automute(codec); |
| 16024 | break; |
| 16025 | } |
| 16026 | } |
| 16027 | |
| 16028 | static void alc662_mode2_inithook(struct hda_codec *codec) |
| 16029 | { |
| 16030 | alc662_f5z_speaker_automute(codec); |
| 16031 | alc662_eeepc_mic_automute(codec); |
| 16032 | } |
| 16033 | /* ***************** Mode3 ******************************/ |
| 16034 | static void alc663_mode3_unsol_event(struct hda_codec *codec, |
| 16035 | unsigned int res) |
| 16036 | { |
| 16037 | switch (res >> 26) { |
| 16038 | case ALC880_HP_EVENT: |
| 16039 | alc663_two_hp_m1_speaker_automute(codec); |
| 16040 | break; |
| 16041 | case ALC880_MIC_EVENT: |
| 16042 | alc662_eeepc_mic_automute(codec); |
| 16043 | break; |
| 16044 | } |
| 16045 | } |
| 16046 | |
| 16047 | static void alc663_mode3_inithook(struct hda_codec *codec) |
| 16048 | { |
| 16049 | alc663_two_hp_m1_speaker_automute(codec); |
| 16050 | alc662_eeepc_mic_automute(codec); |
| 16051 | } |
| 16052 | /* ***************** Mode4 ******************************/ |
| 16053 | static void alc663_mode4_unsol_event(struct hda_codec *codec, |
| 16054 | unsigned int res) |
| 16055 | { |
| 16056 | switch (res >> 26) { |
| 16057 | case ALC880_HP_EVENT: |
| 16058 | alc663_21jd_two_speaker_automute(codec); |
| 16059 | break; |
| 16060 | case ALC880_MIC_EVENT: |
| 16061 | alc662_eeepc_mic_automute(codec); |
| 16062 | break; |
| 16063 | } |
| 16064 | } |
| 16065 | |
| 16066 | static void alc663_mode4_inithook(struct hda_codec *codec) |
| 16067 | { |
| 16068 | alc663_21jd_two_speaker_automute(codec); |
| 16069 | alc662_eeepc_mic_automute(codec); |
| 16070 | } |
| 16071 | /* ***************** Mode5 ******************************/ |
| 16072 | static void alc663_mode5_unsol_event(struct hda_codec *codec, |
| 16073 | unsigned int res) |
| 16074 | { |
| 16075 | switch (res >> 26) { |
| 16076 | case ALC880_HP_EVENT: |
| 16077 | alc663_15jd_two_speaker_automute(codec); |
| 16078 | break; |
| 16079 | case ALC880_MIC_EVENT: |
| 16080 | alc662_eeepc_mic_automute(codec); |
| 16081 | break; |
| 16082 | } |
| 16083 | } |
| 16084 | |
| 16085 | static void alc663_mode5_inithook(struct hda_codec *codec) |
| 16086 | { |
| 16087 | alc663_15jd_two_speaker_automute(codec); |
| 16088 | alc662_eeepc_mic_automute(codec); |
| 16089 | } |
| 16090 | /* ***************** Mode6 ******************************/ |
| 16091 | static void alc663_mode6_unsol_event(struct hda_codec *codec, |
| 16092 | unsigned int res) |
| 16093 | { |
| 16094 | switch (res >> 26) { |
| 16095 | case ALC880_HP_EVENT: |
| 16096 | alc663_two_hp_m2_speaker_automute(codec); |
| 16097 | break; |
| 16098 | case ALC880_MIC_EVENT: |
| 16099 | alc662_eeepc_mic_automute(codec); |
| 16100 | break; |
| 16101 | } |
| 16102 | } |
| 16103 | |
| 16104 | static void alc663_mode6_inithook(struct hda_codec *codec) |
| 16105 | { |
| 16106 | alc663_two_hp_m2_speaker_automute(codec); |
| 16107 | alc662_eeepc_mic_automute(codec); |
| 16108 | } |
| 16109 | |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 16110 | static void alc663_g71v_hp_automute(struct hda_codec *codec) |
| 16111 | { |
| 16112 | unsigned int present; |
| 16113 | unsigned char bits; |
| 16114 | |
| 16115 | present = snd_hda_codec_read(codec, 0x21, 0, |
| 16116 | AC_VERB_GET_PIN_SENSE, 0) |
| 16117 | & AC_PINSENSE_PRESENCE; |
| 16118 | bits = present ? HDA_AMP_MUTE : 0; |
| 16119 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 16120 | HDA_AMP_MUTE, bits); |
| 16121 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 16122 | HDA_AMP_MUTE, bits); |
| 16123 | } |
| 16124 | |
| 16125 | static void alc663_g71v_front_automute(struct hda_codec *codec) |
| 16126 | { |
| 16127 | unsigned int present; |
| 16128 | unsigned char bits; |
| 16129 | |
| 16130 | present = snd_hda_codec_read(codec, 0x15, 0, |
| 16131 | AC_VERB_GET_PIN_SENSE, 0) |
| 16132 | & AC_PINSENSE_PRESENCE; |
| 16133 | bits = present ? HDA_AMP_MUTE : 0; |
| 16134 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 16135 | HDA_AMP_MUTE, bits); |
| 16136 | } |
| 16137 | |
| 16138 | static void alc663_g71v_unsol_event(struct hda_codec *codec, |
| 16139 | unsigned int res) |
| 16140 | { |
| 16141 | switch (res >> 26) { |
| 16142 | case ALC880_HP_EVENT: |
| 16143 | alc663_g71v_hp_automute(codec); |
| 16144 | break; |
| 16145 | case ALC880_FRONT_EVENT: |
| 16146 | alc663_g71v_front_automute(codec); |
| 16147 | break; |
| 16148 | case ALC880_MIC_EVENT: |
| 16149 | alc662_eeepc_mic_automute(codec); |
| 16150 | break; |
| 16151 | } |
| 16152 | } |
| 16153 | |
| 16154 | static void alc663_g71v_inithook(struct hda_codec *codec) |
| 16155 | { |
| 16156 | alc663_g71v_front_automute(codec); |
| 16157 | alc663_g71v_hp_automute(codec); |
| 16158 | alc662_eeepc_mic_automute(codec); |
| 16159 | } |
| 16160 | |
| 16161 | static void alc663_g50v_unsol_event(struct hda_codec *codec, |
| 16162 | unsigned int res) |
| 16163 | { |
| 16164 | switch (res >> 26) { |
| 16165 | case ALC880_HP_EVENT: |
| 16166 | alc663_m51va_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_g50v_inithook(struct hda_codec *codec) |
| 16175 | { |
| 16176 | alc663_m51va_speaker_automute(codec); |
| 16177 | alc662_eeepc_mic_automute(codec); |
| 16178 | } |
| 16179 | |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 16180 | /* bind hp and internal speaker mute (with plug check) */ |
| 16181 | static int alc662_ecs_master_sw_put(struct snd_kcontrol *kcontrol, |
| 16182 | struct snd_ctl_elem_value *ucontrol) |
| 16183 | { |
| 16184 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 16185 | long *valp = ucontrol->value.integer.value; |
| 16186 | int change; |
| 16187 | |
| 16188 | change = snd_hda_codec_amp_update(codec, 0x1b, 0, HDA_OUTPUT, 0, |
| 16189 | HDA_AMP_MUTE, |
| 16190 | valp[0] ? 0 : HDA_AMP_MUTE); |
| 16191 | change |= snd_hda_codec_amp_update(codec, 0x1b, 1, HDA_OUTPUT, 0, |
| 16192 | HDA_AMP_MUTE, |
| 16193 | valp[1] ? 0 : HDA_AMP_MUTE); |
| 16194 | if (change) |
| 16195 | alc262_hippo1_automute(codec); |
| 16196 | return change; |
| 16197 | } |
| 16198 | |
| 16199 | static struct snd_kcontrol_new alc662_ecs_mixer[] = { |
| 16200 | HDA_CODEC_VOLUME("Master Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 16201 | { |
| 16202 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 16203 | .name = "Master Playback Switch", |
| 16204 | .info = snd_hda_mixer_amp_switch_info, |
| 16205 | .get = snd_hda_mixer_amp_switch_get, |
| 16206 | .put = alc662_ecs_master_sw_put, |
| 16207 | .private_value = HDA_COMPOSE_AMP_VAL(0x1b, 3, 0, HDA_OUTPUT), |
| 16208 | }, |
| 16209 | |
| 16210 | HDA_CODEC_VOLUME("e-Mic/LineIn Boost", 0x18, 0, HDA_INPUT), |
| 16211 | HDA_CODEC_VOLUME("e-Mic/LineIn Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 16212 | HDA_CODEC_MUTE("e-Mic/LineIn Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 16213 | |
| 16214 | HDA_CODEC_VOLUME("i-Mic Boost", 0x19, 0, HDA_INPUT), |
| 16215 | HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 16216 | HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 16217 | { } /* end */ |
| 16218 | }; |
| 16219 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 16220 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 16221 | #define alc662_loopbacks alc880_loopbacks |
| 16222 | #endif |
| 16223 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16224 | |
| 16225 | /* pcm configuration: identiacal with ALC880 */ |
| 16226 | #define alc662_pcm_analog_playback alc880_pcm_analog_playback |
| 16227 | #define alc662_pcm_analog_capture alc880_pcm_analog_capture |
| 16228 | #define alc662_pcm_digital_playback alc880_pcm_digital_playback |
| 16229 | #define alc662_pcm_digital_capture alc880_pcm_digital_capture |
| 16230 | |
| 16231 | /* |
| 16232 | * configuration and preset |
| 16233 | */ |
| 16234 | static const char *alc662_models[ALC662_MODEL_LAST] = { |
| 16235 | [ALC662_3ST_2ch_DIG] = "3stack-dig", |
| 16236 | [ALC662_3ST_6ch_DIG] = "3stack-6ch-dig", |
| 16237 | [ALC662_3ST_6ch] = "3stack-6ch", |
| 16238 | [ALC662_5ST_DIG] = "6stack-dig", |
| 16239 | [ALC662_LENOVO_101E] = "lenovo-101e", |
Takashi Iwai | b995d76 | 2007-10-17 10:41:06 +0200 | [diff] [blame] | 16240 | [ALC662_ASUS_EEEPC_P701] = "eeepc-p701", |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 16241 | [ALC662_ASUS_EEEPC_EP20] = "eeepc-ep20", |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 16242 | [ALC662_ECS] = "ecs", |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 16243 | [ALC663_ASUS_M51VA] = "m51va", |
| 16244 | [ALC663_ASUS_G71V] = "g71v", |
| 16245 | [ALC663_ASUS_H13] = "h13", |
| 16246 | [ALC663_ASUS_G50V] = "g50v", |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 16247 | [ALC663_ASUS_MODE1] = "asus-mode1", |
| 16248 | [ALC662_ASUS_MODE2] = "asus-mode2", |
| 16249 | [ALC663_ASUS_MODE3] = "asus-mode3", |
| 16250 | [ALC663_ASUS_MODE4] = "asus-mode4", |
| 16251 | [ALC663_ASUS_MODE5] = "asus-mode5", |
| 16252 | [ALC663_ASUS_MODE6] = "asus-mode6", |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16253 | [ALC662_AUTO] = "auto", |
| 16254 | }; |
| 16255 | |
| 16256 | static struct snd_pci_quirk alc662_cfg_tbl[] = { |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 16257 | SND_PCI_QUIRK(0x1019, 0x9087, "ECS", ALC662_ECS), |
| 16258 | SND_PCI_QUIRK(0x1043, 0x1000, "ASUS N50Vm", ALC663_ASUS_MODE1), |
| 16259 | SND_PCI_QUIRK(0x1043, 0x1092, "ASUS NB", ALC663_ASUS_MODE3), |
| 16260 | SND_PCI_QUIRK(0x1043, 0x11c3, "ASUS M70V", ALC663_ASUS_MODE3), |
| 16261 | SND_PCI_QUIRK(0x1043, 0x11d3, "ASUS NB", ALC663_ASUS_MODE1), |
| 16262 | SND_PCI_QUIRK(0x1043, 0x11f3, "ASUS NB", ALC662_ASUS_MODE2), |
| 16263 | SND_PCI_QUIRK(0x1043, 0x1203, "ASUS NB", ALC663_ASUS_MODE1), |
| 16264 | SND_PCI_QUIRK(0x1043, 0x1339, "ASUS NB", ALC662_ASUS_MODE2), |
| 16265 | SND_PCI_QUIRK(0x1043, 0x16c3, "ASUS NB", ALC662_ASUS_MODE2), |
| 16266 | SND_PCI_QUIRK(0x1043, 0x1753, "ASUS NB", ALC662_ASUS_MODE2), |
| 16267 | SND_PCI_QUIRK(0x1043, 0x1763, "ASUS NB", ALC663_ASUS_MODE6), |
| 16268 | SND_PCI_QUIRK(0x1043, 0x1765, "ASUS NB", ALC663_ASUS_MODE6), |
| 16269 | SND_PCI_QUIRK(0x1043, 0x1783, "ASUS NB", ALC662_ASUS_MODE2), |
| 16270 | SND_PCI_QUIRK(0x1043, 0x1813, "ASUS NB", ALC662_ASUS_MODE2), |
| 16271 | SND_PCI_QUIRK(0x1043, 0x1823, "ASUS NB", ALC663_ASUS_MODE5), |
| 16272 | SND_PCI_QUIRK(0x1043, 0x1833, "ASUS NB", ALC663_ASUS_MODE6), |
| 16273 | SND_PCI_QUIRK(0x1043, 0x1843, "ASUS NB", ALC662_ASUS_MODE2), |
| 16274 | SND_PCI_QUIRK(0x1043, 0x1864, "ASUS NB", ALC662_ASUS_MODE2), |
| 16275 | SND_PCI_QUIRK(0x1043, 0x1876, "ASUS NB", ALC662_ASUS_MODE2), |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 16276 | SND_PCI_QUIRK(0x1043, 0x1878, "ASUS M51VA", ALC663_ASUS_M51VA), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 16277 | /*SND_PCI_QUIRK(0x1043, 0x1878, "ASUS M50Vr", ALC663_ASUS_MODE1),*/ |
| 16278 | SND_PCI_QUIRK(0x1043, 0x1893, "ASUS M50Vm", ALC663_ASUS_MODE3), |
| 16279 | SND_PCI_QUIRK(0x1043, 0x1894, "ASUS X55", ALC663_ASUS_MODE3), |
| 16280 | SND_PCI_QUIRK(0x1043, 0x1903, "ASUS F5GL", ALC663_ASUS_MODE1), |
| 16281 | SND_PCI_QUIRK(0x1043, 0x1913, "ASUS NB", ALC662_ASUS_MODE2), |
| 16282 | SND_PCI_QUIRK(0x1043, 0x1933, "ASUS F80Q", ALC662_ASUS_MODE2), |
| 16283 | SND_PCI_QUIRK(0x1043, 0x1953, "ASUS NB", ALC663_ASUS_MODE1), |
| 16284 | SND_PCI_QUIRK(0x1043, 0x1963, "ASUS X71C", ALC663_ASUS_MODE3), |
| 16285 | SND_PCI_QUIRK(0x1043, 0x1993, "ASUS N20", ALC663_ASUS_MODE1), |
Kailang Yang | 80ffe86 | 2008-10-15 11:23:27 +0200 | [diff] [blame] | 16286 | SND_PCI_QUIRK(0x1043, 0x19a3, "ASUS G50V", ALC663_ASUS_G50V), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 16287 | /*SND_PCI_QUIRK(0x1043, 0x19a3, "ASUS NB", ALC663_ASUS_MODE1),*/ |
| 16288 | SND_PCI_QUIRK(0x1043, 0x19b3, "ASUS F7Z", ALC663_ASUS_MODE1), |
| 16289 | SND_PCI_QUIRK(0x1043, 0x19c3, "ASUS F5Z/F6x", ALC662_ASUS_MODE2), |
| 16290 | SND_PCI_QUIRK(0x1043, 0x19e3, "ASUS NB", ALC663_ASUS_MODE1), |
| 16291 | SND_PCI_QUIRK(0x1043, 0x19f3, "ASUS NB", ALC663_ASUS_MODE4), |
Herton Ronaldo Krzesinski | 3da23ca | 2008-03-14 12:52:59 +0100 | [diff] [blame] | 16292 | SND_PCI_QUIRK(0x1043, 0x8290, "ASUS P5GC-MX", ALC662_3ST_6ch_DIG), |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 16293 | SND_PCI_QUIRK(0x1043, 0x82a1, "ASUS Eeepc", ALC662_ASUS_EEEPC_P701), |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 16294 | SND_PCI_QUIRK(0x1043, 0x82d1, "ASUS Eeepc EP20", ALC662_ASUS_EEEPC_EP20), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 16295 | SND_PCI_QUIRK(0x105b, 0x0cd6, "Foxconn", ALC662_ECS), |
Herton Ronaldo Krzesinski | 95fe5f2 | 2008-09-26 23:48:45 -0300 | [diff] [blame] | 16296 | SND_PCI_QUIRK(0x105b, 0x0d47, "Foxconn 45CMX/45GMX/45CMX-K", |
| 16297 | ALC662_3ST_6ch_DIG), |
Herton Ronaldo Krzesinski | cb55974 | 2008-09-26 23:47:45 -0300 | [diff] [blame] | 16298 | SND_PCI_QUIRK(0x1458, 0xa002, "Gigabyte 945GCM-S2L", |
| 16299 | ALC662_3ST_6ch_DIG), |
Vedran Miletic | 19c009a | 2008-09-29 20:29:25 +0200 | [diff] [blame] | 16300 | SND_PCI_QUIRK(0x1565, 0x820f, "Biostar TA780G M2+", ALC662_3ST_6ch_DIG), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 16301 | SND_PCI_QUIRK(0x17aa, 0x101e, "Lenovo", ALC662_LENOVO_101E), |
Takashi Iwai | 238713d | 2008-10-05 10:57:39 +0200 | [diff] [blame] | 16302 | SND_PCI_QUIRK(0x1849, 0x3662, "ASROCK K10N78FullHD-hSLI R3.0", |
Vedran Miletic | 19c009a | 2008-09-29 20:29:25 +0200 | [diff] [blame] | 16303 | ALC662_3ST_6ch_DIG), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 16304 | SND_PCI_QUIRK_MASK(0x1854, 0xf000, 0x2000, "ASUS H13-200x", |
| 16305 | ALC663_ASUS_H13), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16306 | {} |
| 16307 | }; |
| 16308 | |
| 16309 | static struct alc_config_preset alc662_presets[] = { |
| 16310 | [ALC662_3ST_2ch_DIG] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 16311 | .mixers = { alc662_3ST_2ch_mixer }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16312 | .init_verbs = { alc662_init_verbs }, |
| 16313 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 16314 | .dac_nids = alc662_dac_nids, |
| 16315 | .dig_out_nid = ALC662_DIGOUT_NID, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16316 | .dig_in_nid = ALC662_DIGIN_NID, |
| 16317 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 16318 | .channel_mode = alc662_3ST_2ch_modes, |
| 16319 | .input_mux = &alc662_capture_source, |
| 16320 | }, |
| 16321 | [ALC662_3ST_6ch_DIG] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 16322 | .mixers = { alc662_3ST_6ch_mixer, alc662_chmode_mixer }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16323 | .init_verbs = { alc662_init_verbs }, |
| 16324 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 16325 | .dac_nids = alc662_dac_nids, |
| 16326 | .dig_out_nid = ALC662_DIGOUT_NID, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16327 | .dig_in_nid = ALC662_DIGIN_NID, |
| 16328 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes), |
| 16329 | .channel_mode = alc662_3ST_6ch_modes, |
| 16330 | .need_dac_fix = 1, |
| 16331 | .input_mux = &alc662_capture_source, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 16332 | }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16333 | [ALC662_3ST_6ch] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 16334 | .mixers = { alc662_3ST_6ch_mixer, alc662_chmode_mixer }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16335 | .init_verbs = { alc662_init_verbs }, |
| 16336 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 16337 | .dac_nids = alc662_dac_nids, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16338 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes), |
| 16339 | .channel_mode = alc662_3ST_6ch_modes, |
| 16340 | .need_dac_fix = 1, |
| 16341 | .input_mux = &alc662_capture_source, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 16342 | }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16343 | [ALC662_5ST_DIG] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 16344 | .mixers = { alc662_base_mixer, alc662_chmode_mixer }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16345 | .init_verbs = { alc662_init_verbs }, |
| 16346 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 16347 | .dac_nids = alc662_dac_nids, |
| 16348 | .dig_out_nid = ALC662_DIGOUT_NID, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16349 | .dig_in_nid = ALC662_DIGIN_NID, |
| 16350 | .num_channel_mode = ARRAY_SIZE(alc662_5stack_modes), |
| 16351 | .channel_mode = alc662_5stack_modes, |
| 16352 | .input_mux = &alc662_capture_source, |
| 16353 | }, |
| 16354 | [ALC662_LENOVO_101E] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 16355 | .mixers = { alc662_lenovo_101e_mixer }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16356 | .init_verbs = { alc662_init_verbs, alc662_sue_init_verbs }, |
| 16357 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 16358 | .dac_nids = alc662_dac_nids, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16359 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 16360 | .channel_mode = alc662_3ST_2ch_modes, |
| 16361 | .input_mux = &alc662_lenovo_101e_capture_source, |
| 16362 | .unsol_event = alc662_lenovo_101e_unsol_event, |
| 16363 | .init_hook = alc662_lenovo_101e_all_automute, |
| 16364 | }, |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 16365 | [ALC662_ASUS_EEEPC_P701] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 16366 | .mixers = { alc662_eeepc_p701_mixer }, |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 16367 | .init_verbs = { alc662_init_verbs, |
| 16368 | alc662_eeepc_sue_init_verbs }, |
| 16369 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 16370 | .dac_nids = alc662_dac_nids, |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 16371 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 16372 | .channel_mode = alc662_3ST_2ch_modes, |
| 16373 | .input_mux = &alc662_eeepc_capture_source, |
| 16374 | .unsol_event = alc662_eeepc_unsol_event, |
| 16375 | .init_hook = alc662_eeepc_inithook, |
| 16376 | }, |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 16377 | [ALC662_ASUS_EEEPC_EP20] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 16378 | .mixers = { alc662_eeepc_ep20_mixer, |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 16379 | alc662_chmode_mixer }, |
| 16380 | .init_verbs = { alc662_init_verbs, |
| 16381 | alc662_eeepc_ep20_sue_init_verbs }, |
| 16382 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 16383 | .dac_nids = alc662_dac_nids, |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 16384 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes), |
| 16385 | .channel_mode = alc662_3ST_6ch_modes, |
| 16386 | .input_mux = &alc662_lenovo_101e_capture_source, |
| 16387 | .unsol_event = alc662_eeepc_ep20_unsol_event, |
| 16388 | .init_hook = alc662_eeepc_ep20_inithook, |
| 16389 | }, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 16390 | [ALC662_ECS] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 16391 | .mixers = { alc662_ecs_mixer }, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 16392 | .init_verbs = { alc662_init_verbs, |
| 16393 | alc662_ecs_init_verbs }, |
| 16394 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 16395 | .dac_nids = alc662_dac_nids, |
| 16396 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 16397 | .channel_mode = alc662_3ST_2ch_modes, |
| 16398 | .input_mux = &alc662_eeepc_capture_source, |
| 16399 | .unsol_event = alc662_eeepc_unsol_event, |
| 16400 | .init_hook = alc662_eeepc_inithook, |
| 16401 | }, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 16402 | [ALC663_ASUS_M51VA] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 16403 | .mixers = { alc663_m51va_mixer }, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 16404 | .init_verbs = { alc662_init_verbs, alc663_m51va_init_verbs }, |
| 16405 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 16406 | .dac_nids = alc662_dac_nids, |
| 16407 | .dig_out_nid = ALC662_DIGOUT_NID, |
| 16408 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 16409 | .channel_mode = alc662_3ST_2ch_modes, |
| 16410 | .input_mux = &alc663_m51va_capture_source, |
| 16411 | .unsol_event = alc663_m51va_unsol_event, |
| 16412 | .init_hook = alc663_m51va_inithook, |
| 16413 | }, |
| 16414 | [ALC663_ASUS_G71V] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 16415 | .mixers = { alc663_g71v_mixer }, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 16416 | .init_verbs = { alc662_init_verbs, alc663_g71v_init_verbs }, |
| 16417 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 16418 | .dac_nids = alc662_dac_nids, |
| 16419 | .dig_out_nid = ALC662_DIGOUT_NID, |
| 16420 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 16421 | .channel_mode = alc662_3ST_2ch_modes, |
| 16422 | .input_mux = &alc662_eeepc_capture_source, |
| 16423 | .unsol_event = alc663_g71v_unsol_event, |
| 16424 | .init_hook = alc663_g71v_inithook, |
| 16425 | }, |
| 16426 | [ALC663_ASUS_H13] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 16427 | .mixers = { alc663_m51va_mixer }, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 16428 | .init_verbs = { alc662_init_verbs, alc663_m51va_init_verbs }, |
| 16429 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 16430 | .dac_nids = alc662_dac_nids, |
| 16431 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 16432 | .channel_mode = alc662_3ST_2ch_modes, |
| 16433 | .input_mux = &alc663_m51va_capture_source, |
| 16434 | .unsol_event = alc663_m51va_unsol_event, |
| 16435 | .init_hook = alc663_m51va_inithook, |
| 16436 | }, |
| 16437 | [ALC663_ASUS_G50V] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 16438 | .mixers = { alc663_g50v_mixer }, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 16439 | .init_verbs = { alc662_init_verbs, alc663_g50v_init_verbs }, |
| 16440 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 16441 | .dac_nids = alc662_dac_nids, |
| 16442 | .dig_out_nid = ALC662_DIGOUT_NID, |
| 16443 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes), |
| 16444 | .channel_mode = alc662_3ST_6ch_modes, |
| 16445 | .input_mux = &alc663_capture_source, |
| 16446 | .unsol_event = alc663_g50v_unsol_event, |
| 16447 | .init_hook = alc663_g50v_inithook, |
| 16448 | }, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 16449 | [ALC663_ASUS_MODE1] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 16450 | .mixers = { alc663_m51va_mixer }, |
| 16451 | .cap_mixer = alc662_auto_capture_mixer, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 16452 | .init_verbs = { alc662_init_verbs, |
| 16453 | alc663_21jd_amic_init_verbs }, |
| 16454 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 16455 | .hp_nid = 0x03, |
| 16456 | .dac_nids = alc662_dac_nids, |
| 16457 | .dig_out_nid = ALC662_DIGOUT_NID, |
| 16458 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 16459 | .channel_mode = alc662_3ST_2ch_modes, |
| 16460 | .input_mux = &alc662_eeepc_capture_source, |
| 16461 | .unsol_event = alc663_mode1_unsol_event, |
| 16462 | .init_hook = alc663_mode1_inithook, |
| 16463 | }, |
| 16464 | [ALC662_ASUS_MODE2] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 16465 | .mixers = { alc662_1bjd_mixer }, |
| 16466 | .cap_mixer = alc662_auto_capture_mixer, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 16467 | .init_verbs = { alc662_init_verbs, |
| 16468 | alc662_1bjd_amic_init_verbs }, |
| 16469 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 16470 | .dac_nids = alc662_dac_nids, |
| 16471 | .dig_out_nid = ALC662_DIGOUT_NID, |
| 16472 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 16473 | .channel_mode = alc662_3ST_2ch_modes, |
| 16474 | .input_mux = &alc662_eeepc_capture_source, |
| 16475 | .unsol_event = alc662_mode2_unsol_event, |
| 16476 | .init_hook = alc662_mode2_inithook, |
| 16477 | }, |
| 16478 | [ALC663_ASUS_MODE3] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 16479 | .mixers = { alc663_two_hp_m1_mixer }, |
| 16480 | .cap_mixer = alc662_auto_capture_mixer, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 16481 | .init_verbs = { alc662_init_verbs, |
| 16482 | alc663_two_hp_amic_m1_init_verbs }, |
| 16483 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 16484 | .hp_nid = 0x03, |
| 16485 | .dac_nids = alc662_dac_nids, |
| 16486 | .dig_out_nid = ALC662_DIGOUT_NID, |
| 16487 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 16488 | .channel_mode = alc662_3ST_2ch_modes, |
| 16489 | .input_mux = &alc662_eeepc_capture_source, |
| 16490 | .unsol_event = alc663_mode3_unsol_event, |
| 16491 | .init_hook = alc663_mode3_inithook, |
| 16492 | }, |
| 16493 | [ALC663_ASUS_MODE4] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 16494 | .mixers = { alc663_asus_21jd_clfe_mixer }, |
| 16495 | .cap_mixer = alc662_auto_capture_mixer, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 16496 | .init_verbs = { alc662_init_verbs, |
| 16497 | alc663_21jd_amic_init_verbs}, |
| 16498 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 16499 | .hp_nid = 0x03, |
| 16500 | .dac_nids = alc662_dac_nids, |
| 16501 | .dig_out_nid = ALC662_DIGOUT_NID, |
| 16502 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 16503 | .channel_mode = alc662_3ST_2ch_modes, |
| 16504 | .input_mux = &alc662_eeepc_capture_source, |
| 16505 | .unsol_event = alc663_mode4_unsol_event, |
| 16506 | .init_hook = alc663_mode4_inithook, |
| 16507 | }, |
| 16508 | [ALC663_ASUS_MODE5] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 16509 | .mixers = { alc663_asus_15jd_clfe_mixer }, |
| 16510 | .cap_mixer = alc662_auto_capture_mixer, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 16511 | .init_verbs = { alc662_init_verbs, |
| 16512 | alc663_15jd_amic_init_verbs }, |
| 16513 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 16514 | .hp_nid = 0x03, |
| 16515 | .dac_nids = alc662_dac_nids, |
| 16516 | .dig_out_nid = ALC662_DIGOUT_NID, |
| 16517 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 16518 | .channel_mode = alc662_3ST_2ch_modes, |
| 16519 | .input_mux = &alc662_eeepc_capture_source, |
| 16520 | .unsol_event = alc663_mode5_unsol_event, |
| 16521 | .init_hook = alc663_mode5_inithook, |
| 16522 | }, |
| 16523 | [ALC663_ASUS_MODE6] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 16524 | .mixers = { alc663_two_hp_m2_mixer }, |
| 16525 | .cap_mixer = alc662_auto_capture_mixer, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 16526 | .init_verbs = { alc662_init_verbs, |
| 16527 | alc663_two_hp_amic_m2_init_verbs }, |
| 16528 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 16529 | .hp_nid = 0x03, |
| 16530 | .dac_nids = alc662_dac_nids, |
| 16531 | .dig_out_nid = ALC662_DIGOUT_NID, |
| 16532 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 16533 | .channel_mode = alc662_3ST_2ch_modes, |
| 16534 | .input_mux = &alc662_eeepc_capture_source, |
| 16535 | .unsol_event = alc663_mode6_unsol_event, |
| 16536 | .init_hook = alc663_mode6_inithook, |
| 16537 | }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16538 | }; |
| 16539 | |
| 16540 | |
| 16541 | /* |
| 16542 | * BIOS auto configuration |
| 16543 | */ |
| 16544 | |
| 16545 | /* add playback controls from the parsed DAC table */ |
| 16546 | static int alc662_auto_create_multi_out_ctls(struct alc_spec *spec, |
| 16547 | const struct auto_pin_cfg *cfg) |
| 16548 | { |
| 16549 | char name[32]; |
| 16550 | static const char *chname[4] = { |
| 16551 | "Front", "Surround", NULL /*CLFE*/, "Side" |
| 16552 | }; |
| 16553 | hda_nid_t nid; |
| 16554 | int i, err; |
| 16555 | |
| 16556 | for (i = 0; i < cfg->line_outs; i++) { |
| 16557 | if (!spec->multiout.dac_nids[i]) |
| 16558 | continue; |
Kailang Yang | b60dd39 | 2007-09-20 12:50:29 +0200 | [diff] [blame] | 16559 | nid = alc880_idx_to_dac(i); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16560 | if (i == 2) { |
| 16561 | /* Center/LFE */ |
| 16562 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 16563 | "Center Playback Volume", |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 16564 | HDA_COMPOSE_AMP_VAL(nid, 1, 0, |
| 16565 | HDA_OUTPUT)); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16566 | if (err < 0) |
| 16567 | return err; |
| 16568 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 16569 | "LFE Playback Volume", |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 16570 | HDA_COMPOSE_AMP_VAL(nid, 2, 0, |
| 16571 | HDA_OUTPUT)); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16572 | if (err < 0) |
| 16573 | return err; |
Herton Ronaldo Krzesinski | b69ce01 | 2008-09-18 16:41:49 -0300 | [diff] [blame] | 16574 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16575 | "Center Playback Switch", |
Herton Ronaldo Krzesinski | b69ce01 | 2008-09-18 16:41:49 -0300 | [diff] [blame] | 16576 | HDA_COMPOSE_AMP_VAL(0x0e, 1, 0, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 16577 | HDA_INPUT)); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16578 | if (err < 0) |
| 16579 | return err; |
Herton Ronaldo Krzesinski | b69ce01 | 2008-09-18 16:41:49 -0300 | [diff] [blame] | 16580 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16581 | "LFE Playback Switch", |
Herton Ronaldo Krzesinski | b69ce01 | 2008-09-18 16:41:49 -0300 | [diff] [blame] | 16582 | HDA_COMPOSE_AMP_VAL(0x0e, 2, 0, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 16583 | HDA_INPUT)); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16584 | if (err < 0) |
| 16585 | return err; |
| 16586 | } else { |
| 16587 | sprintf(name, "%s Playback Volume", chname[i]); |
| 16588 | err = add_control(spec, ALC_CTL_WIDGET_VOL, name, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 16589 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, |
| 16590 | HDA_OUTPUT)); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16591 | if (err < 0) |
| 16592 | return err; |
| 16593 | sprintf(name, "%s Playback Switch", chname[i]); |
Herton Ronaldo Krzesinski | b69ce01 | 2008-09-18 16:41:49 -0300 | [diff] [blame] | 16594 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, name, |
| 16595 | HDA_COMPOSE_AMP_VAL(alc880_idx_to_mixer(i), |
| 16596 | 3, 0, HDA_INPUT)); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16597 | if (err < 0) |
| 16598 | return err; |
| 16599 | } |
| 16600 | } |
| 16601 | return 0; |
| 16602 | } |
| 16603 | |
| 16604 | /* add playback controls for speaker and HP outputs */ |
| 16605 | static int alc662_auto_create_extra_out(struct alc_spec *spec, hda_nid_t pin, |
| 16606 | const char *pfx) |
| 16607 | { |
| 16608 | hda_nid_t nid; |
| 16609 | int err; |
| 16610 | char name[32]; |
| 16611 | |
| 16612 | if (!pin) |
| 16613 | return 0; |
| 16614 | |
Takashi Iwai | 24fb917 | 2008-09-02 14:48:20 +0200 | [diff] [blame] | 16615 | if (pin == 0x17) { |
| 16616 | /* ALC663 has a mono output pin on 0x17 */ |
| 16617 | sprintf(name, "%s Playback Switch", pfx); |
| 16618 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, name, |
| 16619 | HDA_COMPOSE_AMP_VAL(pin, 2, 0, HDA_OUTPUT)); |
| 16620 | return err; |
| 16621 | } |
| 16622 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16623 | if (alc880_is_fixed_pin(pin)) { |
| 16624 | nid = alc880_idx_to_dac(alc880_fixed_pin_idx(pin)); |
Takashi Iwai | 939778a | 2009-02-05 15:57:55 +0100 | [diff] [blame] | 16625 | /* printk(KERN_DEBUG "DAC nid=%x\n",nid); */ |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16626 | /* specify the DAC as the extra output */ |
| 16627 | if (!spec->multiout.hp_nid) |
| 16628 | spec->multiout.hp_nid = nid; |
| 16629 | else |
| 16630 | spec->multiout.extra_out_nid[0] = nid; |
| 16631 | /* control HP volume/switch on the output mixer amp */ |
| 16632 | nid = alc880_idx_to_dac(alc880_fixed_pin_idx(pin)); |
| 16633 | sprintf(name, "%s Playback Volume", pfx); |
| 16634 | err = add_control(spec, ALC_CTL_WIDGET_VOL, name, |
| 16635 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT)); |
| 16636 | if (err < 0) |
| 16637 | return err; |
| 16638 | sprintf(name, "%s Playback Switch", pfx); |
| 16639 | err = add_control(spec, ALC_CTL_BIND_MUTE, name, |
| 16640 | HDA_COMPOSE_AMP_VAL(nid, 3, 2, HDA_INPUT)); |
| 16641 | if (err < 0) |
| 16642 | return err; |
| 16643 | } else if (alc880_is_multi_pin(pin)) { |
| 16644 | /* set manual connection */ |
| 16645 | /* we have only a switch on HP-out PIN */ |
| 16646 | sprintf(name, "%s Playback Switch", pfx); |
| 16647 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, name, |
| 16648 | HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT)); |
| 16649 | if (err < 0) |
| 16650 | return err; |
| 16651 | } |
| 16652 | return 0; |
| 16653 | } |
| 16654 | |
| 16655 | /* create playback/capture controls for input pins */ |
| 16656 | static int alc662_auto_create_analog_input_ctls(struct alc_spec *spec, |
| 16657 | const struct auto_pin_cfg *cfg) |
| 16658 | { |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 16659 | struct hda_input_mux *imux = &spec->private_imux[0]; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16660 | int i, err, idx; |
| 16661 | |
| 16662 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
| 16663 | if (alc880_is_input_pin(cfg->input_pins[i])) { |
| 16664 | idx = alc880_input_pin_idx(cfg->input_pins[i]); |
| 16665 | err = new_analog_input(spec, cfg->input_pins[i], |
| 16666 | auto_pin_cfg_labels[i], |
| 16667 | idx, 0x0b); |
| 16668 | if (err < 0) |
| 16669 | return err; |
| 16670 | imux->items[imux->num_items].label = |
| 16671 | auto_pin_cfg_labels[i]; |
| 16672 | imux->items[imux->num_items].index = |
| 16673 | alc880_input_pin_idx(cfg->input_pins[i]); |
| 16674 | imux->num_items++; |
| 16675 | } |
| 16676 | } |
| 16677 | return 0; |
| 16678 | } |
| 16679 | |
| 16680 | static void alc662_auto_set_output_and_unmute(struct hda_codec *codec, |
| 16681 | hda_nid_t nid, int pin_type, |
| 16682 | int dac_idx) |
| 16683 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 16684 | alc_set_pin_output(codec, nid, pin_type); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16685 | /* need the manual connection? */ |
| 16686 | if (alc880_is_multi_pin(nid)) { |
| 16687 | struct alc_spec *spec = codec->spec; |
| 16688 | int idx = alc880_multi_pin_idx(nid); |
| 16689 | snd_hda_codec_write(codec, alc880_idx_to_selector(idx), 0, |
| 16690 | AC_VERB_SET_CONNECT_SEL, |
| 16691 | alc880_dac_to_idx(spec->multiout.dac_nids[dac_idx])); |
| 16692 | } |
| 16693 | } |
| 16694 | |
| 16695 | static void alc662_auto_init_multi_out(struct hda_codec *codec) |
| 16696 | { |
| 16697 | struct alc_spec *spec = codec->spec; |
| 16698 | int i; |
| 16699 | |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 16700 | alc_subsystem_id(codec, 0x15, 0x1b, 0x14); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16701 | for (i = 0; i <= HDA_SIDE; i++) { |
| 16702 | hda_nid_t nid = spec->autocfg.line_out_pins[i]; |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 16703 | int pin_type = get_pin_type(spec->autocfg.line_out_type); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16704 | if (nid) |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 16705 | alc662_auto_set_output_and_unmute(codec, nid, pin_type, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16706 | i); |
| 16707 | } |
| 16708 | } |
| 16709 | |
| 16710 | static void alc662_auto_init_hp_out(struct hda_codec *codec) |
| 16711 | { |
| 16712 | struct alc_spec *spec = codec->spec; |
| 16713 | hda_nid_t pin; |
| 16714 | |
| 16715 | pin = spec->autocfg.hp_pins[0]; |
| 16716 | if (pin) /* connect to front */ |
| 16717 | /* use dac 0 */ |
| 16718 | alc662_auto_set_output_and_unmute(codec, pin, PIN_HP, 0); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 16719 | pin = spec->autocfg.speaker_pins[0]; |
| 16720 | if (pin) |
| 16721 | alc662_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16722 | } |
| 16723 | |
| 16724 | #define alc662_is_input_pin(nid) alc880_is_input_pin(nid) |
| 16725 | #define ALC662_PIN_CD_NID ALC880_PIN_CD_NID |
| 16726 | |
| 16727 | static void alc662_auto_init_analog_input(struct hda_codec *codec) |
| 16728 | { |
| 16729 | struct alc_spec *spec = codec->spec; |
| 16730 | int i; |
| 16731 | |
| 16732 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
| 16733 | hda_nid_t nid = spec->autocfg.input_pins[i]; |
| 16734 | if (alc662_is_input_pin(nid)) { |
| 16735 | snd_hda_codec_write(codec, nid, 0, |
| 16736 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 16737 | (i <= AUTO_PIN_FRONT_MIC ? |
| 16738 | PIN_VREF80 : PIN_IN)); |
| 16739 | if (nid != ALC662_PIN_CD_NID) |
| 16740 | snd_hda_codec_write(codec, nid, 0, |
| 16741 | AC_VERB_SET_AMP_GAIN_MUTE, |
| 16742 | AMP_OUT_MUTE); |
| 16743 | } |
| 16744 | } |
| 16745 | } |
| 16746 | |
Takashi Iwai | f511b01 | 2008-08-15 16:46:42 +0200 | [diff] [blame] | 16747 | #define alc662_auto_init_input_src alc882_auto_init_input_src |
| 16748 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16749 | static int alc662_parse_auto_config(struct hda_codec *codec) |
| 16750 | { |
| 16751 | struct alc_spec *spec = codec->spec; |
| 16752 | int err; |
| 16753 | static hda_nid_t alc662_ignore[] = { 0x1d, 0 }; |
| 16754 | |
| 16755 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 16756 | alc662_ignore); |
| 16757 | if (err < 0) |
| 16758 | return err; |
| 16759 | if (!spec->autocfg.line_outs) |
| 16760 | return 0; /* can't find valid BIOS pin config */ |
| 16761 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 16762 | err = alc880_auto_fill_dac_nids(spec, &spec->autocfg); |
| 16763 | if (err < 0) |
| 16764 | return err; |
| 16765 | err = alc662_auto_create_multi_out_ctls(spec, &spec->autocfg); |
| 16766 | if (err < 0) |
| 16767 | return err; |
| 16768 | err = alc662_auto_create_extra_out(spec, |
| 16769 | spec->autocfg.speaker_pins[0], |
| 16770 | "Speaker"); |
| 16771 | if (err < 0) |
| 16772 | return err; |
| 16773 | err = alc662_auto_create_extra_out(spec, spec->autocfg.hp_pins[0], |
| 16774 | "Headphone"); |
| 16775 | if (err < 0) |
| 16776 | return err; |
| 16777 | err = alc662_auto_create_analog_input_ctls(spec, &spec->autocfg); |
| 16778 | if (err < 0) |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16779 | return err; |
| 16780 | |
| 16781 | spec->multiout.max_channels = spec->multiout.num_dacs * 2; |
| 16782 | |
Takashi Iwai | 0852d7a | 2009-02-11 11:35:15 +0100 | [diff] [blame] | 16783 | if (spec->autocfg.dig_outs) |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16784 | spec->multiout.dig_out_nid = ALC880_DIGOUT_NID; |
| 16785 | |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 16786 | if (spec->kctls.list) |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 16787 | add_mixer(spec, spec->kctls.list); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16788 | |
| 16789 | spec->num_mux_defs = 1; |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 16790 | spec->input_mux = &spec->private_imux[0]; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 16791 | |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 16792 | add_verb(spec, alc662_auto_init_verbs); |
Takashi Iwai | 24fb917 | 2008-09-02 14:48:20 +0200 | [diff] [blame] | 16793 | if (codec->vendor_id == 0x10ec0663) |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 16794 | add_verb(spec, alc663_auto_init_verbs); |
Takashi Iwai | ee979a14 | 2008-09-02 15:42:20 +0200 | [diff] [blame] | 16795 | |
| 16796 | err = alc_auto_add_mic_boost(codec); |
| 16797 | if (err < 0) |
| 16798 | return err; |
| 16799 | |
Takashi Iwai | 8c87286f | 2007-06-19 12:11:16 +0200 | [diff] [blame] | 16800 | return 1; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16801 | } |
| 16802 | |
| 16803 | /* additional initialization for auto-configuration model */ |
| 16804 | static void alc662_auto_init(struct hda_codec *codec) |
| 16805 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 16806 | struct alc_spec *spec = codec->spec; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16807 | alc662_auto_init_multi_out(codec); |
| 16808 | alc662_auto_init_hp_out(codec); |
| 16809 | alc662_auto_init_analog_input(codec); |
Takashi Iwai | f511b01 | 2008-08-15 16:46:42 +0200 | [diff] [blame] | 16810 | alc662_auto_init_input_src(codec); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 16811 | if (spec->unsol_event) |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 16812 | alc_inithook(codec); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16813 | } |
| 16814 | |
| 16815 | static int patch_alc662(struct hda_codec *codec) |
| 16816 | { |
| 16817 | struct alc_spec *spec; |
| 16818 | int err, board_config; |
| 16819 | |
| 16820 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
| 16821 | if (!spec) |
| 16822 | return -ENOMEM; |
| 16823 | |
| 16824 | codec->spec = spec; |
| 16825 | |
Takashi Iwai | 2c3bf9a | 2008-06-04 12:39:38 +0200 | [diff] [blame] | 16826 | alc_fix_pll_init(codec, 0x20, 0x04, 15); |
| 16827 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16828 | board_config = snd_hda_check_board_config(codec, ALC662_MODEL_LAST, |
| 16829 | alc662_models, |
| 16830 | alc662_cfg_tbl); |
| 16831 | if (board_config < 0) { |
| 16832 | printk(KERN_INFO "hda_codec: Unknown model for ALC662, " |
| 16833 | "trying auto-probe from BIOS...\n"); |
| 16834 | board_config = ALC662_AUTO; |
| 16835 | } |
| 16836 | |
| 16837 | if (board_config == ALC662_AUTO) { |
| 16838 | /* automatic parse from the BIOS config */ |
| 16839 | err = alc662_parse_auto_config(codec); |
| 16840 | if (err < 0) { |
| 16841 | alc_free(codec); |
| 16842 | return err; |
Takashi Iwai | 8c87286f | 2007-06-19 12:11:16 +0200 | [diff] [blame] | 16843 | } else if (!err) { |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16844 | printk(KERN_INFO |
| 16845 | "hda_codec: Cannot set up configuration " |
| 16846 | "from BIOS. Using base mode...\n"); |
| 16847 | board_config = ALC662_3ST_2ch_DIG; |
| 16848 | } |
| 16849 | } |
| 16850 | |
Kusanagi Kouichi | 680cd53 | 2009-02-05 00:00:58 +0900 | [diff] [blame] | 16851 | err = snd_hda_attach_beep_device(codec, 0x1); |
| 16852 | if (err < 0) { |
| 16853 | alc_free(codec); |
| 16854 | return err; |
| 16855 | } |
| 16856 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16857 | if (board_config != ALC662_AUTO) |
| 16858 | setup_preset(spec, &alc662_presets[board_config]); |
| 16859 | |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 16860 | if (codec->vendor_id == 0x10ec0663) { |
| 16861 | spec->stream_name_analog = "ALC663 Analog"; |
| 16862 | spec->stream_name_digital = "ALC663 Digital"; |
Kailang Yang | 01afd41 | 2008-10-15 11:22:09 +0200 | [diff] [blame] | 16863 | } else if (codec->vendor_id == 0x10ec0272) { |
| 16864 | spec->stream_name_analog = "ALC272 Analog"; |
| 16865 | spec->stream_name_digital = "ALC272 Digital"; |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 16866 | } else { |
| 16867 | spec->stream_name_analog = "ALC662 Analog"; |
| 16868 | spec->stream_name_digital = "ALC662 Digital"; |
| 16869 | } |
| 16870 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16871 | spec->stream_analog_playback = &alc662_pcm_analog_playback; |
| 16872 | spec->stream_analog_capture = &alc662_pcm_analog_capture; |
| 16873 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16874 | spec->stream_digital_playback = &alc662_pcm_digital_playback; |
| 16875 | spec->stream_digital_capture = &alc662_pcm_digital_capture; |
| 16876 | |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 16877 | spec->adc_nids = alc662_adc_nids; |
| 16878 | spec->num_adc_nids = ARRAY_SIZE(alc662_adc_nids); |
| 16879 | spec->capsrc_nids = alc662_capsrc_nids; |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 16880 | spec->capture_style = CAPT_MIX; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16881 | |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 16882 | if (!spec->cap_mixer) |
| 16883 | set_capture_mixer(spec); |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 16884 | set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT); |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 16885 | |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 16886 | spec->vmaster_nid = 0x02; |
| 16887 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16888 | codec->patch_ops = alc_patch_ops; |
| 16889 | if (board_config == ALC662_AUTO) |
| 16890 | spec->init_hook = alc662_auto_init; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 16891 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 16892 | if (!spec->loopback.amplist) |
| 16893 | spec->loopback.amplist = alc662_loopbacks; |
| 16894 | #endif |
Takashi Iwai | daead53 | 2008-11-28 12:55:36 +0100 | [diff] [blame] | 16895 | codec->proc_widget_hook = print_realtek_coef; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16896 | |
| 16897 | return 0; |
| 16898 | } |
| 16899 | |
| 16900 | /* |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 16901 | * patch entries |
| 16902 | */ |
Takashi Iwai | 1289e9e | 2008-11-27 15:47:11 +0100 | [diff] [blame] | 16903 | static struct hda_codec_preset snd_hda_preset_realtek[] = { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 16904 | { .id = 0x10ec0260, .name = "ALC260", .patch = patch_alc260 }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16905 | { .id = 0x10ec0262, .name = "ALC262", .patch = patch_alc262 }, |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 16906 | { .id = 0x10ec0267, .name = "ALC267", .patch = patch_alc268 }, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 16907 | { .id = 0x10ec0268, .name = "ALC268", .patch = patch_alc268 }, |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 16908 | { .id = 0x10ec0269, .name = "ALC269", .patch = patch_alc269 }, |
Kailang Yang | 01afd41 | 2008-10-15 11:22:09 +0200 | [diff] [blame] | 16909 | { .id = 0x10ec0272, .name = "ALC272", .patch = patch_alc662 }, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16910 | { .id = 0x10ec0861, .rev = 0x100340, .name = "ALC660", |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16911 | .patch = patch_alc861 }, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16912 | { .id = 0x10ec0660, .name = "ALC660-VD", .patch = patch_alc861vd }, |
| 16913 | { .id = 0x10ec0861, .name = "ALC861", .patch = patch_alc861 }, |
| 16914 | { .id = 0x10ec0862, .name = "ALC861-VD", .patch = patch_alc861vd }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16915 | { .id = 0x10ec0662, .rev = 0x100002, .name = "ALC662 rev2", |
| 16916 | .patch = patch_alc883 }, |
| 16917 | { .id = 0x10ec0662, .rev = 0x100101, .name = "ALC662 rev1", |
| 16918 | .patch = patch_alc662 }, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 16919 | { .id = 0x10ec0663, .name = "ALC663", .patch = patch_alc662 }, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16920 | { .id = 0x10ec0880, .name = "ALC880", .patch = patch_alc880 }, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 16921 | { .id = 0x10ec0882, .name = "ALC882", .patch = patch_alc882 }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 16922 | { .id = 0x10ec0883, .name = "ALC883", .patch = patch_alc883 }, |
Clive Messer | 669faba | 2008-09-30 15:49:13 +0200 | [diff] [blame] | 16923 | { .id = 0x10ec0885, .rev = 0x100101, .name = "ALC889A", |
| 16924 | .patch = patch_alc882 }, /* should be patch_alc883() in future */ |
Takashi Iwai | cb308f9 | 2008-04-16 14:13:29 +0200 | [diff] [blame] | 16925 | { .id = 0x10ec0885, .rev = 0x100103, .name = "ALC889A", |
Takashi Iwai | 7943a8a | 2008-04-16 17:29:09 +0200 | [diff] [blame] | 16926 | .patch = patch_alc882 }, /* should be patch_alc883() in future */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16927 | { .id = 0x10ec0885, .name = "ALC885", .patch = patch_alc882 }, |
Kailang Yang | a385a52 | 2008-10-15 11:20:21 +0200 | [diff] [blame] | 16928 | { .id = 0x10ec0887, .name = "ALC887", .patch = patch_alc883 }, |
Kailang Yang | 4442608 | 2008-10-15 11:18:05 +0200 | [diff] [blame] | 16929 | { .id = 0x10ec0888, .rev = 0x100101, .name = "ALC1200", |
| 16930 | .patch = patch_alc883 }, |
Wu Fengguang | 3fea2cb | 2008-12-26 12:20:43 +0800 | [diff] [blame] | 16931 | { .id = 0x10ec0888, .name = "ALC888", .patch = patch_alc883 }, |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 16932 | { .id = 0x10ec0889, .name = "ALC889", .patch = patch_alc883 }, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 16933 | {} /* terminator */ |
| 16934 | }; |
Takashi Iwai | 1289e9e | 2008-11-27 15:47:11 +0100 | [diff] [blame] | 16935 | |
| 16936 | MODULE_ALIAS("snd-hda-codec-id:10ec*"); |
| 16937 | |
| 16938 | MODULE_LICENSE("GPL"); |
| 16939 | MODULE_DESCRIPTION("Realtek HD-audio codec"); |
| 16940 | |
| 16941 | static struct hda_codec_preset_list realtek_list = { |
| 16942 | .preset = snd_hda_preset_realtek, |
| 16943 | .owner = THIS_MODULE, |
| 16944 | }; |
| 16945 | |
| 16946 | static int __init patch_realtek_init(void) |
| 16947 | { |
| 16948 | return snd_hda_add_codec_preset(&realtek_list); |
| 16949 | } |
| 16950 | |
| 16951 | static void __exit patch_realtek_exit(void) |
| 16952 | { |
| 16953 | snd_hda_delete_codec_preset(&realtek_list); |
| 16954 | } |
| 16955 | |
| 16956 | module_init(patch_realtek_init) |
| 16957 | module_exit(patch_realtek_exit) |