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, |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 81 | #ifdef CONFIG_SND_DEBUG |
| 82 | ALC260_TEST, |
| 83 | #endif |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 84 | ALC260_AUTO, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 85 | ALC260_MODEL_LAST /* last tag */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 86 | }; |
| 87 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 88 | /* ALC262 models */ |
| 89 | enum { |
| 90 | ALC262_BASIC, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 91 | ALC262_HIPPO, |
| 92 | ALC262_HIPPO_1, |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 93 | ALC262_FUJITSU, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 94 | ALC262_HP_BPC, |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 95 | ALC262_HP_BPC_D7000_WL, |
| 96 | ALC262_HP_BPC_D7000_WF, |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 97 | ALC262_HP_TC_T5735, |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 98 | ALC262_HP_RP5700, |
Takashi Iwai | 304dcaa | 2006-07-25 14:51:16 +0200 | [diff] [blame] | 99 | ALC262_BENQ_ED8, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 100 | ALC262_SONY_ASSAMD, |
Kailang Yang | 83c3421 | 2007-07-05 11:43:05 +0200 | [diff] [blame] | 101 | ALC262_BENQ_T31, |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 102 | ALC262_ULTRA, |
Jiang zhe | 0e31daf | 2008-03-20 12:12:39 +0100 | [diff] [blame] | 103 | ALC262_LENOVO_3000, |
Pascal Terjan | e8f9ae2 | 2008-08-04 14:36:05 +0200 | [diff] [blame] | 104 | ALC262_NEC, |
Kailang Yang | 4e555fe | 2008-08-26 13:05:55 +0200 | [diff] [blame] | 105 | ALC262_TOSHIBA_S06, |
Hiroshi Miura | 9f99a63 | 2008-08-28 16:09:06 +0200 | [diff] [blame] | 106 | ALC262_TOSHIBA_RX1, |
Tony Vroon | ba340e8 | 2009-02-02 19:01:30 +0000 | [diff] [blame] | 107 | ALC262_TYAN, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 108 | ALC262_AUTO, |
| 109 | ALC262_MODEL_LAST /* last tag */ |
| 110 | }; |
| 111 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 112 | /* ALC268 models */ |
| 113 | enum { |
Herton Ronaldo Krzesinski | eb5a662 | 2008-04-14 13:46:28 +0200 | [diff] [blame] | 114 | ALC267_QUANTA_IL1, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 115 | ALC268_3ST, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 116 | ALC268_TOSHIBA, |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 117 | ALC268_ACER, |
Takashi Iwai | c238b4f | 2008-11-05 14:57:20 +0100 | [diff] [blame] | 118 | ALC268_ACER_DMIC, |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 119 | ALC268_ACER_ASPIRE_ONE, |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 120 | ALC268_DELL, |
Mirco Tischler | f12462c | 2008-02-04 12:33:59 +0100 | [diff] [blame] | 121 | ALC268_ZEPTO, |
Jonathan Woithe | 86c53bd | 2008-01-08 12:33:19 +0100 | [diff] [blame] | 122 | #ifdef CONFIG_SND_DEBUG |
| 123 | ALC268_TEST, |
| 124 | #endif |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 125 | ALC268_AUTO, |
| 126 | ALC268_MODEL_LAST /* last tag */ |
| 127 | }; |
| 128 | |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 129 | /* ALC269 models */ |
| 130 | enum { |
| 131 | ALC269_BASIC, |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 132 | ALC269_QUANTA_FL1, |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 133 | ALC269_ASUS_EEEPC_P703, |
| 134 | ALC269_ASUS_EEEPC_P901, |
Takashi Iwai | 26f5df2 | 2008-11-03 17:39:46 +0100 | [diff] [blame] | 135 | ALC269_FUJITSU, |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 136 | ALC269_LIFEBOOK, |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 137 | ALC269_AUTO, |
| 138 | ALC269_MODEL_LAST /* last tag */ |
| 139 | }; |
| 140 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 141 | /* ALC861 models */ |
| 142 | enum { |
| 143 | ALC861_3ST, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 144 | ALC660_3ST, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 145 | ALC861_3ST_DIG, |
| 146 | ALC861_6ST_DIG, |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 147 | ALC861_UNIWILL_M31, |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 148 | ALC861_TOSHIBA, |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 149 | ALC861_ASUS, |
Takashi Iwai | 56bb0ca | 2006-11-22 11:52:52 +0100 | [diff] [blame] | 150 | ALC861_ASUS_LAPTOP, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 151 | ALC861_AUTO, |
| 152 | ALC861_MODEL_LAST, |
| 153 | }; |
| 154 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 155 | /* ALC861-VD models */ |
| 156 | enum { |
| 157 | ALC660VD_3ST, |
Mike Crash | 6963f84 | 2007-06-25 12:12:51 +0200 | [diff] [blame] | 158 | ALC660VD_3ST_DIG, |
Takashi Iwai | 13c9474 | 2008-11-05 08:06:08 +0100 | [diff] [blame] | 159 | ALC660VD_ASUS_V1S, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 160 | ALC861VD_3ST, |
| 161 | ALC861VD_3ST_DIG, |
| 162 | ALC861VD_6ST_DIG, |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 163 | ALC861VD_LENOVO, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 164 | ALC861VD_DALLAS, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 165 | ALC861VD_HP, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 166 | ALC861VD_AUTO, |
| 167 | ALC861VD_MODEL_LAST, |
| 168 | }; |
| 169 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 170 | /* ALC662 models */ |
| 171 | enum { |
| 172 | ALC662_3ST_2ch_DIG, |
| 173 | ALC662_3ST_6ch_DIG, |
| 174 | ALC662_3ST_6ch, |
| 175 | ALC662_5ST_DIG, |
| 176 | ALC662_LENOVO_101E, |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 177 | ALC662_ASUS_EEEPC_P701, |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 178 | ALC662_ASUS_EEEPC_EP20, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 179 | ALC663_ASUS_M51VA, |
| 180 | ALC663_ASUS_G71V, |
| 181 | ALC663_ASUS_H13, |
| 182 | ALC663_ASUS_G50V, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 183 | ALC662_ECS, |
| 184 | ALC663_ASUS_MODE1, |
| 185 | ALC662_ASUS_MODE2, |
| 186 | ALC663_ASUS_MODE3, |
| 187 | ALC663_ASUS_MODE4, |
| 188 | ALC663_ASUS_MODE5, |
| 189 | ALC663_ASUS_MODE6, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 190 | ALC662_AUTO, |
| 191 | ALC662_MODEL_LAST, |
| 192 | }; |
| 193 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 194 | /* ALC882 models */ |
| 195 | enum { |
| 196 | ALC882_3ST_DIG, |
| 197 | ALC882_6ST_DIG, |
Takashi Iwai | 4b146cb | 2006-07-28 14:42:36 +0200 | [diff] [blame] | 198 | ALC882_ARIMA, |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 199 | ALC882_W2JC, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 200 | ALC882_TARGA, |
| 201 | ALC882_ASUS_A7J, |
Takashi Iwai | 914759b | 2007-09-06 14:52:04 +0200 | [diff] [blame] | 202 | ALC882_ASUS_A7M, |
Tobin Davis | 9102cd1 | 2006-12-15 10:02:12 +0100 | [diff] [blame] | 203 | ALC885_MACPRO, |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 204 | ALC885_MBP3, |
Nicola Fagnani | c54728d | 2007-07-19 23:28:52 +0200 | [diff] [blame] | 205 | ALC885_IMAC24, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 206 | ALC882_AUTO, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 207 | ALC882_MODEL_LAST, |
| 208 | }; |
| 209 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 210 | /* ALC883 models */ |
| 211 | enum { |
| 212 | ALC883_3ST_2ch_DIG, |
| 213 | ALC883_3ST_6ch_DIG, |
| 214 | ALC883_3ST_6ch, |
| 215 | ALC883_6ST_DIG, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 216 | ALC883_TARGA_DIG, |
| 217 | ALC883_TARGA_2ch_DIG, |
Vladimir Avdonin | bab282b9 | 2006-08-22 13:31:58 +0200 | [diff] [blame] | 218 | ALC883_ACER, |
Tobin Davis | 2880a86 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 219 | ALC883_ACER_ASPIRE, |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 220 | ALC888_ACER_ASPIRE_4930G, |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 221 | ALC883_MEDION, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 222 | ALC883_MEDION_MD2, |
Andrew L. Neporada | b373bde | 2006-11-07 11:37:08 +0100 | [diff] [blame] | 223 | ALC883_LAPTOP_EAPD, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 224 | ALC883_LENOVO_101E_2ch, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 225 | ALC883_LENOVO_NB0763, |
Kailang Yang | 189609a | 2007-08-20 11:31:23 +0200 | [diff] [blame] | 226 | ALC888_LENOVO_MS7195_DIG, |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 227 | ALC888_LENOVO_SKY, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 228 | ALC883_HAIER_W66, |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 229 | ALC888_3ST_HP, |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 230 | ALC888_6ST_DELL, |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 231 | ALC883_MITAC, |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 232 | ALC883_CLEVO_M720, |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 233 | ALC883_FUJITSU_PI2515, |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 234 | ALC888_FUJITSU_XA3530, |
Jiang zhe | 17bba1b | 2008-06-04 12:11:07 +0200 | [diff] [blame] | 235 | ALC883_3ST_6ch_INTEL, |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 236 | ALC888_ASUS_M90V, |
| 237 | ALC888_ASUS_EEE1601, |
Wu Fengguang | 3ab9093 | 2008-11-17 09:51:09 +0100 | [diff] [blame] | 238 | ALC1200_ASUS_P5Q, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 239 | ALC883_AUTO, |
| 240 | ALC883_MODEL_LAST, |
| 241 | }; |
| 242 | |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 243 | /* styles of capture selection */ |
| 244 | enum { |
| 245 | CAPT_MUX = 0, /* only mux based */ |
| 246 | CAPT_MIX, /* only mixer based */ |
| 247 | CAPT_1MUX_MIX, /* first mux and other mixers */ |
| 248 | }; |
| 249 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 250 | /* for GPIO Poll */ |
| 251 | #define GPIO_MASK 0x03 |
| 252 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 253 | struct alc_spec { |
| 254 | /* codec parameterization */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 255 | struct snd_kcontrol_new *mixers[5]; /* mixer arrays */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 256 | unsigned int num_mixers; |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 257 | struct snd_kcontrol_new *cap_mixer; /* capture mixer */ |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 258 | unsigned int beep_amp; /* beep amp value, set via set_beep_amp() */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 259 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 260 | const struct hda_verb *init_verbs[5]; /* initialization verbs |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 261 | * don't forget NULL |
| 262 | * termination! |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 263 | */ |
| 264 | unsigned int num_init_verbs; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 265 | |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 266 | char *stream_name_analog; /* analog PCM stream */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 267 | struct hda_pcm_stream *stream_analog_playback; |
| 268 | struct hda_pcm_stream *stream_analog_capture; |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 269 | struct hda_pcm_stream *stream_analog_alt_playback; |
| 270 | struct hda_pcm_stream *stream_analog_alt_capture; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 271 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 272 | char *stream_name_digital; /* digital PCM stream */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 273 | struct hda_pcm_stream *stream_digital_playback; |
| 274 | struct hda_pcm_stream *stream_digital_capture; |
| 275 | |
| 276 | /* playback */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 277 | struct hda_multi_out multiout; /* playback set-up |
| 278 | * max_channels, dacs must be set |
| 279 | * dig_out_nid and hp_nid are optional |
| 280 | */ |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 281 | hda_nid_t alt_dac_nid; |
Takashi Iwai | 8c44198 | 2009-01-20 18:30:20 +0100 | [diff] [blame] | 282 | int dig_out_type; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 283 | |
| 284 | /* capture */ |
| 285 | unsigned int num_adc_nids; |
| 286 | hda_nid_t *adc_nids; |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 287 | hda_nid_t *capsrc_nids; |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 288 | hda_nid_t dig_in_nid; /* digital-in NID; optional */ |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 289 | int capture_style; /* capture style (CAPT_*) */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 290 | |
| 291 | /* capture source */ |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 292 | unsigned int num_mux_defs; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 293 | const struct hda_input_mux *input_mux; |
| 294 | unsigned int cur_mux[3]; |
| 295 | |
| 296 | /* channel model */ |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 297 | const struct hda_channel_mode *channel_mode; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 298 | int num_channel_mode; |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 299 | int need_dac_fix; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 300 | |
| 301 | /* PCM information */ |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 302 | struct hda_pcm pcm_rec[3]; /* used in alc_build_pcms() */ |
Takashi Iwai | 41e41f1 | 2005-06-08 14:48:49 +0200 | [diff] [blame] | 303 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 304 | /* dynamic controls, init_verbs and input_mux */ |
| 305 | struct auto_pin_cfg autocfg; |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 306 | struct snd_array kctls; |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 307 | struct hda_input_mux private_imux[3]; |
Takashi Iwai | 41923e4 | 2007-10-22 17:20:10 +0200 | [diff] [blame] | 308 | hda_nid_t private_dac_nids[AUTO_CFG_MAX_OUTS]; |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 309 | |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 310 | /* hooks */ |
| 311 | void (*init_hook)(struct hda_codec *codec); |
| 312 | void (*unsol_event)(struct hda_codec *codec, unsigned int res); |
| 313 | |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 314 | /* for pin sensing */ |
| 315 | unsigned int sense_updated: 1; |
| 316 | unsigned int jack_present: 1; |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 317 | unsigned int master_sw: 1; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 318 | |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 319 | /* other flags */ |
| 320 | unsigned int no_analog :1; /* digital I/O only */ |
| 321 | |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 322 | /* for virtual master */ |
| 323 | hda_nid_t vmaster_nid; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 324 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 325 | struct hda_loopback_check loopback; |
| 326 | #endif |
Takashi Iwai | 2c3bf9a | 2008-06-04 12:39:38 +0200 | [diff] [blame] | 327 | |
| 328 | /* for PLL fix */ |
| 329 | hda_nid_t pll_nid; |
| 330 | unsigned int pll_coef_idx, pll_coef_bit; |
Takashi Iwai | e044c39 | 2008-10-27 16:56:24 +0100 | [diff] [blame] | 331 | |
| 332 | #ifdef SND_HDA_NEEDS_RESUME |
| 333 | #define ALC_MAX_PINS 16 |
| 334 | unsigned int num_pins; |
| 335 | hda_nid_t pin_nids[ALC_MAX_PINS]; |
| 336 | unsigned int pin_cfgs[ALC_MAX_PINS]; |
| 337 | #endif |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 338 | }; |
| 339 | |
| 340 | /* |
| 341 | * configuration template - to be copied to the spec instance |
| 342 | */ |
| 343 | struct alc_config_preset { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 344 | struct snd_kcontrol_new *mixers[5]; /* should be identical size |
| 345 | * with spec |
| 346 | */ |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 347 | struct snd_kcontrol_new *cap_mixer; /* capture mixer */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 348 | const struct hda_verb *init_verbs[5]; |
| 349 | unsigned int num_dacs; |
| 350 | hda_nid_t *dac_nids; |
| 351 | hda_nid_t dig_out_nid; /* optional */ |
| 352 | hda_nid_t hp_nid; /* optional */ |
Wu Fengguang | b25c9da | 2009-02-06 15:02:27 +0800 | [diff] [blame] | 353 | hda_nid_t *slave_dig_outs; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 354 | unsigned int num_adc_nids; |
| 355 | hda_nid_t *adc_nids; |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 356 | hda_nid_t *capsrc_nids; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 357 | hda_nid_t dig_in_nid; |
| 358 | unsigned int num_channel_mode; |
| 359 | const struct hda_channel_mode *channel_mode; |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 360 | int need_dac_fix; |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 361 | unsigned int num_mux_defs; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 362 | const struct hda_input_mux *input_mux; |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 363 | void (*unsol_event)(struct hda_codec *, unsigned int); |
| 364 | void (*init_hook)(struct hda_codec *); |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 365 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 366 | struct hda_amp_list *loopbacks; |
| 367 | #endif |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 368 | }; |
| 369 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 370 | |
| 371 | /* |
| 372 | * input MUX handling |
| 373 | */ |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 374 | static int alc_mux_enum_info(struct snd_kcontrol *kcontrol, |
| 375 | struct snd_ctl_elem_info *uinfo) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 376 | { |
| 377 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 378 | struct alc_spec *spec = codec->spec; |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 379 | unsigned int mux_idx = snd_ctl_get_ioffidx(kcontrol, &uinfo->id); |
| 380 | if (mux_idx >= spec->num_mux_defs) |
| 381 | mux_idx = 0; |
| 382 | return snd_hda_input_mux_info(&spec->input_mux[mux_idx], uinfo); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 383 | } |
| 384 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 385 | static int alc_mux_enum_get(struct snd_kcontrol *kcontrol, |
| 386 | struct snd_ctl_elem_value *ucontrol) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 387 | { |
| 388 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 389 | struct alc_spec *spec = codec->spec; |
| 390 | unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id); |
| 391 | |
| 392 | ucontrol->value.enumerated.item[0] = spec->cur_mux[adc_idx]; |
| 393 | return 0; |
| 394 | } |
| 395 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 396 | static int alc_mux_enum_put(struct snd_kcontrol *kcontrol, |
| 397 | struct snd_ctl_elem_value *ucontrol) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 398 | { |
| 399 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 400 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | cd896c3 | 2008-11-18 12:36:33 +0100 | [diff] [blame] | 401 | const struct hda_input_mux *imux; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 402 | unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id); |
Takashi Iwai | cd896c3 | 2008-11-18 12:36:33 +0100 | [diff] [blame] | 403 | unsigned int mux_idx; |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 404 | hda_nid_t nid = spec->capsrc_nids ? |
| 405 | spec->capsrc_nids[adc_idx] : spec->adc_nids[adc_idx]; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 406 | |
Takashi Iwai | cd896c3 | 2008-11-18 12:36:33 +0100 | [diff] [blame] | 407 | mux_idx = adc_idx >= spec->num_mux_defs ? 0 : adc_idx; |
| 408 | imux = &spec->input_mux[mux_idx]; |
| 409 | |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 410 | if (spec->capture_style && |
| 411 | !(spec->capture_style == CAPT_1MUX_MIX && !adc_idx)) { |
Takashi Iwai | 54cbc9a | 2008-10-31 15:24:04 +0100 | [diff] [blame] | 412 | /* Matrix-mixer style (e.g. ALC882) */ |
| 413 | unsigned int *cur_val = &spec->cur_mux[adc_idx]; |
| 414 | unsigned int i, idx; |
| 415 | |
| 416 | idx = ucontrol->value.enumerated.item[0]; |
| 417 | if (idx >= imux->num_items) |
| 418 | idx = imux->num_items - 1; |
| 419 | if (*cur_val == idx) |
| 420 | return 0; |
| 421 | for (i = 0; i < imux->num_items; i++) { |
| 422 | unsigned int v = (i == idx) ? 0 : HDA_AMP_MUTE; |
| 423 | snd_hda_codec_amp_stereo(codec, nid, HDA_INPUT, |
| 424 | imux->items[i].index, |
| 425 | HDA_AMP_MUTE, v); |
| 426 | } |
| 427 | *cur_val = idx; |
| 428 | return 1; |
| 429 | } else { |
| 430 | /* MUX style (e.g. ALC880) */ |
Takashi Iwai | cd896c3 | 2008-11-18 12:36:33 +0100 | [diff] [blame] | 431 | return snd_hda_input_mux_put(codec, imux, ucontrol, nid, |
Takashi Iwai | 54cbc9a | 2008-10-31 15:24:04 +0100 | [diff] [blame] | 432 | &spec->cur_mux[adc_idx]); |
| 433 | } |
| 434 | } |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 435 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 436 | /* |
| 437 | * channel mode setting |
| 438 | */ |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 439 | static int alc_ch_mode_info(struct snd_kcontrol *kcontrol, |
| 440 | struct snd_ctl_elem_info *uinfo) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 441 | { |
| 442 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 443 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 444 | return snd_hda_ch_mode_info(codec, uinfo, spec->channel_mode, |
| 445 | spec->num_channel_mode); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 446 | } |
| 447 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 448 | static int alc_ch_mode_get(struct snd_kcontrol *kcontrol, |
| 449 | struct snd_ctl_elem_value *ucontrol) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 450 | { |
| 451 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 452 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 453 | return snd_hda_ch_mode_get(codec, ucontrol, spec->channel_mode, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 454 | spec->num_channel_mode, |
| 455 | spec->multiout.max_channels); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 456 | } |
| 457 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 458 | static int alc_ch_mode_put(struct snd_kcontrol *kcontrol, |
| 459 | struct snd_ctl_elem_value *ucontrol) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 460 | { |
| 461 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 462 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 463 | int err = snd_hda_ch_mode_put(codec, ucontrol, spec->channel_mode, |
| 464 | spec->num_channel_mode, |
| 465 | &spec->multiout.max_channels); |
Takashi Iwai | bd2033f | 2006-10-10 19:49:31 +0200 | [diff] [blame] | 466 | if (err >= 0 && spec->need_dac_fix) |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 467 | spec->multiout.num_dacs = spec->multiout.max_channels / 2; |
| 468 | return err; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 469 | } |
| 470 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 471 | /* |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 472 | * 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] | 473 | * instead of "%" to avoid consequences of accidently treating the % as |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 474 | * being part of a format specifier. Maximum allowed length of a value is |
| 475 | * 63 characters plus NULL terminator. |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 476 | * |
| 477 | * Note: some retasking pin complexes seem to ignore requests for input |
| 478 | * states other than HiZ (eg: PIN_VREFxx) and revert to HiZ if any of these |
| 479 | * are requested. Therefore order this list so that this behaviour will not |
| 480 | * cause problems when mixer clients move through the enum sequentially. |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 481 | * NIDs 0x0f and 0x10 have been observed to have this behaviour as of |
| 482 | * March 2006. |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 483 | */ |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 484 | static char *alc_pin_mode_names[] = { |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 485 | "Mic 50pc bias", "Mic 80pc bias", |
| 486 | "Line in", "Line out", "Headphone out", |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 487 | }; |
| 488 | static unsigned char alc_pin_mode_values[] = { |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 489 | PIN_VREF50, PIN_VREF80, PIN_IN, PIN_OUT, PIN_HP, |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 490 | }; |
| 491 | /* 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] | 492 | * in the pin being assumed to be exclusively an input or an output pin. In |
| 493 | * addition, "input" pins may or may not process the mic bias option |
| 494 | * depending on actual widget capability (NIDs 0x0f and 0x10 don't seem to |
| 495 | * accept requests for bias as of chip versions up to March 2006) and/or |
| 496 | * wiring in the computer. |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 497 | */ |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 498 | #define ALC_PIN_DIR_IN 0x00 |
| 499 | #define ALC_PIN_DIR_OUT 0x01 |
| 500 | #define ALC_PIN_DIR_INOUT 0x02 |
| 501 | #define ALC_PIN_DIR_IN_NOMICBIAS 0x03 |
| 502 | #define ALC_PIN_DIR_INOUT_NOMICBIAS 0x04 |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 503 | |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 504 | /* Info about the pin modes supported by the different pin direction modes. |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 505 | * For each direction the minimum and maximum values are given. |
| 506 | */ |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 507 | static signed char alc_pin_mode_dir_info[5][2] = { |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 508 | { 0, 2 }, /* ALC_PIN_DIR_IN */ |
| 509 | { 3, 4 }, /* ALC_PIN_DIR_OUT */ |
| 510 | { 0, 4 }, /* ALC_PIN_DIR_INOUT */ |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 511 | { 2, 2 }, /* ALC_PIN_DIR_IN_NOMICBIAS */ |
| 512 | { 2, 4 }, /* ALC_PIN_DIR_INOUT_NOMICBIAS */ |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 513 | }; |
| 514 | #define alc_pin_mode_min(_dir) (alc_pin_mode_dir_info[_dir][0]) |
| 515 | #define alc_pin_mode_max(_dir) (alc_pin_mode_dir_info[_dir][1]) |
| 516 | #define alc_pin_mode_n_items(_dir) \ |
| 517 | (alc_pin_mode_max(_dir)-alc_pin_mode_min(_dir)+1) |
| 518 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 519 | static int alc_pin_mode_info(struct snd_kcontrol *kcontrol, |
| 520 | struct snd_ctl_elem_info *uinfo) |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 521 | { |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 522 | unsigned int item_num = uinfo->value.enumerated.item; |
| 523 | unsigned char dir = (kcontrol->private_value >> 16) & 0xff; |
| 524 | |
| 525 | uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED; |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 526 | uinfo->count = 1; |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 527 | uinfo->value.enumerated.items = alc_pin_mode_n_items(dir); |
| 528 | |
| 529 | if (item_num<alc_pin_mode_min(dir) || item_num>alc_pin_mode_max(dir)) |
| 530 | item_num = alc_pin_mode_min(dir); |
| 531 | strcpy(uinfo->value.enumerated.name, alc_pin_mode_names[item_num]); |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 532 | return 0; |
| 533 | } |
| 534 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 535 | static int alc_pin_mode_get(struct snd_kcontrol *kcontrol, |
| 536 | struct snd_ctl_elem_value *ucontrol) |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 537 | { |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 538 | unsigned int i; |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 539 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 540 | hda_nid_t nid = kcontrol->private_value & 0xffff; |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 541 | unsigned char dir = (kcontrol->private_value >> 16) & 0xff; |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 542 | long *valp = ucontrol->value.integer.value; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 543 | unsigned int pinctl = snd_hda_codec_read(codec, nid, 0, |
| 544 | AC_VERB_GET_PIN_WIDGET_CONTROL, |
| 545 | 0x00); |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 546 | |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 547 | /* Find enumerated value for current pinctl setting */ |
| 548 | i = alc_pin_mode_min(dir); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 549 | 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] | 550 | i++; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 551 | *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] | 552 | return 0; |
| 553 | } |
| 554 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 555 | static int alc_pin_mode_put(struct snd_kcontrol *kcontrol, |
| 556 | struct snd_ctl_elem_value *ucontrol) |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 557 | { |
| 558 | signed int change; |
| 559 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 560 | hda_nid_t nid = kcontrol->private_value & 0xffff; |
| 561 | unsigned char dir = (kcontrol->private_value >> 16) & 0xff; |
| 562 | long val = *ucontrol->value.integer.value; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 563 | unsigned int pinctl = snd_hda_codec_read(codec, nid, 0, |
| 564 | AC_VERB_GET_PIN_WIDGET_CONTROL, |
| 565 | 0x00); |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 566 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 567 | 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] | 568 | val = alc_pin_mode_min(dir); |
| 569 | |
| 570 | change = pinctl != alc_pin_mode_values[val]; |
Jonathan Woithe | cdcd926 | 2006-02-28 11:36:42 +0100 | [diff] [blame] | 571 | if (change) { |
| 572 | /* Set pin mode to that requested */ |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 573 | snd_hda_codec_write_cache(codec, nid, 0, |
| 574 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 575 | alc_pin_mode_values[val]); |
Jonathan Woithe | cdcd926 | 2006-02-28 11:36:42 +0100 | [diff] [blame] | 576 | |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 577 | /* Also enable the retasking pin's input/output as required |
Jonathan Woithe | cdcd926 | 2006-02-28 11:36:42 +0100 | [diff] [blame] | 578 | * for the requested pin mode. Enum values of 2 or less are |
| 579 | * input modes. |
| 580 | * |
| 581 | * Dynamically switching the input/output buffers probably |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 582 | * reduces noise slightly (particularly on input) so we'll |
| 583 | * do it. However, having both input and output buffers |
| 584 | * enabled simultaneously doesn't seem to be problematic if |
| 585 | * this turns out to be necessary in the future. |
Jonathan Woithe | cdcd926 | 2006-02-28 11:36:42 +0100 | [diff] [blame] | 586 | */ |
| 587 | if (val <= 2) { |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 588 | snd_hda_codec_amp_stereo(codec, nid, HDA_OUTPUT, 0, |
| 589 | HDA_AMP_MUTE, HDA_AMP_MUTE); |
| 590 | snd_hda_codec_amp_stereo(codec, nid, HDA_INPUT, 0, |
| 591 | HDA_AMP_MUTE, 0); |
Jonathan Woithe | cdcd926 | 2006-02-28 11:36:42 +0100 | [diff] [blame] | 592 | } else { |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 593 | snd_hda_codec_amp_stereo(codec, nid, HDA_INPUT, 0, |
| 594 | HDA_AMP_MUTE, HDA_AMP_MUTE); |
| 595 | snd_hda_codec_amp_stereo(codec, nid, HDA_OUTPUT, 0, |
| 596 | HDA_AMP_MUTE, 0); |
Jonathan Woithe | cdcd926 | 2006-02-28 11:36:42 +0100 | [diff] [blame] | 597 | } |
| 598 | } |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 599 | return change; |
| 600 | } |
| 601 | |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 602 | #define ALC_PIN_MODE(xname, nid, dir) \ |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 603 | { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \ |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 604 | .info = alc_pin_mode_info, \ |
| 605 | .get = alc_pin_mode_get, \ |
| 606 | .put = alc_pin_mode_put, \ |
| 607 | .private_value = nid | (dir<<16) } |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 608 | |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 609 | /* A switch control for ALC260 GPIO pins. Multiple GPIOs can be ganged |
| 610 | * together using a mask with more than one bit set. This control is |
| 611 | * currently used only by the ALC260 test model. At this stage they are not |
| 612 | * needed for any "production" models. |
| 613 | */ |
| 614 | #ifdef CONFIG_SND_DEBUG |
Takashi Iwai | a5ce889 | 2007-07-23 15:42:26 +0200 | [diff] [blame] | 615 | #define alc_gpio_data_info snd_ctl_boolean_mono_info |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 616 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 617 | static int alc_gpio_data_get(struct snd_kcontrol *kcontrol, |
| 618 | struct snd_ctl_elem_value *ucontrol) |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 619 | { |
| 620 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 621 | hda_nid_t nid = kcontrol->private_value & 0xffff; |
| 622 | unsigned char mask = (kcontrol->private_value >> 16) & 0xff; |
| 623 | long *valp = ucontrol->value.integer.value; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 624 | unsigned int val = snd_hda_codec_read(codec, nid, 0, |
| 625 | AC_VERB_GET_GPIO_DATA, 0x00); |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 626 | |
| 627 | *valp = (val & mask) != 0; |
| 628 | return 0; |
| 629 | } |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 630 | static int alc_gpio_data_put(struct snd_kcontrol *kcontrol, |
| 631 | struct snd_ctl_elem_value *ucontrol) |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 632 | { |
| 633 | signed int change; |
| 634 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 635 | hda_nid_t nid = kcontrol->private_value & 0xffff; |
| 636 | unsigned char mask = (kcontrol->private_value >> 16) & 0xff; |
| 637 | long val = *ucontrol->value.integer.value; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 638 | unsigned int gpio_data = snd_hda_codec_read(codec, nid, 0, |
| 639 | AC_VERB_GET_GPIO_DATA, |
| 640 | 0x00); |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 641 | |
| 642 | /* Set/unset the masked GPIO bit(s) as needed */ |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 643 | change = (val == 0 ? 0 : mask) != (gpio_data & mask); |
| 644 | if (val == 0) |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 645 | gpio_data &= ~mask; |
| 646 | else |
| 647 | gpio_data |= mask; |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 648 | snd_hda_codec_write_cache(codec, nid, 0, |
| 649 | AC_VERB_SET_GPIO_DATA, gpio_data); |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 650 | |
| 651 | return change; |
| 652 | } |
| 653 | #define ALC_GPIO_DATA_SWITCH(xname, nid, mask) \ |
| 654 | { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \ |
| 655 | .info = alc_gpio_data_info, \ |
| 656 | .get = alc_gpio_data_get, \ |
| 657 | .put = alc_gpio_data_put, \ |
| 658 | .private_value = nid | (mask<<16) } |
| 659 | #endif /* CONFIG_SND_DEBUG */ |
| 660 | |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 661 | /* A switch control to allow the enabling of the digital IO pins on the |
| 662 | * ALC260. This is incredibly simplistic; the intention of this control is |
| 663 | * to provide something in the test model allowing digital outputs to be |
| 664 | * identified if present. If models are found which can utilise these |
| 665 | * outputs a more complete mixer control can be devised for those models if |
| 666 | * necessary. |
| 667 | */ |
| 668 | #ifdef CONFIG_SND_DEBUG |
Takashi Iwai | a5ce889 | 2007-07-23 15:42:26 +0200 | [diff] [blame] | 669 | #define alc_spdif_ctrl_info snd_ctl_boolean_mono_info |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 670 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 671 | static int alc_spdif_ctrl_get(struct snd_kcontrol *kcontrol, |
| 672 | struct snd_ctl_elem_value *ucontrol) |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 673 | { |
| 674 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 675 | hda_nid_t nid = kcontrol->private_value & 0xffff; |
| 676 | unsigned char mask = (kcontrol->private_value >> 16) & 0xff; |
| 677 | long *valp = ucontrol->value.integer.value; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 678 | unsigned int val = snd_hda_codec_read(codec, nid, 0, |
Andrew Paprocki | 3982d17 | 2007-12-19 12:13:44 +0100 | [diff] [blame] | 679 | AC_VERB_GET_DIGI_CONVERT_1, 0x00); |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 680 | |
| 681 | *valp = (val & mask) != 0; |
| 682 | return 0; |
| 683 | } |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 684 | static int alc_spdif_ctrl_put(struct snd_kcontrol *kcontrol, |
| 685 | struct snd_ctl_elem_value *ucontrol) |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 686 | { |
| 687 | signed int change; |
| 688 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 689 | hda_nid_t nid = kcontrol->private_value & 0xffff; |
| 690 | unsigned char mask = (kcontrol->private_value >> 16) & 0xff; |
| 691 | long val = *ucontrol->value.integer.value; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 692 | unsigned int ctrl_data = snd_hda_codec_read(codec, nid, 0, |
Andrew Paprocki | 3982d17 | 2007-12-19 12:13:44 +0100 | [diff] [blame] | 693 | AC_VERB_GET_DIGI_CONVERT_1, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 694 | 0x00); |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 695 | |
| 696 | /* Set/unset the masked control bit(s) as needed */ |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 697 | change = (val == 0 ? 0 : mask) != (ctrl_data & mask); |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 698 | if (val==0) |
| 699 | ctrl_data &= ~mask; |
| 700 | else |
| 701 | ctrl_data |= mask; |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 702 | snd_hda_codec_write_cache(codec, nid, 0, AC_VERB_SET_DIGI_CONVERT_1, |
| 703 | ctrl_data); |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 704 | |
| 705 | return change; |
| 706 | } |
| 707 | #define ALC_SPDIF_CTRL_SWITCH(xname, nid, mask) \ |
| 708 | { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \ |
| 709 | .info = alc_spdif_ctrl_info, \ |
| 710 | .get = alc_spdif_ctrl_get, \ |
| 711 | .put = alc_spdif_ctrl_put, \ |
| 712 | .private_value = nid | (mask<<16) } |
| 713 | #endif /* CONFIG_SND_DEBUG */ |
| 714 | |
Jonathan Woithe | f8225f6 | 2008-01-08 12:16:54 +0100 | [diff] [blame] | 715 | /* A switch control to allow the enabling EAPD digital outputs on the ALC26x. |
| 716 | * Again, this is only used in the ALC26x test models to help identify when |
| 717 | * the EAPD line must be asserted for features to work. |
| 718 | */ |
| 719 | #ifdef CONFIG_SND_DEBUG |
| 720 | #define alc_eapd_ctrl_info snd_ctl_boolean_mono_info |
| 721 | |
| 722 | static int alc_eapd_ctrl_get(struct snd_kcontrol *kcontrol, |
| 723 | struct snd_ctl_elem_value *ucontrol) |
| 724 | { |
| 725 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 726 | hda_nid_t nid = kcontrol->private_value & 0xffff; |
| 727 | unsigned char mask = (kcontrol->private_value >> 16) & 0xff; |
| 728 | long *valp = ucontrol->value.integer.value; |
| 729 | unsigned int val = snd_hda_codec_read(codec, nid, 0, |
| 730 | AC_VERB_GET_EAPD_BTLENABLE, 0x00); |
| 731 | |
| 732 | *valp = (val & mask) != 0; |
| 733 | return 0; |
| 734 | } |
| 735 | |
| 736 | static int alc_eapd_ctrl_put(struct snd_kcontrol *kcontrol, |
| 737 | struct snd_ctl_elem_value *ucontrol) |
| 738 | { |
| 739 | int change; |
| 740 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 741 | hda_nid_t nid = kcontrol->private_value & 0xffff; |
| 742 | unsigned char mask = (kcontrol->private_value >> 16) & 0xff; |
| 743 | long val = *ucontrol->value.integer.value; |
| 744 | unsigned int ctrl_data = snd_hda_codec_read(codec, nid, 0, |
| 745 | AC_VERB_GET_EAPD_BTLENABLE, |
| 746 | 0x00); |
| 747 | |
| 748 | /* Set/unset the masked control bit(s) as needed */ |
| 749 | change = (!val ? 0 : mask) != (ctrl_data & mask); |
| 750 | if (!val) |
| 751 | ctrl_data &= ~mask; |
| 752 | else |
| 753 | ctrl_data |= mask; |
| 754 | snd_hda_codec_write_cache(codec, nid, 0, AC_VERB_SET_EAPD_BTLENABLE, |
| 755 | ctrl_data); |
| 756 | |
| 757 | return change; |
| 758 | } |
| 759 | |
| 760 | #define ALC_EAPD_CTRL_SWITCH(xname, nid, mask) \ |
| 761 | { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \ |
| 762 | .info = alc_eapd_ctrl_info, \ |
| 763 | .get = alc_eapd_ctrl_get, \ |
| 764 | .put = alc_eapd_ctrl_put, \ |
| 765 | .private_value = nid | (mask<<16) } |
| 766 | #endif /* CONFIG_SND_DEBUG */ |
| 767 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 768 | /* |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 769 | */ |
| 770 | static void add_mixer(struct alc_spec *spec, struct snd_kcontrol_new *mix) |
| 771 | { |
| 772 | if (snd_BUG_ON(spec->num_mixers >= ARRAY_SIZE(spec->mixers))) |
| 773 | return; |
| 774 | spec->mixers[spec->num_mixers++] = mix; |
| 775 | } |
| 776 | |
| 777 | static void add_verb(struct alc_spec *spec, const struct hda_verb *verb) |
| 778 | { |
| 779 | if (snd_BUG_ON(spec->num_init_verbs >= ARRAY_SIZE(spec->init_verbs))) |
| 780 | return; |
| 781 | spec->init_verbs[spec->num_init_verbs++] = verb; |
| 782 | } |
| 783 | |
Takashi Iwai | daead53 | 2008-11-28 12:55:36 +0100 | [diff] [blame] | 784 | #ifdef CONFIG_PROC_FS |
| 785 | /* |
| 786 | * hook for proc |
| 787 | */ |
| 788 | static void print_realtek_coef(struct snd_info_buffer *buffer, |
| 789 | struct hda_codec *codec, hda_nid_t nid) |
| 790 | { |
| 791 | int coeff; |
| 792 | |
| 793 | if (nid != 0x20) |
| 794 | return; |
| 795 | coeff = snd_hda_codec_read(codec, nid, 0, AC_VERB_GET_PROC_COEF, 0); |
| 796 | snd_iprintf(buffer, " Processing Coefficient: 0x%02x\n", coeff); |
| 797 | coeff = snd_hda_codec_read(codec, nid, 0, |
| 798 | AC_VERB_GET_COEF_INDEX, 0); |
| 799 | snd_iprintf(buffer, " Coefficient Index: 0x%02x\n", coeff); |
| 800 | } |
| 801 | #else |
| 802 | #define print_realtek_coef NULL |
| 803 | #endif |
| 804 | |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 805 | /* |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 806 | * set up from the preset table |
| 807 | */ |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 808 | static void setup_preset(struct alc_spec *spec, |
| 809 | const struct alc_config_preset *preset) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 810 | { |
| 811 | int i; |
| 812 | |
| 813 | for (i = 0; i < ARRAY_SIZE(preset->mixers) && preset->mixers[i]; i++) |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 814 | add_mixer(spec, preset->mixers[i]); |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 815 | spec->cap_mixer = preset->cap_mixer; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 816 | for (i = 0; i < ARRAY_SIZE(preset->init_verbs) && preset->init_verbs[i]; |
| 817 | i++) |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 818 | add_verb(spec, preset->init_verbs[i]); |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 819 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 820 | spec->channel_mode = preset->channel_mode; |
| 821 | spec->num_channel_mode = preset->num_channel_mode; |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 822 | spec->need_dac_fix = preset->need_dac_fix; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 823 | |
| 824 | spec->multiout.max_channels = spec->channel_mode[0].channels; |
| 825 | |
| 826 | spec->multiout.num_dacs = preset->num_dacs; |
| 827 | spec->multiout.dac_nids = preset->dac_nids; |
| 828 | spec->multiout.dig_out_nid = preset->dig_out_nid; |
Wu Fengguang | b25c9da | 2009-02-06 15:02:27 +0800 | [diff] [blame] | 829 | spec->multiout.slave_dig_outs = preset->slave_dig_outs; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 830 | spec->multiout.hp_nid = preset->hp_nid; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 831 | |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 832 | spec->num_mux_defs = preset->num_mux_defs; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 833 | if (!spec->num_mux_defs) |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 834 | spec->num_mux_defs = 1; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 835 | spec->input_mux = preset->input_mux; |
| 836 | |
| 837 | spec->num_adc_nids = preset->num_adc_nids; |
| 838 | spec->adc_nids = preset->adc_nids; |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 839 | spec->capsrc_nids = preset->capsrc_nids; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 840 | spec->dig_in_nid = preset->dig_in_nid; |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 841 | |
| 842 | spec->unsol_event = preset->unsol_event; |
| 843 | spec->init_hook = preset->init_hook; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 844 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 845 | spec->loopback.amplist = preset->loopbacks; |
| 846 | #endif |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 847 | } |
| 848 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 849 | /* Enable GPIO mask and set output */ |
| 850 | static struct hda_verb alc_gpio1_init_verbs[] = { |
| 851 | {0x01, AC_VERB_SET_GPIO_MASK, 0x01}, |
| 852 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01}, |
| 853 | {0x01, AC_VERB_SET_GPIO_DATA, 0x01}, |
| 854 | { } |
| 855 | }; |
| 856 | |
| 857 | static struct hda_verb alc_gpio2_init_verbs[] = { |
| 858 | {0x01, AC_VERB_SET_GPIO_MASK, 0x02}, |
| 859 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x02}, |
| 860 | {0x01, AC_VERB_SET_GPIO_DATA, 0x02}, |
| 861 | { } |
| 862 | }; |
| 863 | |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 864 | static struct hda_verb alc_gpio3_init_verbs[] = { |
| 865 | {0x01, AC_VERB_SET_GPIO_MASK, 0x03}, |
| 866 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x03}, |
| 867 | {0x01, AC_VERB_SET_GPIO_DATA, 0x03}, |
| 868 | { } |
| 869 | }; |
| 870 | |
Takashi Iwai | 2c3bf9a | 2008-06-04 12:39:38 +0200 | [diff] [blame] | 871 | /* |
| 872 | * Fix hardware PLL issue |
| 873 | * On some codecs, the analog PLL gating control must be off while |
| 874 | * the default value is 1. |
| 875 | */ |
| 876 | static void alc_fix_pll(struct hda_codec *codec) |
| 877 | { |
| 878 | struct alc_spec *spec = codec->spec; |
| 879 | unsigned int val; |
| 880 | |
| 881 | if (!spec->pll_nid) |
| 882 | return; |
| 883 | snd_hda_codec_write(codec, spec->pll_nid, 0, AC_VERB_SET_COEF_INDEX, |
| 884 | spec->pll_coef_idx); |
| 885 | val = snd_hda_codec_read(codec, spec->pll_nid, 0, |
| 886 | AC_VERB_GET_PROC_COEF, 0); |
| 887 | snd_hda_codec_write(codec, spec->pll_nid, 0, AC_VERB_SET_COEF_INDEX, |
| 888 | spec->pll_coef_idx); |
| 889 | snd_hda_codec_write(codec, spec->pll_nid, 0, AC_VERB_SET_PROC_COEF, |
| 890 | val & ~(1 << spec->pll_coef_bit)); |
| 891 | } |
| 892 | |
| 893 | static void alc_fix_pll_init(struct hda_codec *codec, hda_nid_t nid, |
| 894 | unsigned int coef_idx, unsigned int coef_bit) |
| 895 | { |
| 896 | struct alc_spec *spec = codec->spec; |
| 897 | spec->pll_nid = nid; |
| 898 | spec->pll_coef_idx = coef_idx; |
| 899 | spec->pll_coef_bit = coef_bit; |
| 900 | alc_fix_pll(codec); |
| 901 | } |
| 902 | |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 903 | static void alc_sku_automute(struct hda_codec *codec) |
| 904 | { |
| 905 | struct alc_spec *spec = codec->spec; |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 906 | unsigned int present; |
| 907 | unsigned int hp_nid = spec->autocfg.hp_pins[0]; |
| 908 | unsigned int sp_nid = spec->autocfg.speaker_pins[0]; |
| 909 | |
| 910 | /* need to execute and sync at first */ |
| 911 | snd_hda_codec_read(codec, hp_nid, 0, AC_VERB_SET_PIN_SENSE, 0); |
| 912 | present = snd_hda_codec_read(codec, hp_nid, 0, |
| 913 | AC_VERB_GET_PIN_SENSE, 0); |
| 914 | spec->jack_present = (present & 0x80000000) != 0; |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 915 | snd_hda_codec_write(codec, sp_nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 916 | spec->jack_present ? 0 : PIN_OUT); |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 917 | } |
| 918 | |
Takashi Iwai | 4605b71 | 2008-10-31 14:18:24 +0100 | [diff] [blame] | 919 | #if 0 /* it's broken in some acses -- temporarily disabled */ |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 920 | static void alc_mic_automute(struct hda_codec *codec) |
| 921 | { |
| 922 | struct alc_spec *spec = codec->spec; |
| 923 | unsigned int present; |
| 924 | unsigned int mic_nid = spec->autocfg.input_pins[AUTO_PIN_MIC]; |
| 925 | unsigned int fmic_nid = spec->autocfg.input_pins[AUTO_PIN_FRONT_MIC]; |
| 926 | unsigned int mix_nid = spec->capsrc_nids[0]; |
| 927 | unsigned int capsrc_idx_mic, capsrc_idx_fmic; |
| 928 | |
| 929 | capsrc_idx_mic = mic_nid - 0x18; |
| 930 | capsrc_idx_fmic = fmic_nid - 0x18; |
| 931 | present = snd_hda_codec_read(codec, mic_nid, 0, |
| 932 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 933 | snd_hda_codec_write(codec, mix_nid, 0, AC_VERB_SET_AMP_GAIN_MUTE, |
| 934 | 0x7000 | (capsrc_idx_mic << 8) | (present ? 0 : 0x80)); |
| 935 | snd_hda_codec_write(codec, mix_nid, 0, AC_VERB_SET_AMP_GAIN_MUTE, |
| 936 | 0x7000 | (capsrc_idx_fmic << 8) | (present ? 0x80 : 0)); |
| 937 | snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, capsrc_idx_fmic, |
| 938 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
| 939 | } |
Takashi Iwai | 4605b71 | 2008-10-31 14:18:24 +0100 | [diff] [blame] | 940 | #else |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 941 | #define alc_mic_automute(codec) do {} while(0) /* NOP */ |
Takashi Iwai | 4605b71 | 2008-10-31 14:18:24 +0100 | [diff] [blame] | 942 | #endif /* disabled */ |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 943 | |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 944 | /* unsolicited event for HP jack sensing */ |
| 945 | static void alc_sku_unsol_event(struct hda_codec *codec, unsigned int res) |
| 946 | { |
| 947 | if (codec->vendor_id == 0x10ec0880) |
| 948 | res >>= 28; |
| 949 | else |
| 950 | res >>= 26; |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 951 | if (res == ALC880_HP_EVENT) |
| 952 | alc_sku_automute(codec); |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 953 | |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 954 | if (res == ALC880_MIC_EVENT) |
| 955 | alc_mic_automute(codec); |
| 956 | } |
| 957 | |
| 958 | static void alc_inithook(struct hda_codec *codec) |
| 959 | { |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 960 | alc_sku_automute(codec); |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 961 | alc_mic_automute(codec); |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 962 | } |
| 963 | |
Kailang Yang | f9423e7 | 2008-05-27 12:32:25 +0200 | [diff] [blame] | 964 | /* additional initialization for ALC888 variants */ |
| 965 | static void alc888_coef_init(struct hda_codec *codec) |
| 966 | { |
| 967 | unsigned int tmp; |
| 968 | |
| 969 | snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_COEF_INDEX, 0); |
| 970 | tmp = snd_hda_codec_read(codec, 0x20, 0, AC_VERB_GET_PROC_COEF, 0); |
| 971 | snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_COEF_INDEX, 7); |
| 972 | if ((tmp & 0xf0) == 2) |
| 973 | /* alc888S-VC */ |
| 974 | snd_hda_codec_read(codec, 0x20, 0, |
| 975 | AC_VERB_SET_PROC_COEF, 0x830); |
| 976 | else |
| 977 | /* alc888-VB */ |
| 978 | snd_hda_codec_read(codec, 0x20, 0, |
| 979 | AC_VERB_SET_PROC_COEF, 0x3030); |
| 980 | } |
| 981 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 982 | /* 32-bit subsystem ID for BIOS loading in HD Audio codec. |
| 983 | * 31 ~ 16 : Manufacture ID |
| 984 | * 15 ~ 8 : SKU ID |
| 985 | * 7 ~ 0 : Assembly ID |
| 986 | * port-A --> pin 39/41, port-E --> pin 14/15, port-D --> pin 35/36 |
| 987 | */ |
| 988 | static void alc_subsystem_id(struct hda_codec *codec, |
| 989 | unsigned int porta, unsigned int porte, |
| 990 | unsigned int portd) |
| 991 | { |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 992 | unsigned int ass, tmp, i; |
| 993 | unsigned nid; |
| 994 | struct alc_spec *spec = codec->spec; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 995 | |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 996 | ass = codec->subsystem_id & 0xffff; |
| 997 | if ((ass != codec->bus->pci->subsystem_device) && (ass & 1)) |
| 998 | goto do_sku; |
| 999 | |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 1000 | /* |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1001 | * 31~30 : port conetcivity |
| 1002 | * 29~21 : reserve |
| 1003 | * 20 : PCBEEP input |
| 1004 | * 19~16 : Check sum (15:1) |
| 1005 | * 15~1 : Custom |
| 1006 | * 0 : override |
| 1007 | */ |
| 1008 | nid = 0x1d; |
| 1009 | if (codec->vendor_id == 0x10ec0260) |
| 1010 | nid = 0x17; |
| 1011 | ass = snd_hda_codec_read(codec, nid, 0, |
| 1012 | AC_VERB_GET_CONFIG_DEFAULT, 0); |
| 1013 | if (!(ass & 1) && !(ass & 0x100000)) |
| 1014 | return; |
| 1015 | if ((ass >> 30) != 1) /* no physical connection */ |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 1016 | return; |
| 1017 | |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1018 | /* check sum */ |
| 1019 | tmp = 0; |
| 1020 | for (i = 1; i < 16; i++) { |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 1021 | if ((ass >> i) & 1) |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1022 | tmp++; |
| 1023 | } |
| 1024 | if (((ass >> 16) & 0xf) != tmp) |
| 1025 | return; |
| 1026 | do_sku: |
| 1027 | /* |
| 1028 | * 0 : override |
| 1029 | * 1 : Swap Jack |
| 1030 | * 2 : 0 --> Desktop, 1 --> Laptop |
| 1031 | * 3~5 : External Amplifier control |
| 1032 | * 7~6 : Reserved |
| 1033 | */ |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 1034 | tmp = (ass & 0x38) >> 3; /* external Amp control */ |
| 1035 | switch (tmp) { |
| 1036 | case 1: |
| 1037 | snd_hda_sequence_write(codec, alc_gpio1_init_verbs); |
| 1038 | break; |
| 1039 | case 3: |
| 1040 | snd_hda_sequence_write(codec, alc_gpio2_init_verbs); |
| 1041 | break; |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 1042 | case 7: |
| 1043 | snd_hda_sequence_write(codec, alc_gpio3_init_verbs); |
| 1044 | break; |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1045 | case 5: /* set EAPD output high */ |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 1046 | switch (codec->vendor_id) { |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1047 | case 0x10ec0260: |
| 1048 | snd_hda_codec_write(codec, 0x0f, 0, |
| 1049 | AC_VERB_SET_EAPD_BTLENABLE, 2); |
| 1050 | snd_hda_codec_write(codec, 0x10, 0, |
| 1051 | AC_VERB_SET_EAPD_BTLENABLE, 2); |
| 1052 | break; |
| 1053 | case 0x10ec0262: |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 1054 | case 0x10ec0267: |
| 1055 | case 0x10ec0268: |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1056 | case 0x10ec0269: |
Takashi Iwai | c6e8f2d | 2009-02-06 12:45:52 +0100 | [diff] [blame] | 1057 | case 0x10ec0272: |
Kailang Yang | f9423e7 | 2008-05-27 12:32:25 +0200 | [diff] [blame] | 1058 | case 0x10ec0660: |
| 1059 | case 0x10ec0662: |
| 1060 | case 0x10ec0663: |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1061 | case 0x10ec0862: |
Takashi Iwai | 20a3a05 | 2008-05-23 17:52:53 +0200 | [diff] [blame] | 1062 | case 0x10ec0889: |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 1063 | snd_hda_codec_write(codec, 0x14, 0, |
| 1064 | AC_VERB_SET_EAPD_BTLENABLE, 2); |
| 1065 | snd_hda_codec_write(codec, 0x15, 0, |
| 1066 | AC_VERB_SET_EAPD_BTLENABLE, 2); |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1067 | break; |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 1068 | } |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1069 | switch (codec->vendor_id) { |
| 1070 | case 0x10ec0260: |
| 1071 | snd_hda_codec_write(codec, 0x1a, 0, |
| 1072 | AC_VERB_SET_COEF_INDEX, 7); |
| 1073 | tmp = snd_hda_codec_read(codec, 0x1a, 0, |
| 1074 | AC_VERB_GET_PROC_COEF, 0); |
| 1075 | snd_hda_codec_write(codec, 0x1a, 0, |
| 1076 | AC_VERB_SET_COEF_INDEX, 7); |
| 1077 | snd_hda_codec_write(codec, 0x1a, 0, |
| 1078 | AC_VERB_SET_PROC_COEF, |
| 1079 | tmp | 0x2010); |
| 1080 | break; |
| 1081 | case 0x10ec0262: |
| 1082 | case 0x10ec0880: |
| 1083 | case 0x10ec0882: |
| 1084 | case 0x10ec0883: |
| 1085 | case 0x10ec0885: |
Takashi Iwai | 4a5a4c5 | 2009-02-06 12:46:59 +0100 | [diff] [blame] | 1086 | case 0x10ec0887: |
Takashi Iwai | 20a3a05 | 2008-05-23 17:52:53 +0200 | [diff] [blame] | 1087 | case 0x10ec0889: |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1088 | snd_hda_codec_write(codec, 0x20, 0, |
| 1089 | AC_VERB_SET_COEF_INDEX, 7); |
| 1090 | tmp = snd_hda_codec_read(codec, 0x20, 0, |
| 1091 | AC_VERB_GET_PROC_COEF, 0); |
| 1092 | snd_hda_codec_write(codec, 0x20, 0, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 1093 | AC_VERB_SET_COEF_INDEX, 7); |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1094 | snd_hda_codec_write(codec, 0x20, 0, |
| 1095 | AC_VERB_SET_PROC_COEF, |
| 1096 | tmp | 0x2010); |
| 1097 | break; |
Kailang Yang | f9423e7 | 2008-05-27 12:32:25 +0200 | [diff] [blame] | 1098 | case 0x10ec0888: |
Takashi Iwai | 1082c74 | 2008-08-22 15:24:22 +0200 | [diff] [blame] | 1099 | /*alc888_coef_init(codec);*/ /* called in alc_init() */ |
Kailang Yang | f9423e7 | 2008-05-27 12:32:25 +0200 | [diff] [blame] | 1100 | break; |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1101 | case 0x10ec0267: |
| 1102 | case 0x10ec0268: |
| 1103 | snd_hda_codec_write(codec, 0x20, 0, |
| 1104 | AC_VERB_SET_COEF_INDEX, 7); |
| 1105 | tmp = snd_hda_codec_read(codec, 0x20, 0, |
| 1106 | AC_VERB_GET_PROC_COEF, 0); |
| 1107 | snd_hda_codec_write(codec, 0x20, 0, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 1108 | AC_VERB_SET_COEF_INDEX, 7); |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1109 | snd_hda_codec_write(codec, 0x20, 0, |
| 1110 | AC_VERB_SET_PROC_COEF, |
| 1111 | tmp | 0x3000); |
| 1112 | break; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 1113 | } |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1114 | default: |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 1115 | break; |
| 1116 | } |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 1117 | |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 1118 | /* is laptop or Desktop and enable the function "Mute internal speaker |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1119 | * when the external headphone out jack is plugged" |
| 1120 | */ |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 1121 | if (!(ass & 0x8000)) |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1122 | return; |
| 1123 | /* |
| 1124 | * 10~8 : Jack location |
| 1125 | * 12~11: Headphone out -> 00: PortA, 01: PortE, 02: PortD, 03: Resvered |
| 1126 | * 14~13: Resvered |
| 1127 | * 15 : 1 --> enable the function "Mute internal speaker |
| 1128 | * when the external headphone out jack is plugged" |
| 1129 | */ |
| 1130 | if (!spec->autocfg.speaker_pins[0]) { |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 1131 | if (spec->autocfg.line_out_pins[0]) |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1132 | spec->autocfg.speaker_pins[0] = |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 1133 | spec->autocfg.line_out_pins[0]; |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1134 | else |
| 1135 | return; |
| 1136 | } |
| 1137 | |
| 1138 | if (!spec->autocfg.hp_pins[0]) { |
| 1139 | tmp = (ass >> 11) & 0x3; /* HP to chassis */ |
| 1140 | if (tmp == 0) |
| 1141 | spec->autocfg.hp_pins[0] = porta; |
| 1142 | else if (tmp == 1) |
| 1143 | spec->autocfg.hp_pins[0] = porte; |
| 1144 | else if (tmp == 2) |
| 1145 | spec->autocfg.hp_pins[0] = portd; |
| 1146 | else |
| 1147 | return; |
| 1148 | } |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 1149 | if (spec->autocfg.hp_pins[0]) |
| 1150 | snd_hda_codec_write(codec, spec->autocfg.hp_pins[0], 0, |
| 1151 | AC_VERB_SET_UNSOLICITED_ENABLE, |
| 1152 | AC_USRSP_EN | ALC880_HP_EVENT); |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1153 | |
Takashi Iwai | 4605b71 | 2008-10-31 14:18:24 +0100 | [diff] [blame] | 1154 | #if 0 /* it's broken in some acses -- temporarily disabled */ |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 1155 | if (spec->autocfg.input_pins[AUTO_PIN_MIC] && |
| 1156 | spec->autocfg.input_pins[AUTO_PIN_FRONT_MIC]) |
| 1157 | snd_hda_codec_write(codec, |
| 1158 | spec->autocfg.input_pins[AUTO_PIN_MIC], 0, |
| 1159 | AC_VERB_SET_UNSOLICITED_ENABLE, |
| 1160 | AC_USRSP_EN | ALC880_MIC_EVENT); |
Takashi Iwai | 4605b71 | 2008-10-31 14:18:24 +0100 | [diff] [blame] | 1161 | #endif /* disabled */ |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 1162 | |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1163 | spec->unsol_event = alc_sku_unsol_event; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 1164 | } |
| 1165 | |
Takashi Iwai | 41e41f1 | 2005-06-08 14:48:49 +0200 | [diff] [blame] | 1166 | /* |
Takashi Iwai | f95474e | 2007-07-10 00:47:43 +0200 | [diff] [blame] | 1167 | * Fix-up pin default configurations |
| 1168 | */ |
| 1169 | |
| 1170 | struct alc_pincfg { |
| 1171 | hda_nid_t nid; |
| 1172 | u32 val; |
| 1173 | }; |
| 1174 | |
| 1175 | static void alc_fix_pincfg(struct hda_codec *codec, |
| 1176 | const struct snd_pci_quirk *quirk, |
| 1177 | const struct alc_pincfg **pinfix) |
| 1178 | { |
| 1179 | const struct alc_pincfg *cfg; |
| 1180 | |
| 1181 | quirk = snd_pci_quirk_lookup(codec->bus->pci, quirk); |
| 1182 | if (!quirk) |
| 1183 | return; |
| 1184 | |
| 1185 | cfg = pinfix[quirk->value]; |
| 1186 | for (; cfg->nid; cfg++) { |
| 1187 | int i; |
| 1188 | u32 val = cfg->val; |
| 1189 | for (i = 0; i < 4; i++) { |
| 1190 | snd_hda_codec_write(codec, cfg->nid, 0, |
| 1191 | AC_VERB_SET_CONFIG_DEFAULT_BYTES_0 + i, |
| 1192 | val & 0xff); |
| 1193 | val >>= 8; |
| 1194 | } |
| 1195 | } |
| 1196 | } |
| 1197 | |
| 1198 | /* |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 1199 | * ALC888 |
| 1200 | */ |
| 1201 | |
| 1202 | /* |
| 1203 | * 2ch mode |
| 1204 | */ |
| 1205 | static struct hda_verb alc888_4ST_ch2_intel_init[] = { |
| 1206 | /* Mic-in jack as mic in */ |
| 1207 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 1208 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 1209 | /* Line-in jack as Line in */ |
| 1210 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 1211 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 1212 | /* Line-Out as Front */ |
| 1213 | { 0x17, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 1214 | { } /* end */ |
| 1215 | }; |
| 1216 | |
| 1217 | /* |
| 1218 | * 4ch mode |
| 1219 | */ |
| 1220 | static struct hda_verb alc888_4ST_ch4_intel_init[] = { |
| 1221 | /* Mic-in jack as mic in */ |
| 1222 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 1223 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 1224 | /* Line-in jack as Surround */ |
| 1225 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 1226 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 1227 | /* Line-Out as Front */ |
| 1228 | { 0x17, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 1229 | { } /* end */ |
| 1230 | }; |
| 1231 | |
| 1232 | /* |
| 1233 | * 6ch mode |
| 1234 | */ |
| 1235 | static struct hda_verb alc888_4ST_ch6_intel_init[] = { |
| 1236 | /* Mic-in jack as CLFE */ |
| 1237 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 1238 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 1239 | /* Line-in jack as Surround */ |
| 1240 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 1241 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 1242 | /* Line-Out as CLFE (workaround because Mic-in is not loud enough) */ |
| 1243 | { 0x17, AC_VERB_SET_CONNECT_SEL, 0x03}, |
| 1244 | { } /* end */ |
| 1245 | }; |
| 1246 | |
| 1247 | /* |
| 1248 | * 8ch mode |
| 1249 | */ |
| 1250 | static struct hda_verb alc888_4ST_ch8_intel_init[] = { |
| 1251 | /* Mic-in jack as CLFE */ |
| 1252 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 1253 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 1254 | /* Line-in jack as Surround */ |
| 1255 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 1256 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 1257 | /* Line-Out as Side */ |
| 1258 | { 0x17, AC_VERB_SET_CONNECT_SEL, 0x03}, |
| 1259 | { } /* end */ |
| 1260 | }; |
| 1261 | |
| 1262 | static struct hda_channel_mode alc888_4ST_8ch_intel_modes[4] = { |
| 1263 | { 2, alc888_4ST_ch2_intel_init }, |
| 1264 | { 4, alc888_4ST_ch4_intel_init }, |
| 1265 | { 6, alc888_4ST_ch6_intel_init }, |
| 1266 | { 8, alc888_4ST_ch8_intel_init }, |
| 1267 | }; |
| 1268 | |
| 1269 | /* |
| 1270 | * ALC888 Fujitsu Siemens Amillo xa3530 |
| 1271 | */ |
| 1272 | |
| 1273 | static struct hda_verb alc888_fujitsu_xa3530_verbs[] = { |
| 1274 | /* Front Mic: set to PIN_IN (empty by default) */ |
| 1275 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 1276 | /* Connect Internal HP to Front */ |
| 1277 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1278 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1279 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 1280 | /* Connect Bass HP to Front */ |
| 1281 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1282 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1283 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 1284 | /* Connect Line-Out side jack (SPDIF) to Side */ |
| 1285 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1286 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1287 | {0x17, AC_VERB_SET_CONNECT_SEL, 0x03}, |
| 1288 | /* Connect Mic jack to CLFE */ |
| 1289 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1290 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1291 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 1292 | /* Connect Line-in jack to Surround */ |
| 1293 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1294 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1295 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 1296 | /* Connect HP out jack to Front */ |
| 1297 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1298 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1299 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 1300 | /* Enable unsolicited event for HP jack and Line-out jack */ |
| 1301 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 1302 | {0x17, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 1303 | {} |
| 1304 | }; |
| 1305 | |
| 1306 | static void alc888_fujitsu_xa3530_automute(struct hda_codec *codec) |
| 1307 | { |
| 1308 | unsigned int present; |
| 1309 | unsigned int bits; |
| 1310 | /* Line out presence */ |
| 1311 | present = snd_hda_codec_read(codec, 0x17, 0, |
| 1312 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 1313 | /* HP out presence */ |
| 1314 | present = present || snd_hda_codec_read(codec, 0x1b, 0, |
| 1315 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 1316 | bits = present ? HDA_AMP_MUTE : 0; |
| 1317 | /* Toggle internal speakers muting */ |
| 1318 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 1319 | HDA_AMP_MUTE, bits); |
| 1320 | /* Toggle internal bass muting */ |
| 1321 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 1322 | HDA_AMP_MUTE, bits); |
| 1323 | } |
| 1324 | |
| 1325 | static void alc888_fujitsu_xa3530_unsol_event(struct hda_codec *codec, |
| 1326 | unsigned int res) |
| 1327 | { |
| 1328 | if (res >> 26 == ALC880_HP_EVENT) |
| 1329 | alc888_fujitsu_xa3530_automute(codec); |
| 1330 | } |
| 1331 | |
| 1332 | |
| 1333 | /* |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 1334 | * ALC888 Acer Aspire 4930G model |
| 1335 | */ |
| 1336 | |
| 1337 | static struct hda_verb alc888_acer_aspire_4930g_verbs[] = { |
| 1338 | /* Front Mic: set to PIN_IN (empty by default) */ |
| 1339 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 1340 | /* Unselect Front Mic by default in input mixer 3 */ |
| 1341 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0xb)}, |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 1342 | /* Enable unsolicited event for HP jack */ |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 1343 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 1344 | /* Connect Internal HP to front */ |
| 1345 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1346 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1347 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 1348 | /* Connect HP out to front */ |
| 1349 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1350 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1351 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 1352 | { } |
| 1353 | }; |
| 1354 | |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 1355 | static struct hda_input_mux alc888_2_capture_sources[2] = { |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 1356 | /* Front mic only available on one ADC */ |
| 1357 | { |
| 1358 | .num_items = 4, |
| 1359 | .items = { |
| 1360 | { "Mic", 0x0 }, |
| 1361 | { "Line", 0x2 }, |
| 1362 | { "CD", 0x4 }, |
| 1363 | { "Front Mic", 0xb }, |
| 1364 | }, |
| 1365 | }, |
| 1366 | { |
| 1367 | .num_items = 3, |
| 1368 | .items = { |
| 1369 | { "Mic", 0x0 }, |
| 1370 | { "Line", 0x2 }, |
| 1371 | { "CD", 0x4 }, |
| 1372 | }, |
| 1373 | } |
| 1374 | }; |
| 1375 | |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 1376 | static struct snd_kcontrol_new alc888_base_mixer[] = { |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 1377 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 1378 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 1379 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 1380 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
| 1381 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, |
| 1382 | HDA_OUTPUT), |
| 1383 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 1384 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 1385 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 1386 | HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
| 1387 | HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT), |
| 1388 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 1389 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 1390 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 1391 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 1392 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 1393 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 1394 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 1395 | { } /* end */ |
| 1396 | }; |
| 1397 | |
| 1398 | static void alc888_acer_aspire_4930g_automute(struct hda_codec *codec) |
| 1399 | { |
| 1400 | unsigned int present; |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 1401 | unsigned int bits; |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 1402 | present = snd_hda_codec_read(codec, 0x15, 0, |
| 1403 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 1404 | bits = present ? HDA_AMP_MUTE : 0; |
| 1405 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 1406 | HDA_AMP_MUTE, bits); |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 1407 | } |
| 1408 | |
| 1409 | static void alc888_acer_aspire_4930g_unsol_event(struct hda_codec *codec, |
| 1410 | unsigned int res) |
| 1411 | { |
| 1412 | if (res >> 26 == ALC880_HP_EVENT) |
| 1413 | alc888_acer_aspire_4930g_automute(codec); |
| 1414 | } |
| 1415 | |
| 1416 | /* |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1417 | * ALC880 3-stack model |
| 1418 | * |
| 1419 | * DAC: Front = 0x02 (0x0c), Surr = 0x05 (0x0f), CLFE = 0x04 (0x0e) |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 1420 | * Pin assignment: Front = 0x14, Line-In/Surr = 0x1a, Mic/CLFE = 0x18, |
| 1421 | * F-Mic = 0x1b, HP = 0x19 |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1422 | */ |
| 1423 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1424 | static hda_nid_t alc880_dac_nids[4] = { |
| 1425 | /* front, rear, clfe, rear_surr */ |
| 1426 | 0x02, 0x05, 0x04, 0x03 |
| 1427 | }; |
| 1428 | |
| 1429 | static hda_nid_t alc880_adc_nids[3] = { |
| 1430 | /* ADC0-2 */ |
| 1431 | 0x07, 0x08, 0x09, |
| 1432 | }; |
| 1433 | |
| 1434 | /* The datasheet says the node 0x07 is connected from inputs, |
| 1435 | * but it shows zero connection in the real implementation on some devices. |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 1436 | * Note: this is a 915GAV bug, fixed on 915GLV |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1437 | */ |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1438 | static hda_nid_t alc880_adc_nids_alt[2] = { |
| 1439 | /* ADC1-2 */ |
| 1440 | 0x08, 0x09, |
| 1441 | }; |
| 1442 | |
| 1443 | #define ALC880_DIGOUT_NID 0x06 |
| 1444 | #define ALC880_DIGIN_NID 0x0a |
| 1445 | |
| 1446 | static struct hda_input_mux alc880_capture_source = { |
| 1447 | .num_items = 4, |
| 1448 | .items = { |
| 1449 | { "Mic", 0x0 }, |
| 1450 | { "Front Mic", 0x3 }, |
| 1451 | { "Line", 0x2 }, |
| 1452 | { "CD", 0x4 }, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1453 | }, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1454 | }; |
| 1455 | |
| 1456 | /* channel source setting (2/6 channel selection for 3-stack) */ |
| 1457 | /* 2ch mode */ |
| 1458 | static struct hda_verb alc880_threestack_ch2_init[] = { |
| 1459 | /* set line-in to input, mute it */ |
| 1460 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 1461 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 1462 | /* set mic-in to input vref 80%, mute it */ |
| 1463 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 1464 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1465 | { } /* end */ |
| 1466 | }; |
| 1467 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1468 | /* 6ch mode */ |
| 1469 | static struct hda_verb alc880_threestack_ch6_init[] = { |
| 1470 | /* set line-in to output, unmute it */ |
| 1471 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 1472 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 1473 | /* set mic-in to output, unmute it */ |
| 1474 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 1475 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 1476 | { } /* end */ |
| 1477 | }; |
| 1478 | |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 1479 | static struct hda_channel_mode alc880_threestack_modes[2] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1480 | { 2, alc880_threestack_ch2_init }, |
| 1481 | { 6, alc880_threestack_ch6_init }, |
| 1482 | }; |
| 1483 | |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 1484 | static struct snd_kcontrol_new alc880_three_stack_mixer[] = { |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 1485 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 1486 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 1487 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 1488 | HDA_BIND_MUTE("Surround Playback Switch", 0x0f, 2, HDA_INPUT), |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 1489 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 1490 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 1491 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 1492 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1493 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 1494 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 1495 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 1496 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 1497 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 1498 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 1499 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x3, HDA_INPUT), |
| 1500 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x3, HDA_INPUT), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1501 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x19, 0x0, HDA_OUTPUT), |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1502 | { |
| 1503 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 1504 | .name = "Channel Mode", |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 1505 | .info = alc_ch_mode_info, |
| 1506 | .get = alc_ch_mode_get, |
| 1507 | .put = alc_ch_mode_put, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1508 | }, |
| 1509 | { } /* end */ |
| 1510 | }; |
| 1511 | |
| 1512 | /* capture mixer elements */ |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 1513 | static int alc_cap_vol_info(struct snd_kcontrol *kcontrol, |
| 1514 | struct snd_ctl_elem_info *uinfo) |
| 1515 | { |
| 1516 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 1517 | struct alc_spec *spec = codec->spec; |
| 1518 | int err; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1519 | |
Wu Fengguang | 5a9e02e | 2009-01-09 16:45:24 +0800 | [diff] [blame] | 1520 | mutex_lock(&codec->control_mutex); |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 1521 | kcontrol->private_value = HDA_COMPOSE_AMP_VAL(spec->adc_nids[0], 3, 0, |
| 1522 | HDA_INPUT); |
| 1523 | err = snd_hda_mixer_amp_volume_info(kcontrol, uinfo); |
Wu Fengguang | 5a9e02e | 2009-01-09 16:45:24 +0800 | [diff] [blame] | 1524 | mutex_unlock(&codec->control_mutex); |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 1525 | return err; |
| 1526 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1527 | |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 1528 | static int alc_cap_vol_tlv(struct snd_kcontrol *kcontrol, int op_flag, |
| 1529 | unsigned int size, unsigned int __user *tlv) |
| 1530 | { |
| 1531 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 1532 | struct alc_spec *spec = codec->spec; |
| 1533 | int err; |
| 1534 | |
Wu Fengguang | 5a9e02e | 2009-01-09 16:45:24 +0800 | [diff] [blame] | 1535 | mutex_lock(&codec->control_mutex); |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 1536 | kcontrol->private_value = HDA_COMPOSE_AMP_VAL(spec->adc_nids[0], 3, 0, |
| 1537 | HDA_INPUT); |
| 1538 | err = snd_hda_mixer_amp_tlv(kcontrol, op_flag, size, tlv); |
Wu Fengguang | 5a9e02e | 2009-01-09 16:45:24 +0800 | [diff] [blame] | 1539 | mutex_unlock(&codec->control_mutex); |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 1540 | return err; |
| 1541 | } |
| 1542 | |
| 1543 | typedef int (*getput_call_t)(struct snd_kcontrol *kcontrol, |
| 1544 | struct snd_ctl_elem_value *ucontrol); |
| 1545 | |
| 1546 | static int alc_cap_getput_caller(struct snd_kcontrol *kcontrol, |
| 1547 | struct snd_ctl_elem_value *ucontrol, |
| 1548 | getput_call_t func) |
| 1549 | { |
| 1550 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 1551 | struct alc_spec *spec = codec->spec; |
| 1552 | unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id); |
| 1553 | int err; |
| 1554 | |
Wu Fengguang | 5a9e02e | 2009-01-09 16:45:24 +0800 | [diff] [blame] | 1555 | mutex_lock(&codec->control_mutex); |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 1556 | kcontrol->private_value = HDA_COMPOSE_AMP_VAL(spec->adc_nids[adc_idx], |
| 1557 | 3, 0, HDA_INPUT); |
| 1558 | err = func(kcontrol, ucontrol); |
Wu Fengguang | 5a9e02e | 2009-01-09 16:45:24 +0800 | [diff] [blame] | 1559 | mutex_unlock(&codec->control_mutex); |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 1560 | return err; |
| 1561 | } |
| 1562 | |
| 1563 | static int alc_cap_vol_get(struct snd_kcontrol *kcontrol, |
| 1564 | struct snd_ctl_elem_value *ucontrol) |
| 1565 | { |
| 1566 | return alc_cap_getput_caller(kcontrol, ucontrol, |
| 1567 | snd_hda_mixer_amp_volume_get); |
| 1568 | } |
| 1569 | |
| 1570 | static int alc_cap_vol_put(struct snd_kcontrol *kcontrol, |
| 1571 | struct snd_ctl_elem_value *ucontrol) |
| 1572 | { |
| 1573 | return alc_cap_getput_caller(kcontrol, ucontrol, |
| 1574 | snd_hda_mixer_amp_volume_put); |
| 1575 | } |
| 1576 | |
| 1577 | /* capture mixer elements */ |
| 1578 | #define alc_cap_sw_info snd_ctl_boolean_stereo_info |
| 1579 | |
| 1580 | static int alc_cap_sw_get(struct snd_kcontrol *kcontrol, |
| 1581 | struct snd_ctl_elem_value *ucontrol) |
| 1582 | { |
| 1583 | return alc_cap_getput_caller(kcontrol, ucontrol, |
| 1584 | snd_hda_mixer_amp_switch_get); |
| 1585 | } |
| 1586 | |
| 1587 | static int alc_cap_sw_put(struct snd_kcontrol *kcontrol, |
| 1588 | struct snd_ctl_elem_value *ucontrol) |
| 1589 | { |
| 1590 | return alc_cap_getput_caller(kcontrol, ucontrol, |
| 1591 | snd_hda_mixer_amp_switch_put); |
| 1592 | } |
| 1593 | |
| 1594 | #define DEFINE_CAPMIX(num) \ |
| 1595 | static struct snd_kcontrol_new alc_capture_mixer ## num[] = { \ |
| 1596 | { \ |
| 1597 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \ |
| 1598 | .name = "Capture Switch", \ |
| 1599 | .access = SNDRV_CTL_ELEM_ACCESS_READWRITE, \ |
| 1600 | .count = num, \ |
| 1601 | .info = alc_cap_sw_info, \ |
| 1602 | .get = alc_cap_sw_get, \ |
| 1603 | .put = alc_cap_sw_put, \ |
| 1604 | }, \ |
| 1605 | { \ |
| 1606 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \ |
| 1607 | .name = "Capture Volume", \ |
| 1608 | .access = (SNDRV_CTL_ELEM_ACCESS_READWRITE | \ |
| 1609 | SNDRV_CTL_ELEM_ACCESS_TLV_READ | \ |
| 1610 | SNDRV_CTL_ELEM_ACCESS_TLV_CALLBACK), \ |
| 1611 | .count = num, \ |
| 1612 | .info = alc_cap_vol_info, \ |
| 1613 | .get = alc_cap_vol_get, \ |
| 1614 | .put = alc_cap_vol_put, \ |
| 1615 | .tlv = { .c = alc_cap_vol_tlv }, \ |
| 1616 | }, \ |
Takashi Iwai | 3c3e989 | 2008-10-31 17:48:56 +0100 | [diff] [blame] | 1617 | { \ |
| 1618 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \ |
| 1619 | /* .name = "Capture Source", */ \ |
| 1620 | .name = "Input Source", \ |
| 1621 | .count = num, \ |
| 1622 | .info = alc_mux_enum_info, \ |
| 1623 | .get = alc_mux_enum_get, \ |
| 1624 | .put = alc_mux_enum_put, \ |
| 1625 | }, \ |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 1626 | { } /* end */ \ |
| 1627 | } |
| 1628 | |
| 1629 | /* up to three ADCs */ |
| 1630 | DEFINE_CAPMIX(1); |
| 1631 | DEFINE_CAPMIX(2); |
| 1632 | DEFINE_CAPMIX(3); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1633 | |
| 1634 | |
| 1635 | /* |
| 1636 | * ALC880 5-stack model |
| 1637 | * |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 1638 | * DAC: Front = 0x02 (0x0c), Surr = 0x05 (0x0f), CLFE = 0x04 (0x0d), |
| 1639 | * Side = 0x02 (0xd) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1640 | * Pin assignment: Front = 0x14, Surr = 0x17, CLFE = 0x16 |
| 1641 | * Line-In/Side = 0x1a, Mic = 0x18, F-Mic = 0x1b, HP = 0x19 |
| 1642 | */ |
| 1643 | |
| 1644 | /* additional mixers to alc880_three_stack_mixer */ |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 1645 | static struct snd_kcontrol_new alc880_five_stack_mixer[] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1646 | HDA_CODEC_VOLUME("Side Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 1647 | HDA_BIND_MUTE("Side Playback Switch", 0x0d, 2, HDA_INPUT), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1648 | { } /* end */ |
| 1649 | }; |
| 1650 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1651 | /* channel source setting (6/8 channel selection for 5-stack) */ |
| 1652 | /* 6ch mode */ |
| 1653 | static struct hda_verb alc880_fivestack_ch6_init[] = { |
| 1654 | /* set line-in to input, mute it */ |
| 1655 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 1656 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
Takashi Iwai | dfc0ff6 | 2005-05-12 14:31:49 +0200 | [diff] [blame] | 1657 | { } /* end */ |
| 1658 | }; |
| 1659 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1660 | /* 8ch mode */ |
| 1661 | static struct hda_verb alc880_fivestack_ch8_init[] = { |
| 1662 | /* set line-in to output, unmute it */ |
| 1663 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 1664 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 1665 | { } /* end */ |
| 1666 | }; |
| 1667 | |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 1668 | static struct hda_channel_mode alc880_fivestack_modes[2] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1669 | { 6, alc880_fivestack_ch6_init }, |
| 1670 | { 8, alc880_fivestack_ch8_init }, |
| 1671 | }; |
| 1672 | |
| 1673 | |
| 1674 | /* |
| 1675 | * ALC880 6-stack model |
| 1676 | * |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 1677 | * DAC: Front = 0x02 (0x0c), Surr = 0x03 (0x0d), CLFE = 0x04 (0x0e), |
| 1678 | * Side = 0x05 (0x0f) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1679 | * Pin assignment: Front = 0x14, Surr = 0x15, CLFE = 0x16, Side = 0x17, |
| 1680 | * Mic = 0x18, F-Mic = 0x19, Line = 0x1a, HP = 0x1b |
| 1681 | */ |
| 1682 | |
| 1683 | static hda_nid_t alc880_6st_dac_nids[4] = { |
| 1684 | /* front, rear, clfe, rear_surr */ |
| 1685 | 0x02, 0x03, 0x04, 0x05 |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 1686 | }; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1687 | |
| 1688 | static struct hda_input_mux alc880_6stack_capture_source = { |
| 1689 | .num_items = 4, |
| 1690 | .items = { |
| 1691 | { "Mic", 0x0 }, |
| 1692 | { "Front Mic", 0x1 }, |
| 1693 | { "Line", 0x2 }, |
| 1694 | { "CD", 0x4 }, |
| 1695 | }, |
| 1696 | }; |
| 1697 | |
| 1698 | /* fixed 8-channels */ |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 1699 | static struct hda_channel_mode alc880_sixstack_modes[1] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1700 | { 8, NULL }, |
| 1701 | }; |
| 1702 | |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 1703 | static struct snd_kcontrol_new alc880_six_stack_mixer[] = { |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1704 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 1705 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1706 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 1707 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1708 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 1709 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 1710 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 1711 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1712 | HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 1713 | HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1714 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 1715 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 1716 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 1717 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 1718 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 1719 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 1720 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 1721 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1722 | { |
| 1723 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 1724 | .name = "Channel Mode", |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 1725 | .info = alc_ch_mode_info, |
| 1726 | .get = alc_ch_mode_get, |
| 1727 | .put = alc_ch_mode_put, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1728 | }, |
| 1729 | { } /* end */ |
| 1730 | }; |
| 1731 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1732 | |
| 1733 | /* |
| 1734 | * ALC880 W810 model |
| 1735 | * |
| 1736 | * W810 has rear IO for: |
| 1737 | * Front (DAC 02) |
| 1738 | * Surround (DAC 03) |
| 1739 | * Center/LFE (DAC 04) |
| 1740 | * Digital out (06) |
| 1741 | * |
| 1742 | * The system also has a pair of internal speakers, and a headphone jack. |
| 1743 | * 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] | 1744 | * |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1745 | * There is a variable resistor to control the speaker or headphone |
| 1746 | * volume. This is a hardware-only device without a software API. |
| 1747 | * |
| 1748 | * Plugging headphones in will disable the internal speakers. This is |
| 1749 | * implemented in hardware, not via the driver using jack sense. In |
| 1750 | * a similar fashion, plugging into the rear socket marked "front" will |
| 1751 | * disable both the speakers and headphones. |
| 1752 | * |
| 1753 | * For input, there's a microphone jack, and an "audio in" jack. |
| 1754 | * These may not do anything useful with this driver yet, because I |
| 1755 | * haven't setup any initialization verbs for these yet... |
| 1756 | */ |
| 1757 | |
| 1758 | static hda_nid_t alc880_w810_dac_nids[3] = { |
| 1759 | /* front, rear/surround, clfe */ |
| 1760 | 0x02, 0x03, 0x04 |
| 1761 | }; |
| 1762 | |
| 1763 | /* fixed 6 channels */ |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 1764 | static struct hda_channel_mode alc880_w810_modes[1] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1765 | { 6, NULL } |
| 1766 | }; |
| 1767 | |
| 1768 | /* Pin assignment: Front = 0x14, Surr = 0x15, CLFE = 0x16, HP = 0x1b */ |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 1769 | static struct snd_kcontrol_new alc880_w810_base_mixer[] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1770 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 1771 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1772 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 1773 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1774 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 1775 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 1776 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 1777 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1778 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 1779 | { } /* end */ |
| 1780 | }; |
| 1781 | |
| 1782 | |
| 1783 | /* |
| 1784 | * Z710V model |
| 1785 | * |
| 1786 | * DAC: Front = 0x02 (0x0c), HP = 0x03 (0x0d) |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 1787 | * Pin assignment: Front = 0x14, HP = 0x15, Mic = 0x18, Mic2 = 0x19(?), |
| 1788 | * Line = 0x1a |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1789 | */ |
| 1790 | |
| 1791 | static hda_nid_t alc880_z71v_dac_nids[1] = { |
| 1792 | 0x02 |
| 1793 | }; |
| 1794 | #define ALC880_Z71V_HP_DAC 0x03 |
| 1795 | |
| 1796 | /* fixed 2 channels */ |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 1797 | static struct hda_channel_mode alc880_2_jack_modes[1] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1798 | { 2, NULL } |
| 1799 | }; |
| 1800 | |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 1801 | static struct snd_kcontrol_new alc880_z71v_mixer[] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1802 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 1803 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1804 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 1805 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT), |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1806 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 1807 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 1808 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 1809 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 1810 | { } /* end */ |
| 1811 | }; |
| 1812 | |
| 1813 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1814 | /* |
| 1815 | * ALC880 F1734 model |
| 1816 | * |
| 1817 | * DAC: HP = 0x02 (0x0c), Front = 0x03 (0x0d) |
| 1818 | * Pin assignment: HP = 0x14, Front = 0x15, Mic = 0x18 |
| 1819 | */ |
| 1820 | |
| 1821 | static hda_nid_t alc880_f1734_dac_nids[1] = { |
| 1822 | 0x03 |
| 1823 | }; |
| 1824 | #define ALC880_F1734_HP_DAC 0x02 |
| 1825 | |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 1826 | static struct snd_kcontrol_new alc880_f1734_mixer[] = { |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1827 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 1828 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT), |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 1829 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 1830 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1831 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 1832 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
Takashi Iwai | 937b416 | 2008-02-11 14:52:36 +0100 | [diff] [blame] | 1833 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 1834 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1835 | { } /* end */ |
| 1836 | }; |
| 1837 | |
Takashi Iwai | 937b416 | 2008-02-11 14:52:36 +0100 | [diff] [blame] | 1838 | static struct hda_input_mux alc880_f1734_capture_source = { |
| 1839 | .num_items = 2, |
| 1840 | .items = { |
| 1841 | { "Mic", 0x1 }, |
| 1842 | { "CD", 0x4 }, |
| 1843 | }, |
| 1844 | }; |
| 1845 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1846 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1847 | /* |
| 1848 | * ALC880 ASUS model |
| 1849 | * |
| 1850 | * DAC: HP/Front = 0x02 (0x0c), Surr = 0x03 (0x0d), CLFE = 0x04 (0x0e) |
| 1851 | * Pin assignment: HP/Front = 0x14, Surr = 0x15, CLFE = 0x16, |
| 1852 | * Mic = 0x18, Line = 0x1a |
| 1853 | */ |
| 1854 | |
| 1855 | #define alc880_asus_dac_nids alc880_w810_dac_nids /* identical with w810 */ |
| 1856 | #define alc880_asus_modes alc880_threestack_modes /* 2/6 channel mode */ |
| 1857 | |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 1858 | static struct snd_kcontrol_new alc880_asus_mixer[] = { |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1859 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 1860 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1861 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 1862 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1863 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 1864 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 1865 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 1866 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1867 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 1868 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 1869 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 1870 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 1871 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 1872 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1873 | { |
| 1874 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 1875 | .name = "Channel Mode", |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 1876 | .info = alc_ch_mode_info, |
| 1877 | .get = alc_ch_mode_get, |
| 1878 | .put = alc_ch_mode_put, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1879 | }, |
| 1880 | { } /* end */ |
| 1881 | }; |
| 1882 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1883 | /* |
| 1884 | * ALC880 ASUS W1V model |
| 1885 | * |
| 1886 | * DAC: HP/Front = 0x02 (0x0c), Surr = 0x03 (0x0d), CLFE = 0x04 (0x0e) |
| 1887 | * Pin assignment: HP/Front = 0x14, Surr = 0x15, CLFE = 0x16, |
| 1888 | * Mic = 0x18, Line = 0x1a, Line2 = 0x1b |
| 1889 | */ |
| 1890 | |
| 1891 | /* additional mixers to alc880_asus_mixer */ |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 1892 | static struct snd_kcontrol_new alc880_asus_w1v_mixer[] = { |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1893 | HDA_CODEC_VOLUME("Line2 Playback Volume", 0x0b, 0x03, HDA_INPUT), |
| 1894 | HDA_CODEC_MUTE("Line2 Playback Switch", 0x0b, 0x03, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1895 | { } /* end */ |
| 1896 | }; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1897 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 1898 | /* TCL S700 */ |
| 1899 | static struct snd_kcontrol_new alc880_tcl_s700_mixer[] = { |
| 1900 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 1901 | HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 1902 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 1903 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0B, 0x04, HDA_INPUT), |
| 1904 | HDA_CODEC_MUTE("CD Playback Switch", 0x0B, 0x04, HDA_INPUT), |
| 1905 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0B, 0x0, HDA_INPUT), |
| 1906 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0B, 0x0, HDA_INPUT), |
| 1907 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 1908 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 1909 | { } /* end */ |
| 1910 | }; |
| 1911 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 1912 | /* Uniwill */ |
| 1913 | static struct snd_kcontrol_new alc880_uniwill_mixer[] = { |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 1914 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 1915 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT), |
| 1916 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 1917 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 1918 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 1919 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 1920 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 1921 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 1922 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 1923 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 1924 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 1925 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 1926 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 1927 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 1928 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 1929 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 1930 | { |
| 1931 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 1932 | .name = "Channel Mode", |
| 1933 | .info = alc_ch_mode_info, |
| 1934 | .get = alc_ch_mode_get, |
| 1935 | .put = alc_ch_mode_put, |
| 1936 | }, |
| 1937 | { } /* end */ |
| 1938 | }; |
| 1939 | |
Tobin Davis | 2cf9f0f | 2007-02-07 16:04:25 +0100 | [diff] [blame] | 1940 | static struct snd_kcontrol_new alc880_fujitsu_mixer[] = { |
| 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), |
| 1945 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 1946 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 1947 | HDA_CODEC_VOLUME("Ext Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 1948 | HDA_CODEC_MUTE("Ext Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 1949 | HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 1950 | HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 1951 | { } /* end */ |
| 1952 | }; |
| 1953 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 1954 | static struct snd_kcontrol_new alc880_uniwill_p53_mixer[] = { |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 1955 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 1956 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT), |
| 1957 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 1958 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 1959 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 1960 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 1961 | { } /* end */ |
| 1962 | }; |
| 1963 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1964 | /* |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 1965 | * virtual master controls |
| 1966 | */ |
| 1967 | |
| 1968 | /* |
| 1969 | * slave controls for virtual master |
| 1970 | */ |
| 1971 | static const char *alc_slave_vols[] = { |
| 1972 | "Front Playback Volume", |
| 1973 | "Surround Playback Volume", |
| 1974 | "Center Playback Volume", |
| 1975 | "LFE Playback Volume", |
| 1976 | "Side Playback Volume", |
| 1977 | "Headphone Playback Volume", |
| 1978 | "Speaker Playback Volume", |
| 1979 | "Mono Playback Volume", |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 1980 | "Line-Out Playback Volume", |
Takashi Iwai | 26f5df2 | 2008-11-03 17:39:46 +0100 | [diff] [blame] | 1981 | "PCM Playback Volume", |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 1982 | NULL, |
| 1983 | }; |
| 1984 | |
| 1985 | static const char *alc_slave_sws[] = { |
| 1986 | "Front Playback Switch", |
| 1987 | "Surround Playback Switch", |
| 1988 | "Center Playback Switch", |
| 1989 | "LFE Playback Switch", |
| 1990 | "Side Playback Switch", |
| 1991 | "Headphone Playback Switch", |
| 1992 | "Speaker Playback Switch", |
| 1993 | "Mono Playback Switch", |
Takashi Iwai | edb54a5 | 2008-01-29 12:47:02 +0100 | [diff] [blame] | 1994 | "IEC958 Playback Switch", |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 1995 | NULL, |
| 1996 | }; |
| 1997 | |
| 1998 | /* |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1999 | * build control elements |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2000 | */ |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 2001 | |
| 2002 | static void alc_free_kctls(struct hda_codec *codec); |
| 2003 | |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 2004 | /* additional beep mixers; the actual parameters are overwritten at build */ |
| 2005 | static struct snd_kcontrol_new alc_beep_mixer[] = { |
| 2006 | HDA_CODEC_VOLUME("Beep Playback Volume", 0, 0, HDA_INPUT), |
| 2007 | HDA_CODEC_MUTE("Beep Playback Switch", 0, 0, HDA_INPUT), |
| 2008 | { } /* end */ |
| 2009 | }; |
| 2010 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2011 | static int alc_build_controls(struct hda_codec *codec) |
| 2012 | { |
| 2013 | struct alc_spec *spec = codec->spec; |
| 2014 | int err; |
| 2015 | int i; |
| 2016 | |
| 2017 | for (i = 0; i < spec->num_mixers; i++) { |
| 2018 | err = snd_hda_add_new_ctls(codec, spec->mixers[i]); |
| 2019 | if (err < 0) |
| 2020 | return err; |
| 2021 | } |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 2022 | if (spec->cap_mixer) { |
| 2023 | err = snd_hda_add_new_ctls(codec, spec->cap_mixer); |
| 2024 | if (err < 0) |
| 2025 | return err; |
| 2026 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2027 | if (spec->multiout.dig_out_nid) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 2028 | err = snd_hda_create_spdif_out_ctls(codec, |
| 2029 | spec->multiout.dig_out_nid); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2030 | if (err < 0) |
| 2031 | return err; |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 2032 | if (!spec->no_analog) { |
| 2033 | err = snd_hda_create_spdif_share_sw(codec, |
| 2034 | &spec->multiout); |
| 2035 | if (err < 0) |
| 2036 | return err; |
| 2037 | spec->multiout.share_spdif = 1; |
| 2038 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2039 | } |
| 2040 | if (spec->dig_in_nid) { |
| 2041 | err = snd_hda_create_spdif_in_ctls(codec, spec->dig_in_nid); |
| 2042 | if (err < 0) |
| 2043 | return err; |
| 2044 | } |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 2045 | |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 2046 | /* create beep controls if needed */ |
| 2047 | if (spec->beep_amp) { |
| 2048 | struct snd_kcontrol_new *knew; |
| 2049 | for (knew = alc_beep_mixer; knew->name; knew++) { |
| 2050 | struct snd_kcontrol *kctl; |
| 2051 | kctl = snd_ctl_new1(knew, codec); |
| 2052 | if (!kctl) |
| 2053 | return -ENOMEM; |
| 2054 | kctl->private_value = spec->beep_amp; |
| 2055 | err = snd_hda_ctl_add(codec, kctl); |
| 2056 | if (err < 0) |
| 2057 | return err; |
| 2058 | } |
| 2059 | } |
| 2060 | |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 2061 | /* if we have no master control, let's create it */ |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 2062 | if (!spec->no_analog && |
| 2063 | !snd_hda_find_mixer_ctl(codec, "Master Playback Volume")) { |
Takashi Iwai | 1c82ed1 | 2008-02-18 13:05:50 +0100 | [diff] [blame] | 2064 | unsigned int vmaster_tlv[4]; |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 2065 | snd_hda_set_vmaster_tlv(codec, spec->vmaster_nid, |
Takashi Iwai | 1c82ed1 | 2008-02-18 13:05:50 +0100 | [diff] [blame] | 2066 | HDA_OUTPUT, vmaster_tlv); |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 2067 | err = snd_hda_add_vmaster(codec, "Master Playback Volume", |
Takashi Iwai | 1c82ed1 | 2008-02-18 13:05:50 +0100 | [diff] [blame] | 2068 | vmaster_tlv, alc_slave_vols); |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 2069 | if (err < 0) |
| 2070 | return err; |
| 2071 | } |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 2072 | if (!spec->no_analog && |
| 2073 | !snd_hda_find_mixer_ctl(codec, "Master Playback Switch")) { |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 2074 | err = snd_hda_add_vmaster(codec, "Master Playback Switch", |
| 2075 | NULL, alc_slave_sws); |
| 2076 | if (err < 0) |
| 2077 | return err; |
| 2078 | } |
| 2079 | |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 2080 | alc_free_kctls(codec); /* no longer needed */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2081 | return 0; |
| 2082 | } |
| 2083 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2084 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2085 | /* |
| 2086 | * initialize the codec volumes, etc |
| 2087 | */ |
| 2088 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2089 | /* |
| 2090 | * generic initialization of ADC, input mixers and output mixers |
| 2091 | */ |
| 2092 | static struct hda_verb alc880_volume_init_verbs[] = { |
| 2093 | /* |
| 2094 | * Unmute ADC0-2 and set the default input to mic-in |
| 2095 | */ |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 2096 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2097 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 2098 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2099 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 2100 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2101 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
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 | /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback |
| 2104 | * mixer widget |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 2105 | * Note: PASD motherboards uses the Line In 2 as the input for front |
| 2106 | * panel mic (mic 2) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2107 | */ |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2108 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 2109 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 2110 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 2111 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 2112 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 2113 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 2114 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, |
| 2115 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2116 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2117 | /* |
| 2118 | * Set up output mixers (0x0c - 0x0f) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2119 | */ |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2120 | /* set vol=0 to output mixers */ |
| 2121 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 2122 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 2123 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 2124 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 2125 | /* set up input amps for analog loopback */ |
| 2126 | /* Amp Indices: DAC = 0, mixer = 1 */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 2127 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 2128 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 2129 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 2130 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 2131 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 2132 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 2133 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 2134 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2135 | |
| 2136 | { } |
| 2137 | }; |
| 2138 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2139 | /* |
| 2140 | * 3-stack pin configuration: |
| 2141 | * front = 0x14, mic/clfe = 0x18, HP = 0x19, line/surr = 0x1a, f-mic = 0x1b |
| 2142 | */ |
| 2143 | static struct hda_verb alc880_pin_3stack_init_verbs[] = { |
| 2144 | /* |
| 2145 | * preset connection lists of input pins |
| 2146 | * 0 = front, 1 = rear_surr, 2 = CLFE, 3 = surround |
| 2147 | */ |
| 2148 | {0x10, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */ |
| 2149 | {0x11, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 2150 | {0x12, AC_VERB_SET_CONNECT_SEL, 0x03}, /* line/surround */ |
| 2151 | |
| 2152 | /* |
| 2153 | * Set pin mode and muting |
| 2154 | */ |
| 2155 | /* set front pin widgets 0x14 for output */ |
| 2156 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2157 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2158 | /* Mic1 (rear panel) pin widget for input and vref at 80% */ |
| 2159 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 2160 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 2161 | /* Mic2 (as headphone out) for HP output */ |
| 2162 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 2163 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2164 | /* Line In pin widget for input */ |
| 2165 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 2166 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 2167 | /* Line2 (as front mic) pin widget for input and vref at 80% */ |
| 2168 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 2169 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 2170 | /* CD pin widget for input */ |
| 2171 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 2172 | |
| 2173 | { } |
| 2174 | }; |
| 2175 | |
| 2176 | /* |
| 2177 | * 5-stack pin configuration: |
| 2178 | * front = 0x14, surround = 0x17, clfe = 0x16, mic = 0x18, HP = 0x19, |
| 2179 | * line-in/side = 0x1a, f-mic = 0x1b |
| 2180 | */ |
| 2181 | static struct hda_verb alc880_pin_5stack_init_verbs[] = { |
| 2182 | /* |
| 2183 | * preset connection lists of input pins |
| 2184 | * 0 = front, 1 = rear_surr, 2 = CLFE, 3 = surround |
| 2185 | */ |
| 2186 | {0x11, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 2187 | {0x12, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/side */ |
| 2188 | |
| 2189 | /* |
| 2190 | * Set pin mode and muting |
| 2191 | */ |
| 2192 | /* set pin widgets 0x14-0x17 for output */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 2193 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2194 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2195 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2196 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2197 | /* unmute pins for output (no gain on this amp) */ |
| 2198 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2199 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2200 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2201 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2202 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2203 | /* Mic1 (rear panel) pin widget for input and vref at 80% */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2204 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2205 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 2206 | /* Mic2 (as headphone out) for HP output */ |
| 2207 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 2208 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2209 | /* Line In pin widget for input */ |
| 2210 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 2211 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 2212 | /* Line2 (as front mic) pin widget for input and vref at 80% */ |
| 2213 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 2214 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 2215 | /* CD pin widget for input */ |
| 2216 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2217 | |
| 2218 | { } |
| 2219 | }; |
| 2220 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2221 | /* |
| 2222 | * W810 pin configuration: |
| 2223 | * front = 0x14, surround = 0x15, clfe = 0x16, HP = 0x1b |
| 2224 | */ |
| 2225 | static struct hda_verb alc880_pin_w810_init_verbs[] = { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2226 | /* hphone/speaker input selector: front DAC */ |
| 2227 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x0}, |
| 2228 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2229 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2230 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2231 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2232 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2233 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2234 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2235 | |
| 2236 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 2237 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2238 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2239 | { } |
| 2240 | }; |
| 2241 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2242 | /* |
| 2243 | * Z71V pin configuration: |
| 2244 | * Speaker-out = 0x14, HP = 0x15, Mic = 0x18, Line-in = 0x1a, Mic2 = 0x1b (?) |
| 2245 | */ |
| 2246 | static struct hda_verb alc880_pin_z71v_init_verbs[] = { |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 2247 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2248 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 2249 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2250 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | dfc0ff6 | 2005-05-12 14:31:49 +0200 | [diff] [blame] | 2251 | |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2252 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2253 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2254 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2255 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Takashi Iwai | dfc0ff6 | 2005-05-12 14:31:49 +0200 | [diff] [blame] | 2256 | |
| 2257 | { } |
| 2258 | }; |
| 2259 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2260 | /* |
| 2261 | * 6-stack pin configuration: |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 2262 | * front = 0x14, surr = 0x15, clfe = 0x16, side = 0x17, mic = 0x18, |
| 2263 | * f-mic = 0x19, line = 0x1a, HP = 0x1b |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2264 | */ |
| 2265 | static struct hda_verb alc880_pin_6stack_init_verbs[] = { |
| 2266 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 2267 | |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2268 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2269 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2270 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2271 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2272 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2273 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2274 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2275 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2276 | |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2277 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2278 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2279 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2280 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2281 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2282 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2283 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2284 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2285 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 2286 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2287 | { } |
| 2288 | }; |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2289 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 2290 | /* |
| 2291 | * Uniwill pin configuration: |
| 2292 | * HP = 0x14, InternalSpeaker = 0x15, mic = 0x18, internal mic = 0x19, |
| 2293 | * line = 0x1a |
| 2294 | */ |
| 2295 | static struct hda_verb alc880_uniwill_init_verbs[] = { |
| 2296 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 2297 | |
| 2298 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 2299 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2300 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 2301 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2302 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 2303 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2304 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2305 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2306 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 2307 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 2308 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 2309 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 2310 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 2311 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 2312 | |
| 2313 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 2314 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 2315 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 2316 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 2317 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 2318 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 2319 | /* {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, */ |
| 2320 | /* {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, */ |
| 2321 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 2322 | |
| 2323 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 2324 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 2325 | |
| 2326 | { } |
| 2327 | }; |
| 2328 | |
| 2329 | /* |
| 2330 | * Uniwill P53 |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 2331 | * HP = 0x14, InternalSpeaker = 0x15, mic = 0x19, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 2332 | */ |
| 2333 | static struct hda_verb alc880_uniwill_p53_init_verbs[] = { |
| 2334 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 2335 | |
| 2336 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 2337 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2338 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 2339 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2340 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 2341 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2342 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 2343 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 2344 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 2345 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 2346 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 2347 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 2348 | |
| 2349 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 2350 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 2351 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 2352 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 2353 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 2354 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 2355 | |
| 2356 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 2357 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_DCVOL_EVENT}, |
| 2358 | |
| 2359 | { } |
| 2360 | }; |
| 2361 | |
Tobin Davis | 2cf9f0f | 2007-02-07 16:04:25 +0100 | [diff] [blame] | 2362 | static struct hda_verb alc880_beep_init_verbs[] = { |
| 2363 | { 0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(5) }, |
| 2364 | { } |
| 2365 | }; |
| 2366 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 2367 | /* toggle speaker-output according to the hp-jack state */ |
Takashi Iwai | 458a4fa | 2007-05-05 12:18:40 +0200 | [diff] [blame] | 2368 | static void alc880_uniwill_hp_automute(struct hda_codec *codec) |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 2369 | { |
| 2370 | unsigned int present; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 2371 | unsigned char bits; |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 2372 | |
| 2373 | present = snd_hda_codec_read(codec, 0x14, 0, |
| 2374 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 2375 | bits = present ? HDA_AMP_MUTE : 0; |
| 2376 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 2377 | HDA_AMP_MUTE, bits); |
| 2378 | snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0, |
| 2379 | HDA_AMP_MUTE, bits); |
Takashi Iwai | 458a4fa | 2007-05-05 12:18:40 +0200 | [diff] [blame] | 2380 | } |
| 2381 | |
| 2382 | /* auto-toggle front mic */ |
| 2383 | static void alc880_uniwill_mic_automute(struct hda_codec *codec) |
| 2384 | { |
| 2385 | unsigned int present; |
| 2386 | unsigned char bits; |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 2387 | |
| 2388 | present = snd_hda_codec_read(codec, 0x18, 0, |
| 2389 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 2390 | bits = present ? HDA_AMP_MUTE : 0; |
| 2391 | 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] | 2392 | } |
| 2393 | |
| 2394 | static void alc880_uniwill_automute(struct hda_codec *codec) |
| 2395 | { |
| 2396 | alc880_uniwill_hp_automute(codec); |
| 2397 | alc880_uniwill_mic_automute(codec); |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 2398 | } |
| 2399 | |
| 2400 | static void alc880_uniwill_unsol_event(struct hda_codec *codec, |
| 2401 | unsigned int res) |
| 2402 | { |
| 2403 | /* Looks like the unsol event is incompatible with the standard |
| 2404 | * definition. 4bit tag is placed at 28 bit! |
| 2405 | */ |
Takashi Iwai | 458a4fa | 2007-05-05 12:18:40 +0200 | [diff] [blame] | 2406 | switch (res >> 28) { |
| 2407 | case ALC880_HP_EVENT: |
| 2408 | alc880_uniwill_hp_automute(codec); |
| 2409 | break; |
| 2410 | case ALC880_MIC_EVENT: |
| 2411 | alc880_uniwill_mic_automute(codec); |
| 2412 | break; |
| 2413 | } |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 2414 | } |
| 2415 | |
| 2416 | static void alc880_uniwill_p53_hp_automute(struct hda_codec *codec) |
| 2417 | { |
| 2418 | unsigned int present; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 2419 | unsigned char bits; |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 2420 | |
| 2421 | present = snd_hda_codec_read(codec, 0x14, 0, |
| 2422 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 2423 | bits = present ? HDA_AMP_MUTE : 0; |
Jiang zhe | 64654c2 | 2008-04-14 13:26:21 +0200 | [diff] [blame] | 2424 | 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] | 2425 | } |
| 2426 | |
| 2427 | static void alc880_uniwill_p53_dcvol_automute(struct hda_codec *codec) |
| 2428 | { |
| 2429 | unsigned int present; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 2430 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 2431 | present = snd_hda_codec_read(codec, 0x21, 0, |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 2432 | AC_VERB_GET_VOLUME_KNOB_CONTROL, 0); |
| 2433 | present &= HDA_AMP_VOLMASK; |
| 2434 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_OUTPUT, 0, |
| 2435 | HDA_AMP_VOLMASK, present); |
| 2436 | snd_hda_codec_amp_stereo(codec, 0x0d, HDA_OUTPUT, 0, |
| 2437 | HDA_AMP_VOLMASK, present); |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 2438 | } |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 2439 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 2440 | static void alc880_uniwill_p53_unsol_event(struct hda_codec *codec, |
| 2441 | unsigned int res) |
| 2442 | { |
| 2443 | /* Looks like the unsol event is incompatible with the standard |
| 2444 | * definition. 4bit tag is placed at 28 bit! |
| 2445 | */ |
| 2446 | if ((res >> 28) == ALC880_HP_EVENT) |
| 2447 | alc880_uniwill_p53_hp_automute(codec); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 2448 | if ((res >> 28) == ALC880_DCVOL_EVENT) |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 2449 | alc880_uniwill_p53_dcvol_automute(codec); |
| 2450 | } |
| 2451 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2452 | /* |
| 2453 | * F1734 pin configuration: |
| 2454 | * HP = 0x14, speaker-out = 0x15, mic = 0x18 |
| 2455 | */ |
| 2456 | static struct hda_verb alc880_pin_f1734_init_verbs[] = { |
Michael Gruber | ee7a9c7 | 2008-03-10 11:30:59 +0100 | [diff] [blame] | 2457 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x01}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2458 | {0x10, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 2459 | {0x11, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 2460 | {0x12, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 2461 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 2462 | |
| 2463 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 2464 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2465 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2466 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2467 | |
| 2468 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 2469 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Michael Gruber | ee7a9c7 | 2008-03-10 11:30:59 +0100 | [diff] [blame] | 2470 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2471 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 2472 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2473 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2474 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2475 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2476 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2477 | |
Takashi Iwai | 937b416 | 2008-02-11 14:52:36 +0100 | [diff] [blame] | 2478 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_HP_EVENT}, |
| 2479 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_DCVOL_EVENT}, |
| 2480 | |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2481 | { } |
| 2482 | }; |
| 2483 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2484 | /* |
| 2485 | * ASUS pin configuration: |
| 2486 | * HP/front = 0x14, surr = 0x15, clfe = 0x16, mic = 0x18, line = 0x1a |
| 2487 | */ |
| 2488 | static struct hda_verb alc880_pin_asus_init_verbs[] = { |
| 2489 | {0x10, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 2490 | {0x11, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 2491 | {0x12, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 2492 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 2493 | |
| 2494 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 2495 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2496 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2497 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2498 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2499 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2500 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2501 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2502 | |
| 2503 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 2504 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 2505 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 2506 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 2507 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 2508 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 2509 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2510 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2511 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 2512 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2513 | { } |
| 2514 | }; |
| 2515 | |
| 2516 | /* Enable GPIO mask and set output */ |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 2517 | #define alc880_gpio1_init_verbs alc_gpio1_init_verbs |
| 2518 | #define alc880_gpio2_init_verbs alc_gpio2_init_verbs |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2519 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 2520 | /* Clevo m520g init */ |
| 2521 | static struct hda_verb alc880_pin_clevo_init_verbs[] = { |
| 2522 | /* headphone output */ |
| 2523 | {0x11, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 2524 | /* line-out */ |
| 2525 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2526 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2527 | /* Line-in */ |
| 2528 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 2529 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2530 | /* CD */ |
| 2531 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 2532 | {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2533 | /* Mic1 (rear panel) */ |
| 2534 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 2535 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2536 | /* Mic2 (front panel) */ |
| 2537 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 2538 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2539 | /* headphone */ |
| 2540 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 2541 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2542 | /* change to EAPD mode */ |
| 2543 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 2544 | {0x20, AC_VERB_SET_PROC_COEF, 0x3060}, |
| 2545 | |
| 2546 | { } |
| 2547 | }; |
| 2548 | |
| 2549 | static struct hda_verb alc880_pin_tcl_S700_init_verbs[] = { |
Takashi Iwai | 4b146cb | 2006-07-28 14:42:36 +0200 | [diff] [blame] | 2550 | /* change to EAPD mode */ |
| 2551 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 2552 | {0x20, AC_VERB_SET_PROC_COEF, 0x3060}, |
| 2553 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 2554 | /* Headphone output */ |
| 2555 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 2556 | /* Front output*/ |
| 2557 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2558 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 2559 | |
| 2560 | /* Line In pin widget for input */ |
| 2561 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 2562 | /* CD pin widget for input */ |
| 2563 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 2564 | /* Mic1 (rear panel) pin widget for input and vref at 80% */ |
| 2565 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 2566 | |
| 2567 | /* change to EAPD mode */ |
| 2568 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 2569 | {0x20, AC_VERB_SET_PROC_COEF, 0x3070}, |
| 2570 | |
| 2571 | { } |
| 2572 | }; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2573 | |
| 2574 | /* |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 2575 | * LG m1 express dual |
| 2576 | * |
| 2577 | * Pin assignment: |
| 2578 | * Rear Line-In/Out (blue): 0x14 |
| 2579 | * Build-in Mic-In: 0x15 |
| 2580 | * Speaker-out: 0x17 |
| 2581 | * HP-Out (green): 0x1b |
| 2582 | * Mic-In/Out (red): 0x19 |
| 2583 | * SPDIF-Out: 0x1e |
| 2584 | */ |
| 2585 | |
| 2586 | /* To make 5.1 output working (green=Front, blue=Surr, red=CLFE) */ |
| 2587 | static hda_nid_t alc880_lg_dac_nids[3] = { |
| 2588 | 0x05, 0x02, 0x03 |
| 2589 | }; |
| 2590 | |
| 2591 | /* seems analog CD is not working */ |
| 2592 | static struct hda_input_mux alc880_lg_capture_source = { |
| 2593 | .num_items = 3, |
| 2594 | .items = { |
| 2595 | { "Mic", 0x1 }, |
| 2596 | { "Line", 0x5 }, |
| 2597 | { "Internal Mic", 0x6 }, |
| 2598 | }, |
| 2599 | }; |
| 2600 | |
| 2601 | /* 2,4,6 channel modes */ |
| 2602 | static struct hda_verb alc880_lg_ch2_init[] = { |
| 2603 | /* set line-in and mic-in to input */ |
| 2604 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 2605 | { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 2606 | { } |
| 2607 | }; |
| 2608 | |
| 2609 | static struct hda_verb alc880_lg_ch4_init[] = { |
| 2610 | /* set line-in to out and mic-in to input */ |
| 2611 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, |
| 2612 | { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 2613 | { } |
| 2614 | }; |
| 2615 | |
| 2616 | static struct hda_verb alc880_lg_ch6_init[] = { |
| 2617 | /* set line-in and mic-in to output */ |
| 2618 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, |
| 2619 | { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, |
| 2620 | { } |
| 2621 | }; |
| 2622 | |
| 2623 | static struct hda_channel_mode alc880_lg_ch_modes[3] = { |
| 2624 | { 2, alc880_lg_ch2_init }, |
| 2625 | { 4, alc880_lg_ch4_init }, |
| 2626 | { 6, alc880_lg_ch6_init }, |
| 2627 | }; |
| 2628 | |
| 2629 | static struct snd_kcontrol_new alc880_lg_mixer[] = { |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 2630 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
| 2631 | HDA_BIND_MUTE("Front Playback Switch", 0x0f, 2, HDA_INPUT), |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 2632 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 2633 | HDA_BIND_MUTE("Surround Playback Switch", 0x0c, 2, HDA_INPUT), |
| 2634 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0d, 1, 0x0, HDA_OUTPUT), |
| 2635 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0d, 2, 0x0, HDA_OUTPUT), |
| 2636 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0d, 1, 2, HDA_INPUT), |
| 2637 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0d, 2, 2, HDA_INPUT), |
| 2638 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 2639 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 2640 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x06, HDA_INPUT), |
| 2641 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x06, HDA_INPUT), |
| 2642 | HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x07, HDA_INPUT), |
| 2643 | HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x07, HDA_INPUT), |
| 2644 | { |
| 2645 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 2646 | .name = "Channel Mode", |
| 2647 | .info = alc_ch_mode_info, |
| 2648 | .get = alc_ch_mode_get, |
| 2649 | .put = alc_ch_mode_put, |
| 2650 | }, |
| 2651 | { } /* end */ |
| 2652 | }; |
| 2653 | |
| 2654 | static struct hda_verb alc880_lg_init_verbs[] = { |
| 2655 | /* set capture source to mic-in */ |
| 2656 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 2657 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 2658 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 2659 | /* mute all amp mixer inputs */ |
| 2660 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(5)}, |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 2661 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, |
| 2662 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 2663 | /* line-in to input */ |
| 2664 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 2665 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2666 | /* built-in mic */ |
| 2667 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 2668 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2669 | /* speaker-out */ |
| 2670 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 2671 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2672 | /* mic-in to input */ |
| 2673 | {0x11, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 2674 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 2675 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2676 | /* HP-out */ |
| 2677 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x03}, |
| 2678 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 2679 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2680 | /* jack sense */ |
| 2681 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | 0x1}, |
| 2682 | { } |
| 2683 | }; |
| 2684 | |
| 2685 | /* toggle speaker-output according to the hp-jack state */ |
| 2686 | static void alc880_lg_automute(struct hda_codec *codec) |
| 2687 | { |
| 2688 | unsigned int present; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 2689 | unsigned char bits; |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 2690 | |
| 2691 | present = snd_hda_codec_read(codec, 0x1b, 0, |
| 2692 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 2693 | bits = present ? HDA_AMP_MUTE : 0; |
| 2694 | snd_hda_codec_amp_stereo(codec, 0x17, HDA_OUTPUT, 0, |
| 2695 | HDA_AMP_MUTE, bits); |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 2696 | } |
| 2697 | |
| 2698 | static void alc880_lg_unsol_event(struct hda_codec *codec, unsigned int res) |
| 2699 | { |
| 2700 | /* Looks like the unsol event is incompatible with the standard |
| 2701 | * definition. 4bit tag is placed at 28 bit! |
| 2702 | */ |
| 2703 | if ((res >> 28) == 0x01) |
| 2704 | alc880_lg_automute(codec); |
| 2705 | } |
| 2706 | |
| 2707 | /* |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 2708 | * LG LW20 |
| 2709 | * |
| 2710 | * Pin assignment: |
| 2711 | * Speaker-out: 0x14 |
| 2712 | * Mic-In: 0x18 |
Claudio Matsuoka | e4f41da | 2007-07-13 11:51:06 +0200 | [diff] [blame] | 2713 | * Built-in Mic-In: 0x19 |
| 2714 | * Line-In: 0x1b |
| 2715 | * HP-Out: 0x1a |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 2716 | * SPDIF-Out: 0x1e |
| 2717 | */ |
| 2718 | |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 2719 | static struct hda_input_mux alc880_lg_lw_capture_source = { |
Claudio Matsuoka | e4f41da | 2007-07-13 11:51:06 +0200 | [diff] [blame] | 2720 | .num_items = 3, |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 2721 | .items = { |
| 2722 | { "Mic", 0x0 }, |
| 2723 | { "Internal Mic", 0x1 }, |
Claudio Matsuoka | e4f41da | 2007-07-13 11:51:06 +0200 | [diff] [blame] | 2724 | { "Line In", 0x2 }, |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 2725 | }, |
| 2726 | }; |
| 2727 | |
Claudio Matsuoka | 0a8c5da | 2007-07-04 15:17:38 +0200 | [diff] [blame] | 2728 | #define alc880_lg_lw_modes alc880_threestack_modes |
| 2729 | |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 2730 | static struct snd_kcontrol_new alc880_lg_lw_mixer[] = { |
Claudio Matsuoka | 0a8c5da | 2007-07-04 15:17:38 +0200 | [diff] [blame] | 2731 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 2732 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 2733 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
| 2734 | HDA_BIND_MUTE("Surround Playback Switch", 0x0f, 2, HDA_INPUT), |
| 2735 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 2736 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 2737 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 2738 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 2739 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 2740 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 2741 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 2742 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 2743 | HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 2744 | HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
Claudio Matsuoka | 0a8c5da | 2007-07-04 15:17:38 +0200 | [diff] [blame] | 2745 | { |
| 2746 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 2747 | .name = "Channel Mode", |
| 2748 | .info = alc_ch_mode_info, |
| 2749 | .get = alc_ch_mode_get, |
| 2750 | .put = alc_ch_mode_put, |
| 2751 | }, |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 2752 | { } /* end */ |
| 2753 | }; |
| 2754 | |
| 2755 | static struct hda_verb alc880_lg_lw_init_verbs[] = { |
Claudio Matsuoka | 0a8c5da | 2007-07-04 15:17:38 +0200 | [diff] [blame] | 2756 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 2757 | {0x10, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */ |
| 2758 | {0x12, AC_VERB_SET_CONNECT_SEL, 0x03}, /* line/surround */ |
| 2759 | |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 2760 | /* set capture source to mic-in */ |
| 2761 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 2762 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 2763 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 2764 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 2765 | /* speaker-out */ |
| 2766 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 2767 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2768 | /* HP-out */ |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 2769 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 2770 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2771 | /* mic-in to input */ |
| 2772 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 2773 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2774 | /* built-in mic */ |
| 2775 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 2776 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2777 | /* jack sense */ |
| 2778 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | 0x1}, |
| 2779 | { } |
| 2780 | }; |
| 2781 | |
| 2782 | /* toggle speaker-output according to the hp-jack state */ |
| 2783 | static void alc880_lg_lw_automute(struct hda_codec *codec) |
| 2784 | { |
| 2785 | unsigned int present; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 2786 | unsigned char bits; |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 2787 | |
| 2788 | present = snd_hda_codec_read(codec, 0x1b, 0, |
| 2789 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 2790 | bits = present ? HDA_AMP_MUTE : 0; |
| 2791 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 2792 | HDA_AMP_MUTE, bits); |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 2793 | } |
| 2794 | |
| 2795 | static void alc880_lg_lw_unsol_event(struct hda_codec *codec, unsigned int res) |
| 2796 | { |
| 2797 | /* Looks like the unsol event is incompatible with the standard |
| 2798 | * definition. 4bit tag is placed at 28 bit! |
| 2799 | */ |
| 2800 | if ((res >> 28) == 0x01) |
| 2801 | alc880_lg_lw_automute(codec); |
| 2802 | } |
| 2803 | |
Takashi Iwai | df99cd3 | 2008-04-25 15:25:04 +0200 | [diff] [blame] | 2804 | static struct snd_kcontrol_new alc880_medion_rim_mixer[] = { |
| 2805 | HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 2806 | HDA_BIND_MUTE("Master Playback Switch", 0x0c, 2, HDA_INPUT), |
| 2807 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 2808 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 2809 | HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 2810 | HDA_CODEC_MUTE("Internal Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 2811 | { } /* end */ |
| 2812 | }; |
| 2813 | |
| 2814 | static struct hda_input_mux alc880_medion_rim_capture_source = { |
| 2815 | .num_items = 2, |
| 2816 | .items = { |
| 2817 | { "Mic", 0x0 }, |
| 2818 | { "Internal Mic", 0x1 }, |
| 2819 | }, |
| 2820 | }; |
| 2821 | |
| 2822 | static struct hda_verb alc880_medion_rim_init_verbs[] = { |
| 2823 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 2824 | |
| 2825 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 2826 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2827 | |
| 2828 | /* Mic1 (rear panel) pin widget for input and vref at 80% */ |
| 2829 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 2830 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 2831 | /* Mic2 (as headphone out) for HP output */ |
| 2832 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 2833 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 2834 | /* Internal Speaker */ |
| 2835 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2836 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2837 | |
| 2838 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 2839 | {0x20, AC_VERB_SET_PROC_COEF, 0x3060}, |
| 2840 | |
| 2841 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 2842 | { } |
| 2843 | }; |
| 2844 | |
| 2845 | /* toggle speaker-output according to the hp-jack state */ |
| 2846 | static void alc880_medion_rim_automute(struct hda_codec *codec) |
| 2847 | { |
| 2848 | unsigned int present; |
| 2849 | unsigned char bits; |
| 2850 | |
| 2851 | present = snd_hda_codec_read(codec, 0x14, 0, |
| 2852 | AC_VERB_GET_PIN_SENSE, 0) |
| 2853 | & AC_PINSENSE_PRESENCE; |
| 2854 | bits = present ? HDA_AMP_MUTE : 0; |
| 2855 | snd_hda_codec_amp_stereo(codec, 0x1b, HDA_OUTPUT, 0, |
| 2856 | HDA_AMP_MUTE, bits); |
| 2857 | if (present) |
| 2858 | snd_hda_codec_write(codec, 0x01, 0, AC_VERB_SET_GPIO_DATA, 0); |
| 2859 | else |
| 2860 | snd_hda_codec_write(codec, 0x01, 0, AC_VERB_SET_GPIO_DATA, 2); |
| 2861 | } |
| 2862 | |
| 2863 | static void alc880_medion_rim_unsol_event(struct hda_codec *codec, |
| 2864 | unsigned int res) |
| 2865 | { |
| 2866 | /* Looks like the unsol event is incompatible with the standard |
| 2867 | * definition. 4bit tag is placed at 28 bit! |
| 2868 | */ |
| 2869 | if ((res >> 28) == ALC880_HP_EVENT) |
| 2870 | alc880_medion_rim_automute(codec); |
| 2871 | } |
| 2872 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 2873 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 2874 | static struct hda_amp_list alc880_loopbacks[] = { |
| 2875 | { 0x0b, HDA_INPUT, 0 }, |
| 2876 | { 0x0b, HDA_INPUT, 1 }, |
| 2877 | { 0x0b, HDA_INPUT, 2 }, |
| 2878 | { 0x0b, HDA_INPUT, 3 }, |
| 2879 | { 0x0b, HDA_INPUT, 4 }, |
| 2880 | { } /* end */ |
| 2881 | }; |
| 2882 | |
| 2883 | static struct hda_amp_list alc880_lg_loopbacks[] = { |
| 2884 | { 0x0b, HDA_INPUT, 1 }, |
| 2885 | { 0x0b, HDA_INPUT, 6 }, |
| 2886 | { 0x0b, HDA_INPUT, 7 }, |
| 2887 | { } /* end */ |
| 2888 | }; |
| 2889 | #endif |
| 2890 | |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 2891 | /* |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 2892 | * Common callbacks |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2893 | */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2894 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2895 | static int alc_init(struct hda_codec *codec) |
| 2896 | { |
| 2897 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2898 | unsigned int i; |
| 2899 | |
Takashi Iwai | 2c3bf9a | 2008-06-04 12:39:38 +0200 | [diff] [blame] | 2900 | alc_fix_pll(codec); |
Takashi Iwai | 1082c74 | 2008-08-22 15:24:22 +0200 | [diff] [blame] | 2901 | if (codec->vendor_id == 0x10ec0888) |
| 2902 | alc888_coef_init(codec); |
Takashi Iwai | 2c3bf9a | 2008-06-04 12:39:38 +0200 | [diff] [blame] | 2903 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2904 | for (i = 0; i < spec->num_init_verbs; i++) |
| 2905 | snd_hda_sequence_write(codec, spec->init_verbs[i]); |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 2906 | |
| 2907 | if (spec->init_hook) |
| 2908 | spec->init_hook(codec); |
| 2909 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2910 | return 0; |
| 2911 | } |
| 2912 | |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 2913 | static void alc_unsol_event(struct hda_codec *codec, unsigned int res) |
| 2914 | { |
| 2915 | struct alc_spec *spec = codec->spec; |
| 2916 | |
| 2917 | if (spec->unsol_event) |
| 2918 | spec->unsol_event(codec, res); |
| 2919 | } |
| 2920 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 2921 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 2922 | static int alc_check_power_status(struct hda_codec *codec, hda_nid_t nid) |
| 2923 | { |
| 2924 | struct alc_spec *spec = codec->spec; |
| 2925 | return snd_hda_check_amp_list_power(codec, &spec->loopback, nid); |
| 2926 | } |
| 2927 | #endif |
| 2928 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2929 | /* |
| 2930 | * Analog playback callbacks |
| 2931 | */ |
| 2932 | static int alc880_playback_pcm_open(struct hda_pcm_stream *hinfo, |
| 2933 | struct hda_codec *codec, |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 2934 | struct snd_pcm_substream *substream) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2935 | { |
| 2936 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 9a08160 | 2008-02-12 18:37:26 +0100 | [diff] [blame] | 2937 | return snd_hda_multi_out_analog_open(codec, &spec->multiout, substream, |
| 2938 | hinfo); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2939 | } |
| 2940 | |
| 2941 | static int alc880_playback_pcm_prepare(struct hda_pcm_stream *hinfo, |
| 2942 | struct hda_codec *codec, |
| 2943 | unsigned int stream_tag, |
| 2944 | unsigned int format, |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 2945 | struct snd_pcm_substream *substream) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2946 | { |
| 2947 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 2948 | return snd_hda_multi_out_analog_prepare(codec, &spec->multiout, |
| 2949 | stream_tag, format, substream); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2950 | } |
| 2951 | |
| 2952 | static int alc880_playback_pcm_cleanup(struct hda_pcm_stream *hinfo, |
| 2953 | struct hda_codec *codec, |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 2954 | struct snd_pcm_substream *substream) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2955 | { |
| 2956 | struct alc_spec *spec = codec->spec; |
| 2957 | return snd_hda_multi_out_analog_cleanup(codec, &spec->multiout); |
| 2958 | } |
| 2959 | |
| 2960 | /* |
| 2961 | * Digital out |
| 2962 | */ |
| 2963 | static int alc880_dig_playback_pcm_open(struct hda_pcm_stream *hinfo, |
| 2964 | struct hda_codec *codec, |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 2965 | struct snd_pcm_substream *substream) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2966 | { |
| 2967 | struct alc_spec *spec = codec->spec; |
| 2968 | return snd_hda_multi_out_dig_open(codec, &spec->multiout); |
| 2969 | } |
| 2970 | |
Takashi Iwai | 6b97eb4 | 2007-04-05 14:51:48 +0200 | [diff] [blame] | 2971 | static int alc880_dig_playback_pcm_prepare(struct hda_pcm_stream *hinfo, |
| 2972 | struct hda_codec *codec, |
| 2973 | unsigned int stream_tag, |
| 2974 | unsigned int format, |
| 2975 | struct snd_pcm_substream *substream) |
| 2976 | { |
| 2977 | struct alc_spec *spec = codec->spec; |
| 2978 | return snd_hda_multi_out_dig_prepare(codec, &spec->multiout, |
| 2979 | stream_tag, format, substream); |
| 2980 | } |
| 2981 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2982 | static int alc880_dig_playback_pcm_close(struct hda_pcm_stream *hinfo, |
| 2983 | struct hda_codec *codec, |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 2984 | struct snd_pcm_substream *substream) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2985 | { |
| 2986 | struct alc_spec *spec = codec->spec; |
| 2987 | return snd_hda_multi_out_dig_close(codec, &spec->multiout); |
| 2988 | } |
| 2989 | |
| 2990 | /* |
| 2991 | * Analog capture |
| 2992 | */ |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 2993 | static int alc880_alt_capture_pcm_prepare(struct hda_pcm_stream *hinfo, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2994 | struct hda_codec *codec, |
| 2995 | unsigned int stream_tag, |
| 2996 | unsigned int format, |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 2997 | struct snd_pcm_substream *substream) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2998 | { |
| 2999 | struct alc_spec *spec = codec->spec; |
| 3000 | |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 3001 | snd_hda_codec_setup_stream(codec, spec->adc_nids[substream->number + 1], |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3002 | stream_tag, 0, format); |
| 3003 | return 0; |
| 3004 | } |
| 3005 | |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 3006 | static int alc880_alt_capture_pcm_cleanup(struct hda_pcm_stream *hinfo, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3007 | struct hda_codec *codec, |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 3008 | struct snd_pcm_substream *substream) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3009 | { |
| 3010 | struct alc_spec *spec = codec->spec; |
| 3011 | |
Takashi Iwai | 888afa1 | 2008-03-18 09:57:50 +0100 | [diff] [blame] | 3012 | snd_hda_codec_cleanup_stream(codec, |
| 3013 | spec->adc_nids[substream->number + 1]); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3014 | return 0; |
| 3015 | } |
| 3016 | |
| 3017 | |
| 3018 | /* |
| 3019 | */ |
| 3020 | static struct hda_pcm_stream alc880_pcm_analog_playback = { |
| 3021 | .substreams = 1, |
| 3022 | .channels_min = 2, |
| 3023 | .channels_max = 8, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3024 | /* NID is set in alc_build_pcms */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3025 | .ops = { |
| 3026 | .open = alc880_playback_pcm_open, |
| 3027 | .prepare = alc880_playback_pcm_prepare, |
| 3028 | .cleanup = alc880_playback_pcm_cleanup |
| 3029 | }, |
| 3030 | }; |
| 3031 | |
| 3032 | static struct hda_pcm_stream alc880_pcm_analog_capture = { |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 3033 | .substreams = 1, |
| 3034 | .channels_min = 2, |
| 3035 | .channels_max = 2, |
| 3036 | /* NID is set in alc_build_pcms */ |
| 3037 | }; |
| 3038 | |
| 3039 | static struct hda_pcm_stream alc880_pcm_analog_alt_playback = { |
| 3040 | .substreams = 1, |
| 3041 | .channels_min = 2, |
| 3042 | .channels_max = 2, |
| 3043 | /* NID is set in alc_build_pcms */ |
| 3044 | }; |
| 3045 | |
| 3046 | static struct hda_pcm_stream alc880_pcm_analog_alt_capture = { |
| 3047 | .substreams = 2, /* can be overridden */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3048 | .channels_min = 2, |
| 3049 | .channels_max = 2, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3050 | /* NID is set in alc_build_pcms */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3051 | .ops = { |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 3052 | .prepare = alc880_alt_capture_pcm_prepare, |
| 3053 | .cleanup = alc880_alt_capture_pcm_cleanup |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3054 | }, |
| 3055 | }; |
| 3056 | |
| 3057 | static struct hda_pcm_stream alc880_pcm_digital_playback = { |
| 3058 | .substreams = 1, |
| 3059 | .channels_min = 2, |
| 3060 | .channels_max = 2, |
| 3061 | /* NID is set in alc_build_pcms */ |
| 3062 | .ops = { |
| 3063 | .open = alc880_dig_playback_pcm_open, |
Takashi Iwai | 6b97eb4 | 2007-04-05 14:51:48 +0200 | [diff] [blame] | 3064 | .close = alc880_dig_playback_pcm_close, |
| 3065 | .prepare = alc880_dig_playback_pcm_prepare |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3066 | }, |
| 3067 | }; |
| 3068 | |
| 3069 | static struct hda_pcm_stream alc880_pcm_digital_capture = { |
| 3070 | .substreams = 1, |
| 3071 | .channels_min = 2, |
| 3072 | .channels_max = 2, |
| 3073 | /* NID is set in alc_build_pcms */ |
| 3074 | }; |
| 3075 | |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 3076 | /* 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] | 3077 | static struct hda_pcm_stream alc_pcm_null_stream = { |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 3078 | .substreams = 0, |
| 3079 | .channels_min = 0, |
| 3080 | .channels_max = 0, |
| 3081 | }; |
| 3082 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3083 | static int alc_build_pcms(struct hda_codec *codec) |
| 3084 | { |
| 3085 | struct alc_spec *spec = codec->spec; |
| 3086 | struct hda_pcm *info = spec->pcm_rec; |
| 3087 | int i; |
| 3088 | |
| 3089 | codec->num_pcms = 1; |
| 3090 | codec->pcm_info = info; |
| 3091 | |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 3092 | if (spec->no_analog) |
| 3093 | goto skip_analog; |
| 3094 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3095 | info->name = spec->stream_name_analog; |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 3096 | if (spec->stream_analog_playback) { |
Takashi Iwai | da3cec3 | 2008-08-08 17:12:14 +0200 | [diff] [blame] | 3097 | if (snd_BUG_ON(!spec->multiout.dac_nids)) |
| 3098 | return -EINVAL; |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 3099 | info->stream[SNDRV_PCM_STREAM_PLAYBACK] = *(spec->stream_analog_playback); |
| 3100 | info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = spec->multiout.dac_nids[0]; |
| 3101 | } |
| 3102 | if (spec->stream_analog_capture) { |
Takashi Iwai | da3cec3 | 2008-08-08 17:12:14 +0200 | [diff] [blame] | 3103 | if (snd_BUG_ON(!spec->adc_nids)) |
| 3104 | return -EINVAL; |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 3105 | info->stream[SNDRV_PCM_STREAM_CAPTURE] = *(spec->stream_analog_capture); |
| 3106 | info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = spec->adc_nids[0]; |
| 3107 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3108 | |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 3109 | if (spec->channel_mode) { |
| 3110 | info->stream[SNDRV_PCM_STREAM_PLAYBACK].channels_max = 0; |
| 3111 | for (i = 0; i < spec->num_channel_mode; i++) { |
| 3112 | if (spec->channel_mode[i].channels > info->stream[SNDRV_PCM_STREAM_PLAYBACK].channels_max) { |
| 3113 | info->stream[SNDRV_PCM_STREAM_PLAYBACK].channels_max = spec->channel_mode[i].channels; |
| 3114 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3115 | } |
| 3116 | } |
| 3117 | |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 3118 | skip_analog: |
Takashi Iwai | e08a007 | 2006-09-07 17:52:14 +0200 | [diff] [blame] | 3119 | /* SPDIF for stream index #1 */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3120 | if (spec->multiout.dig_out_nid || spec->dig_in_nid) { |
Takashi Iwai | e08a007 | 2006-09-07 17:52:14 +0200 | [diff] [blame] | 3121 | codec->num_pcms = 2; |
Wu Fengguang | b25c9da | 2009-02-06 15:02:27 +0800 | [diff] [blame] | 3122 | codec->slave_dig_outs = spec->multiout.slave_dig_outs; |
Takashi Iwai | c06134d | 2006-10-11 18:49:13 +0200 | [diff] [blame] | 3123 | info = spec->pcm_rec + 1; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3124 | info->name = spec->stream_name_digital; |
Takashi Iwai | 8c44198 | 2009-01-20 18:30:20 +0100 | [diff] [blame] | 3125 | if (spec->dig_out_type) |
| 3126 | info->pcm_type = spec->dig_out_type; |
| 3127 | else |
| 3128 | info->pcm_type = HDA_PCM_TYPE_SPDIF; |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 3129 | if (spec->multiout.dig_out_nid && |
| 3130 | spec->stream_digital_playback) { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3131 | info->stream[SNDRV_PCM_STREAM_PLAYBACK] = *(spec->stream_digital_playback); |
| 3132 | info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = spec->multiout.dig_out_nid; |
| 3133 | } |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 3134 | if (spec->dig_in_nid && |
| 3135 | spec->stream_digital_capture) { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3136 | info->stream[SNDRV_PCM_STREAM_CAPTURE] = *(spec->stream_digital_capture); |
| 3137 | info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = spec->dig_in_nid; |
| 3138 | } |
Takashi Iwai | 963f803 | 2008-08-11 10:04:40 +0200 | [diff] [blame] | 3139 | /* FIXME: do we need this for all Realtek codec models? */ |
| 3140 | codec->spdif_status_reset = 1; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3141 | } |
| 3142 | |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 3143 | if (spec->no_analog) |
| 3144 | return 0; |
| 3145 | |
Takashi Iwai | e08a007 | 2006-09-07 17:52:14 +0200 | [diff] [blame] | 3146 | /* If the use of more than one ADC is requested for the current |
| 3147 | * model, configure a second analog capture-only PCM. |
| 3148 | */ |
| 3149 | /* Additional Analaog capture for index #2 */ |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 3150 | if ((spec->alt_dac_nid && spec->stream_analog_alt_playback) || |
| 3151 | (spec->num_adc_nids > 1 && spec->stream_analog_alt_capture)) { |
Takashi Iwai | e08a007 | 2006-09-07 17:52:14 +0200 | [diff] [blame] | 3152 | codec->num_pcms = 3; |
Takashi Iwai | c06134d | 2006-10-11 18:49:13 +0200 | [diff] [blame] | 3153 | info = spec->pcm_rec + 2; |
Takashi Iwai | e08a007 | 2006-09-07 17:52:14 +0200 | [diff] [blame] | 3154 | info->name = spec->stream_name_analog; |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 3155 | if (spec->alt_dac_nid) { |
| 3156 | info->stream[SNDRV_PCM_STREAM_PLAYBACK] = |
| 3157 | *spec->stream_analog_alt_playback; |
| 3158 | info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = |
| 3159 | spec->alt_dac_nid; |
| 3160 | } else { |
| 3161 | info->stream[SNDRV_PCM_STREAM_PLAYBACK] = |
| 3162 | alc_pcm_null_stream; |
| 3163 | info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = 0; |
| 3164 | } |
| 3165 | if (spec->num_adc_nids > 1) { |
| 3166 | info->stream[SNDRV_PCM_STREAM_CAPTURE] = |
| 3167 | *spec->stream_analog_alt_capture; |
| 3168 | info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = |
| 3169 | spec->adc_nids[1]; |
| 3170 | info->stream[SNDRV_PCM_STREAM_CAPTURE].substreams = |
| 3171 | spec->num_adc_nids - 1; |
| 3172 | } else { |
| 3173 | info->stream[SNDRV_PCM_STREAM_CAPTURE] = |
| 3174 | alc_pcm_null_stream; |
| 3175 | info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = 0; |
Takashi Iwai | e08a007 | 2006-09-07 17:52:14 +0200 | [diff] [blame] | 3176 | } |
| 3177 | } |
| 3178 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3179 | return 0; |
| 3180 | } |
| 3181 | |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 3182 | static void alc_free_kctls(struct hda_codec *codec) |
| 3183 | { |
| 3184 | struct alc_spec *spec = codec->spec; |
| 3185 | |
| 3186 | if (spec->kctls.list) { |
| 3187 | struct snd_kcontrol_new *kctl = spec->kctls.list; |
| 3188 | int i; |
| 3189 | for (i = 0; i < spec->kctls.used; i++) |
| 3190 | kfree(kctl[i].name); |
| 3191 | } |
| 3192 | snd_array_free(&spec->kctls); |
| 3193 | } |
| 3194 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3195 | static void alc_free(struct hda_codec *codec) |
| 3196 | { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3197 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3198 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3199 | if (!spec) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3200 | return; |
| 3201 | |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 3202 | alc_free_kctls(codec); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3203 | kfree(spec); |
Kusanagi Kouichi | 680cd53 | 2009-02-05 00:00:58 +0900 | [diff] [blame] | 3204 | snd_hda_detach_beep_device(codec); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3205 | } |
| 3206 | |
Takashi Iwai | e044c39 | 2008-10-27 16:56:24 +0100 | [diff] [blame] | 3207 | #ifdef SND_HDA_NEEDS_RESUME |
| 3208 | static void store_pin_configs(struct hda_codec *codec) |
| 3209 | { |
| 3210 | struct alc_spec *spec = codec->spec; |
| 3211 | hda_nid_t nid, end_nid; |
| 3212 | |
| 3213 | end_nid = codec->start_nid + codec->num_nodes; |
| 3214 | for (nid = codec->start_nid; nid < end_nid; nid++) { |
| 3215 | unsigned int wid_caps = get_wcaps(codec, nid); |
| 3216 | unsigned int wid_type = |
| 3217 | (wid_caps & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT; |
| 3218 | if (wid_type != AC_WID_PIN) |
| 3219 | continue; |
| 3220 | if (spec->num_pins >= ARRAY_SIZE(spec->pin_nids)) |
| 3221 | break; |
| 3222 | spec->pin_nids[spec->num_pins] = nid; |
| 3223 | spec->pin_cfgs[spec->num_pins] = |
| 3224 | snd_hda_codec_read(codec, nid, 0, |
| 3225 | AC_VERB_GET_CONFIG_DEFAULT, 0); |
| 3226 | spec->num_pins++; |
| 3227 | } |
| 3228 | } |
| 3229 | |
| 3230 | static void resume_pin_configs(struct hda_codec *codec) |
| 3231 | { |
| 3232 | struct alc_spec *spec = codec->spec; |
| 3233 | int i; |
| 3234 | |
| 3235 | for (i = 0; i < spec->num_pins; i++) { |
| 3236 | hda_nid_t pin_nid = spec->pin_nids[i]; |
| 3237 | unsigned int pin_config = spec->pin_cfgs[i]; |
| 3238 | snd_hda_codec_write(codec, pin_nid, 0, |
| 3239 | AC_VERB_SET_CONFIG_DEFAULT_BYTES_0, |
| 3240 | pin_config & 0x000000ff); |
| 3241 | snd_hda_codec_write(codec, pin_nid, 0, |
| 3242 | AC_VERB_SET_CONFIG_DEFAULT_BYTES_1, |
| 3243 | (pin_config & 0x0000ff00) >> 8); |
| 3244 | snd_hda_codec_write(codec, pin_nid, 0, |
| 3245 | AC_VERB_SET_CONFIG_DEFAULT_BYTES_2, |
| 3246 | (pin_config & 0x00ff0000) >> 16); |
| 3247 | snd_hda_codec_write(codec, pin_nid, 0, |
| 3248 | AC_VERB_SET_CONFIG_DEFAULT_BYTES_3, |
| 3249 | pin_config >> 24); |
| 3250 | } |
| 3251 | } |
| 3252 | |
| 3253 | static int alc_resume(struct hda_codec *codec) |
| 3254 | { |
| 3255 | resume_pin_configs(codec); |
| 3256 | codec->patch_ops.init(codec); |
| 3257 | snd_hda_codec_resume_amp(codec); |
| 3258 | snd_hda_codec_resume_cache(codec); |
| 3259 | return 0; |
| 3260 | } |
| 3261 | #else |
| 3262 | #define store_pin_configs(codec) |
| 3263 | #endif |
| 3264 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3265 | /* |
| 3266 | */ |
| 3267 | static struct hda_codec_ops alc_patch_ops = { |
| 3268 | .build_controls = alc_build_controls, |
| 3269 | .build_pcms = alc_build_pcms, |
| 3270 | .init = alc_init, |
| 3271 | .free = alc_free, |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 3272 | .unsol_event = alc_unsol_event, |
Takashi Iwai | e044c39 | 2008-10-27 16:56:24 +0100 | [diff] [blame] | 3273 | #ifdef SND_HDA_NEEDS_RESUME |
| 3274 | .resume = alc_resume, |
| 3275 | #endif |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 3276 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 3277 | .check_power_status = alc_check_power_status, |
| 3278 | #endif |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3279 | }; |
| 3280 | |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3281 | |
| 3282 | /* |
| 3283 | * Test configuration for debugging |
| 3284 | * |
| 3285 | * Almost all inputs/outputs are enabled. I/O pins can be configured via |
| 3286 | * enum controls. |
| 3287 | */ |
| 3288 | #ifdef CONFIG_SND_DEBUG |
| 3289 | static hda_nid_t alc880_test_dac_nids[4] = { |
| 3290 | 0x02, 0x03, 0x04, 0x05 |
| 3291 | }; |
| 3292 | |
| 3293 | static struct hda_input_mux alc880_test_capture_source = { |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 3294 | .num_items = 7, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3295 | .items = { |
| 3296 | { "In-1", 0x0 }, |
| 3297 | { "In-2", 0x1 }, |
| 3298 | { "In-3", 0x2 }, |
| 3299 | { "In-4", 0x3 }, |
| 3300 | { "CD", 0x4 }, |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 3301 | { "Front", 0x5 }, |
| 3302 | { "Surround", 0x6 }, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3303 | }, |
| 3304 | }; |
| 3305 | |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 3306 | static struct hda_channel_mode alc880_test_modes[4] = { |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3307 | { 2, NULL }, |
Takashi Iwai | fd2c326 | 2005-05-13 17:18:42 +0200 | [diff] [blame] | 3308 | { 4, NULL }, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3309 | { 6, NULL }, |
Takashi Iwai | fd2c326 | 2005-05-13 17:18:42 +0200 | [diff] [blame] | 3310 | { 8, NULL }, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3311 | }; |
| 3312 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 3313 | static int alc_test_pin_ctl_info(struct snd_kcontrol *kcontrol, |
| 3314 | struct snd_ctl_elem_info *uinfo) |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3315 | { |
| 3316 | static char *texts[] = { |
| 3317 | "N/A", "Line Out", "HP Out", |
| 3318 | "In Hi-Z", "In 50%", "In Grd", "In 80%", "In 100%" |
| 3319 | }; |
| 3320 | uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED; |
| 3321 | uinfo->count = 1; |
| 3322 | uinfo->value.enumerated.items = 8; |
| 3323 | if (uinfo->value.enumerated.item >= 8) |
| 3324 | uinfo->value.enumerated.item = 7; |
| 3325 | strcpy(uinfo->value.enumerated.name, texts[uinfo->value.enumerated.item]); |
| 3326 | return 0; |
| 3327 | } |
| 3328 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 3329 | static int alc_test_pin_ctl_get(struct snd_kcontrol *kcontrol, |
| 3330 | struct snd_ctl_elem_value *ucontrol) |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3331 | { |
| 3332 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 3333 | hda_nid_t nid = (hda_nid_t)kcontrol->private_value; |
| 3334 | unsigned int pin_ctl, item = 0; |
| 3335 | |
| 3336 | pin_ctl = snd_hda_codec_read(codec, nid, 0, |
| 3337 | AC_VERB_GET_PIN_WIDGET_CONTROL, 0); |
| 3338 | if (pin_ctl & AC_PINCTL_OUT_EN) { |
| 3339 | if (pin_ctl & AC_PINCTL_HP_EN) |
| 3340 | item = 2; |
| 3341 | else |
| 3342 | item = 1; |
| 3343 | } else if (pin_ctl & AC_PINCTL_IN_EN) { |
| 3344 | switch (pin_ctl & AC_PINCTL_VREFEN) { |
| 3345 | case AC_PINCTL_VREF_HIZ: item = 3; break; |
| 3346 | case AC_PINCTL_VREF_50: item = 4; break; |
| 3347 | case AC_PINCTL_VREF_GRD: item = 5; break; |
| 3348 | case AC_PINCTL_VREF_80: item = 6; break; |
| 3349 | case AC_PINCTL_VREF_100: item = 7; break; |
| 3350 | } |
| 3351 | } |
| 3352 | ucontrol->value.enumerated.item[0] = item; |
| 3353 | return 0; |
| 3354 | } |
| 3355 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 3356 | static int alc_test_pin_ctl_put(struct snd_kcontrol *kcontrol, |
| 3357 | struct snd_ctl_elem_value *ucontrol) |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3358 | { |
| 3359 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 3360 | hda_nid_t nid = (hda_nid_t)kcontrol->private_value; |
| 3361 | static unsigned int ctls[] = { |
| 3362 | 0, AC_PINCTL_OUT_EN, AC_PINCTL_OUT_EN | AC_PINCTL_HP_EN, |
| 3363 | AC_PINCTL_IN_EN | AC_PINCTL_VREF_HIZ, |
| 3364 | AC_PINCTL_IN_EN | AC_PINCTL_VREF_50, |
| 3365 | AC_PINCTL_IN_EN | AC_PINCTL_VREF_GRD, |
| 3366 | AC_PINCTL_IN_EN | AC_PINCTL_VREF_80, |
| 3367 | AC_PINCTL_IN_EN | AC_PINCTL_VREF_100, |
| 3368 | }; |
| 3369 | unsigned int old_ctl, new_ctl; |
| 3370 | |
| 3371 | old_ctl = snd_hda_codec_read(codec, nid, 0, |
| 3372 | AC_VERB_GET_PIN_WIDGET_CONTROL, 0); |
| 3373 | new_ctl = ctls[ucontrol->value.enumerated.item[0]]; |
| 3374 | if (old_ctl != new_ctl) { |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 3375 | int val; |
| 3376 | snd_hda_codec_write_cache(codec, nid, 0, |
| 3377 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 3378 | new_ctl); |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 3379 | val = ucontrol->value.enumerated.item[0] >= 3 ? |
| 3380 | HDA_AMP_MUTE : 0; |
| 3381 | snd_hda_codec_amp_stereo(codec, nid, HDA_OUTPUT, 0, |
| 3382 | HDA_AMP_MUTE, val); |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3383 | return 1; |
| 3384 | } |
| 3385 | return 0; |
| 3386 | } |
| 3387 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 3388 | static int alc_test_pin_src_info(struct snd_kcontrol *kcontrol, |
| 3389 | struct snd_ctl_elem_info *uinfo) |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3390 | { |
| 3391 | static char *texts[] = { |
| 3392 | "Front", "Surround", "CLFE", "Side" |
| 3393 | }; |
| 3394 | uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED; |
| 3395 | uinfo->count = 1; |
| 3396 | uinfo->value.enumerated.items = 4; |
| 3397 | if (uinfo->value.enumerated.item >= 4) |
| 3398 | uinfo->value.enumerated.item = 3; |
| 3399 | strcpy(uinfo->value.enumerated.name, texts[uinfo->value.enumerated.item]); |
| 3400 | return 0; |
| 3401 | } |
| 3402 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 3403 | static int alc_test_pin_src_get(struct snd_kcontrol *kcontrol, |
| 3404 | struct snd_ctl_elem_value *ucontrol) |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3405 | { |
| 3406 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 3407 | hda_nid_t nid = (hda_nid_t)kcontrol->private_value; |
| 3408 | unsigned int sel; |
| 3409 | |
| 3410 | sel = snd_hda_codec_read(codec, nid, 0, AC_VERB_GET_CONNECT_SEL, 0); |
| 3411 | ucontrol->value.enumerated.item[0] = sel & 3; |
| 3412 | return 0; |
| 3413 | } |
| 3414 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 3415 | static int alc_test_pin_src_put(struct snd_kcontrol *kcontrol, |
| 3416 | struct snd_ctl_elem_value *ucontrol) |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3417 | { |
| 3418 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 3419 | hda_nid_t nid = (hda_nid_t)kcontrol->private_value; |
| 3420 | unsigned int sel; |
| 3421 | |
| 3422 | sel = snd_hda_codec_read(codec, nid, 0, AC_VERB_GET_CONNECT_SEL, 0) & 3; |
| 3423 | if (ucontrol->value.enumerated.item[0] != sel) { |
| 3424 | sel = ucontrol->value.enumerated.item[0] & 3; |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 3425 | snd_hda_codec_write_cache(codec, nid, 0, |
| 3426 | AC_VERB_SET_CONNECT_SEL, sel); |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3427 | return 1; |
| 3428 | } |
| 3429 | return 0; |
| 3430 | } |
| 3431 | |
| 3432 | #define PIN_CTL_TEST(xname,nid) { \ |
| 3433 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \ |
| 3434 | .name = xname, \ |
| 3435 | .info = alc_test_pin_ctl_info, \ |
| 3436 | .get = alc_test_pin_ctl_get, \ |
| 3437 | .put = alc_test_pin_ctl_put, \ |
| 3438 | .private_value = nid \ |
| 3439 | } |
| 3440 | |
| 3441 | #define PIN_SRC_TEST(xname,nid) { \ |
| 3442 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \ |
| 3443 | .name = xname, \ |
| 3444 | .info = alc_test_pin_src_info, \ |
| 3445 | .get = alc_test_pin_src_get, \ |
| 3446 | .put = alc_test_pin_src_put, \ |
| 3447 | .private_value = nid \ |
| 3448 | } |
| 3449 | |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 3450 | static struct snd_kcontrol_new alc880_test_mixer[] = { |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 3451 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 3452 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 3453 | HDA_CODEC_VOLUME("CLFE Playback Volume", 0x0e, 0x0, HDA_OUTPUT), |
| 3454 | HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 3455 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 3456 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
| 3457 | HDA_BIND_MUTE("CLFE Playback Switch", 0x0e, 2, HDA_INPUT), |
| 3458 | HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT), |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3459 | PIN_CTL_TEST("Front Pin Mode", 0x14), |
| 3460 | PIN_CTL_TEST("Surround Pin Mode", 0x15), |
| 3461 | PIN_CTL_TEST("CLFE Pin Mode", 0x16), |
| 3462 | PIN_CTL_TEST("Side Pin Mode", 0x17), |
| 3463 | PIN_CTL_TEST("In-1 Pin Mode", 0x18), |
| 3464 | PIN_CTL_TEST("In-2 Pin Mode", 0x19), |
| 3465 | PIN_CTL_TEST("In-3 Pin Mode", 0x1a), |
| 3466 | PIN_CTL_TEST("In-4 Pin Mode", 0x1b), |
| 3467 | PIN_SRC_TEST("In-1 Pin Source", 0x18), |
| 3468 | PIN_SRC_TEST("In-2 Pin Source", 0x19), |
| 3469 | PIN_SRC_TEST("In-3 Pin Source", 0x1a), |
| 3470 | PIN_SRC_TEST("In-4 Pin Source", 0x1b), |
| 3471 | HDA_CODEC_VOLUME("In-1 Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 3472 | HDA_CODEC_MUTE("In-1 Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 3473 | HDA_CODEC_VOLUME("In-2 Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 3474 | HDA_CODEC_MUTE("In-2 Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 3475 | HDA_CODEC_VOLUME("In-3 Playback Volume", 0x0b, 0x2, HDA_INPUT), |
| 3476 | HDA_CODEC_MUTE("In-3 Playback Switch", 0x0b, 0x2, HDA_INPUT), |
| 3477 | HDA_CODEC_VOLUME("In-4 Playback Volume", 0x0b, 0x3, HDA_INPUT), |
| 3478 | HDA_CODEC_MUTE("In-4 Playback Switch", 0x0b, 0x3, HDA_INPUT), |
| 3479 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x4, HDA_INPUT), |
| 3480 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x4, HDA_INPUT), |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3481 | { |
| 3482 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 3483 | .name = "Channel Mode", |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3484 | .info = alc_ch_mode_info, |
| 3485 | .get = alc_ch_mode_get, |
| 3486 | .put = alc_ch_mode_put, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3487 | }, |
| 3488 | { } /* end */ |
| 3489 | }; |
| 3490 | |
| 3491 | static struct hda_verb alc880_test_init_verbs[] = { |
| 3492 | /* Unmute inputs of 0x0c - 0x0f */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 3493 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 3494 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 3495 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 3496 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 3497 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 3498 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 3499 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 3500 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3501 | /* Vol output for 0x0c-0x0f */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 3502 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 3503 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 3504 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 3505 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3506 | /* Set output pins 0x14-0x17 */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 3507 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 3508 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 3509 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 3510 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3511 | /* Unmute output pins 0x14-0x17 */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 3512 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3513 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3514 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3515 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3516 | /* Set input pins 0x18-0x1c */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3517 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 3518 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 3519 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 3520 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 3521 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3522 | /* Mute input pins 0x18-0x1b */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 3523 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 3524 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 3525 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 3526 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 3527 | /* ADC set up */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 3528 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 3529 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 3530 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 3531 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 3532 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 3533 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 3534 | /* Analog input/passthru */ |
| 3535 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 3536 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 3537 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 3538 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 3539 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3540 | { } |
| 3541 | }; |
| 3542 | #endif |
| 3543 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3544 | /* |
| 3545 | */ |
| 3546 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3547 | static const char *alc880_models[ALC880_MODEL_LAST] = { |
| 3548 | [ALC880_3ST] = "3stack", |
| 3549 | [ALC880_TCL_S700] = "tcl", |
| 3550 | [ALC880_3ST_DIG] = "3stack-digout", |
| 3551 | [ALC880_CLEVO] = "clevo", |
| 3552 | [ALC880_5ST] = "5stack", |
| 3553 | [ALC880_5ST_DIG] = "5stack-digout", |
| 3554 | [ALC880_W810] = "w810", |
| 3555 | [ALC880_Z71V] = "z71v", |
| 3556 | [ALC880_6ST] = "6stack", |
| 3557 | [ALC880_6ST_DIG] = "6stack-digout", |
| 3558 | [ALC880_ASUS] = "asus", |
| 3559 | [ALC880_ASUS_W1V] = "asus-w1v", |
| 3560 | [ALC880_ASUS_DIG] = "asus-dig", |
| 3561 | [ALC880_ASUS_DIG2] = "asus-dig2", |
| 3562 | [ALC880_UNIWILL_DIG] = "uniwill", |
Tobin Davis | 2cf9f0f | 2007-02-07 16:04:25 +0100 | [diff] [blame] | 3563 | [ALC880_UNIWILL_P53] = "uniwill-p53", |
| 3564 | [ALC880_FUJITSU] = "fujitsu", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3565 | [ALC880_F1734] = "F1734", |
| 3566 | [ALC880_LG] = "lg", |
| 3567 | [ALC880_LG_LW] = "lg-lw", |
Takashi Iwai | df99cd3 | 2008-04-25 15:25:04 +0200 | [diff] [blame] | 3568 | [ALC880_MEDION_RIM] = "medion", |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3569 | #ifdef CONFIG_SND_DEBUG |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3570 | [ALC880_TEST] = "test", |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3571 | #endif |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3572 | [ALC880_AUTO] = "auto", |
| 3573 | }; |
| 3574 | |
| 3575 | static struct snd_pci_quirk alc880_cfg_tbl[] = { |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 3576 | SND_PCI_QUIRK(0x1019, 0x0f69, "Coeus G610P", ALC880_W810), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3577 | SND_PCI_QUIRK(0x1019, 0xa880, "ECS", ALC880_5ST_DIG), |
| 3578 | SND_PCI_QUIRK(0x1019, 0xa884, "Acer APFV", ALC880_6ST), |
| 3579 | SND_PCI_QUIRK(0x1025, 0x0070, "ULI", ALC880_3ST_DIG), |
| 3580 | SND_PCI_QUIRK(0x1025, 0x0077, "ULI", ALC880_6ST_DIG), |
| 3581 | SND_PCI_QUIRK(0x1025, 0x0078, "ULI", ALC880_6ST_DIG), |
| 3582 | SND_PCI_QUIRK(0x1025, 0x0087, "ULI", ALC880_6ST_DIG), |
| 3583 | SND_PCI_QUIRK(0x1025, 0xe309, "ULI", ALC880_3ST_DIG), |
| 3584 | SND_PCI_QUIRK(0x1025, 0xe310, "ULI", ALC880_3ST), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3585 | SND_PCI_QUIRK(0x1039, 0x1234, NULL, ALC880_6ST_DIG), |
| 3586 | SND_PCI_QUIRK(0x103c, 0x2a09, "HP", ALC880_5ST), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3587 | SND_PCI_QUIRK(0x1043, 0x10b3, "ASUS W1V", ALC880_ASUS_W1V), |
| 3588 | SND_PCI_QUIRK(0x1043, 0x10c2, "ASUS W6A", ALC880_ASUS_DIG), |
| 3589 | SND_PCI_QUIRK(0x1043, 0x10c3, "ASUS Wxx", ALC880_ASUS_DIG), |
| 3590 | SND_PCI_QUIRK(0x1043, 0x1113, "ASUS", ALC880_ASUS_DIG), |
| 3591 | SND_PCI_QUIRK(0x1043, 0x1123, "ASUS", ALC880_ASUS_DIG), |
| 3592 | SND_PCI_QUIRK(0x1043, 0x1173, "ASUS", ALC880_ASUS_DIG), |
| 3593 | SND_PCI_QUIRK(0x1043, 0x1964, "ASUS Z71V", ALC880_Z71V), |
| 3594 | /* SND_PCI_QUIRK(0x1043, 0x1964, "ASUS", ALC880_ASUS_DIG), */ |
| 3595 | SND_PCI_QUIRK(0x1043, 0x1973, "ASUS", ALC880_ASUS_DIG), |
| 3596 | SND_PCI_QUIRK(0x1043, 0x19b3, "ASUS", ALC880_ASUS_DIG), |
Travis Place | 186c311 | 2008-05-20 11:54:41 +0200 | [diff] [blame] | 3597 | SND_PCI_QUIRK(0x1043, 0x814e, "ASUS P5GD1 w/SPDIF", ALC880_6ST_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3598 | SND_PCI_QUIRK(0x1043, 0x8181, "ASUS P4GPL", ALC880_ASUS_DIG), |
| 3599 | SND_PCI_QUIRK(0x1043, 0x8196, "ASUS P5GD1", ALC880_6ST), |
| 3600 | SND_PCI_QUIRK(0x1043, 0x81b4, "ASUS", ALC880_6ST), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 3601 | SND_PCI_QUIRK_VENDOR(0x1043, "ASUS", ALC880_ASUS), /* default ASUS */ |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3602 | SND_PCI_QUIRK(0x104d, 0x81a0, "Sony", ALC880_3ST), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 3603 | SND_PCI_QUIRK(0x104d, 0x81d6, "Sony", ALC880_3ST), |
| 3604 | SND_PCI_QUIRK(0x107b, 0x3032, "Gateway", ALC880_5ST), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3605 | SND_PCI_QUIRK(0x107b, 0x3033, "Gateway", ALC880_5ST), |
| 3606 | SND_PCI_QUIRK(0x107b, 0x4039, "Gateway", ALC880_5ST), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3607 | SND_PCI_QUIRK(0x1297, 0xc790, "Shuttle ST20G5", ALC880_6ST_DIG), |
| 3608 | SND_PCI_QUIRK(0x1458, 0xa102, "Gigabyte K8", ALC880_6ST_DIG), |
| 3609 | SND_PCI_QUIRK(0x1462, 0x1150, "MSI", ALC880_6ST_DIG), |
| 3610 | SND_PCI_QUIRK(0x1509, 0x925d, "FIC P4M", ALC880_6ST_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 3611 | SND_PCI_QUIRK(0x1558, 0x0520, "Clevo m520G", ALC880_CLEVO), |
| 3612 | SND_PCI_QUIRK(0x1558, 0x0660, "Clevo m655n", ALC880_CLEVO), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3613 | SND_PCI_QUIRK(0x1558, 0x5401, "ASUS", ALC880_ASUS_DIG2), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 3614 | SND_PCI_QUIRK(0x1565, 0x8202, "Biostar", ALC880_5ST_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3615 | SND_PCI_QUIRK(0x1584, 0x9050, "Uniwill", ALC880_UNIWILL_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 3616 | SND_PCI_QUIRK(0x1584, 0x9054, "Uniwlll", ALC880_F1734), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3617 | SND_PCI_QUIRK(0x1584, 0x9070, "Uniwill", ALC880_UNIWILL), |
| 3618 | SND_PCI_QUIRK(0x1584, 0x9077, "Uniwill P53", ALC880_UNIWILL_P53), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 3619 | SND_PCI_QUIRK(0x161f, 0x203d, "W810", ALC880_W810), |
Takashi Iwai | df99cd3 | 2008-04-25 15:25:04 +0200 | [diff] [blame] | 3620 | SND_PCI_QUIRK(0x161f, 0x205d, "Medion Rim 2150", ALC880_MEDION_RIM), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 3621 | SND_PCI_QUIRK(0x1695, 0x400d, "EPoX", ALC880_5ST_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3622 | SND_PCI_QUIRK(0x1695, 0x4012, "EPox EP-5LDA", ALC880_5ST_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3623 | SND_PCI_QUIRK(0x1734, 0x107c, "FSC F1734", ALC880_F1734), |
Travis Place | 1d11604 | 2008-06-23 11:42:30 +0200 | [diff] [blame] | 3624 | SND_PCI_QUIRK(0x1734, 0x1094, "FSC Amilo M1451G", ALC880_FUJITSU), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 3625 | SND_PCI_QUIRK(0x1734, 0x10ac, "FSC", ALC880_UNIWILL), |
Tobin Davis | 2cf9f0f | 2007-02-07 16:04:25 +0100 | [diff] [blame] | 3626 | SND_PCI_QUIRK(0x1734, 0x10b0, "Fujitsu", ALC880_FUJITSU), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 3627 | SND_PCI_QUIRK(0x1854, 0x0018, "LG LW20", ALC880_LG_LW), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3628 | SND_PCI_QUIRK(0x1854, 0x003b, "LG", ALC880_LG), |
| 3629 | SND_PCI_QUIRK(0x1854, 0x0068, "LG w1", ALC880_LG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3630 | SND_PCI_QUIRK(0x1854, 0x0077, "LG LW25", ALC880_LG_LW), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 3631 | SND_PCI_QUIRK(0x19db, 0x4188, "TCL S700", ALC880_TCL_S700), |
| 3632 | SND_PCI_QUIRK(0x2668, 0x8086, NULL, ALC880_6ST_DIG), /* broken BIOS */ |
| 3633 | SND_PCI_QUIRK(0x8086, 0x2668, NULL, ALC880_6ST_DIG), |
| 3634 | SND_PCI_QUIRK(0x8086, 0xa100, "Intel mobo", ALC880_5ST_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3635 | SND_PCI_QUIRK(0x8086, 0xd400, "Intel mobo", ALC880_5ST_DIG), |
| 3636 | SND_PCI_QUIRK(0x8086, 0xd401, "Intel mobo", ALC880_5ST_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 3637 | SND_PCI_QUIRK(0x8086, 0xd402, "Intel mobo", ALC880_3ST_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3638 | SND_PCI_QUIRK(0x8086, 0xe224, "Intel mobo", ALC880_5ST_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 3639 | SND_PCI_QUIRK(0x8086, 0xe305, "Intel mobo", ALC880_3ST_DIG), |
| 3640 | SND_PCI_QUIRK(0x8086, 0xe308, "Intel mobo", ALC880_3ST_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3641 | SND_PCI_QUIRK(0x8086, 0xe400, "Intel mobo", ALC880_5ST_DIG), |
| 3642 | SND_PCI_QUIRK(0x8086, 0xe401, "Intel mobo", ALC880_5ST_DIG), |
| 3643 | SND_PCI_QUIRK(0x8086, 0xe402, "Intel mobo", ALC880_5ST_DIG), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 3644 | /* default Intel */ |
| 3645 | SND_PCI_QUIRK_VENDOR(0x8086, "Intel mobo", ALC880_3ST), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 3646 | SND_PCI_QUIRK(0xa0a0, 0x0560, "AOpen i915GMm-HFS", ALC880_5ST_DIG), |
| 3647 | SND_PCI_QUIRK(0xe803, 0x1019, NULL, ALC880_6ST_DIG), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3648 | {} |
| 3649 | }; |
| 3650 | |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3651 | /* |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3652 | * ALC880 codec presets |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3653 | */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3654 | static struct alc_config_preset alc880_presets[] = { |
| 3655 | [ALC880_3ST] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3656 | .mixers = { alc880_three_stack_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3657 | .init_verbs = { alc880_volume_init_verbs, |
| 3658 | alc880_pin_3stack_init_verbs }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3659 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3660 | .dac_nids = alc880_dac_nids, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3661 | .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes), |
| 3662 | .channel_mode = alc880_threestack_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 3663 | .need_dac_fix = 1, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3664 | .input_mux = &alc880_capture_source, |
| 3665 | }, |
| 3666 | [ALC880_3ST_DIG] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3667 | .mixers = { alc880_three_stack_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3668 | .init_verbs = { alc880_volume_init_verbs, |
| 3669 | alc880_pin_3stack_init_verbs }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3670 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3671 | .dac_nids = alc880_dac_nids, |
| 3672 | .dig_out_nid = ALC880_DIGOUT_NID, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3673 | .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes), |
| 3674 | .channel_mode = alc880_threestack_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 3675 | .need_dac_fix = 1, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3676 | .input_mux = &alc880_capture_source, |
| 3677 | }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3678 | [ALC880_TCL_S700] = { |
| 3679 | .mixers = { alc880_tcl_s700_mixer }, |
| 3680 | .init_verbs = { alc880_volume_init_verbs, |
| 3681 | alc880_pin_tcl_S700_init_verbs, |
| 3682 | alc880_gpio2_init_verbs }, |
| 3683 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
| 3684 | .dac_nids = alc880_dac_nids, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 3685 | .adc_nids = alc880_adc_nids_alt, /* FIXME: correct? */ |
| 3686 | .num_adc_nids = 1, /* single ADC */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3687 | .hp_nid = 0x03, |
| 3688 | .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes), |
| 3689 | .channel_mode = alc880_2_jack_modes, |
| 3690 | .input_mux = &alc880_capture_source, |
| 3691 | }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3692 | [ALC880_5ST] = { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3693 | .mixers = { alc880_three_stack_mixer, |
| 3694 | alc880_five_stack_mixer}, |
| 3695 | .init_verbs = { alc880_volume_init_verbs, |
| 3696 | alc880_pin_5stack_init_verbs }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3697 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
| 3698 | .dac_nids = alc880_dac_nids, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3699 | .num_channel_mode = ARRAY_SIZE(alc880_fivestack_modes), |
| 3700 | .channel_mode = alc880_fivestack_modes, |
| 3701 | .input_mux = &alc880_capture_source, |
| 3702 | }, |
| 3703 | [ALC880_5ST_DIG] = { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3704 | .mixers = { alc880_three_stack_mixer, |
| 3705 | alc880_five_stack_mixer }, |
| 3706 | .init_verbs = { alc880_volume_init_verbs, |
| 3707 | alc880_pin_5stack_init_verbs }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3708 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
| 3709 | .dac_nids = alc880_dac_nids, |
| 3710 | .dig_out_nid = ALC880_DIGOUT_NID, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3711 | .num_channel_mode = ARRAY_SIZE(alc880_fivestack_modes), |
| 3712 | .channel_mode = alc880_fivestack_modes, |
| 3713 | .input_mux = &alc880_capture_source, |
| 3714 | }, |
Takashi Iwai | b6482d4 | 2005-06-27 15:32:43 +0200 | [diff] [blame] | 3715 | [ALC880_6ST] = { |
| 3716 | .mixers = { alc880_six_stack_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3717 | .init_verbs = { alc880_volume_init_verbs, |
| 3718 | alc880_pin_6stack_init_verbs }, |
Takashi Iwai | b6482d4 | 2005-06-27 15:32:43 +0200 | [diff] [blame] | 3719 | .num_dacs = ARRAY_SIZE(alc880_6st_dac_nids), |
| 3720 | .dac_nids = alc880_6st_dac_nids, |
| 3721 | .num_channel_mode = ARRAY_SIZE(alc880_sixstack_modes), |
| 3722 | .channel_mode = alc880_sixstack_modes, |
| 3723 | .input_mux = &alc880_6stack_capture_source, |
| 3724 | }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3725 | [ALC880_6ST_DIG] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3726 | .mixers = { alc880_six_stack_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3727 | .init_verbs = { alc880_volume_init_verbs, |
| 3728 | alc880_pin_6stack_init_verbs }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3729 | .num_dacs = ARRAY_SIZE(alc880_6st_dac_nids), |
| 3730 | .dac_nids = alc880_6st_dac_nids, |
| 3731 | .dig_out_nid = ALC880_DIGOUT_NID, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3732 | .num_channel_mode = ARRAY_SIZE(alc880_sixstack_modes), |
| 3733 | .channel_mode = alc880_sixstack_modes, |
| 3734 | .input_mux = &alc880_6stack_capture_source, |
| 3735 | }, |
| 3736 | [ALC880_W810] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3737 | .mixers = { alc880_w810_base_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3738 | .init_verbs = { alc880_volume_init_verbs, |
| 3739 | alc880_pin_w810_init_verbs, |
Takashi Iwai | b0af0de | 2005-06-21 14:49:19 +0200 | [diff] [blame] | 3740 | alc880_gpio2_init_verbs }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3741 | .num_dacs = ARRAY_SIZE(alc880_w810_dac_nids), |
| 3742 | .dac_nids = alc880_w810_dac_nids, |
| 3743 | .dig_out_nid = ALC880_DIGOUT_NID, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3744 | .num_channel_mode = ARRAY_SIZE(alc880_w810_modes), |
| 3745 | .channel_mode = alc880_w810_modes, |
| 3746 | .input_mux = &alc880_capture_source, |
| 3747 | }, |
| 3748 | [ALC880_Z71V] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3749 | .mixers = { alc880_z71v_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3750 | .init_verbs = { alc880_volume_init_verbs, |
| 3751 | alc880_pin_z71v_init_verbs }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3752 | .num_dacs = ARRAY_SIZE(alc880_z71v_dac_nids), |
| 3753 | .dac_nids = alc880_z71v_dac_nids, |
| 3754 | .dig_out_nid = ALC880_DIGOUT_NID, |
| 3755 | .hp_nid = 0x03, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3756 | .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes), |
| 3757 | .channel_mode = alc880_2_jack_modes, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3758 | .input_mux = &alc880_capture_source, |
| 3759 | }, |
| 3760 | [ALC880_F1734] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3761 | .mixers = { alc880_f1734_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3762 | .init_verbs = { alc880_volume_init_verbs, |
| 3763 | alc880_pin_f1734_init_verbs }, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3764 | .num_dacs = ARRAY_SIZE(alc880_f1734_dac_nids), |
| 3765 | .dac_nids = alc880_f1734_dac_nids, |
| 3766 | .hp_nid = 0x02, |
| 3767 | .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes), |
| 3768 | .channel_mode = alc880_2_jack_modes, |
Takashi Iwai | 937b416 | 2008-02-11 14:52:36 +0100 | [diff] [blame] | 3769 | .input_mux = &alc880_f1734_capture_source, |
| 3770 | .unsol_event = alc880_uniwill_p53_unsol_event, |
| 3771 | .init_hook = alc880_uniwill_p53_hp_automute, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3772 | }, |
| 3773 | [ALC880_ASUS] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3774 | .mixers = { alc880_asus_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3775 | .init_verbs = { alc880_volume_init_verbs, |
| 3776 | alc880_pin_asus_init_verbs, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3777 | alc880_gpio1_init_verbs }, |
| 3778 | .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids), |
| 3779 | .dac_nids = alc880_asus_dac_nids, |
| 3780 | .num_channel_mode = ARRAY_SIZE(alc880_asus_modes), |
| 3781 | .channel_mode = alc880_asus_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 3782 | .need_dac_fix = 1, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3783 | .input_mux = &alc880_capture_source, |
| 3784 | }, |
| 3785 | [ALC880_ASUS_DIG] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3786 | .mixers = { alc880_asus_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3787 | .init_verbs = { alc880_volume_init_verbs, |
| 3788 | alc880_pin_asus_init_verbs, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3789 | alc880_gpio1_init_verbs }, |
| 3790 | .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids), |
| 3791 | .dac_nids = alc880_asus_dac_nids, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3792 | .dig_out_nid = ALC880_DIGOUT_NID, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3793 | .num_channel_mode = ARRAY_SIZE(alc880_asus_modes), |
| 3794 | .channel_mode = alc880_asus_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 3795 | .need_dac_fix = 1, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3796 | .input_mux = &alc880_capture_source, |
| 3797 | }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3798 | [ALC880_ASUS_DIG2] = { |
| 3799 | .mixers = { alc880_asus_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3800 | .init_verbs = { alc880_volume_init_verbs, |
| 3801 | alc880_pin_asus_init_verbs, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3802 | alc880_gpio2_init_verbs }, /* use GPIO2 */ |
| 3803 | .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids), |
| 3804 | .dac_nids = alc880_asus_dac_nids, |
| 3805 | .dig_out_nid = ALC880_DIGOUT_NID, |
| 3806 | .num_channel_mode = ARRAY_SIZE(alc880_asus_modes), |
| 3807 | .channel_mode = alc880_asus_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 3808 | .need_dac_fix = 1, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3809 | .input_mux = &alc880_capture_source, |
| 3810 | }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3811 | [ALC880_ASUS_W1V] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3812 | .mixers = { alc880_asus_mixer, alc880_asus_w1v_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3813 | .init_verbs = { alc880_volume_init_verbs, |
| 3814 | alc880_pin_asus_init_verbs, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3815 | alc880_gpio1_init_verbs }, |
| 3816 | .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids), |
| 3817 | .dac_nids = alc880_asus_dac_nids, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3818 | .dig_out_nid = ALC880_DIGOUT_NID, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3819 | .num_channel_mode = ARRAY_SIZE(alc880_asus_modes), |
| 3820 | .channel_mode = alc880_asus_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 3821 | .need_dac_fix = 1, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3822 | .input_mux = &alc880_capture_source, |
| 3823 | }, |
| 3824 | [ALC880_UNIWILL_DIG] = { |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 3825 | .mixers = { alc880_asus_mixer }, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 3826 | .init_verbs = { alc880_volume_init_verbs, |
| 3827 | alc880_pin_asus_init_verbs }, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3828 | .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids), |
| 3829 | .dac_nids = alc880_asus_dac_nids, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3830 | .dig_out_nid = ALC880_DIGOUT_NID, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3831 | .num_channel_mode = ARRAY_SIZE(alc880_asus_modes), |
| 3832 | .channel_mode = alc880_asus_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 3833 | .need_dac_fix = 1, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3834 | .input_mux = &alc880_capture_source, |
| 3835 | }, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 3836 | [ALC880_UNIWILL] = { |
| 3837 | .mixers = { alc880_uniwill_mixer }, |
| 3838 | .init_verbs = { alc880_volume_init_verbs, |
| 3839 | alc880_uniwill_init_verbs }, |
| 3840 | .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids), |
| 3841 | .dac_nids = alc880_asus_dac_nids, |
| 3842 | .dig_out_nid = ALC880_DIGOUT_NID, |
| 3843 | .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes), |
| 3844 | .channel_mode = alc880_threestack_modes, |
| 3845 | .need_dac_fix = 1, |
| 3846 | .input_mux = &alc880_capture_source, |
| 3847 | .unsol_event = alc880_uniwill_unsol_event, |
| 3848 | .init_hook = alc880_uniwill_automute, |
| 3849 | }, |
| 3850 | [ALC880_UNIWILL_P53] = { |
| 3851 | .mixers = { alc880_uniwill_p53_mixer }, |
| 3852 | .init_verbs = { alc880_volume_init_verbs, |
| 3853 | alc880_uniwill_p53_init_verbs }, |
| 3854 | .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids), |
| 3855 | .dac_nids = alc880_asus_dac_nids, |
| 3856 | .num_channel_mode = ARRAY_SIZE(alc880_w810_modes), |
Tobin Davis | 2cf9f0f | 2007-02-07 16:04:25 +0100 | [diff] [blame] | 3857 | .channel_mode = alc880_threestack_modes, |
| 3858 | .input_mux = &alc880_capture_source, |
| 3859 | .unsol_event = alc880_uniwill_p53_unsol_event, |
| 3860 | .init_hook = alc880_uniwill_p53_hp_automute, |
| 3861 | }, |
| 3862 | [ALC880_FUJITSU] = { |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 3863 | .mixers = { alc880_fujitsu_mixer }, |
Tobin Davis | 2cf9f0f | 2007-02-07 16:04:25 +0100 | [diff] [blame] | 3864 | .init_verbs = { alc880_volume_init_verbs, |
| 3865 | alc880_uniwill_p53_init_verbs, |
| 3866 | alc880_beep_init_verbs }, |
| 3867 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
| 3868 | .dac_nids = alc880_dac_nids, |
Takashi Iwai | d53d7d9 | 2007-08-20 15:20:02 +0200 | [diff] [blame] | 3869 | .dig_out_nid = ALC880_DIGOUT_NID, |
Tobin Davis | 2cf9f0f | 2007-02-07 16:04:25 +0100 | [diff] [blame] | 3870 | .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes), |
| 3871 | .channel_mode = alc880_2_jack_modes, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 3872 | .input_mux = &alc880_capture_source, |
| 3873 | .unsol_event = alc880_uniwill_p53_unsol_event, |
| 3874 | .init_hook = alc880_uniwill_p53_hp_automute, |
| 3875 | }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3876 | [ALC880_CLEVO] = { |
| 3877 | .mixers = { alc880_three_stack_mixer }, |
| 3878 | .init_verbs = { alc880_volume_init_verbs, |
| 3879 | alc880_pin_clevo_init_verbs }, |
| 3880 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
| 3881 | .dac_nids = alc880_dac_nids, |
| 3882 | .hp_nid = 0x03, |
| 3883 | .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes), |
| 3884 | .channel_mode = alc880_threestack_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 3885 | .need_dac_fix = 1, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3886 | .input_mux = &alc880_capture_source, |
| 3887 | }, |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 3888 | [ALC880_LG] = { |
| 3889 | .mixers = { alc880_lg_mixer }, |
| 3890 | .init_verbs = { alc880_volume_init_verbs, |
| 3891 | alc880_lg_init_verbs }, |
| 3892 | .num_dacs = ARRAY_SIZE(alc880_lg_dac_nids), |
| 3893 | .dac_nids = alc880_lg_dac_nids, |
| 3894 | .dig_out_nid = ALC880_DIGOUT_NID, |
| 3895 | .num_channel_mode = ARRAY_SIZE(alc880_lg_ch_modes), |
| 3896 | .channel_mode = alc880_lg_ch_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 3897 | .need_dac_fix = 1, |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 3898 | .input_mux = &alc880_lg_capture_source, |
| 3899 | .unsol_event = alc880_lg_unsol_event, |
| 3900 | .init_hook = alc880_lg_automute, |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 3901 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 3902 | .loopbacks = alc880_lg_loopbacks, |
| 3903 | #endif |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 3904 | }, |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 3905 | [ALC880_LG_LW] = { |
| 3906 | .mixers = { alc880_lg_lw_mixer }, |
| 3907 | .init_verbs = { alc880_volume_init_verbs, |
| 3908 | alc880_lg_lw_init_verbs }, |
Claudio Matsuoka | 0a8c5da | 2007-07-04 15:17:38 +0200 | [diff] [blame] | 3909 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 3910 | .dac_nids = alc880_dac_nids, |
| 3911 | .dig_out_nid = ALC880_DIGOUT_NID, |
Claudio Matsuoka | 0a8c5da | 2007-07-04 15:17:38 +0200 | [diff] [blame] | 3912 | .num_channel_mode = ARRAY_SIZE(alc880_lg_lw_modes), |
| 3913 | .channel_mode = alc880_lg_lw_modes, |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 3914 | .input_mux = &alc880_lg_lw_capture_source, |
| 3915 | .unsol_event = alc880_lg_lw_unsol_event, |
| 3916 | .init_hook = alc880_lg_lw_automute, |
| 3917 | }, |
Takashi Iwai | df99cd3 | 2008-04-25 15:25:04 +0200 | [diff] [blame] | 3918 | [ALC880_MEDION_RIM] = { |
| 3919 | .mixers = { alc880_medion_rim_mixer }, |
| 3920 | .init_verbs = { alc880_volume_init_verbs, |
| 3921 | alc880_medion_rim_init_verbs, |
| 3922 | alc_gpio2_init_verbs }, |
| 3923 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
| 3924 | .dac_nids = alc880_dac_nids, |
| 3925 | .dig_out_nid = ALC880_DIGOUT_NID, |
| 3926 | .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes), |
| 3927 | .channel_mode = alc880_2_jack_modes, |
| 3928 | .input_mux = &alc880_medion_rim_capture_source, |
| 3929 | .unsol_event = alc880_medion_rim_unsol_event, |
| 3930 | .init_hook = alc880_medion_rim_automute, |
| 3931 | }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3932 | #ifdef CONFIG_SND_DEBUG |
| 3933 | [ALC880_TEST] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3934 | .mixers = { alc880_test_mixer }, |
| 3935 | .init_verbs = { alc880_test_init_verbs }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3936 | .num_dacs = ARRAY_SIZE(alc880_test_dac_nids), |
| 3937 | .dac_nids = alc880_test_dac_nids, |
| 3938 | .dig_out_nid = ALC880_DIGOUT_NID, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3939 | .num_channel_mode = ARRAY_SIZE(alc880_test_modes), |
| 3940 | .channel_mode = alc880_test_modes, |
| 3941 | .input_mux = &alc880_test_capture_source, |
| 3942 | }, |
| 3943 | #endif |
| 3944 | }; |
| 3945 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3946 | /* |
| 3947 | * Automatic parse of I/O pins from the BIOS configuration |
| 3948 | */ |
| 3949 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3950 | enum { |
| 3951 | ALC_CTL_WIDGET_VOL, |
| 3952 | ALC_CTL_WIDGET_MUTE, |
| 3953 | ALC_CTL_BIND_MUTE, |
| 3954 | }; |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 3955 | static struct snd_kcontrol_new alc880_control_templates[] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3956 | HDA_CODEC_VOLUME(NULL, 0, 0, 0), |
| 3957 | HDA_CODEC_MUTE(NULL, 0, 0, 0), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 3958 | HDA_BIND_MUTE(NULL, 0, 0, 0), |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3959 | }; |
| 3960 | |
| 3961 | /* add dynamic controls */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3962 | static int add_control(struct alc_spec *spec, int type, const char *name, |
| 3963 | unsigned long val) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3964 | { |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 3965 | struct snd_kcontrol_new *knew; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3966 | |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 3967 | snd_array_init(&spec->kctls, sizeof(*knew), 32); |
| 3968 | knew = snd_array_new(&spec->kctls); |
| 3969 | if (!knew) |
| 3970 | return -ENOMEM; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3971 | *knew = alc880_control_templates[type]; |
Paulo Marques | 543537b | 2005-06-23 00:09:02 -0700 | [diff] [blame] | 3972 | knew->name = kstrdup(name, GFP_KERNEL); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3973 | if (!knew->name) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3974 | return -ENOMEM; |
| 3975 | knew->private_value = val; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3976 | return 0; |
| 3977 | } |
| 3978 | |
| 3979 | #define alc880_is_fixed_pin(nid) ((nid) >= 0x14 && (nid) <= 0x17) |
| 3980 | #define alc880_fixed_pin_idx(nid) ((nid) - 0x14) |
| 3981 | #define alc880_is_multi_pin(nid) ((nid) >= 0x18) |
| 3982 | #define alc880_multi_pin_idx(nid) ((nid) - 0x18) |
| 3983 | #define alc880_is_input_pin(nid) ((nid) >= 0x18) |
| 3984 | #define alc880_input_pin_idx(nid) ((nid) - 0x18) |
| 3985 | #define alc880_idx_to_dac(nid) ((nid) + 0x02) |
| 3986 | #define alc880_dac_to_idx(nid) ((nid) - 0x02) |
| 3987 | #define alc880_idx_to_mixer(nid) ((nid) + 0x0c) |
| 3988 | #define alc880_idx_to_selector(nid) ((nid) + 0x10) |
| 3989 | #define ALC880_PIN_CD_NID 0x1c |
| 3990 | |
| 3991 | /* fill in the dac_nids table from the parsed pin configuration */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3992 | static int alc880_auto_fill_dac_nids(struct alc_spec *spec, |
| 3993 | const struct auto_pin_cfg *cfg) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3994 | { |
| 3995 | hda_nid_t nid; |
| 3996 | int assigned[4]; |
| 3997 | int i, j; |
| 3998 | |
| 3999 | memset(assigned, 0, sizeof(assigned)); |
Takashi Iwai | b0af0de | 2005-06-21 14:49:19 +0200 | [diff] [blame] | 4000 | spec->multiout.dac_nids = spec->private_dac_nids; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4001 | |
| 4002 | /* check the pins hardwired to audio widget */ |
| 4003 | for (i = 0; i < cfg->line_outs; i++) { |
| 4004 | nid = cfg->line_out_pins[i]; |
| 4005 | if (alc880_is_fixed_pin(nid)) { |
| 4006 | int idx = alc880_fixed_pin_idx(nid); |
Libin Yang | 5014f19 | 2005-11-23 15:48:36 +0100 | [diff] [blame] | 4007 | spec->multiout.dac_nids[i] = alc880_idx_to_dac(idx); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4008 | assigned[idx] = 1; |
| 4009 | } |
| 4010 | } |
| 4011 | /* left pins can be connect to any audio widget */ |
| 4012 | for (i = 0; i < cfg->line_outs; i++) { |
| 4013 | nid = cfg->line_out_pins[i]; |
| 4014 | if (alc880_is_fixed_pin(nid)) |
| 4015 | continue; |
| 4016 | /* search for an empty channel */ |
| 4017 | for (j = 0; j < cfg->line_outs; j++) { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4018 | if (!assigned[j]) { |
| 4019 | spec->multiout.dac_nids[i] = |
| 4020 | alc880_idx_to_dac(j); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4021 | assigned[j] = 1; |
| 4022 | break; |
| 4023 | } |
| 4024 | } |
| 4025 | } |
| 4026 | spec->multiout.num_dacs = cfg->line_outs; |
| 4027 | return 0; |
| 4028 | } |
| 4029 | |
| 4030 | /* add playback controls from the parsed DAC table */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4031 | static int alc880_auto_create_multi_out_ctls(struct alc_spec *spec, |
| 4032 | const struct auto_pin_cfg *cfg) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4033 | { |
| 4034 | char name[32]; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4035 | static const char *chname[4] = { |
| 4036 | "Front", "Surround", NULL /*CLFE*/, "Side" |
| 4037 | }; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4038 | hda_nid_t nid; |
| 4039 | int i, err; |
| 4040 | |
| 4041 | for (i = 0; i < cfg->line_outs; i++) { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4042 | if (!spec->multiout.dac_nids[i]) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4043 | continue; |
| 4044 | nid = alc880_idx_to_mixer(alc880_dac_to_idx(spec->multiout.dac_nids[i])); |
| 4045 | if (i == 2) { |
| 4046 | /* Center/LFE */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4047 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 4048 | "Center Playback Volume", |
| 4049 | HDA_COMPOSE_AMP_VAL(nid, 1, 0, |
| 4050 | HDA_OUTPUT)); |
| 4051 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4052 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4053 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 4054 | "LFE Playback Volume", |
| 4055 | HDA_COMPOSE_AMP_VAL(nid, 2, 0, |
| 4056 | HDA_OUTPUT)); |
| 4057 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4058 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4059 | err = add_control(spec, ALC_CTL_BIND_MUTE, |
| 4060 | "Center Playback Switch", |
| 4061 | HDA_COMPOSE_AMP_VAL(nid, 1, 2, |
| 4062 | HDA_INPUT)); |
| 4063 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4064 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4065 | err = add_control(spec, ALC_CTL_BIND_MUTE, |
| 4066 | "LFE Playback Switch", |
| 4067 | HDA_COMPOSE_AMP_VAL(nid, 2, 2, |
| 4068 | HDA_INPUT)); |
| 4069 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4070 | return err; |
| 4071 | } else { |
| 4072 | sprintf(name, "%s Playback Volume", chname[i]); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4073 | err = add_control(spec, ALC_CTL_WIDGET_VOL, name, |
| 4074 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, |
| 4075 | HDA_OUTPUT)); |
| 4076 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4077 | return err; |
| 4078 | sprintf(name, "%s Playback Switch", chname[i]); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4079 | err = add_control(spec, ALC_CTL_BIND_MUTE, name, |
| 4080 | HDA_COMPOSE_AMP_VAL(nid, 3, 2, |
| 4081 | HDA_INPUT)); |
| 4082 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4083 | return err; |
| 4084 | } |
| 4085 | } |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4086 | return 0; |
| 4087 | } |
| 4088 | |
Takashi Iwai | 8d88bc3 | 2005-11-17 11:09:23 +0100 | [diff] [blame] | 4089 | /* add playback controls for speaker and HP outputs */ |
| 4090 | static int alc880_auto_create_extra_out(struct alc_spec *spec, hda_nid_t pin, |
| 4091 | const char *pfx) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4092 | { |
| 4093 | hda_nid_t nid; |
| 4094 | int err; |
Takashi Iwai | 8d88bc3 | 2005-11-17 11:09:23 +0100 | [diff] [blame] | 4095 | char name[32]; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4096 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4097 | if (!pin) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4098 | return 0; |
| 4099 | |
| 4100 | if (alc880_is_fixed_pin(pin)) { |
| 4101 | nid = alc880_idx_to_dac(alc880_fixed_pin_idx(pin)); |
Takashi Iwai | 82bc955 | 2006-03-21 11:24:42 +0100 | [diff] [blame] | 4102 | /* specify the DAC as the extra output */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4103 | if (!spec->multiout.hp_nid) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4104 | spec->multiout.hp_nid = nid; |
Takashi Iwai | 82bc955 | 2006-03-21 11:24:42 +0100 | [diff] [blame] | 4105 | else |
| 4106 | spec->multiout.extra_out_nid[0] = nid; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4107 | /* control HP volume/switch on the output mixer amp */ |
| 4108 | nid = alc880_idx_to_mixer(alc880_fixed_pin_idx(pin)); |
Takashi Iwai | 8d88bc3 | 2005-11-17 11:09:23 +0100 | [diff] [blame] | 4109 | sprintf(name, "%s Playback Volume", pfx); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4110 | err = add_control(spec, ALC_CTL_WIDGET_VOL, name, |
| 4111 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT)); |
| 4112 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4113 | return err; |
Takashi Iwai | 8d88bc3 | 2005-11-17 11:09:23 +0100 | [diff] [blame] | 4114 | sprintf(name, "%s Playback Switch", pfx); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4115 | err = add_control(spec, ALC_CTL_BIND_MUTE, name, |
| 4116 | HDA_COMPOSE_AMP_VAL(nid, 3, 2, HDA_INPUT)); |
| 4117 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4118 | return err; |
| 4119 | } else if (alc880_is_multi_pin(pin)) { |
| 4120 | /* set manual connection */ |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4121 | /* we have only a switch on HP-out PIN */ |
Takashi Iwai | 8d88bc3 | 2005-11-17 11:09:23 +0100 | [diff] [blame] | 4122 | sprintf(name, "%s Playback Switch", pfx); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4123 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, name, |
| 4124 | HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT)); |
| 4125 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4126 | return err; |
| 4127 | } |
| 4128 | return 0; |
| 4129 | } |
| 4130 | |
| 4131 | /* create input playback/capture controls for the given pin */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4132 | static int new_analog_input(struct alc_spec *spec, hda_nid_t pin, |
| 4133 | const char *ctlname, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4134 | int idx, hda_nid_t mix_nid) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4135 | { |
| 4136 | char name[32]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4137 | int err; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4138 | |
| 4139 | sprintf(name, "%s Playback Volume", ctlname); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4140 | err = add_control(spec, ALC_CTL_WIDGET_VOL, name, |
| 4141 | HDA_COMPOSE_AMP_VAL(mix_nid, 3, idx, HDA_INPUT)); |
| 4142 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4143 | return err; |
| 4144 | sprintf(name, "%s Playback Switch", ctlname); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4145 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, name, |
| 4146 | HDA_COMPOSE_AMP_VAL(mix_nid, 3, idx, HDA_INPUT)); |
| 4147 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4148 | return err; |
| 4149 | return 0; |
| 4150 | } |
| 4151 | |
| 4152 | /* create playback/capture controls for input pins */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4153 | static int alc880_auto_create_analog_input_ctls(struct alc_spec *spec, |
| 4154 | const struct auto_pin_cfg *cfg) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4155 | { |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 4156 | struct hda_input_mux *imux = &spec->private_imux[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4157 | int i, err, idx; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4158 | |
| 4159 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
| 4160 | if (alc880_is_input_pin(cfg->input_pins[i])) { |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4161 | idx = alc880_input_pin_idx(cfg->input_pins[i]); |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 4162 | err = new_analog_input(spec, cfg->input_pins[i], |
| 4163 | auto_pin_cfg_labels[i], |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4164 | idx, 0x0b); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4165 | if (err < 0) |
| 4166 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4167 | imux->items[imux->num_items].label = |
| 4168 | auto_pin_cfg_labels[i]; |
| 4169 | imux->items[imux->num_items].index = |
| 4170 | alc880_input_pin_idx(cfg->input_pins[i]); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4171 | imux->num_items++; |
| 4172 | } |
| 4173 | } |
| 4174 | return 0; |
| 4175 | } |
| 4176 | |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 4177 | static void alc_set_pin_output(struct hda_codec *codec, hda_nid_t nid, |
| 4178 | unsigned int pin_type) |
| 4179 | { |
| 4180 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 4181 | pin_type); |
| 4182 | /* unmute pin */ |
Takashi Iwai | d260cdf | 2008-02-13 17:19:35 +0100 | [diff] [blame] | 4183 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_AMP_GAIN_MUTE, |
| 4184 | AMP_OUT_UNMUTE); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 4185 | } |
| 4186 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4187 | static void alc880_auto_set_output_and_unmute(struct hda_codec *codec, |
| 4188 | hda_nid_t nid, int pin_type, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4189 | int dac_idx) |
| 4190 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 4191 | alc_set_pin_output(codec, nid, pin_type); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4192 | /* need the manual connection? */ |
| 4193 | if (alc880_is_multi_pin(nid)) { |
| 4194 | struct alc_spec *spec = codec->spec; |
| 4195 | int idx = alc880_multi_pin_idx(nid); |
| 4196 | snd_hda_codec_write(codec, alc880_idx_to_selector(idx), 0, |
| 4197 | AC_VERB_SET_CONNECT_SEL, |
| 4198 | alc880_dac_to_idx(spec->multiout.dac_nids[dac_idx])); |
| 4199 | } |
| 4200 | } |
| 4201 | |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 4202 | static int get_pin_type(int line_out_type) |
| 4203 | { |
| 4204 | if (line_out_type == AUTO_PIN_HP_OUT) |
| 4205 | return PIN_HP; |
| 4206 | else |
| 4207 | return PIN_OUT; |
| 4208 | } |
| 4209 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4210 | static void alc880_auto_init_multi_out(struct hda_codec *codec) |
| 4211 | { |
| 4212 | struct alc_spec *spec = codec->spec; |
| 4213 | int i; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 4214 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 4215 | alc_subsystem_id(codec, 0x15, 0x1b, 0x14); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4216 | for (i = 0; i < spec->autocfg.line_outs; i++) { |
| 4217 | hda_nid_t nid = spec->autocfg.line_out_pins[i]; |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 4218 | int pin_type = get_pin_type(spec->autocfg.line_out_type); |
| 4219 | alc880_auto_set_output_and_unmute(codec, nid, pin_type, i); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4220 | } |
| 4221 | } |
| 4222 | |
Takashi Iwai | 8d88bc3 | 2005-11-17 11:09:23 +0100 | [diff] [blame] | 4223 | static void alc880_auto_init_extra_out(struct hda_codec *codec) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4224 | { |
| 4225 | struct alc_spec *spec = codec->spec; |
| 4226 | hda_nid_t pin; |
| 4227 | |
Takashi Iwai | 82bc955 | 2006-03-21 11:24:42 +0100 | [diff] [blame] | 4228 | pin = spec->autocfg.speaker_pins[0]; |
Takashi Iwai | 8d88bc3 | 2005-11-17 11:09:23 +0100 | [diff] [blame] | 4229 | if (pin) /* connect to front */ |
| 4230 | alc880_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0); |
Takashi Iwai | eb06ed8 | 2006-09-20 17:10:27 +0200 | [diff] [blame] | 4231 | pin = spec->autocfg.hp_pins[0]; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4232 | if (pin) /* connect to front */ |
| 4233 | alc880_auto_set_output_and_unmute(codec, pin, PIN_HP, 0); |
| 4234 | } |
| 4235 | |
| 4236 | static void alc880_auto_init_analog_input(struct hda_codec *codec) |
| 4237 | { |
| 4238 | struct alc_spec *spec = codec->spec; |
| 4239 | int i; |
| 4240 | |
| 4241 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
| 4242 | hda_nid_t nid = spec->autocfg.input_pins[i]; |
| 4243 | if (alc880_is_input_pin(nid)) { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4244 | snd_hda_codec_write(codec, nid, 0, |
| 4245 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 4246 | i <= AUTO_PIN_FRONT_MIC ? |
| 4247 | PIN_VREF80 : PIN_IN); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4248 | if (nid != ALC880_PIN_CD_NID) |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4249 | snd_hda_codec_write(codec, nid, 0, |
| 4250 | AC_VERB_SET_AMP_GAIN_MUTE, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4251 | AMP_OUT_MUTE); |
| 4252 | } |
| 4253 | } |
| 4254 | } |
| 4255 | |
| 4256 | /* parse the BIOS configuration and set up the alc_spec */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4257 | /* return 1 if successful, 0 if the proper config is not found, |
| 4258 | * or a negative error code |
| 4259 | */ |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4260 | static int alc880_parse_auto_config(struct hda_codec *codec) |
| 4261 | { |
| 4262 | struct alc_spec *spec = codec->spec; |
| 4263 | int err; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4264 | static hda_nid_t alc880_ignore[] = { 0x1d, 0 }; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4265 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4266 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 4267 | alc880_ignore); |
| 4268 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4269 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4270 | if (!spec->autocfg.line_outs) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4271 | return 0; /* can't find valid BIOS pin config */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4272 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4273 | err = alc880_auto_fill_dac_nids(spec, &spec->autocfg); |
| 4274 | if (err < 0) |
| 4275 | return err; |
| 4276 | err = alc880_auto_create_multi_out_ctls(spec, &spec->autocfg); |
| 4277 | if (err < 0) |
| 4278 | return err; |
| 4279 | err = alc880_auto_create_extra_out(spec, |
| 4280 | spec->autocfg.speaker_pins[0], |
| 4281 | "Speaker"); |
| 4282 | if (err < 0) |
| 4283 | return err; |
| 4284 | err = alc880_auto_create_extra_out(spec, spec->autocfg.hp_pins[0], |
| 4285 | "Headphone"); |
| 4286 | if (err < 0) |
| 4287 | return err; |
| 4288 | err = alc880_auto_create_analog_input_ctls(spec, &spec->autocfg); |
| 4289 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4290 | return err; |
| 4291 | |
| 4292 | spec->multiout.max_channels = spec->multiout.num_dacs * 2; |
| 4293 | |
Takashi Iwai | 0852d7a | 2009-02-11 11:35:15 +0100 | [diff] [blame] | 4294 | if (spec->autocfg.dig_outs) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4295 | spec->multiout.dig_out_nid = ALC880_DIGOUT_NID; |
| 4296 | if (spec->autocfg.dig_in_pin) |
| 4297 | spec->dig_in_nid = ALC880_DIGIN_NID; |
| 4298 | |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 4299 | if (spec->kctls.list) |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 4300 | add_mixer(spec, spec->kctls.list); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4301 | |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 4302 | add_verb(spec, alc880_volume_init_verbs); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4303 | |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 4304 | spec->num_mux_defs = 1; |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 4305 | spec->input_mux = &spec->private_imux[0]; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4306 | |
Takashi Iwai | e044c39 | 2008-10-27 16:56:24 +0100 | [diff] [blame] | 4307 | store_pin_configs(codec); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4308 | return 1; |
| 4309 | } |
| 4310 | |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 4311 | /* additional initialization for auto-configuration model */ |
| 4312 | static void alc880_auto_init(struct hda_codec *codec) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4313 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 4314 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4315 | alc880_auto_init_multi_out(codec); |
Takashi Iwai | 8d88bc3 | 2005-11-17 11:09:23 +0100 | [diff] [blame] | 4316 | alc880_auto_init_extra_out(codec); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4317 | alc880_auto_init_analog_input(codec); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 4318 | if (spec->unsol_event) |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 4319 | alc_inithook(codec); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4320 | } |
| 4321 | |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 4322 | static void set_capture_mixer(struct alc_spec *spec) |
| 4323 | { |
| 4324 | static struct snd_kcontrol_new *caps[3] = { |
| 4325 | alc_capture_mixer1, |
| 4326 | alc_capture_mixer2, |
| 4327 | alc_capture_mixer3, |
| 4328 | }; |
Takashi Iwai | 30d72e9 | 2008-11-27 15:25:34 +0100 | [diff] [blame] | 4329 | if (spec->num_adc_nids > 0 && spec->num_adc_nids <= 3) |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 4330 | spec->cap_mixer = caps[spec->num_adc_nids - 1]; |
| 4331 | } |
| 4332 | |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 4333 | #define set_beep_amp(spec, nid, idx, dir) \ |
| 4334 | ((spec)->beep_amp = HDA_COMPOSE_AMP_VAL(nid, 3, idx, dir)) |
| 4335 | |
| 4336 | /* |
| 4337 | * OK, here we have finally the patch for ALC880 |
| 4338 | */ |
| 4339 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4340 | static int patch_alc880(struct hda_codec *codec) |
| 4341 | { |
| 4342 | struct alc_spec *spec; |
| 4343 | int board_config; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4344 | int err; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4345 | |
Takashi Iwai | e560d8d | 2005-09-09 14:21:46 +0200 | [diff] [blame] | 4346 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4347 | if (spec == NULL) |
| 4348 | return -ENOMEM; |
| 4349 | |
| 4350 | codec->spec = spec; |
| 4351 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 4352 | board_config = snd_hda_check_board_config(codec, ALC880_MODEL_LAST, |
| 4353 | alc880_models, |
| 4354 | alc880_cfg_tbl); |
| 4355 | if (board_config < 0) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 4356 | printk(KERN_INFO "hda_codec: Unknown model for ALC880, " |
| 4357 | "trying auto-probe from BIOS...\n"); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4358 | board_config = ALC880_AUTO; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4359 | } |
| 4360 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4361 | if (board_config == ALC880_AUTO) { |
| 4362 | /* automatic parse from the BIOS config */ |
| 4363 | err = alc880_parse_auto_config(codec); |
| 4364 | if (err < 0) { |
| 4365 | alc_free(codec); |
| 4366 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4367 | } else if (!err) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 4368 | printk(KERN_INFO |
| 4369 | "hda_codec: Cannot set up configuration " |
| 4370 | "from BIOS. Using 3-stack mode...\n"); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4371 | board_config = ALC880_3ST; |
| 4372 | } |
| 4373 | } |
| 4374 | |
Kusanagi Kouichi | 680cd53 | 2009-02-05 00:00:58 +0900 | [diff] [blame] | 4375 | err = snd_hda_attach_beep_device(codec, 0x1); |
| 4376 | if (err < 0) { |
| 4377 | alc_free(codec); |
| 4378 | return err; |
| 4379 | } |
| 4380 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4381 | if (board_config != ALC880_AUTO) |
| 4382 | setup_preset(spec, &alc880_presets[board_config]); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4383 | |
| 4384 | spec->stream_name_analog = "ALC880 Analog"; |
| 4385 | spec->stream_analog_playback = &alc880_pcm_analog_playback; |
| 4386 | spec->stream_analog_capture = &alc880_pcm_analog_capture; |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 4387 | spec->stream_analog_alt_capture = &alc880_pcm_analog_alt_capture; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4388 | |
| 4389 | spec->stream_name_digital = "ALC880 Digital"; |
| 4390 | spec->stream_digital_playback = &alc880_pcm_digital_playback; |
| 4391 | spec->stream_digital_capture = &alc880_pcm_digital_capture; |
| 4392 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4393 | if (!spec->adc_nids && spec->input_mux) { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4394 | /* check whether NID 0x07 is valid */ |
Takashi Iwai | 54d1740 | 2005-11-21 16:33:22 +0100 | [diff] [blame] | 4395 | unsigned int wcap = get_wcaps(codec, alc880_adc_nids[0]); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4396 | /* get type */ |
| 4397 | wcap = (wcap & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4398 | if (wcap != AC_WID_AUD_IN) { |
| 4399 | spec->adc_nids = alc880_adc_nids_alt; |
| 4400 | spec->num_adc_nids = ARRAY_SIZE(alc880_adc_nids_alt); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4401 | } else { |
| 4402 | spec->adc_nids = alc880_adc_nids; |
| 4403 | spec->num_adc_nids = ARRAY_SIZE(alc880_adc_nids); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4404 | } |
| 4405 | } |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 4406 | set_capture_mixer(spec); |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 4407 | set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4408 | |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 4409 | spec->vmaster_nid = 0x0c; |
| 4410 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4411 | codec->patch_ops = alc_patch_ops; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4412 | if (board_config == ALC880_AUTO) |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 4413 | spec->init_hook = alc880_auto_init; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 4414 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 4415 | if (!spec->loopback.amplist) |
| 4416 | spec->loopback.amplist = alc880_loopbacks; |
| 4417 | #endif |
Takashi Iwai | daead53 | 2008-11-28 12:55:36 +0100 | [diff] [blame] | 4418 | codec->proc_widget_hook = print_realtek_coef; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4419 | |
| 4420 | return 0; |
| 4421 | } |
| 4422 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4423 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4424 | /* |
| 4425 | * ALC260 support |
| 4426 | */ |
| 4427 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4428 | static hda_nid_t alc260_dac_nids[1] = { |
| 4429 | /* front */ |
| 4430 | 0x02, |
| 4431 | }; |
| 4432 | |
| 4433 | static hda_nid_t alc260_adc_nids[1] = { |
| 4434 | /* ADC0 */ |
| 4435 | 0x04, |
| 4436 | }; |
| 4437 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4438 | static hda_nid_t alc260_adc_nids_alt[1] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4439 | /* ADC1 */ |
| 4440 | 0x05, |
| 4441 | }; |
| 4442 | |
Jonathan Woithe | d57fdac | 2006-02-28 11:38:35 +0100 | [diff] [blame] | 4443 | /* NIDs used when simultaneous access to both ADCs makes sense. Note that |
| 4444 | * alc260_capture_mixer assumes ADC0 (nid 0x04) is the first ADC. |
| 4445 | */ |
| 4446 | static hda_nid_t alc260_dual_adc_nids[2] = { |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 4447 | /* ADC0, ADC1 */ |
| 4448 | 0x04, 0x05 |
| 4449 | }; |
| 4450 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4451 | #define ALC260_DIGOUT_NID 0x03 |
| 4452 | #define ALC260_DIGIN_NID 0x06 |
| 4453 | |
| 4454 | static struct hda_input_mux alc260_capture_source = { |
| 4455 | .num_items = 4, |
| 4456 | .items = { |
| 4457 | { "Mic", 0x0 }, |
| 4458 | { "Front Mic", 0x1 }, |
| 4459 | { "Line", 0x2 }, |
| 4460 | { "CD", 0x4 }, |
| 4461 | }, |
| 4462 | }; |
| 4463 | |
Jonathan Woithe | 17e7aec | 2006-02-28 11:35:18 +0100 | [diff] [blame] | 4464 | /* On Fujitsu S702x laptops capture only makes sense from Mic/LineIn jack, |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 4465 | * headphone jack and the internal CD lines since these are the only pins at |
| 4466 | * which audio can appear. For flexibility, also allow the option of |
| 4467 | * recording the mixer output on the second ADC (ADC0 doesn't have a |
| 4468 | * connection to the mixer output). |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 4469 | */ |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 4470 | static struct hda_input_mux alc260_fujitsu_capture_sources[2] = { |
| 4471 | { |
| 4472 | .num_items = 3, |
| 4473 | .items = { |
| 4474 | { "Mic/Line", 0x0 }, |
| 4475 | { "CD", 0x4 }, |
| 4476 | { "Headphone", 0x2 }, |
| 4477 | }, |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 4478 | }, |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 4479 | { |
| 4480 | .num_items = 4, |
| 4481 | .items = { |
| 4482 | { "Mic/Line", 0x0 }, |
| 4483 | { "CD", 0x4 }, |
| 4484 | { "Headphone", 0x2 }, |
| 4485 | { "Mixer", 0x5 }, |
| 4486 | }, |
| 4487 | }, |
| 4488 | |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 4489 | }; |
| 4490 | |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 4491 | /* Acer TravelMate(/Extensa/Aspire) notebooks have similar configuration to |
| 4492 | * the Fujitsu S702x, but jacks are marked differently. |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 4493 | */ |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 4494 | static struct hda_input_mux alc260_acer_capture_sources[2] = { |
| 4495 | { |
| 4496 | .num_items = 4, |
| 4497 | .items = { |
| 4498 | { "Mic", 0x0 }, |
| 4499 | { "Line", 0x2 }, |
| 4500 | { "CD", 0x4 }, |
| 4501 | { "Headphone", 0x5 }, |
| 4502 | }, |
| 4503 | }, |
| 4504 | { |
| 4505 | .num_items = 5, |
| 4506 | .items = { |
| 4507 | { "Mic", 0x0 }, |
| 4508 | { "Line", 0x2 }, |
| 4509 | { "CD", 0x4 }, |
| 4510 | { "Headphone", 0x6 }, |
| 4511 | { "Mixer", 0x5 }, |
| 4512 | }, |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 4513 | }, |
| 4514 | }; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4515 | /* |
| 4516 | * This is just place-holder, so there's something for alc_build_pcms to look |
| 4517 | * at when it calculates the maximum number of channels. ALC260 has no mixer |
| 4518 | * element which allows changing the channel mode, so the verb list is |
| 4519 | * never used. |
| 4520 | */ |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 4521 | static struct hda_channel_mode alc260_modes[1] = { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4522 | { 2, NULL }, |
| 4523 | }; |
| 4524 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4525 | |
| 4526 | /* Mixer combinations |
| 4527 | * |
| 4528 | * basic: base_output + input + pc_beep + capture |
| 4529 | * HP: base_output + input + capture_alt |
| 4530 | * HP_3013: hp_3013 + input + capture |
| 4531 | * fujitsu: fujitsu + capture |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 4532 | * acer: acer + capture |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4533 | */ |
| 4534 | |
| 4535 | static struct snd_kcontrol_new alc260_base_output_mixer[] = { |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 4536 | HDA_CODEC_VOLUME("Front Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 4537 | HDA_BIND_MUTE("Front Playback Switch", 0x08, 2, HDA_INPUT), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4538 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x09, 0x0, HDA_OUTPUT), |
| 4539 | HDA_BIND_MUTE("Headphone Playback Switch", 0x09, 2, HDA_INPUT), |
| 4540 | HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT), |
| 4541 | HDA_BIND_MUTE_MONO("Mono Playback Switch", 0x0a, 1, 2, HDA_INPUT), |
| 4542 | { } /* end */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4543 | }; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4544 | |
| 4545 | static struct snd_kcontrol_new alc260_input_mixer[] = { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4546 | HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT), |
| 4547 | HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT), |
| 4548 | HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT), |
| 4549 | HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT), |
| 4550 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT), |
| 4551 | HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT), |
| 4552 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x07, 0x01, HDA_INPUT), |
| 4553 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x07, 0x01, HDA_INPUT), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4554 | { } /* end */ |
| 4555 | }; |
| 4556 | |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 4557 | /* update HP, line and mono out pins according to the master switch */ |
| 4558 | static void alc260_hp_master_update(struct hda_codec *codec, |
| 4559 | hda_nid_t hp, hda_nid_t line, |
| 4560 | hda_nid_t mono) |
| 4561 | { |
| 4562 | struct alc_spec *spec = codec->spec; |
| 4563 | unsigned int val = spec->master_sw ? PIN_HP : 0; |
| 4564 | /* change HP and line-out pins */ |
Takashi Iwai | 30cde0a | 2008-11-07 14:49:28 +0100 | [diff] [blame] | 4565 | 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] | 4566 | val); |
Takashi Iwai | 30cde0a | 2008-11-07 14:49:28 +0100 | [diff] [blame] | 4567 | 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] | 4568 | val); |
| 4569 | /* mono (speaker) depending on the HP jack sense */ |
| 4570 | val = (val && !spec->jack_present) ? PIN_OUT : 0; |
Takashi Iwai | 30cde0a | 2008-11-07 14:49:28 +0100 | [diff] [blame] | 4571 | 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] | 4572 | val); |
| 4573 | } |
| 4574 | |
| 4575 | static int alc260_hp_master_sw_get(struct snd_kcontrol *kcontrol, |
| 4576 | struct snd_ctl_elem_value *ucontrol) |
| 4577 | { |
| 4578 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 4579 | struct alc_spec *spec = codec->spec; |
| 4580 | *ucontrol->value.integer.value = spec->master_sw; |
| 4581 | return 0; |
| 4582 | } |
| 4583 | |
| 4584 | static int alc260_hp_master_sw_put(struct snd_kcontrol *kcontrol, |
| 4585 | struct snd_ctl_elem_value *ucontrol) |
| 4586 | { |
| 4587 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 4588 | struct alc_spec *spec = codec->spec; |
| 4589 | int val = !!*ucontrol->value.integer.value; |
| 4590 | hda_nid_t hp, line, mono; |
| 4591 | |
| 4592 | if (val == spec->master_sw) |
| 4593 | return 0; |
| 4594 | spec->master_sw = val; |
| 4595 | hp = (kcontrol->private_value >> 16) & 0xff; |
| 4596 | line = (kcontrol->private_value >> 8) & 0xff; |
| 4597 | mono = kcontrol->private_value & 0xff; |
| 4598 | alc260_hp_master_update(codec, hp, line, mono); |
| 4599 | return 1; |
| 4600 | } |
| 4601 | |
| 4602 | static struct snd_kcontrol_new alc260_hp_output_mixer[] = { |
| 4603 | { |
| 4604 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 4605 | .name = "Master Playback Switch", |
| 4606 | .info = snd_ctl_boolean_mono_info, |
| 4607 | .get = alc260_hp_master_sw_get, |
| 4608 | .put = alc260_hp_master_sw_put, |
| 4609 | .private_value = (0x0f << 16) | (0x10 << 8) | 0x11 |
| 4610 | }, |
| 4611 | HDA_CODEC_VOLUME("Front Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
| 4612 | HDA_BIND_MUTE("Front Playback Switch", 0x08, 2, HDA_INPUT), |
| 4613 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x09, 0x0, HDA_OUTPUT), |
| 4614 | HDA_BIND_MUTE("Headphone Playback Switch", 0x09, 2, HDA_INPUT), |
| 4615 | HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0a, 1, 0x0, |
| 4616 | HDA_OUTPUT), |
| 4617 | HDA_BIND_MUTE_MONO("Speaker Playback Switch", 0x0a, 1, 2, HDA_INPUT), |
| 4618 | { } /* end */ |
| 4619 | }; |
| 4620 | |
| 4621 | static struct hda_verb alc260_hp_unsol_verbs[] = { |
| 4622 | {0x10, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 4623 | {}, |
| 4624 | }; |
| 4625 | |
| 4626 | static void alc260_hp_automute(struct hda_codec *codec) |
| 4627 | { |
| 4628 | struct alc_spec *spec = codec->spec; |
| 4629 | unsigned int present; |
| 4630 | |
| 4631 | present = snd_hda_codec_read(codec, 0x10, 0, |
| 4632 | AC_VERB_GET_PIN_SENSE, 0); |
| 4633 | spec->jack_present = (present & AC_PINSENSE_PRESENCE) != 0; |
| 4634 | alc260_hp_master_update(codec, 0x0f, 0x10, 0x11); |
| 4635 | } |
| 4636 | |
| 4637 | static void alc260_hp_unsol_event(struct hda_codec *codec, unsigned int res) |
| 4638 | { |
| 4639 | if ((res >> 26) == ALC880_HP_EVENT) |
| 4640 | alc260_hp_automute(codec); |
| 4641 | } |
| 4642 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4643 | static struct snd_kcontrol_new alc260_hp_3013_mixer[] = { |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 4644 | { |
| 4645 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 4646 | .name = "Master Playback Switch", |
| 4647 | .info = snd_ctl_boolean_mono_info, |
| 4648 | .get = alc260_hp_master_sw_get, |
| 4649 | .put = alc260_hp_master_sw_put, |
Takashi Iwai | 30cde0a | 2008-11-07 14:49:28 +0100 | [diff] [blame] | 4650 | .private_value = (0x15 << 16) | (0x10 << 8) | 0x11 |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 4651 | }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4652 | HDA_CODEC_VOLUME("Front Playback Volume", 0x09, 0x0, HDA_OUTPUT), |
| 4653 | HDA_CODEC_MUTE("Front Playback Switch", 0x10, 0x0, HDA_OUTPUT), |
| 4654 | HDA_CODEC_VOLUME("Aux-In Playback Volume", 0x07, 0x06, HDA_INPUT), |
| 4655 | HDA_CODEC_MUTE("Aux-In Playback Switch", 0x07, 0x06, HDA_INPUT), |
| 4656 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
| 4657 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
Takashi Iwai | 86cd929 | 2008-01-28 18:09:56 +0100 | [diff] [blame] | 4658 | HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT), |
| 4659 | HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x11, 1, 0x0, HDA_OUTPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4660 | { } /* end */ |
| 4661 | }; |
| 4662 | |
Kailang Yang | 3f87830 | 2008-08-26 13:02:23 +0200 | [diff] [blame] | 4663 | static struct hda_bind_ctls alc260_dc7600_bind_master_vol = { |
| 4664 | .ops = &snd_hda_bind_vol, |
| 4665 | .values = { |
| 4666 | HDA_COMPOSE_AMP_VAL(0x08, 3, 0, HDA_OUTPUT), |
| 4667 | HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_OUTPUT), |
| 4668 | HDA_COMPOSE_AMP_VAL(0x0a, 3, 0, HDA_OUTPUT), |
| 4669 | 0 |
| 4670 | }, |
| 4671 | }; |
| 4672 | |
| 4673 | static struct hda_bind_ctls alc260_dc7600_bind_switch = { |
| 4674 | .ops = &snd_hda_bind_sw, |
| 4675 | .values = { |
| 4676 | HDA_COMPOSE_AMP_VAL(0x11, 3, 0, HDA_OUTPUT), |
| 4677 | HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT), |
| 4678 | 0 |
| 4679 | }, |
| 4680 | }; |
| 4681 | |
| 4682 | static struct snd_kcontrol_new alc260_hp_dc7600_mixer[] = { |
| 4683 | HDA_BIND_VOL("Master Playback Volume", &alc260_dc7600_bind_master_vol), |
| 4684 | HDA_BIND_SW("LineOut Playback Switch", &alc260_dc7600_bind_switch), |
| 4685 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x0f, 0x0, HDA_OUTPUT), |
| 4686 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x10, 0x0, HDA_OUTPUT), |
| 4687 | { } /* end */ |
| 4688 | }; |
| 4689 | |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 4690 | static struct hda_verb alc260_hp_3013_unsol_verbs[] = { |
| 4691 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 4692 | {}, |
| 4693 | }; |
| 4694 | |
| 4695 | static void alc260_hp_3013_automute(struct hda_codec *codec) |
| 4696 | { |
| 4697 | struct alc_spec *spec = codec->spec; |
| 4698 | unsigned int present; |
| 4699 | |
| 4700 | present = snd_hda_codec_read(codec, 0x15, 0, |
| 4701 | AC_VERB_GET_PIN_SENSE, 0); |
| 4702 | spec->jack_present = (present & AC_PINSENSE_PRESENCE) != 0; |
Takashi Iwai | 30cde0a | 2008-11-07 14:49:28 +0100 | [diff] [blame] | 4703 | alc260_hp_master_update(codec, 0x15, 0x10, 0x11); |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 4704 | } |
| 4705 | |
| 4706 | static void alc260_hp_3013_unsol_event(struct hda_codec *codec, |
| 4707 | unsigned int res) |
| 4708 | { |
| 4709 | if ((res >> 26) == ALC880_HP_EVENT) |
| 4710 | alc260_hp_3013_automute(codec); |
| 4711 | } |
| 4712 | |
Kailang Yang | 3f87830 | 2008-08-26 13:02:23 +0200 | [diff] [blame] | 4713 | static void alc260_hp_3012_automute(struct hda_codec *codec) |
| 4714 | { |
| 4715 | unsigned int present, bits; |
| 4716 | |
| 4717 | present = snd_hda_codec_read(codec, 0x10, 0, |
| 4718 | AC_VERB_GET_PIN_SENSE, 0) & AC_PINSENSE_PRESENCE; |
| 4719 | |
| 4720 | bits = present ? 0 : PIN_OUT; |
| 4721 | snd_hda_codec_write(codec, 0x0f, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 4722 | bits); |
| 4723 | snd_hda_codec_write(codec, 0x11, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 4724 | bits); |
| 4725 | snd_hda_codec_write(codec, 0x15, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 4726 | bits); |
| 4727 | } |
| 4728 | |
| 4729 | static void alc260_hp_3012_unsol_event(struct hda_codec *codec, |
| 4730 | unsigned int res) |
| 4731 | { |
| 4732 | if ((res >> 26) == ALC880_HP_EVENT) |
| 4733 | alc260_hp_3012_automute(codec); |
| 4734 | } |
| 4735 | |
| 4736 | /* Fujitsu S702x series laptops. ALC260 pin usage: Mic/Line jack = 0x12, |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 4737 | * HP jack = 0x14, CD audio = 0x16, internal speaker = 0x10. |
| 4738 | */ |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 4739 | static struct snd_kcontrol_new alc260_fujitsu_mixer[] = { |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 4740 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 4741 | HDA_BIND_MUTE("Headphone Playback Switch", 0x08, 2, HDA_INPUT), |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 4742 | ALC_PIN_MODE("Headphone Jack Mode", 0x14, ALC_PIN_DIR_INOUT), |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 4743 | HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT), |
| 4744 | HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT), |
| 4745 | HDA_CODEC_VOLUME("Mic/Line Playback Volume", 0x07, 0x0, HDA_INPUT), |
| 4746 | HDA_CODEC_MUTE("Mic/Line Playback Switch", 0x07, 0x0, HDA_INPUT), |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 4747 | ALC_PIN_MODE("Mic/Line Jack Mode", 0x12, ALC_PIN_DIR_IN), |
Takashi Iwai | 31bffaa | 2008-02-27 16:10:44 +0100 | [diff] [blame] | 4748 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x09, 0x0, HDA_OUTPUT), |
| 4749 | HDA_BIND_MUTE("Speaker Playback Switch", 0x09, 2, HDA_INPUT), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4750 | { } /* end */ |
| 4751 | }; |
| 4752 | |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 4753 | /* Mixer for Acer TravelMate(/Extensa/Aspire) notebooks. Note that current |
| 4754 | * versions of the ALC260 don't act on requests to enable mic bias from NID |
| 4755 | * 0x0f (used to drive the headphone jack in these laptops). The ALC260 |
| 4756 | * datasheet doesn't mention this restriction. At this stage it's not clear |
| 4757 | * whether this behaviour is intentional or is a hardware bug in chip |
| 4758 | * revisions available in early 2006. Therefore for now allow the |
| 4759 | * "Headphone Jack Mode" control to span all choices, but if it turns out |
| 4760 | * that the lack of mic bias for this NID is intentional we could change the |
| 4761 | * mode from ALC_PIN_DIR_INOUT to ALC_PIN_DIR_INOUT_NOMICBIAS. |
| 4762 | * |
| 4763 | * In addition, Acer TravelMate(/Extensa/Aspire) notebooks in early 2006 |
| 4764 | * don't appear to make the mic bias available from the "line" jack, even |
| 4765 | * though the NID used for this jack (0x14) can supply it. The theory is |
| 4766 | * that perhaps Acer have included blocking capacitors between the ALC260 |
| 4767 | * and the output jack. If this turns out to be the case for all such |
| 4768 | * models the "Line Jack Mode" mode could be changed from ALC_PIN_DIR_INOUT |
| 4769 | * to ALC_PIN_DIR_INOUT_NOMICBIAS. |
Jonathan Woithe | bd86948 | 2006-11-28 11:35:52 +0100 | [diff] [blame] | 4770 | * |
| 4771 | * The C20x Tablet series have a mono internal speaker which is controlled |
| 4772 | * via the chip's Mono sum widget and pin complex, so include the necessary |
| 4773 | * controls for such models. On models without a "mono speaker" the control |
| 4774 | * won't do anything. |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 4775 | */ |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 4776 | static struct snd_kcontrol_new alc260_acer_mixer[] = { |
| 4777 | HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
| 4778 | HDA_BIND_MUTE("Master Playback Switch", 0x08, 2, HDA_INPUT), |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 4779 | ALC_PIN_MODE("Headphone Jack Mode", 0x0f, ALC_PIN_DIR_INOUT), |
Takashi Iwai | 31bffaa | 2008-02-27 16:10:44 +0100 | [diff] [blame] | 4780 | HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0a, 1, 0x0, |
Jonathan Woithe | bd86948 | 2006-11-28 11:35:52 +0100 | [diff] [blame] | 4781 | HDA_OUTPUT), |
Takashi Iwai | 31bffaa | 2008-02-27 16:10:44 +0100 | [diff] [blame] | 4782 | HDA_BIND_MUTE_MONO("Speaker Playback Switch", 0x0a, 1, 2, |
Jonathan Woithe | bd86948 | 2006-11-28 11:35:52 +0100 | [diff] [blame] | 4783 | HDA_INPUT), |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 4784 | HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT), |
| 4785 | HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT), |
| 4786 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT), |
| 4787 | HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT), |
| 4788 | ALC_PIN_MODE("Mic Jack Mode", 0x12, ALC_PIN_DIR_IN), |
| 4789 | HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT), |
| 4790 | HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT), |
| 4791 | ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT), |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 4792 | { } /* end */ |
| 4793 | }; |
| 4794 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 4795 | /* Packard bell V7900 ALC260 pin usage: HP = 0x0f, Mic jack = 0x12, |
| 4796 | * Line In jack = 0x14, CD audio = 0x16, pc beep = 0x17. |
| 4797 | */ |
| 4798 | static struct snd_kcontrol_new alc260_will_mixer[] = { |
| 4799 | HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
| 4800 | HDA_BIND_MUTE("Master Playback Switch", 0x08, 0x2, HDA_INPUT), |
| 4801 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT), |
| 4802 | HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT), |
| 4803 | ALC_PIN_MODE("Mic Jack Mode", 0x12, ALC_PIN_DIR_IN), |
| 4804 | HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT), |
| 4805 | HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT), |
| 4806 | ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT), |
| 4807 | HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT), |
| 4808 | HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 4809 | { } /* end */ |
| 4810 | }; |
| 4811 | |
| 4812 | /* Replacer 672V ALC260 pin usage: Mic jack = 0x12, |
| 4813 | * Line In jack = 0x14, ATAPI Mic = 0x13, speaker = 0x0f. |
| 4814 | */ |
| 4815 | static struct snd_kcontrol_new alc260_replacer_672v_mixer[] = { |
| 4816 | HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
| 4817 | HDA_BIND_MUTE("Master Playback Switch", 0x08, 0x2, HDA_INPUT), |
| 4818 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT), |
| 4819 | HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT), |
| 4820 | ALC_PIN_MODE("Mic Jack Mode", 0x12, ALC_PIN_DIR_IN), |
| 4821 | HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x07, 0x1, HDA_INPUT), |
| 4822 | HDA_CODEC_MUTE("ATATI Mic Playback Switch", 0x07, 0x1, HDA_INPUT), |
| 4823 | HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT), |
| 4824 | HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT), |
| 4825 | ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT), |
| 4826 | { } /* end */ |
| 4827 | }; |
| 4828 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4829 | /* |
| 4830 | * initialization verbs |
| 4831 | */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4832 | static struct hda_verb alc260_init_verbs[] = { |
| 4833 | /* Line In pin widget for input */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 4834 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4835 | /* CD pin widget for input */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 4836 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4837 | /* Mic1 (rear panel) pin widget for input and vref at 80% */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4838 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4839 | /* Mic2 (front panel) pin widget for input and vref at 80% */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4840 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4841 | /* LINE-2 is used for line-out in rear */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 4842 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4843 | /* select line-out */ |
Jonathan Woithe | fd56f2d | 2006-01-24 10:35:46 +0100 | [diff] [blame] | 4844 | {0x0e, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4845 | /* LINE-OUT pin */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 4846 | {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4847 | /* enable HP */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 4848 | {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4849 | /* enable Mono */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 4850 | {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 4851 | /* mute capture amp left and right */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4852 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4853 | /* set connection select to line in (default select for this ADC) */ |
| 4854 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x02}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4855 | /* mute capture amp left and right */ |
| 4856 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 4857 | /* set connection select to line in (default select for this ADC) */ |
| 4858 | {0x05, AC_VERB_SET_CONNECT_SEL, 0x02}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 4859 | /* set vol=0 Line-Out mixer amp left and right */ |
| 4860 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 4861 | /* unmute pin widget amp left and right (no gain on this amp) */ |
| 4862 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 4863 | /* set vol=0 HP mixer amp left and right */ |
| 4864 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 4865 | /* unmute pin widget amp left and right (no gain on this amp) */ |
| 4866 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 4867 | /* set vol=0 Mono mixer amp left and right */ |
| 4868 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 4869 | /* unmute pin widget amp left and right (no gain on this amp) */ |
| 4870 | {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 4871 | /* unmute LINE-2 out pin */ |
| 4872 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4873 | /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 & |
| 4874 | * Line In 2 = 0x03 |
| 4875 | */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 4876 | /* mute analog inputs */ |
| 4877 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 4878 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 4879 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 4880 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 4881 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4882 | /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 4883 | /* mute Front out path */ |
| 4884 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 4885 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 4886 | /* mute Headphone out path */ |
| 4887 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 4888 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 4889 | /* mute Mono out path */ |
| 4890 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 4891 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4892 | { } |
| 4893 | }; |
| 4894 | |
Takashi Iwai | 474167d | 2006-05-17 17:17:43 +0200 | [diff] [blame] | 4895 | #if 0 /* should be identical with alc260_init_verbs? */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4896 | static struct hda_verb alc260_hp_init_verbs[] = { |
| 4897 | /* Headphone and output */ |
| 4898 | {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0}, |
| 4899 | /* mono output */ |
| 4900 | {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, |
| 4901 | /* Mic1 (rear panel) pin widget for input and vref at 80% */ |
| 4902 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 4903 | /* Mic2 (front panel) pin widget for input and vref at 80% */ |
| 4904 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 4905 | /* Line In pin widget for input */ |
| 4906 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 4907 | /* Line-2 pin widget for output */ |
| 4908 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, |
| 4909 | /* CD pin widget for input */ |
| 4910 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 4911 | /* unmute amp left and right */ |
| 4912 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000}, |
| 4913 | /* set connection select to line in (default select for this ADC) */ |
| 4914 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 4915 | /* unmute Line-Out mixer amp left and right (volume = 0) */ |
| 4916 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000}, |
| 4917 | /* mute pin widget amp left and right (no gain on this amp) */ |
| 4918 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
| 4919 | /* unmute HP mixer amp left and right (volume = 0) */ |
| 4920 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000}, |
| 4921 | /* mute pin widget amp left and right (no gain on this amp) */ |
| 4922 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4923 | /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 & |
| 4924 | * Line In 2 = 0x03 |
| 4925 | */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 4926 | /* mute analog inputs */ |
| 4927 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 4928 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 4929 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 4930 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 4931 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4932 | /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */ |
| 4933 | /* Unmute Front out path */ |
| 4934 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 4935 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 4936 | /* Unmute Headphone out path */ |
| 4937 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 4938 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 4939 | /* Unmute Mono out path */ |
| 4940 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 4941 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 4942 | { } |
| 4943 | }; |
Takashi Iwai | 474167d | 2006-05-17 17:17:43 +0200 | [diff] [blame] | 4944 | #endif |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4945 | |
| 4946 | static struct hda_verb alc260_hp_3013_init_verbs[] = { |
| 4947 | /* Line out and output */ |
| 4948 | {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, |
| 4949 | /* mono output */ |
| 4950 | {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, |
| 4951 | /* Mic1 (rear panel) pin widget for input and vref at 80% */ |
| 4952 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 4953 | /* Mic2 (front panel) pin widget for input and vref at 80% */ |
| 4954 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 4955 | /* Line In pin widget for input */ |
| 4956 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 4957 | /* Headphone pin widget for output */ |
| 4958 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0}, |
| 4959 | /* CD pin widget for input */ |
| 4960 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 4961 | /* unmute amp left and right */ |
| 4962 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000}, |
| 4963 | /* set connection select to line in (default select for this ADC) */ |
| 4964 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 4965 | /* unmute Line-Out mixer amp left and right (volume = 0) */ |
| 4966 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000}, |
| 4967 | /* mute pin widget amp left and right (no gain on this amp) */ |
| 4968 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
| 4969 | /* unmute HP mixer amp left and right (volume = 0) */ |
| 4970 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000}, |
| 4971 | /* mute pin widget amp left and right (no gain on this amp) */ |
| 4972 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4973 | /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 & |
| 4974 | * Line In 2 = 0x03 |
| 4975 | */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 4976 | /* mute analog inputs */ |
| 4977 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 4978 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 4979 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 4980 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 4981 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4982 | /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */ |
| 4983 | /* Unmute Front out path */ |
| 4984 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 4985 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 4986 | /* Unmute Headphone out path */ |
| 4987 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 4988 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 4989 | /* Unmute Mono out path */ |
| 4990 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 4991 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 4992 | { } |
| 4993 | }; |
| 4994 | |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 4995 | /* Initialisation sequence for ALC260 as configured in Fujitsu S702x |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 4996 | * laptops. ALC260 pin usage: Mic/Line jack = 0x12, HP jack = 0x14, CD |
| 4997 | * audio = 0x16, internal speaker = 0x10. |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 4998 | */ |
| 4999 | static struct hda_verb alc260_fujitsu_init_verbs[] = { |
| 5000 | /* Disable all GPIOs */ |
| 5001 | {0x01, AC_VERB_SET_GPIO_MASK, 0}, |
| 5002 | /* Internal speaker is connected to headphone pin */ |
| 5003 | {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 5004 | /* Headphone/Line-out jack connects to Line1 pin; make it an output */ |
| 5005 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 5006 | /* Mic/Line-in jack is connected to mic1 pin, so make it an input */ |
| 5007 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 5008 | /* Ensure all other unused pins are disabled and muted. */ |
| 5009 | {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
| 5010 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 5011 | {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 5012 | {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 5013 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 5014 | {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5015 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
| 5016 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 5017 | |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 5018 | /* Disable digital (SPDIF) pins */ |
| 5019 | {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0}, |
| 5020 | {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0}, |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 5021 | |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 5022 | /* Ensure Line1 pin widget takes its input from the OUT1 sum bus |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 5023 | * when acting as an output. |
| 5024 | */ |
| 5025 | {0x0d, AC_VERB_SET_CONNECT_SEL, 0}, |
| 5026 | |
| 5027 | /* Start with output sum widgets muted and their output gains at min */ |
Takashi Iwai | 8b33a5a | 2006-02-09 11:57:01 +0100 | [diff] [blame] | 5028 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5029 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 5030 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5031 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5032 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 5033 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5034 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5035 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 5036 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 5037 | |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 5038 | /* Unmute HP pin widget amp left and right (no equiv mixer ctrl) */ |
| 5039 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 5040 | /* Unmute Line1 pin widget output buffer since it starts as an output. |
| 5041 | * If the pin mode is changed by the user the pin mode control will |
| 5042 | * take care of enabling the pin's input/output buffers as needed. |
| 5043 | * Therefore there's no need to enable the input buffer at this |
| 5044 | * stage. |
Jonathan Woithe | cdcd926 | 2006-02-28 11:36:42 +0100 | [diff] [blame] | 5045 | */ |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 5046 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 5047 | /* Unmute input buffer of pin widget used for Line-in (no equiv |
Jonathan Woithe | cdcd926 | 2006-02-28 11:36:42 +0100 | [diff] [blame] | 5048 | * mixer ctrl) |
| 5049 | */ |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 5050 | {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
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 | /* Mute capture amp left and right */ |
| 5053 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 5054 | /* Set ADC connection select to match default mixer setting - line |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 5055 | * in (on mic1 pin) |
| 5056 | */ |
| 5057 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 5058 | |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 5059 | /* Do the same for the second ADC: mute capture input amp and |
| 5060 | * set ADC connection to line in (on mic1 pin) |
| 5061 | */ |
| 5062 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5063 | {0x05, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 5064 | |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 5065 | /* Mute all inputs to mixer widget (even unconnected ones) */ |
| 5066 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */ |
| 5067 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */ |
| 5068 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */ |
| 5069 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */ |
| 5070 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */ |
| 5071 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */ |
| 5072 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */ |
| 5073 | {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] | 5074 | |
| 5075 | { } |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 5076 | }; |
| 5077 | |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 5078 | /* Initialisation sequence for ALC260 as configured in Acer TravelMate and |
| 5079 | * similar laptops (adapted from Fujitsu init verbs). |
| 5080 | */ |
| 5081 | static struct hda_verb alc260_acer_init_verbs[] = { |
| 5082 | /* On TravelMate laptops, GPIO 0 enables the internal speaker and |
| 5083 | * the headphone jack. Turn this on and rely on the standard mute |
| 5084 | * methods whenever the user wants to turn these outputs off. |
| 5085 | */ |
| 5086 | {0x01, AC_VERB_SET_GPIO_MASK, 0x01}, |
| 5087 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01}, |
| 5088 | {0x01, AC_VERB_SET_GPIO_DATA, 0x01}, |
| 5089 | /* Internal speaker/Headphone jack is connected to Line-out pin */ |
| 5090 | {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 5091 | /* Internal microphone/Mic jack is connected to Mic1 pin */ |
| 5092 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50}, |
| 5093 | /* Line In jack is connected to Line1 pin */ |
| 5094 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Jonathan Woithe | bd86948 | 2006-11-28 11:35:52 +0100 | [diff] [blame] | 5095 | /* Some Acers (eg: C20x Tablets) use Mono pin for internal speaker */ |
| 5096 | {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 5097 | /* Ensure all other unused pins are disabled and muted. */ |
| 5098 | {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
| 5099 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 5100 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
| 5101 | {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5102 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
| 5103 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5104 | /* Disable digital (SPDIF) pins */ |
| 5105 | {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0}, |
| 5106 | {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0}, |
| 5107 | |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 5108 | /* Ensure Mic1 and Line1 pin widgets take input from the OUT1 sum |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 5109 | * bus when acting as outputs. |
| 5110 | */ |
| 5111 | {0x0b, AC_VERB_SET_CONNECT_SEL, 0}, |
| 5112 | {0x0d, AC_VERB_SET_CONNECT_SEL, 0}, |
| 5113 | |
| 5114 | /* Start with output sum widgets muted and their output gains at min */ |
| 5115 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5116 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 5117 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5118 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5119 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 5120 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5121 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5122 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 5123 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5124 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5125 | /* Unmute Line-out pin widget amp left and right |
| 5126 | * (no equiv mixer ctrl) |
| 5127 | */ |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 5128 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Jonathan Woithe | bd86948 | 2006-11-28 11:35:52 +0100 | [diff] [blame] | 5129 | /* Unmute mono pin widget amp output (no equiv mixer ctrl) */ |
| 5130 | {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 5131 | /* Unmute Mic1 and Line1 pin widget input buffers since they start as |
| 5132 | * inputs. If the pin mode is changed by the user the pin mode control |
| 5133 | * will take care of enabling the pin's input/output buffers as needed. |
| 5134 | * Therefore there's no need to enable the input buffer at this |
| 5135 | * stage. |
| 5136 | */ |
| 5137 | {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5138 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5139 | |
| 5140 | /* Mute capture amp left and right */ |
| 5141 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5142 | /* Set ADC connection select to match default mixer setting - mic |
| 5143 | * (on mic1 pin) |
| 5144 | */ |
| 5145 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 5146 | |
| 5147 | /* Do similar with the second ADC: mute capture input amp and |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 5148 | * set ADC connection to mic to match ALSA's default state. |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 5149 | */ |
| 5150 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 5151 | {0x05, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 5152 | |
| 5153 | /* Mute all inputs to mixer widget (even unconnected ones) */ |
| 5154 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */ |
| 5155 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */ |
| 5156 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */ |
| 5157 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */ |
| 5158 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */ |
| 5159 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */ |
| 5160 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */ |
| 5161 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */ |
| 5162 | |
| 5163 | { } |
| 5164 | }; |
| 5165 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 5166 | static struct hda_verb alc260_will_verbs[] = { |
| 5167 | {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 5168 | {0x0b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 5169 | {0x0d, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 5170 | {0x0f, AC_VERB_SET_EAPD_BTLENABLE, 0x02}, |
| 5171 | {0x1a, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 5172 | {0x1a, AC_VERB_SET_PROC_COEF, 0x3040}, |
| 5173 | {} |
| 5174 | }; |
| 5175 | |
| 5176 | static struct hda_verb alc260_replacer_672v_verbs[] = { |
| 5177 | {0x0f, AC_VERB_SET_EAPD_BTLENABLE, 0x02}, |
| 5178 | {0x1a, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 5179 | {0x1a, AC_VERB_SET_PROC_COEF, 0x3050}, |
| 5180 | |
| 5181 | {0x01, AC_VERB_SET_GPIO_MASK, 0x01}, |
| 5182 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01}, |
| 5183 | {0x01, AC_VERB_SET_GPIO_DATA, 0x00}, |
| 5184 | |
| 5185 | {0x0f, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 5186 | {} |
| 5187 | }; |
| 5188 | |
| 5189 | /* toggle speaker-output according to the hp-jack state */ |
| 5190 | static void alc260_replacer_672v_automute(struct hda_codec *codec) |
| 5191 | { |
| 5192 | unsigned int present; |
| 5193 | |
| 5194 | /* speaker --> GPIO Data 0, hp or spdif --> GPIO data 1 */ |
| 5195 | present = snd_hda_codec_read(codec, 0x0f, 0, |
| 5196 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 5197 | if (present) { |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 5198 | snd_hda_codec_write_cache(codec, 0x01, 0, |
| 5199 | AC_VERB_SET_GPIO_DATA, 1); |
| 5200 | snd_hda_codec_write_cache(codec, 0x0f, 0, |
| 5201 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 5202 | PIN_HP); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 5203 | } else { |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 5204 | snd_hda_codec_write_cache(codec, 0x01, 0, |
| 5205 | AC_VERB_SET_GPIO_DATA, 0); |
| 5206 | snd_hda_codec_write_cache(codec, 0x0f, 0, |
| 5207 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 5208 | PIN_OUT); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 5209 | } |
| 5210 | } |
| 5211 | |
| 5212 | static void alc260_replacer_672v_unsol_event(struct hda_codec *codec, |
| 5213 | unsigned int res) |
| 5214 | { |
| 5215 | if ((res >> 26) == ALC880_HP_EVENT) |
| 5216 | alc260_replacer_672v_automute(codec); |
| 5217 | } |
| 5218 | |
Kailang Yang | 3f87830 | 2008-08-26 13:02:23 +0200 | [diff] [blame] | 5219 | static struct hda_verb alc260_hp_dc7600_verbs[] = { |
| 5220 | {0x05, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 5221 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 5222 | {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 5223 | {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 5224 | {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 5225 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 5226 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 5227 | {0x10, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 5228 | {0x11, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 5229 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 5230 | {} |
| 5231 | }; |
| 5232 | |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 5233 | /* Test configuration for debugging, modelled after the ALC880 test |
| 5234 | * configuration. |
| 5235 | */ |
| 5236 | #ifdef CONFIG_SND_DEBUG |
| 5237 | static hda_nid_t alc260_test_dac_nids[1] = { |
| 5238 | 0x02, |
| 5239 | }; |
| 5240 | static hda_nid_t alc260_test_adc_nids[2] = { |
| 5241 | 0x04, 0x05, |
| 5242 | }; |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 5243 | /* For testing the ALC260, each input MUX needs its own definition since |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 5244 | * the signal assignments are different. This assumes that the first ADC |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 5245 | * is NID 0x04. |
Jonathan Woithe | 17e7aec | 2006-02-28 11:35:18 +0100 | [diff] [blame] | 5246 | */ |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 5247 | static struct hda_input_mux alc260_test_capture_sources[2] = { |
| 5248 | { |
| 5249 | .num_items = 7, |
| 5250 | .items = { |
| 5251 | { "MIC1 pin", 0x0 }, |
| 5252 | { "MIC2 pin", 0x1 }, |
| 5253 | { "LINE1 pin", 0x2 }, |
| 5254 | { "LINE2 pin", 0x3 }, |
| 5255 | { "CD pin", 0x4 }, |
| 5256 | { "LINE-OUT pin", 0x5 }, |
| 5257 | { "HP-OUT pin", 0x6 }, |
| 5258 | }, |
| 5259 | }, |
| 5260 | { |
| 5261 | .num_items = 8, |
| 5262 | .items = { |
| 5263 | { "MIC1 pin", 0x0 }, |
| 5264 | { "MIC2 pin", 0x1 }, |
| 5265 | { "LINE1 pin", 0x2 }, |
| 5266 | { "LINE2 pin", 0x3 }, |
| 5267 | { "CD pin", 0x4 }, |
| 5268 | { "Mixer", 0x5 }, |
| 5269 | { "LINE-OUT pin", 0x6 }, |
| 5270 | { "HP-OUT pin", 0x7 }, |
| 5271 | }, |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 5272 | }, |
| 5273 | }; |
| 5274 | static struct snd_kcontrol_new alc260_test_mixer[] = { |
| 5275 | /* Output driver widgets */ |
| 5276 | HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT), |
| 5277 | HDA_BIND_MUTE_MONO("Mono Playback Switch", 0x0a, 1, 2, HDA_INPUT), |
| 5278 | HDA_CODEC_VOLUME("LOUT2 Playback Volume", 0x09, 0x0, HDA_OUTPUT), |
| 5279 | HDA_BIND_MUTE("LOUT2 Playback Switch", 0x09, 2, HDA_INPUT), |
| 5280 | HDA_CODEC_VOLUME("LOUT1 Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
| 5281 | HDA_BIND_MUTE("LOUT1 Playback Switch", 0x08, 2, HDA_INPUT), |
| 5282 | |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 5283 | /* Modes for retasking pin widgets |
| 5284 | * Note: the ALC260 doesn't seem to act on requests to enable mic |
| 5285 | * bias from NIDs 0x0f and 0x10. The ALC260 datasheet doesn't |
| 5286 | * mention this restriction. At this stage it's not clear whether |
| 5287 | * this behaviour is intentional or is a hardware bug in chip |
| 5288 | * revisions available at least up until early 2006. Therefore for |
| 5289 | * now allow the "HP-OUT" and "LINE-OUT" Mode controls to span all |
| 5290 | * choices, but if it turns out that the lack of mic bias for these |
| 5291 | * NIDs is intentional we could change their modes from |
| 5292 | * ALC_PIN_DIR_INOUT to ALC_PIN_DIR_INOUT_NOMICBIAS. |
| 5293 | */ |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 5294 | ALC_PIN_MODE("HP-OUT pin mode", 0x10, ALC_PIN_DIR_INOUT), |
| 5295 | ALC_PIN_MODE("LINE-OUT pin mode", 0x0f, ALC_PIN_DIR_INOUT), |
| 5296 | ALC_PIN_MODE("LINE2 pin mode", 0x15, ALC_PIN_DIR_INOUT), |
| 5297 | ALC_PIN_MODE("LINE1 pin mode", 0x14, ALC_PIN_DIR_INOUT), |
| 5298 | ALC_PIN_MODE("MIC2 pin mode", 0x13, ALC_PIN_DIR_INOUT), |
| 5299 | ALC_PIN_MODE("MIC1 pin mode", 0x12, ALC_PIN_DIR_INOUT), |
| 5300 | |
| 5301 | /* Loopback mixer controls */ |
| 5302 | HDA_CODEC_VOLUME("MIC1 Playback Volume", 0x07, 0x00, HDA_INPUT), |
| 5303 | HDA_CODEC_MUTE("MIC1 Playback Switch", 0x07, 0x00, HDA_INPUT), |
| 5304 | HDA_CODEC_VOLUME("MIC2 Playback Volume", 0x07, 0x01, HDA_INPUT), |
| 5305 | HDA_CODEC_MUTE("MIC2 Playback Switch", 0x07, 0x01, HDA_INPUT), |
| 5306 | HDA_CODEC_VOLUME("LINE1 Playback Volume", 0x07, 0x02, HDA_INPUT), |
| 5307 | HDA_CODEC_MUTE("LINE1 Playback Switch", 0x07, 0x02, HDA_INPUT), |
| 5308 | HDA_CODEC_VOLUME("LINE2 Playback Volume", 0x07, 0x03, HDA_INPUT), |
| 5309 | HDA_CODEC_MUTE("LINE2 Playback Switch", 0x07, 0x03, HDA_INPUT), |
| 5310 | HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT), |
| 5311 | HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT), |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 5312 | HDA_CODEC_VOLUME("LINE-OUT loopback Playback Volume", 0x07, 0x06, HDA_INPUT), |
| 5313 | HDA_CODEC_MUTE("LINE-OUT loopback Playback Switch", 0x07, 0x06, HDA_INPUT), |
| 5314 | HDA_CODEC_VOLUME("HP-OUT loopback Playback Volume", 0x07, 0x7, HDA_INPUT), |
| 5315 | HDA_CODEC_MUTE("HP-OUT loopback Playback Switch", 0x07, 0x7, HDA_INPUT), |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 5316 | |
| 5317 | /* Controls for GPIO pins, assuming they are configured as outputs */ |
| 5318 | ALC_GPIO_DATA_SWITCH("GPIO pin 0", 0x01, 0x01), |
| 5319 | ALC_GPIO_DATA_SWITCH("GPIO pin 1", 0x01, 0x02), |
| 5320 | ALC_GPIO_DATA_SWITCH("GPIO pin 2", 0x01, 0x04), |
| 5321 | ALC_GPIO_DATA_SWITCH("GPIO pin 3", 0x01, 0x08), |
| 5322 | |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 5323 | /* Switches to allow the digital IO pins to be enabled. The datasheet |
| 5324 | * is ambigious as to which NID is which; testing on laptops which |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 5325 | * make this output available should provide clarification. |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 5326 | */ |
| 5327 | ALC_SPDIF_CTRL_SWITCH("SPDIF Playback Switch", 0x03, 0x01), |
| 5328 | ALC_SPDIF_CTRL_SWITCH("SPDIF Capture Switch", 0x06, 0x01), |
| 5329 | |
Jonathan Woithe | f8225f6 | 2008-01-08 12:16:54 +0100 | [diff] [blame] | 5330 | /* A switch allowing EAPD to be enabled. Some laptops seem to use |
| 5331 | * this output to turn on an external amplifier. |
| 5332 | */ |
| 5333 | ALC_EAPD_CTRL_SWITCH("LINE-OUT EAPD Enable Switch", 0x0f, 0x02), |
| 5334 | ALC_EAPD_CTRL_SWITCH("HP-OUT EAPD Enable Switch", 0x10, 0x02), |
| 5335 | |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 5336 | { } /* end */ |
| 5337 | }; |
| 5338 | static struct hda_verb alc260_test_init_verbs[] = { |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 5339 | /* Enable all GPIOs as outputs with an initial value of 0 */ |
| 5340 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x0f}, |
| 5341 | {0x01, AC_VERB_SET_GPIO_DATA, 0x00}, |
| 5342 | {0x01, AC_VERB_SET_GPIO_MASK, 0x0f}, |
| 5343 | |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 5344 | /* Enable retasking pins as output, initially without power amp */ |
| 5345 | {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 5346 | {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 5347 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 5348 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 5349 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 5350 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 5351 | |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 5352 | /* Disable digital (SPDIF) pins initially, but users can enable |
| 5353 | * them via a mixer switch. In the case of SPDIF-out, this initverb |
| 5354 | * payload also sets the generation to 0, output to be in "consumer" |
| 5355 | * PCM format, copyright asserted, no pre-emphasis and no validity |
| 5356 | * control. |
| 5357 | */ |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 5358 | {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0}, |
| 5359 | {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0}, |
| 5360 | |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 5361 | /* Ensure mic1, mic2, line1 and line2 pin widgets take input from the |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 5362 | * OUT1 sum bus when acting as an output. |
| 5363 | */ |
| 5364 | {0x0b, AC_VERB_SET_CONNECT_SEL, 0}, |
| 5365 | {0x0c, AC_VERB_SET_CONNECT_SEL, 0}, |
| 5366 | {0x0d, AC_VERB_SET_CONNECT_SEL, 0}, |
| 5367 | {0x0e, AC_VERB_SET_CONNECT_SEL, 0}, |
| 5368 | |
| 5369 | /* Start with output sum widgets muted and their output gains at min */ |
| 5370 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5371 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 5372 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5373 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5374 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 5375 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5376 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5377 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 5378 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5379 | |
Jonathan Woithe | cdcd926 | 2006-02-28 11:36:42 +0100 | [diff] [blame] | 5380 | /* Unmute retasking pin widget output buffers since the default |
| 5381 | * state appears to be output. As the pin mode is changed by the |
| 5382 | * user the pin mode control will take care of enabling the pin's |
| 5383 | * input/output buffers as needed. |
| 5384 | */ |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 5385 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 5386 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 5387 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 5388 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 5389 | {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 5390 | {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 5391 | /* Also unmute the mono-out pin widget */ |
| 5392 | {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 5393 | |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 5394 | /* Mute capture amp left and right */ |
| 5395 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 5396 | /* Set ADC connection select to match default mixer setting (mic1 |
| 5397 | * pin) |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 5398 | */ |
| 5399 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 5400 | |
| 5401 | /* Do the same for the second ADC: mute capture input amp and |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 5402 | * set ADC connection to mic1 pin |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 5403 | */ |
| 5404 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5405 | {0x05, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 5406 | |
| 5407 | /* Mute all inputs to mixer widget (even unconnected ones) */ |
| 5408 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */ |
| 5409 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */ |
| 5410 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */ |
| 5411 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */ |
| 5412 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */ |
| 5413 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */ |
| 5414 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */ |
| 5415 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */ |
| 5416 | |
| 5417 | { } |
| 5418 | }; |
| 5419 | #endif |
| 5420 | |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 5421 | #define alc260_pcm_analog_playback alc880_pcm_analog_alt_playback |
| 5422 | #define alc260_pcm_analog_capture alc880_pcm_analog_capture |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5423 | |
Takashi Iwai | a3bcba3 | 2005-12-06 19:05:29 +0100 | [diff] [blame] | 5424 | #define alc260_pcm_digital_playback alc880_pcm_digital_playback |
| 5425 | #define alc260_pcm_digital_capture alc880_pcm_digital_capture |
| 5426 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5427 | /* |
| 5428 | * for BIOS auto-configuration |
| 5429 | */ |
| 5430 | |
| 5431 | 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] | 5432 | const char *pfx, int *vol_bits) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5433 | { |
| 5434 | hda_nid_t nid_vol; |
| 5435 | unsigned long vol_val, sw_val; |
| 5436 | char name[32]; |
| 5437 | int err; |
| 5438 | |
| 5439 | if (nid >= 0x0f && nid < 0x11) { |
| 5440 | nid_vol = nid - 0x7; |
| 5441 | vol_val = HDA_COMPOSE_AMP_VAL(nid_vol, 3, 0, HDA_OUTPUT); |
| 5442 | sw_val = HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT); |
| 5443 | } else if (nid == 0x11) { |
| 5444 | nid_vol = nid - 0x7; |
| 5445 | vol_val = HDA_COMPOSE_AMP_VAL(nid_vol, 2, 0, HDA_OUTPUT); |
| 5446 | sw_val = HDA_COMPOSE_AMP_VAL(nid, 2, 0, HDA_OUTPUT); |
| 5447 | } else if (nid >= 0x12 && nid <= 0x15) { |
| 5448 | nid_vol = 0x08; |
| 5449 | vol_val = HDA_COMPOSE_AMP_VAL(nid_vol, 3, 0, HDA_OUTPUT); |
| 5450 | sw_val = HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT); |
| 5451 | } else |
| 5452 | return 0; /* N/A */ |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 5453 | |
Takashi Iwai | 863b451 | 2008-10-21 17:01:47 +0200 | [diff] [blame] | 5454 | if (!(*vol_bits & (1 << nid_vol))) { |
| 5455 | /* first control for the volume widget */ |
| 5456 | snprintf(name, sizeof(name), "%s Playback Volume", pfx); |
| 5457 | err = add_control(spec, ALC_CTL_WIDGET_VOL, name, vol_val); |
| 5458 | if (err < 0) |
| 5459 | return err; |
| 5460 | *vol_bits |= (1 << nid_vol); |
| 5461 | } |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5462 | snprintf(name, sizeof(name), "%s Playback Switch", pfx); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5463 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, name, sw_val); |
| 5464 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5465 | return err; |
| 5466 | return 1; |
| 5467 | } |
| 5468 | |
| 5469 | /* add playback controls from the parsed DAC table */ |
| 5470 | static int alc260_auto_create_multi_out_ctls(struct alc_spec *spec, |
| 5471 | const struct auto_pin_cfg *cfg) |
| 5472 | { |
| 5473 | hda_nid_t nid; |
| 5474 | int err; |
Takashi Iwai | 863b451 | 2008-10-21 17:01:47 +0200 | [diff] [blame] | 5475 | int vols = 0; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5476 | |
| 5477 | spec->multiout.num_dacs = 1; |
| 5478 | spec->multiout.dac_nids = spec->private_dac_nids; |
| 5479 | spec->multiout.dac_nids[0] = 0x02; |
| 5480 | |
| 5481 | nid = cfg->line_out_pins[0]; |
| 5482 | if (nid) { |
Takashi Iwai | 863b451 | 2008-10-21 17:01:47 +0200 | [diff] [blame] | 5483 | err = alc260_add_playback_controls(spec, nid, "Front", &vols); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5484 | if (err < 0) |
| 5485 | return err; |
| 5486 | } |
| 5487 | |
Takashi Iwai | 82bc955 | 2006-03-21 11:24:42 +0100 | [diff] [blame] | 5488 | nid = cfg->speaker_pins[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5489 | if (nid) { |
Takashi Iwai | 863b451 | 2008-10-21 17:01:47 +0200 | [diff] [blame] | 5490 | err = alc260_add_playback_controls(spec, nid, "Speaker", &vols); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5491 | if (err < 0) |
| 5492 | return err; |
| 5493 | } |
| 5494 | |
Takashi Iwai | eb06ed8 | 2006-09-20 17:10:27 +0200 | [diff] [blame] | 5495 | nid = cfg->hp_pins[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5496 | if (nid) { |
Takashi Iwai | 863b451 | 2008-10-21 17:01:47 +0200 | [diff] [blame] | 5497 | err = alc260_add_playback_controls(spec, nid, "Headphone", |
| 5498 | &vols); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5499 | if (err < 0) |
| 5500 | return err; |
| 5501 | } |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5502 | return 0; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5503 | } |
| 5504 | |
| 5505 | /* create playback/capture controls for input pins */ |
| 5506 | static int alc260_auto_create_analog_input_ctls(struct alc_spec *spec, |
| 5507 | const struct auto_pin_cfg *cfg) |
| 5508 | { |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 5509 | struct hda_input_mux *imux = &spec->private_imux[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5510 | int i, err, idx; |
| 5511 | |
| 5512 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
| 5513 | if (cfg->input_pins[i] >= 0x12) { |
| 5514 | idx = cfg->input_pins[i] - 0x12; |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 5515 | err = new_analog_input(spec, cfg->input_pins[i], |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5516 | auto_pin_cfg_labels[i], idx, |
| 5517 | 0x07); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5518 | if (err < 0) |
| 5519 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5520 | imux->items[imux->num_items].label = |
| 5521 | auto_pin_cfg_labels[i]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5522 | imux->items[imux->num_items].index = idx; |
| 5523 | imux->num_items++; |
| 5524 | } |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5525 | if (cfg->input_pins[i] >= 0x0f && cfg->input_pins[i] <= 0x10){ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5526 | idx = cfg->input_pins[i] - 0x09; |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 5527 | err = new_analog_input(spec, cfg->input_pins[i], |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5528 | auto_pin_cfg_labels[i], idx, |
| 5529 | 0x07); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5530 | if (err < 0) |
| 5531 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5532 | imux->items[imux->num_items].label = |
| 5533 | auto_pin_cfg_labels[i]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5534 | imux->items[imux->num_items].index = idx; |
| 5535 | imux->num_items++; |
| 5536 | } |
| 5537 | } |
| 5538 | return 0; |
| 5539 | } |
| 5540 | |
| 5541 | static void alc260_auto_set_output_and_unmute(struct hda_codec *codec, |
| 5542 | hda_nid_t nid, int pin_type, |
| 5543 | int sel_idx) |
| 5544 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 5545 | alc_set_pin_output(codec, nid, pin_type); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5546 | /* need the manual connection? */ |
| 5547 | if (nid >= 0x12) { |
| 5548 | int idx = nid - 0x12; |
| 5549 | snd_hda_codec_write(codec, idx + 0x0b, 0, |
| 5550 | AC_VERB_SET_CONNECT_SEL, sel_idx); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5551 | } |
| 5552 | } |
| 5553 | |
| 5554 | static void alc260_auto_init_multi_out(struct hda_codec *codec) |
| 5555 | { |
| 5556 | struct alc_spec *spec = codec->spec; |
| 5557 | hda_nid_t nid; |
| 5558 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 5559 | alc_subsystem_id(codec, 0x10, 0x15, 0x0f); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5560 | nid = spec->autocfg.line_out_pins[0]; |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 5561 | if (nid) { |
| 5562 | int pin_type = get_pin_type(spec->autocfg.line_out_type); |
| 5563 | alc260_auto_set_output_and_unmute(codec, nid, pin_type, 0); |
| 5564 | } |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 5565 | |
Takashi Iwai | 82bc955 | 2006-03-21 11:24:42 +0100 | [diff] [blame] | 5566 | nid = spec->autocfg.speaker_pins[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5567 | if (nid) |
| 5568 | alc260_auto_set_output_and_unmute(codec, nid, PIN_OUT, 0); |
| 5569 | |
Takashi Iwai | eb06ed8 | 2006-09-20 17:10:27 +0200 | [diff] [blame] | 5570 | nid = spec->autocfg.hp_pins[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5571 | if (nid) |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 5572 | alc260_auto_set_output_and_unmute(codec, nid, PIN_HP, 0); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5573 | } |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5574 | |
| 5575 | #define ALC260_PIN_CD_NID 0x16 |
| 5576 | static void alc260_auto_init_analog_input(struct hda_codec *codec) |
| 5577 | { |
| 5578 | struct alc_spec *spec = codec->spec; |
| 5579 | int i; |
| 5580 | |
| 5581 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
| 5582 | hda_nid_t nid = spec->autocfg.input_pins[i]; |
| 5583 | if (nid >= 0x12) { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5584 | snd_hda_codec_write(codec, nid, 0, |
| 5585 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 5586 | i <= AUTO_PIN_FRONT_MIC ? |
| 5587 | PIN_VREF80 : PIN_IN); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5588 | if (nid != ALC260_PIN_CD_NID) |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5589 | snd_hda_codec_write(codec, nid, 0, |
| 5590 | AC_VERB_SET_AMP_GAIN_MUTE, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5591 | AMP_OUT_MUTE); |
| 5592 | } |
| 5593 | } |
| 5594 | } |
| 5595 | |
| 5596 | /* |
| 5597 | * generic initialization of ADC, input mixers and output mixers |
| 5598 | */ |
| 5599 | static struct hda_verb alc260_volume_init_verbs[] = { |
| 5600 | /* |
| 5601 | * Unmute ADC0-1 and set the default input to mic-in |
| 5602 | */ |
| 5603 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 5604 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5605 | {0x05, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 5606 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 5607 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5608 | /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback |
| 5609 | * mixer widget |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5610 | * Note: PASD motherboards uses the Line In 2 as the input for |
| 5611 | * front panel mic (mic 2) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5612 | */ |
| 5613 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 5614 | /* mute analog inputs */ |
| 5615 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5616 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 5617 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 5618 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 5619 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5620 | |
| 5621 | /* |
| 5622 | * Set up output mixers (0x08 - 0x0a) |
| 5623 | */ |
| 5624 | /* set vol=0 to output mixers */ |
| 5625 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5626 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5627 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5628 | /* set up input amps for analog loopback */ |
| 5629 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 5630 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5631 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 5632 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5633 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 5634 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5635 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 5636 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5637 | { } |
| 5638 | }; |
| 5639 | |
| 5640 | static int alc260_parse_auto_config(struct hda_codec *codec) |
| 5641 | { |
| 5642 | struct alc_spec *spec = codec->spec; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5643 | int err; |
| 5644 | static hda_nid_t alc260_ignore[] = { 0x17, 0 }; |
| 5645 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5646 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 5647 | alc260_ignore); |
| 5648 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5649 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5650 | err = alc260_auto_create_multi_out_ctls(spec, &spec->autocfg); |
| 5651 | if (err < 0) |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 5652 | return err; |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 5653 | if (!spec->kctls.list) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5654 | return 0; /* can't find valid BIOS pin config */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5655 | err = alc260_auto_create_analog_input_ctls(spec, &spec->autocfg); |
| 5656 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5657 | return err; |
| 5658 | |
| 5659 | spec->multiout.max_channels = 2; |
| 5660 | |
Takashi Iwai | 0852d7a | 2009-02-11 11:35:15 +0100 | [diff] [blame] | 5661 | if (spec->autocfg.dig_outs) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5662 | spec->multiout.dig_out_nid = ALC260_DIGOUT_NID; |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 5663 | if (spec->kctls.list) |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 5664 | add_mixer(spec, spec->kctls.list); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5665 | |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 5666 | add_verb(spec, alc260_volume_init_verbs); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5667 | |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 5668 | spec->num_mux_defs = 1; |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 5669 | spec->input_mux = &spec->private_imux[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5670 | |
Takashi Iwai | e044c39 | 2008-10-27 16:56:24 +0100 | [diff] [blame] | 5671 | store_pin_configs(codec); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5672 | return 1; |
| 5673 | } |
| 5674 | |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 5675 | /* additional initialization for auto-configuration model */ |
| 5676 | static void alc260_auto_init(struct hda_codec *codec) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5677 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 5678 | struct alc_spec *spec = codec->spec; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5679 | alc260_auto_init_multi_out(codec); |
| 5680 | alc260_auto_init_analog_input(codec); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 5681 | if (spec->unsol_event) |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 5682 | alc_inithook(codec); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5683 | } |
| 5684 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 5685 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 5686 | static struct hda_amp_list alc260_loopbacks[] = { |
| 5687 | { 0x07, HDA_INPUT, 0 }, |
| 5688 | { 0x07, HDA_INPUT, 1 }, |
| 5689 | { 0x07, HDA_INPUT, 2 }, |
| 5690 | { 0x07, HDA_INPUT, 3 }, |
| 5691 | { 0x07, HDA_INPUT, 4 }, |
| 5692 | { } /* end */ |
| 5693 | }; |
| 5694 | #endif |
| 5695 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5696 | /* |
| 5697 | * ALC260 configurations |
| 5698 | */ |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 5699 | static const char *alc260_models[ALC260_MODEL_LAST] = { |
| 5700 | [ALC260_BASIC] = "basic", |
| 5701 | [ALC260_HP] = "hp", |
| 5702 | [ALC260_HP_3013] = "hp-3013", |
Takashi Iwai | 2922c9a | 2008-08-27 18:12:42 +0200 | [diff] [blame] | 5703 | [ALC260_HP_DC7600] = "hp-dc7600", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 5704 | [ALC260_FUJITSU_S702X] = "fujitsu", |
| 5705 | [ALC260_ACER] = "acer", |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 5706 | [ALC260_WILL] = "will", |
| 5707 | [ALC260_REPLACER_672V] = "replacer", |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 5708 | #ifdef CONFIG_SND_DEBUG |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 5709 | [ALC260_TEST] = "test", |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 5710 | #endif |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 5711 | [ALC260_AUTO] = "auto", |
| 5712 | }; |
| 5713 | |
| 5714 | static struct snd_pci_quirk alc260_cfg_tbl[] = { |
Jonathan Woithe | bd86948 | 2006-11-28 11:35:52 +0100 | [diff] [blame] | 5715 | SND_PCI_QUIRK(0x1025, 0x007b, "Acer C20x", ALC260_ACER), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 5716 | SND_PCI_QUIRK(0x1025, 0x008f, "Acer", ALC260_ACER), |
Takashi Iwai | 9720b71 | 2007-03-13 21:46:23 +0100 | [diff] [blame] | 5717 | SND_PCI_QUIRK(0x103c, 0x2808, "HP d5700", ALC260_HP_3013), |
Takashi Iwai | a8a5d06 | 2007-03-15 15:10:28 +0100 | [diff] [blame] | 5718 | SND_PCI_QUIRK(0x103c, 0x280a, "HP d5750", ALC260_HP_3013), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 5719 | SND_PCI_QUIRK(0x103c, 0x3010, "HP", ALC260_HP_3013), |
Jaroslav Kysela | 34ec8a0 | 2008-07-10 14:49:19 +0200 | [diff] [blame] | 5720 | SND_PCI_QUIRK(0x103c, 0x3011, "HP", ALC260_HP_3013), |
Kailang Yang | 3f87830 | 2008-08-26 13:02:23 +0200 | [diff] [blame] | 5721 | SND_PCI_QUIRK(0x103c, 0x3012, "HP", ALC260_HP_DC7600), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 5722 | SND_PCI_QUIRK(0x103c, 0x3013, "HP", ALC260_HP_3013), |
| 5723 | SND_PCI_QUIRK(0x103c, 0x3014, "HP", ALC260_HP), |
| 5724 | SND_PCI_QUIRK(0x103c, 0x3015, "HP", ALC260_HP), |
| 5725 | SND_PCI_QUIRK(0x103c, 0x3016, "HP", ALC260_HP), |
| 5726 | SND_PCI_QUIRK(0x104d, 0x81bb, "Sony VAIO", ALC260_BASIC), |
| 5727 | SND_PCI_QUIRK(0x104d, 0x81cc, "Sony VAIO", ALC260_BASIC), |
| 5728 | SND_PCI_QUIRK(0x104d, 0x81cd, "Sony VAIO", ALC260_BASIC), |
| 5729 | SND_PCI_QUIRK(0x10cf, 0x1326, "Fujitsu S702X", ALC260_FUJITSU_S702X), |
| 5730 | SND_PCI_QUIRK(0x152d, 0x0729, "CTL U553W", ALC260_BASIC), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 5731 | SND_PCI_QUIRK(0x161f, 0x2057, "Replacer 672V", ALC260_REPLACER_672V), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 5732 | SND_PCI_QUIRK(0x1631, 0xc017, "PB V7900", ALC260_WILL), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 5733 | {} |
| 5734 | }; |
| 5735 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5736 | static struct alc_config_preset alc260_presets[] = { |
| 5737 | [ALC260_BASIC] = { |
| 5738 | .mixers = { alc260_base_output_mixer, |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 5739 | alc260_input_mixer }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5740 | .init_verbs = { alc260_init_verbs }, |
| 5741 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
| 5742 | .dac_nids = alc260_dac_nids, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 5743 | .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5744 | .adc_nids = alc260_adc_nids, |
| 5745 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 5746 | .channel_mode = alc260_modes, |
| 5747 | .input_mux = &alc260_capture_source, |
| 5748 | }, |
| 5749 | [ALC260_HP] = { |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 5750 | .mixers = { alc260_hp_output_mixer, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 5751 | alc260_input_mixer }, |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 5752 | .init_verbs = { alc260_init_verbs, |
| 5753 | alc260_hp_unsol_verbs }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5754 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
| 5755 | .dac_nids = alc260_dac_nids, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 5756 | .num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt), |
| 5757 | .adc_nids = alc260_adc_nids_alt, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5758 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 5759 | .channel_mode = alc260_modes, |
| 5760 | .input_mux = &alc260_capture_source, |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 5761 | .unsol_event = alc260_hp_unsol_event, |
| 5762 | .init_hook = alc260_hp_automute, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5763 | }, |
Kailang Yang | 3f87830 | 2008-08-26 13:02:23 +0200 | [diff] [blame] | 5764 | [ALC260_HP_DC7600] = { |
| 5765 | .mixers = { alc260_hp_dc7600_mixer, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 5766 | alc260_input_mixer }, |
Kailang Yang | 3f87830 | 2008-08-26 13:02:23 +0200 | [diff] [blame] | 5767 | .init_verbs = { alc260_init_verbs, |
| 5768 | alc260_hp_dc7600_verbs }, |
| 5769 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
| 5770 | .dac_nids = alc260_dac_nids, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 5771 | .num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt), |
| 5772 | .adc_nids = alc260_adc_nids_alt, |
Kailang Yang | 3f87830 | 2008-08-26 13:02:23 +0200 | [diff] [blame] | 5773 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 5774 | .channel_mode = alc260_modes, |
| 5775 | .input_mux = &alc260_capture_source, |
| 5776 | .unsol_event = alc260_hp_3012_unsol_event, |
| 5777 | .init_hook = alc260_hp_3012_automute, |
| 5778 | }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5779 | [ALC260_HP_3013] = { |
| 5780 | .mixers = { alc260_hp_3013_mixer, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 5781 | alc260_input_mixer }, |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 5782 | .init_verbs = { alc260_hp_3013_init_verbs, |
| 5783 | alc260_hp_3013_unsol_verbs }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5784 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
| 5785 | .dac_nids = alc260_dac_nids, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 5786 | .num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt), |
| 5787 | .adc_nids = alc260_adc_nids_alt, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5788 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 5789 | .channel_mode = alc260_modes, |
| 5790 | .input_mux = &alc260_capture_source, |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 5791 | .unsol_event = alc260_hp_3013_unsol_event, |
| 5792 | .init_hook = alc260_hp_3013_automute, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5793 | }, |
| 5794 | [ALC260_FUJITSU_S702X] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 5795 | .mixers = { alc260_fujitsu_mixer }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5796 | .init_verbs = { alc260_fujitsu_init_verbs }, |
| 5797 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
| 5798 | .dac_nids = alc260_dac_nids, |
Jonathan Woithe | d57fdac | 2006-02-28 11:38:35 +0100 | [diff] [blame] | 5799 | .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids), |
| 5800 | .adc_nids = alc260_dual_adc_nids, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5801 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 5802 | .channel_mode = alc260_modes, |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 5803 | .num_mux_defs = ARRAY_SIZE(alc260_fujitsu_capture_sources), |
| 5804 | .input_mux = alc260_fujitsu_capture_sources, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5805 | }, |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 5806 | [ALC260_ACER] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 5807 | .mixers = { alc260_acer_mixer }, |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 5808 | .init_verbs = { alc260_acer_init_verbs }, |
| 5809 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
| 5810 | .dac_nids = alc260_dac_nids, |
| 5811 | .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids), |
| 5812 | .adc_nids = alc260_dual_adc_nids, |
| 5813 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 5814 | .channel_mode = alc260_modes, |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 5815 | .num_mux_defs = ARRAY_SIZE(alc260_acer_capture_sources), |
| 5816 | .input_mux = alc260_acer_capture_sources, |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 5817 | }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 5818 | [ALC260_WILL] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 5819 | .mixers = { alc260_will_mixer }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 5820 | .init_verbs = { alc260_init_verbs, alc260_will_verbs }, |
| 5821 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
| 5822 | .dac_nids = alc260_dac_nids, |
| 5823 | .num_adc_nids = ARRAY_SIZE(alc260_adc_nids), |
| 5824 | .adc_nids = alc260_adc_nids, |
| 5825 | .dig_out_nid = ALC260_DIGOUT_NID, |
| 5826 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 5827 | .channel_mode = alc260_modes, |
| 5828 | .input_mux = &alc260_capture_source, |
| 5829 | }, |
| 5830 | [ALC260_REPLACER_672V] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 5831 | .mixers = { alc260_replacer_672v_mixer }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 5832 | .init_verbs = { alc260_init_verbs, alc260_replacer_672v_verbs }, |
| 5833 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
| 5834 | .dac_nids = alc260_dac_nids, |
| 5835 | .num_adc_nids = ARRAY_SIZE(alc260_adc_nids), |
| 5836 | .adc_nids = alc260_adc_nids, |
| 5837 | .dig_out_nid = ALC260_DIGOUT_NID, |
| 5838 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 5839 | .channel_mode = alc260_modes, |
| 5840 | .input_mux = &alc260_capture_source, |
| 5841 | .unsol_event = alc260_replacer_672v_unsol_event, |
| 5842 | .init_hook = alc260_replacer_672v_automute, |
| 5843 | }, |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 5844 | #ifdef CONFIG_SND_DEBUG |
| 5845 | [ALC260_TEST] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 5846 | .mixers = { alc260_test_mixer }, |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 5847 | .init_verbs = { alc260_test_init_verbs }, |
| 5848 | .num_dacs = ARRAY_SIZE(alc260_test_dac_nids), |
| 5849 | .dac_nids = alc260_test_dac_nids, |
| 5850 | .num_adc_nids = ARRAY_SIZE(alc260_test_adc_nids), |
| 5851 | .adc_nids = alc260_test_adc_nids, |
| 5852 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 5853 | .channel_mode = alc260_modes, |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 5854 | .num_mux_defs = ARRAY_SIZE(alc260_test_capture_sources), |
| 5855 | .input_mux = alc260_test_capture_sources, |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 5856 | }, |
| 5857 | #endif |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5858 | }; |
| 5859 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5860 | static int patch_alc260(struct hda_codec *codec) |
| 5861 | { |
| 5862 | struct alc_spec *spec; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5863 | int err, board_config; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5864 | |
Takashi Iwai | e560d8d | 2005-09-09 14:21:46 +0200 | [diff] [blame] | 5865 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5866 | if (spec == NULL) |
| 5867 | return -ENOMEM; |
| 5868 | |
| 5869 | codec->spec = spec; |
| 5870 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 5871 | board_config = snd_hda_check_board_config(codec, ALC260_MODEL_LAST, |
| 5872 | alc260_models, |
| 5873 | alc260_cfg_tbl); |
| 5874 | if (board_config < 0) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 5875 | snd_printd(KERN_INFO "hda_codec: Unknown model for ALC260, " |
| 5876 | "trying auto-probe from BIOS...\n"); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5877 | board_config = ALC260_AUTO; |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 5878 | } |
| 5879 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5880 | if (board_config == ALC260_AUTO) { |
| 5881 | /* automatic parse from the BIOS config */ |
| 5882 | err = alc260_parse_auto_config(codec); |
| 5883 | if (err < 0) { |
| 5884 | alc_free(codec); |
| 5885 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5886 | } else if (!err) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 5887 | printk(KERN_INFO |
| 5888 | "hda_codec: Cannot set up configuration " |
| 5889 | "from BIOS. Using base mode...\n"); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5890 | board_config = ALC260_BASIC; |
| 5891 | } |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 5892 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5893 | |
Kusanagi Kouichi | 680cd53 | 2009-02-05 00:00:58 +0900 | [diff] [blame] | 5894 | err = snd_hda_attach_beep_device(codec, 0x1); |
| 5895 | if (err < 0) { |
| 5896 | alc_free(codec); |
| 5897 | return err; |
| 5898 | } |
| 5899 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5900 | if (board_config != ALC260_AUTO) |
| 5901 | setup_preset(spec, &alc260_presets[board_config]); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5902 | |
| 5903 | spec->stream_name_analog = "ALC260 Analog"; |
| 5904 | spec->stream_analog_playback = &alc260_pcm_analog_playback; |
| 5905 | spec->stream_analog_capture = &alc260_pcm_analog_capture; |
| 5906 | |
Takashi Iwai | a3bcba3 | 2005-12-06 19:05:29 +0100 | [diff] [blame] | 5907 | spec->stream_name_digital = "ALC260 Digital"; |
| 5908 | spec->stream_digital_playback = &alc260_pcm_digital_playback; |
| 5909 | spec->stream_digital_capture = &alc260_pcm_digital_capture; |
| 5910 | |
Takashi Iwai | 4ef0ef1 | 2008-11-03 17:47:49 +0100 | [diff] [blame] | 5911 | if (!spec->adc_nids && spec->input_mux) { |
| 5912 | /* check whether NID 0x04 is valid */ |
| 5913 | unsigned int wcap = get_wcaps(codec, 0x04); |
| 5914 | wcap = (wcap & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT; |
| 5915 | /* get type */ |
| 5916 | if (wcap != AC_WID_AUD_IN || spec->input_mux->num_items == 1) { |
| 5917 | spec->adc_nids = alc260_adc_nids_alt; |
| 5918 | spec->num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt); |
| 5919 | } else { |
| 5920 | spec->adc_nids = alc260_adc_nids; |
| 5921 | spec->num_adc_nids = ARRAY_SIZE(alc260_adc_nids); |
| 5922 | } |
| 5923 | } |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 5924 | set_capture_mixer(spec); |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 5925 | set_beep_amp(spec, 0x07, 0x05, HDA_INPUT); |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 5926 | |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 5927 | spec->vmaster_nid = 0x08; |
| 5928 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5929 | codec->patch_ops = alc_patch_ops; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5930 | if (board_config == ALC260_AUTO) |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 5931 | spec->init_hook = alc260_auto_init; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 5932 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 5933 | if (!spec->loopback.amplist) |
| 5934 | spec->loopback.amplist = alc260_loopbacks; |
| 5935 | #endif |
Takashi Iwai | daead53 | 2008-11-28 12:55:36 +0100 | [diff] [blame] | 5936 | codec->proc_widget_hook = print_realtek_coef; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5937 | |
| 5938 | return 0; |
| 5939 | } |
| 5940 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5941 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5942 | /* |
| 5943 | * ALC882 support |
| 5944 | * |
| 5945 | * ALC882 is almost identical with ALC880 but has cleaner and more flexible |
| 5946 | * configuration. Each pin widget can choose any input DACs and a mixer. |
| 5947 | * Each ADC is connected from a mixer of all inputs. This makes possible |
| 5948 | * 6-channel independent captures. |
| 5949 | * |
| 5950 | * In addition, an independent DAC for the multi-playback (not used in this |
| 5951 | * driver yet). |
| 5952 | */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5953 | #define ALC882_DIGOUT_NID 0x06 |
| 5954 | #define ALC882_DIGIN_NID 0x0a |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5955 | |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 5956 | static struct hda_channel_mode alc882_ch_modes[1] = { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5957 | { 8, NULL } |
| 5958 | }; |
| 5959 | |
| 5960 | static hda_nid_t alc882_dac_nids[4] = { |
| 5961 | /* front, rear, clfe, rear_surr */ |
| 5962 | 0x02, 0x03, 0x04, 0x05 |
| 5963 | }; |
| 5964 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5965 | /* identical with ALC880 */ |
| 5966 | #define alc882_adc_nids alc880_adc_nids |
| 5967 | #define alc882_adc_nids_alt alc880_adc_nids_alt |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5968 | |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 5969 | static hda_nid_t alc882_capsrc_nids[3] = { 0x24, 0x23, 0x22 }; |
| 5970 | static hda_nid_t alc882_capsrc_nids_alt[2] = { 0x23, 0x22 }; |
| 5971 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5972 | /* input MUX */ |
| 5973 | /* FIXME: should be a matrix-type input source selection */ |
| 5974 | |
| 5975 | static struct hda_input_mux alc882_capture_source = { |
| 5976 | .num_items = 4, |
| 5977 | .items = { |
| 5978 | { "Mic", 0x0 }, |
| 5979 | { "Front Mic", 0x1 }, |
| 5980 | { "Line", 0x2 }, |
| 5981 | { "CD", 0x4 }, |
| 5982 | }, |
| 5983 | }; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5984 | /* |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 5985 | * 2ch mode |
| 5986 | */ |
| 5987 | static struct hda_verb alc882_3ST_ch2_init[] = { |
| 5988 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 5989 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 5990 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 5991 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 5992 | { } /* end */ |
| 5993 | }; |
| 5994 | |
| 5995 | /* |
| 5996 | * 6ch mode |
| 5997 | */ |
| 5998 | static struct hda_verb alc882_3ST_ch6_init[] = { |
| 5999 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6000 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 6001 | { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 }, |
| 6002 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6003 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 6004 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 6005 | { } /* end */ |
| 6006 | }; |
| 6007 | |
| 6008 | static struct hda_channel_mode alc882_3ST_6ch_modes[2] = { |
| 6009 | { 2, alc882_3ST_ch2_init }, |
| 6010 | { 6, alc882_3ST_ch6_init }, |
| 6011 | }; |
| 6012 | |
| 6013 | /* |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6014 | * 6ch mode |
| 6015 | */ |
| 6016 | static struct hda_verb alc882_sixstack_ch6_init[] = { |
| 6017 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 6018 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6019 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6020 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6021 | { } /* end */ |
| 6022 | }; |
| 6023 | |
| 6024 | /* |
| 6025 | * 8ch mode |
| 6026 | */ |
| 6027 | static struct hda_verb alc882_sixstack_ch8_init[] = { |
| 6028 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6029 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6030 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6031 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6032 | { } /* end */ |
| 6033 | }; |
| 6034 | |
| 6035 | static struct hda_channel_mode alc882_sixstack_modes[2] = { |
| 6036 | { 6, alc882_sixstack_ch6_init }, |
| 6037 | { 8, alc882_sixstack_ch8_init }, |
| 6038 | }; |
| 6039 | |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 6040 | /* |
| 6041 | * macbook pro ALC885 can switch LineIn to LineOut without loosing Mic |
| 6042 | */ |
| 6043 | |
| 6044 | /* |
| 6045 | * 2ch mode |
| 6046 | */ |
| 6047 | static struct hda_verb alc885_mbp_ch2_init[] = { |
| 6048 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 6049 | { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6050 | { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 6051 | { } /* end */ |
| 6052 | }; |
| 6053 | |
| 6054 | /* |
| 6055 | * 6ch mode |
| 6056 | */ |
| 6057 | static struct hda_verb alc885_mbp_ch6_init[] = { |
| 6058 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6059 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 6060 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 6061 | { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6062 | { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 6063 | { } /* end */ |
| 6064 | }; |
| 6065 | |
| 6066 | static struct hda_channel_mode alc885_mbp_6ch_modes[2] = { |
| 6067 | { 2, alc885_mbp_ch2_init }, |
| 6068 | { 6, alc885_mbp_ch6_init }, |
| 6069 | }; |
| 6070 | |
| 6071 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6072 | /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17 |
| 6073 | * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b |
| 6074 | */ |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 6075 | static struct snd_kcontrol_new alc882_base_mixer[] = { |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 6076 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 6077 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 6078 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 6079 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 6080 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 6081 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 6082 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 6083 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 6084 | HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 6085 | HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6086 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 6087 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 6088 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 6089 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 6090 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 6091 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 6092 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6093 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 6094 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 6095 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6096 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6097 | { } /* end */ |
| 6098 | }; |
| 6099 | |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 6100 | static struct snd_kcontrol_new alc885_mbp3_mixer[] = { |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 6101 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x00, HDA_OUTPUT), |
| 6102 | HDA_BIND_MUTE ("Front Playback Switch", 0x0c, 0x02, HDA_INPUT), |
| 6103 | HDA_CODEC_MUTE ("Speaker Playback Switch", 0x14, 0x00, HDA_OUTPUT), |
| 6104 | HDA_CODEC_VOLUME("Line-Out Playback Volume", 0x0d, 0x00, HDA_OUTPUT), |
| 6105 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 6106 | HDA_CODEC_MUTE ("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 6107 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x00, HDA_INPUT), |
| 6108 | HDA_CODEC_MUTE ("Mic Playback Switch", 0x0b, 0x00, HDA_INPUT), |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 6109 | HDA_CODEC_VOLUME("Line Boost", 0x1a, 0x00, HDA_INPUT), |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 6110 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0x00, HDA_INPUT), |
| 6111 | { } /* end */ |
| 6112 | }; |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 6113 | static struct snd_kcontrol_new alc882_w2jc_mixer[] = { |
| 6114 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 6115 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 6116 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 6117 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 6118 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 6119 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 6120 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 6121 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 6122 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 6123 | { } /* end */ |
| 6124 | }; |
| 6125 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 6126 | static struct snd_kcontrol_new alc882_targa_mixer[] = { |
| 6127 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 6128 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 6129 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 6130 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 6131 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 6132 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 6133 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 6134 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 6135 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Takashi Iwai | 96fe7cc8 | 2007-09-07 10:57:44 +0200 | [diff] [blame] | 6136 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 6137 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 6138 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Takashi Iwai | 96fe7cc8 | 2007-09-07 10:57:44 +0200 | [diff] [blame] | 6139 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 6140 | { } /* end */ |
| 6141 | }; |
| 6142 | |
| 6143 | /* Pin assignment: Front=0x14, HP = 0x15, Front = 0x16, ??? |
| 6144 | * Front Mic=0x18, Line In = 0x1a, Line In = 0x1b, CD = 0x1c |
| 6145 | */ |
| 6146 | static struct snd_kcontrol_new alc882_asus_a7j_mixer[] = { |
| 6147 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 6148 | HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 6149 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 6150 | HDA_CODEC_MUTE("Mobile Front Playback Switch", 0x16, 0x0, HDA_OUTPUT), |
| 6151 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 6152 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 6153 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 6154 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 6155 | HDA_CODEC_VOLUME("Mobile Line Playback Volume", 0x0b, 0x03, HDA_INPUT), |
| 6156 | HDA_CODEC_MUTE("Mobile Line Playback Switch", 0x0b, 0x03, HDA_INPUT), |
| 6157 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 6158 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Takashi Iwai | 96fe7cc8 | 2007-09-07 10:57:44 +0200 | [diff] [blame] | 6159 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 6160 | { } /* end */ |
| 6161 | }; |
| 6162 | |
Takashi Iwai | 914759b | 2007-09-06 14:52:04 +0200 | [diff] [blame] | 6163 | static struct snd_kcontrol_new alc882_asus_a7m_mixer[] = { |
| 6164 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 6165 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 6166 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 6167 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 6168 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 6169 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 6170 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 6171 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 6172 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 6173 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Takashi Iwai | 914759b | 2007-09-06 14:52:04 +0200 | [diff] [blame] | 6174 | { } /* end */ |
| 6175 | }; |
| 6176 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6177 | static struct snd_kcontrol_new alc882_chmode_mixer[] = { |
| 6178 | { |
| 6179 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 6180 | .name = "Channel Mode", |
| 6181 | .info = alc_ch_mode_info, |
| 6182 | .get = alc_ch_mode_get, |
| 6183 | .put = alc_ch_mode_put, |
| 6184 | }, |
| 6185 | { } /* end */ |
| 6186 | }; |
| 6187 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6188 | static struct hda_verb alc882_init_verbs[] = { |
| 6189 | /* Front mixer: unmute input/output amp left and right (volume = 0) */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 6190 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 6191 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6192 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6193 | /* Rear mixer */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 6194 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 6195 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6196 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6197 | /* CLFE mixer */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 6198 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 6199 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6200 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6201 | /* Side mixer */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 6202 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 6203 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6204 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6205 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 6206 | /* Front Pin: output 0 (0x0c) */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 6207 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 6208 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6209 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 6210 | /* Rear Pin: output 1 (0x0d) */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 6211 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 6212 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6213 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 6214 | /* CLFE Pin: output 2 (0x0e) */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 6215 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 6216 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6217 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x02}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 6218 | /* Side Pin: output 3 (0x0f) */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 6219 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 6220 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6221 | {0x17, AC_VERB_SET_CONNECT_SEL, 0x03}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 6222 | /* Mic (rear) pin: input vref at 80% */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 6223 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 6224 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 6225 | /* Front Mic pin: input vref at 80% */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 6226 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 6227 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 6228 | /* Line In pin: input */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 6229 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 6230 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 6231 | /* Line-2 In: Headphone output (output 0 - 0x0c) */ |
| 6232 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 6233 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 6234 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6235 | /* CD pin widget for input */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 6236 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6237 | |
| 6238 | /* FIXME: use matrix-type input source selection */ |
| 6239 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 6240 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 6241 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6242 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 6243 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 6244 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6245 | /* Input mixer2 */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 6246 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6247 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 6248 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 6249 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6250 | /* Input mixer3 */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 6251 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6252 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 6253 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 6254 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 6255 | /* ADC1: mute amp left and right */ |
| 6256 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 6257 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 6258 | /* ADC2: mute amp left and right */ |
| 6259 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 6260 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 6261 | /* ADC3: mute amp left and right */ |
| 6262 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 6263 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6264 | |
| 6265 | { } |
| 6266 | }; |
| 6267 | |
Takashi Iwai | 4b146cb | 2006-07-28 14:42:36 +0200 | [diff] [blame] | 6268 | static struct hda_verb alc882_eapd_verbs[] = { |
| 6269 | /* change to EAPD mode */ |
| 6270 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
Andrew L. Neporada | b373bde | 2006-11-07 11:37:08 +0100 | [diff] [blame] | 6271 | {0x20, AC_VERB_SET_PROC_COEF, 0x3060}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6272 | { } |
Takashi Iwai | 4b146cb | 2006-07-28 14:42:36 +0200 | [diff] [blame] | 6273 | }; |
| 6274 | |
Tobin Davis | 9102cd1 | 2006-12-15 10:02:12 +0100 | [diff] [blame] | 6275 | /* Mac Pro test */ |
| 6276 | static struct snd_kcontrol_new alc882_macpro_mixer[] = { |
| 6277 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 6278 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 6279 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x18, 0x0, HDA_OUTPUT), |
| 6280 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 6281 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT), |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 6282 | /* FIXME: this looks suspicious... |
Tobin Davis | 9102cd1 | 2006-12-15 10:02:12 +0100 | [diff] [blame] | 6283 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 6284 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x02, HDA_INPUT), |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 6285 | */ |
Tobin Davis | 9102cd1 | 2006-12-15 10:02:12 +0100 | [diff] [blame] | 6286 | { } /* end */ |
| 6287 | }; |
| 6288 | |
| 6289 | static struct hda_verb alc882_macpro_init_verbs[] = { |
| 6290 | /* Front mixer: unmute input/output amp left and right (volume = 0) */ |
| 6291 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 6292 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6293 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 6294 | /* Front Pin: output 0 (0x0c) */ |
| 6295 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 6296 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 6297 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 6298 | /* Front Mic pin: input vref at 80% */ |
| 6299 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 6300 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 6301 | /* Speaker: output */ |
| 6302 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 6303 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 6304 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x04}, |
| 6305 | /* Headphone output (output 0 - 0x0c) */ |
| 6306 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 6307 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 6308 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 6309 | |
| 6310 | /* FIXME: use matrix-type input source selection */ |
| 6311 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 6312 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ |
| 6313 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6314 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 6315 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 6316 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 6317 | /* Input mixer2 */ |
| 6318 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6319 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 6320 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 6321 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 6322 | /* Input mixer3 */ |
| 6323 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6324 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 6325 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 6326 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 6327 | /* ADC1: mute amp left and right */ |
| 6328 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6329 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 6330 | /* ADC2: mute amp left and right */ |
| 6331 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6332 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 6333 | /* ADC3: mute amp left and right */ |
| 6334 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6335 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 6336 | |
| 6337 | { } |
| 6338 | }; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6339 | |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 6340 | /* Macbook Pro rev3 */ |
| 6341 | static struct hda_verb alc885_mbp3_init_verbs[] = { |
| 6342 | /* Front mixer: unmute input/output amp left and right (volume = 0) */ |
| 6343 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 6344 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6345 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 6346 | /* Rear mixer */ |
| 6347 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 6348 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6349 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 6350 | /* Front Pin: output 0 (0x0c) */ |
| 6351 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 6352 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 6353 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 6354 | /* HP Pin: output 0 (0x0d) */ |
| 6355 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc4}, |
| 6356 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 6357 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 6358 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 6359 | /* Mic (rear) pin: input vref at 80% */ |
| 6360 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 6361 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 6362 | /* Front Mic pin: input vref at 80% */ |
| 6363 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 6364 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 6365 | /* Line In pin: use output 1 when in LineOut mode */ |
| 6366 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 6367 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 6368 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 6369 | |
| 6370 | /* FIXME: use matrix-type input source selection */ |
| 6371 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 6372 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ |
| 6373 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6374 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 6375 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 6376 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 6377 | /* Input mixer2 */ |
| 6378 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6379 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 6380 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 6381 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 6382 | /* Input mixer3 */ |
| 6383 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6384 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 6385 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 6386 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 6387 | /* ADC1: mute amp left and right */ |
| 6388 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6389 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 6390 | /* ADC2: mute amp left and right */ |
| 6391 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6392 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 6393 | /* ADC3: mute amp left and right */ |
| 6394 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6395 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 6396 | |
| 6397 | { } |
| 6398 | }; |
| 6399 | |
Nicola Fagnani | c54728d | 2007-07-19 23:28:52 +0200 | [diff] [blame] | 6400 | /* iMac 24 mixer. */ |
| 6401 | static struct snd_kcontrol_new alc885_imac24_mixer[] = { |
| 6402 | HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x00, HDA_OUTPUT), |
| 6403 | HDA_CODEC_MUTE("Master Playback Switch", 0x0c, 0x00, HDA_INPUT), |
| 6404 | { } /* end */ |
| 6405 | }; |
| 6406 | |
| 6407 | /* iMac 24 init verbs. */ |
| 6408 | static struct hda_verb alc885_imac24_init_verbs[] = { |
| 6409 | /* Internal speakers: output 0 (0x0c) */ |
| 6410 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 6411 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 6412 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 6413 | /* Internal speakers: output 0 (0x0c) */ |
| 6414 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 6415 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 6416 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 6417 | /* Headphone: output 0 (0x0c) */ |
| 6418 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 6419 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 6420 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 6421 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 6422 | /* Front Mic: input vref at 80% */ |
| 6423 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 6424 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 6425 | { } |
| 6426 | }; |
| 6427 | |
| 6428 | /* Toggle speaker-output according to the hp-jack state */ |
| 6429 | static void alc885_imac24_automute(struct hda_codec *codec) |
| 6430 | { |
| 6431 | unsigned int present; |
| 6432 | |
| 6433 | present = snd_hda_codec_read(codec, 0x14, 0, |
| 6434 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 6435 | snd_hda_codec_amp_stereo(codec, 0x18, HDA_OUTPUT, 0, |
| 6436 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
| 6437 | snd_hda_codec_amp_stereo(codec, 0x1a, HDA_OUTPUT, 0, |
| 6438 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
Nicola Fagnani | c54728d | 2007-07-19 23:28:52 +0200 | [diff] [blame] | 6439 | } |
| 6440 | |
| 6441 | /* Processes unsolicited events. */ |
| 6442 | static void alc885_imac24_unsol_event(struct hda_codec *codec, |
| 6443 | unsigned int res) |
| 6444 | { |
| 6445 | /* Headphone insertion or removal. */ |
| 6446 | if ((res >> 26) == ALC880_HP_EVENT) |
| 6447 | alc885_imac24_automute(codec); |
| 6448 | } |
| 6449 | |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 6450 | static void alc885_mbp3_automute(struct hda_codec *codec) |
| 6451 | { |
| 6452 | unsigned int present; |
| 6453 | |
| 6454 | present = snd_hda_codec_read(codec, 0x15, 0, |
| 6455 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 6456 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 6457 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
| 6458 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 6459 | HDA_AMP_MUTE, present ? 0 : HDA_AMP_MUTE); |
| 6460 | |
| 6461 | } |
| 6462 | static void alc885_mbp3_unsol_event(struct hda_codec *codec, |
| 6463 | unsigned int res) |
| 6464 | { |
| 6465 | /* Headphone insertion or removal. */ |
| 6466 | if ((res >> 26) == ALC880_HP_EVENT) |
| 6467 | alc885_mbp3_automute(codec); |
| 6468 | } |
| 6469 | |
| 6470 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 6471 | static struct hda_verb alc882_targa_verbs[] = { |
| 6472 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6473 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 6474 | |
| 6475 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 6476 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 6477 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 6478 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */ |
| 6479 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */ |
| 6480 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 6481 | |
| 6482 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 6483 | {0x01, AC_VERB_SET_GPIO_MASK, 0x03}, |
| 6484 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x03}, |
| 6485 | {0x01, AC_VERB_SET_GPIO_DATA, 0x03}, |
| 6486 | { } /* end */ |
| 6487 | }; |
| 6488 | |
| 6489 | /* toggle speaker-output according to the hp-jack state */ |
| 6490 | static void alc882_targa_automute(struct hda_codec *codec) |
| 6491 | { |
| 6492 | unsigned int present; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 6493 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 6494 | present = snd_hda_codec_read(codec, 0x14, 0, |
| 6495 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 6496 | snd_hda_codec_amp_stereo(codec, 0x1b, HDA_OUTPUT, 0, |
| 6497 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 6498 | snd_hda_codec_write_cache(codec, 1, 0, AC_VERB_SET_GPIO_DATA, |
| 6499 | present ? 1 : 3); |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 6500 | } |
| 6501 | |
| 6502 | static void alc882_targa_unsol_event(struct hda_codec *codec, unsigned int res) |
| 6503 | { |
| 6504 | /* Looks like the unsol event is incompatible with the standard |
| 6505 | * definition. 4bit tag is placed at 26 bit! |
| 6506 | */ |
| 6507 | if (((res >> 26) == ALC880_HP_EVENT)) { |
| 6508 | alc882_targa_automute(codec); |
| 6509 | } |
| 6510 | } |
| 6511 | |
| 6512 | static struct hda_verb alc882_asus_a7j_verbs[] = { |
| 6513 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6514 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 6515 | |
| 6516 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 6517 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 6518 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 6519 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 6520 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */ |
| 6521 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 6522 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */ |
| 6523 | |
| 6524 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */ |
| 6525 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */ |
| 6526 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 6527 | { } /* end */ |
| 6528 | }; |
| 6529 | |
Takashi Iwai | 914759b | 2007-09-06 14:52:04 +0200 | [diff] [blame] | 6530 | static struct hda_verb alc882_asus_a7m_verbs[] = { |
| 6531 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6532 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 6533 | |
| 6534 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 6535 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 6536 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 6537 | |
Takashi Iwai | 914759b | 2007-09-06 14:52:04 +0200 | [diff] [blame] | 6538 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */ |
| 6539 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 6540 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */ |
| 6541 | |
| 6542 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */ |
| 6543 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */ |
| 6544 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 6545 | { } /* end */ |
| 6546 | }; |
| 6547 | |
Tobin Davis | 9102cd1 | 2006-12-15 10:02:12 +0100 | [diff] [blame] | 6548 | static void alc882_gpio_mute(struct hda_codec *codec, int pin, int muted) |
| 6549 | { |
| 6550 | unsigned int gpiostate, gpiomask, gpiodir; |
| 6551 | |
| 6552 | gpiostate = snd_hda_codec_read(codec, codec->afg, 0, |
| 6553 | AC_VERB_GET_GPIO_DATA, 0); |
| 6554 | |
| 6555 | if (!muted) |
| 6556 | gpiostate |= (1 << pin); |
| 6557 | else |
| 6558 | gpiostate &= ~(1 << pin); |
| 6559 | |
| 6560 | gpiomask = snd_hda_codec_read(codec, codec->afg, 0, |
| 6561 | AC_VERB_GET_GPIO_MASK, 0); |
| 6562 | gpiomask |= (1 << pin); |
| 6563 | |
| 6564 | gpiodir = snd_hda_codec_read(codec, codec->afg, 0, |
| 6565 | AC_VERB_GET_GPIO_DIRECTION, 0); |
| 6566 | gpiodir |= (1 << pin); |
| 6567 | |
| 6568 | |
| 6569 | snd_hda_codec_write(codec, codec->afg, 0, |
| 6570 | AC_VERB_SET_GPIO_MASK, gpiomask); |
| 6571 | snd_hda_codec_write(codec, codec->afg, 0, |
| 6572 | AC_VERB_SET_GPIO_DIRECTION, gpiodir); |
| 6573 | |
| 6574 | msleep(1); |
| 6575 | |
| 6576 | snd_hda_codec_write(codec, codec->afg, 0, |
| 6577 | AC_VERB_SET_GPIO_DATA, gpiostate); |
| 6578 | } |
| 6579 | |
Takashi Iwai | 7debbe5 | 2007-08-16 15:01:03 +0200 | [diff] [blame] | 6580 | /* set up GPIO at initialization */ |
| 6581 | static void alc885_macpro_init_hook(struct hda_codec *codec) |
| 6582 | { |
| 6583 | alc882_gpio_mute(codec, 0, 0); |
| 6584 | alc882_gpio_mute(codec, 1, 0); |
| 6585 | } |
| 6586 | |
| 6587 | /* set up GPIO and update auto-muting at initialization */ |
| 6588 | static void alc885_imac24_init_hook(struct hda_codec *codec) |
| 6589 | { |
| 6590 | alc885_macpro_init_hook(codec); |
| 6591 | alc885_imac24_automute(codec); |
| 6592 | } |
| 6593 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6594 | /* |
| 6595 | * generic initialization of ADC, input mixers and output mixers |
| 6596 | */ |
| 6597 | static struct hda_verb alc882_auto_init_verbs[] = { |
| 6598 | /* |
| 6599 | * Unmute ADC0-2 and set the default input to mic-in |
| 6600 | */ |
| 6601 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 6602 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6603 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 6604 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6605 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 6606 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6607 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 6608 | /* 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] | 6609 | * mixer widget |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6610 | * Note: PASD motherboards uses the Line In 2 as the input for |
| 6611 | * front panel mic (mic 2) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6612 | */ |
| 6613 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 6614 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6615 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 6616 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 6617 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 6618 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6619 | |
| 6620 | /* |
| 6621 | * Set up output mixers (0x0c - 0x0f) |
| 6622 | */ |
| 6623 | /* set vol=0 to output mixers */ |
| 6624 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 6625 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 6626 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 6627 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 6628 | /* set up input amps for analog loopback */ |
| 6629 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 6630 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6631 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 6632 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6633 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 6634 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6635 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 6636 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6637 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 6638 | {0x26, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6639 | {0x26, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 6640 | |
| 6641 | /* FIXME: use matrix-type input source selection */ |
| 6642 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 6643 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ |
| 6644 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 6645 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 6646 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 6647 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 6648 | /* Input mixer2 */ |
| 6649 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 6650 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 6651 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 6652 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 6653 | /* Input mixer3 */ |
| 6654 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 6655 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 6656 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 6657 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 6658 | |
| 6659 | { } |
| 6660 | }; |
| 6661 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 6662 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 6663 | #define alc882_loopbacks alc880_loopbacks |
| 6664 | #endif |
| 6665 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6666 | /* pcm configuration: identiacal with ALC880 */ |
| 6667 | #define alc882_pcm_analog_playback alc880_pcm_analog_playback |
| 6668 | #define alc882_pcm_analog_capture alc880_pcm_analog_capture |
| 6669 | #define alc882_pcm_digital_playback alc880_pcm_digital_playback |
| 6670 | #define alc882_pcm_digital_capture alc880_pcm_digital_capture |
| 6671 | |
| 6672 | /* |
| 6673 | * configuration and preset |
| 6674 | */ |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 6675 | static const char *alc882_models[ALC882_MODEL_LAST] = { |
| 6676 | [ALC882_3ST_DIG] = "3stack-dig", |
| 6677 | [ALC882_6ST_DIG] = "6stack-dig", |
| 6678 | [ALC882_ARIMA] = "arima", |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 6679 | [ALC882_W2JC] = "w2jc", |
Takashi Iwai | 0438a00 | 2007-09-06 14:54:11 +0200 | [diff] [blame] | 6680 | [ALC882_TARGA] = "targa", |
| 6681 | [ALC882_ASUS_A7J] = "asus-a7j", |
| 6682 | [ALC882_ASUS_A7M] = "asus-a7m", |
Tobin Davis | 9102cd1 | 2006-12-15 10:02:12 +0100 | [diff] [blame] | 6683 | [ALC885_MACPRO] = "macpro", |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 6684 | [ALC885_MBP3] = "mbp3", |
Nicola Fagnani | c54728d | 2007-07-19 23:28:52 +0200 | [diff] [blame] | 6685 | [ALC885_IMAC24] = "imac24", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 6686 | [ALC882_AUTO] = "auto", |
| 6687 | }; |
| 6688 | |
| 6689 | static struct snd_pci_quirk alc882_cfg_tbl[] = { |
| 6690 | SND_PCI_QUIRK(0x1019, 0x6668, "ECS", ALC882_6ST_DIG), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 6691 | SND_PCI_QUIRK(0x1043, 0x060d, "Asus A7J", ALC882_ASUS_A7J), |
Kailang Yang | ac8842a | 2007-09-20 12:51:39 +0200 | [diff] [blame] | 6692 | SND_PCI_QUIRK(0x1043, 0x1243, "Asus A7J", ALC882_ASUS_A7J), |
Takashi Iwai | 914759b | 2007-09-06 14:52:04 +0200 | [diff] [blame] | 6693 | SND_PCI_QUIRK(0x1043, 0x13c2, "Asus A7M", ALC882_ASUS_A7M), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 6694 | SND_PCI_QUIRK(0x1043, 0x1971, "Asus W2JC", ALC882_W2JC), |
Claudio Matsuoka | c5d9f1c | 2007-07-19 23:18:32 +0200 | [diff] [blame] | 6695 | SND_PCI_QUIRK(0x1043, 0x817f, "Asus P5LD2", ALC882_6ST_DIG), |
Tobin Davis | 7b9470d | 2006-12-28 13:56:48 +0100 | [diff] [blame] | 6696 | SND_PCI_QUIRK(0x1043, 0x81d8, "Asus P5WD", ALC882_6ST_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 6697 | SND_PCI_QUIRK(0x105b, 0x6668, "Foxconn", ALC882_6ST_DIG), |
Jiang zhe | 4444704 | 2008-01-28 12:28:24 +0100 | [diff] [blame] | 6698 | SND_PCI_QUIRK(0x1458, 0xa002, "Gigabyte P35 DS3R", ALC882_6ST_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 6699 | SND_PCI_QUIRK(0x1462, 0x28fb, "Targa T8", ALC882_TARGA), /* MSI-1049 T8 */ |
| 6700 | SND_PCI_QUIRK(0x1462, 0x6668, "MSI", ALC882_6ST_DIG), |
| 6701 | SND_PCI_QUIRK(0x161f, 0x2054, "Arima W820", ALC882_ARIMA), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6702 | {} |
| 6703 | }; |
| 6704 | |
| 6705 | static struct alc_config_preset alc882_presets[] = { |
| 6706 | [ALC882_3ST_DIG] = { |
| 6707 | .mixers = { alc882_base_mixer }, |
| 6708 | .init_verbs = { alc882_init_verbs }, |
| 6709 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 6710 | .dac_nids = alc882_dac_nids, |
| 6711 | .dig_out_nid = ALC882_DIGOUT_NID, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6712 | .dig_in_nid = ALC882_DIGIN_NID, |
| 6713 | .num_channel_mode = ARRAY_SIZE(alc882_ch_modes), |
| 6714 | .channel_mode = alc882_ch_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 6715 | .need_dac_fix = 1, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6716 | .input_mux = &alc882_capture_source, |
| 6717 | }, |
| 6718 | [ALC882_6ST_DIG] = { |
| 6719 | .mixers = { alc882_base_mixer, alc882_chmode_mixer }, |
| 6720 | .init_verbs = { alc882_init_verbs }, |
| 6721 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 6722 | .dac_nids = alc882_dac_nids, |
| 6723 | .dig_out_nid = ALC882_DIGOUT_NID, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6724 | .dig_in_nid = ALC882_DIGIN_NID, |
| 6725 | .num_channel_mode = ARRAY_SIZE(alc882_sixstack_modes), |
| 6726 | .channel_mode = alc882_sixstack_modes, |
| 6727 | .input_mux = &alc882_capture_source, |
| 6728 | }, |
Takashi Iwai | 4b146cb | 2006-07-28 14:42:36 +0200 | [diff] [blame] | 6729 | [ALC882_ARIMA] = { |
| 6730 | .mixers = { alc882_base_mixer, alc882_chmode_mixer }, |
| 6731 | .init_verbs = { alc882_init_verbs, alc882_eapd_verbs }, |
| 6732 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 6733 | .dac_nids = alc882_dac_nids, |
| 6734 | .num_channel_mode = ARRAY_SIZE(alc882_sixstack_modes), |
| 6735 | .channel_mode = alc882_sixstack_modes, |
| 6736 | .input_mux = &alc882_capture_source, |
| 6737 | }, |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 6738 | [ALC882_W2JC] = { |
| 6739 | .mixers = { alc882_w2jc_mixer, alc882_chmode_mixer }, |
| 6740 | .init_verbs = { alc882_init_verbs, alc882_eapd_verbs, |
| 6741 | alc880_gpio1_init_verbs }, |
| 6742 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 6743 | .dac_nids = alc882_dac_nids, |
| 6744 | .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes), |
| 6745 | .channel_mode = alc880_threestack_modes, |
| 6746 | .need_dac_fix = 1, |
| 6747 | .input_mux = &alc882_capture_source, |
| 6748 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 6749 | }, |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 6750 | [ALC885_MBP3] = { |
| 6751 | .mixers = { alc885_mbp3_mixer, alc882_chmode_mixer }, |
| 6752 | .init_verbs = { alc885_mbp3_init_verbs, |
| 6753 | alc880_gpio1_init_verbs }, |
| 6754 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 6755 | .dac_nids = alc882_dac_nids, |
| 6756 | .channel_mode = alc885_mbp_6ch_modes, |
| 6757 | .num_channel_mode = ARRAY_SIZE(alc885_mbp_6ch_modes), |
| 6758 | .input_mux = &alc882_capture_source, |
| 6759 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 6760 | .dig_in_nid = ALC882_DIGIN_NID, |
| 6761 | .unsol_event = alc885_mbp3_unsol_event, |
| 6762 | .init_hook = alc885_mbp3_automute, |
| 6763 | }, |
Tobin Davis | 9102cd1 | 2006-12-15 10:02:12 +0100 | [diff] [blame] | 6764 | [ALC885_MACPRO] = { |
| 6765 | .mixers = { alc882_macpro_mixer }, |
| 6766 | .init_verbs = { alc882_macpro_init_verbs }, |
| 6767 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 6768 | .dac_nids = alc882_dac_nids, |
| 6769 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 6770 | .dig_in_nid = ALC882_DIGIN_NID, |
| 6771 | .num_channel_mode = ARRAY_SIZE(alc882_ch_modes), |
| 6772 | .channel_mode = alc882_ch_modes, |
| 6773 | .input_mux = &alc882_capture_source, |
Takashi Iwai | 7debbe5 | 2007-08-16 15:01:03 +0200 | [diff] [blame] | 6774 | .init_hook = alc885_macpro_init_hook, |
Tobin Davis | 9102cd1 | 2006-12-15 10:02:12 +0100 | [diff] [blame] | 6775 | }, |
Nicola Fagnani | c54728d | 2007-07-19 23:28:52 +0200 | [diff] [blame] | 6776 | [ALC885_IMAC24] = { |
| 6777 | .mixers = { alc885_imac24_mixer }, |
| 6778 | .init_verbs = { alc885_imac24_init_verbs }, |
| 6779 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 6780 | .dac_nids = alc882_dac_nids, |
| 6781 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 6782 | .dig_in_nid = ALC882_DIGIN_NID, |
| 6783 | .num_channel_mode = ARRAY_SIZE(alc882_ch_modes), |
| 6784 | .channel_mode = alc882_ch_modes, |
| 6785 | .input_mux = &alc882_capture_source, |
| 6786 | .unsol_event = alc885_imac24_unsol_event, |
Takashi Iwai | 7debbe5 | 2007-08-16 15:01:03 +0200 | [diff] [blame] | 6787 | .init_hook = alc885_imac24_init_hook, |
Nicola Fagnani | c54728d | 2007-07-19 23:28:52 +0200 | [diff] [blame] | 6788 | }, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 6789 | [ALC882_TARGA] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 6790 | .mixers = { alc882_targa_mixer, alc882_chmode_mixer }, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 6791 | .init_verbs = { alc882_init_verbs, alc882_targa_verbs}, |
| 6792 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 6793 | .dac_nids = alc882_dac_nids, |
| 6794 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 6795 | .num_adc_nids = ARRAY_SIZE(alc882_adc_nids), |
| 6796 | .adc_nids = alc882_adc_nids, |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 6797 | .capsrc_nids = alc882_capsrc_nids, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 6798 | .num_channel_mode = ARRAY_SIZE(alc882_3ST_6ch_modes), |
| 6799 | .channel_mode = alc882_3ST_6ch_modes, |
| 6800 | .need_dac_fix = 1, |
| 6801 | .input_mux = &alc882_capture_source, |
| 6802 | .unsol_event = alc882_targa_unsol_event, |
| 6803 | .init_hook = alc882_targa_automute, |
| 6804 | }, |
| 6805 | [ALC882_ASUS_A7J] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 6806 | .mixers = { alc882_asus_a7j_mixer, alc882_chmode_mixer }, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 6807 | .init_verbs = { alc882_init_verbs, alc882_asus_a7j_verbs}, |
| 6808 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 6809 | .dac_nids = alc882_dac_nids, |
| 6810 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 6811 | .num_adc_nids = ARRAY_SIZE(alc882_adc_nids), |
| 6812 | .adc_nids = alc882_adc_nids, |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 6813 | .capsrc_nids = alc882_capsrc_nids, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 6814 | .num_channel_mode = ARRAY_SIZE(alc882_3ST_6ch_modes), |
| 6815 | .channel_mode = alc882_3ST_6ch_modes, |
| 6816 | .need_dac_fix = 1, |
| 6817 | .input_mux = &alc882_capture_source, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 6818 | }, |
Takashi Iwai | 914759b | 2007-09-06 14:52:04 +0200 | [diff] [blame] | 6819 | [ALC882_ASUS_A7M] = { |
| 6820 | .mixers = { alc882_asus_a7m_mixer, alc882_chmode_mixer }, |
| 6821 | .init_verbs = { alc882_init_verbs, alc882_eapd_verbs, |
| 6822 | alc880_gpio1_init_verbs, |
| 6823 | alc882_asus_a7m_verbs }, |
| 6824 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 6825 | .dac_nids = alc882_dac_nids, |
| 6826 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 6827 | .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes), |
| 6828 | .channel_mode = alc880_threestack_modes, |
| 6829 | .need_dac_fix = 1, |
| 6830 | .input_mux = &alc882_capture_source, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 6831 | }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6832 | }; |
| 6833 | |
| 6834 | |
| 6835 | /* |
Takashi Iwai | f95474e | 2007-07-10 00:47:43 +0200 | [diff] [blame] | 6836 | * Pin config fixes |
| 6837 | */ |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 6838 | enum { |
Takashi Iwai | f95474e | 2007-07-10 00:47:43 +0200 | [diff] [blame] | 6839 | PINFIX_ABIT_AW9D_MAX |
| 6840 | }; |
| 6841 | |
| 6842 | static struct alc_pincfg alc882_abit_aw9d_pinfix[] = { |
| 6843 | { 0x15, 0x01080104 }, /* side */ |
| 6844 | { 0x16, 0x01011012 }, /* rear */ |
| 6845 | { 0x17, 0x01016011 }, /* clfe */ |
| 6846 | { } |
| 6847 | }; |
| 6848 | |
| 6849 | static const struct alc_pincfg *alc882_pin_fixes[] = { |
| 6850 | [PINFIX_ABIT_AW9D_MAX] = alc882_abit_aw9d_pinfix, |
| 6851 | }; |
| 6852 | |
| 6853 | static struct snd_pci_quirk alc882_pinfix_tbl[] = { |
| 6854 | SND_PCI_QUIRK(0x147b, 0x107a, "Abit AW9D-MAX", PINFIX_ABIT_AW9D_MAX), |
| 6855 | {} |
| 6856 | }; |
| 6857 | |
| 6858 | /* |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6859 | * BIOS auto configuration |
| 6860 | */ |
| 6861 | static void alc882_auto_set_output_and_unmute(struct hda_codec *codec, |
| 6862 | hda_nid_t nid, int pin_type, |
| 6863 | int dac_idx) |
| 6864 | { |
| 6865 | /* set as output */ |
| 6866 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6867 | int idx; |
| 6868 | |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 6869 | alc_set_pin_output(codec, nid, pin_type); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6870 | if (spec->multiout.dac_nids[dac_idx] == 0x25) |
| 6871 | idx = 4; |
| 6872 | else |
| 6873 | idx = spec->multiout.dac_nids[dac_idx] - 2; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6874 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_CONNECT_SEL, idx); |
| 6875 | |
| 6876 | } |
| 6877 | |
| 6878 | static void alc882_auto_init_multi_out(struct hda_codec *codec) |
| 6879 | { |
| 6880 | struct alc_spec *spec = codec->spec; |
| 6881 | int i; |
| 6882 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 6883 | alc_subsystem_id(codec, 0x15, 0x1b, 0x14); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6884 | for (i = 0; i <= HDA_SIDE; i++) { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6885 | hda_nid_t nid = spec->autocfg.line_out_pins[i]; |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 6886 | int pin_type = get_pin_type(spec->autocfg.line_out_type); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6887 | if (nid) |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 6888 | alc882_auto_set_output_and_unmute(codec, nid, pin_type, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6889 | i); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6890 | } |
| 6891 | } |
| 6892 | |
| 6893 | static void alc882_auto_init_hp_out(struct hda_codec *codec) |
| 6894 | { |
| 6895 | struct alc_spec *spec = codec->spec; |
| 6896 | hda_nid_t pin; |
| 6897 | |
Takashi Iwai | eb06ed8 | 2006-09-20 17:10:27 +0200 | [diff] [blame] | 6898 | pin = spec->autocfg.hp_pins[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6899 | if (pin) /* connect to front */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6900 | /* use dac 0 */ |
| 6901 | alc882_auto_set_output_and_unmute(codec, pin, PIN_HP, 0); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 6902 | pin = spec->autocfg.speaker_pins[0]; |
| 6903 | if (pin) |
| 6904 | alc882_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6905 | } |
| 6906 | |
| 6907 | #define alc882_is_input_pin(nid) alc880_is_input_pin(nid) |
| 6908 | #define ALC882_PIN_CD_NID ALC880_PIN_CD_NID |
| 6909 | |
| 6910 | static void alc882_auto_init_analog_input(struct hda_codec *codec) |
| 6911 | { |
| 6912 | struct alc_spec *spec = codec->spec; |
| 6913 | int i; |
| 6914 | |
| 6915 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
| 6916 | hda_nid_t nid = spec->autocfg.input_pins[i]; |
Takashi Iwai | 7194cae | 2008-03-06 16:58:17 +0100 | [diff] [blame] | 6917 | unsigned int vref; |
| 6918 | if (!nid) |
| 6919 | continue; |
| 6920 | vref = PIN_IN; |
| 6921 | if (1 /*i <= AUTO_PIN_FRONT_MIC*/) { |
Kailang Yang | 531240f | 2008-05-27 12:10:25 +0200 | [diff] [blame] | 6922 | unsigned int pincap; |
| 6923 | pincap = snd_hda_param_read(codec, nid, AC_PAR_PIN_CAP); |
| 6924 | if ((pincap >> AC_PINCAP_VREF_SHIFT) & |
Takashi Iwai | 7194cae | 2008-03-06 16:58:17 +0100 | [diff] [blame] | 6925 | AC_PINCAP_VREF_80) |
| 6926 | vref = PIN_VREF80; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6927 | } |
Takashi Iwai | 7194cae | 2008-03-06 16:58:17 +0100 | [diff] [blame] | 6928 | snd_hda_codec_write(codec, nid, 0, |
| 6929 | AC_VERB_SET_PIN_WIDGET_CONTROL, vref); |
| 6930 | if (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP) |
| 6931 | snd_hda_codec_write(codec, nid, 0, |
| 6932 | AC_VERB_SET_AMP_GAIN_MUTE, |
| 6933 | AMP_OUT_MUTE); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6934 | } |
| 6935 | } |
| 6936 | |
Takashi Iwai | f511b01 | 2008-08-15 16:46:42 +0200 | [diff] [blame] | 6937 | static void alc882_auto_init_input_src(struct hda_codec *codec) |
| 6938 | { |
| 6939 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | f511b01 | 2008-08-15 16:46:42 +0200 | [diff] [blame] | 6940 | int c; |
| 6941 | |
| 6942 | for (c = 0; c < spec->num_adc_nids; c++) { |
| 6943 | hda_nid_t conn_list[HDA_MAX_NUM_INPUTS]; |
| 6944 | hda_nid_t nid = spec->capsrc_nids[c]; |
Herton Ronaldo Krzesinski | b98b7b3 | 2009-01-29 13:18:31 -0200 | [diff] [blame] | 6945 | unsigned int mux_idx; |
| 6946 | const struct hda_input_mux *imux; |
Takashi Iwai | f511b01 | 2008-08-15 16:46:42 +0200 | [diff] [blame] | 6947 | int conns, mute, idx, item; |
| 6948 | |
| 6949 | conns = snd_hda_get_connections(codec, nid, conn_list, |
| 6950 | ARRAY_SIZE(conn_list)); |
| 6951 | if (conns < 0) |
| 6952 | continue; |
Herton Ronaldo Krzesinski | b98b7b3 | 2009-01-29 13:18:31 -0200 | [diff] [blame] | 6953 | mux_idx = c >= spec->num_mux_defs ? 0 : c; |
| 6954 | imux = &spec->input_mux[mux_idx]; |
Takashi Iwai | f511b01 | 2008-08-15 16:46:42 +0200 | [diff] [blame] | 6955 | for (idx = 0; idx < conns; idx++) { |
| 6956 | /* if the current connection is the selected one, |
| 6957 | * unmute it as default - otherwise mute it |
| 6958 | */ |
| 6959 | mute = AMP_IN_MUTE(idx); |
| 6960 | for (item = 0; item < imux->num_items; item++) { |
| 6961 | if (imux->items[item].index == idx) { |
| 6962 | if (spec->cur_mux[c] == item) |
| 6963 | mute = AMP_IN_UNMUTE(idx); |
| 6964 | break; |
| 6965 | } |
| 6966 | } |
Herton Ronaldo Krzesinski | b98b7b3 | 2009-01-29 13:18:31 -0200 | [diff] [blame] | 6967 | /* check if we have a selector or mixer |
| 6968 | * we could check for the widget type instead, but |
| 6969 | * just check for Amp-In presence (in case of mixer |
| 6970 | * without amp-in there is something wrong, this |
| 6971 | * function shouldn't be used or capsrc nid is wrong) |
| 6972 | */ |
| 6973 | if (get_wcaps(codec, nid) & AC_WCAP_IN_AMP) |
| 6974 | snd_hda_codec_write(codec, nid, 0, |
| 6975 | AC_VERB_SET_AMP_GAIN_MUTE, |
| 6976 | mute); |
| 6977 | else if (mute != AMP_IN_MUTE(idx)) |
| 6978 | snd_hda_codec_write(codec, nid, 0, |
| 6979 | AC_VERB_SET_CONNECT_SEL, |
| 6980 | idx); |
Takashi Iwai | f511b01 | 2008-08-15 16:46:42 +0200 | [diff] [blame] | 6981 | } |
| 6982 | } |
| 6983 | } |
| 6984 | |
Takashi Iwai | 776e184 | 2007-08-29 15:07:11 +0200 | [diff] [blame] | 6985 | /* add mic boosts if needed */ |
| 6986 | static int alc_auto_add_mic_boost(struct hda_codec *codec) |
| 6987 | { |
| 6988 | struct alc_spec *spec = codec->spec; |
| 6989 | int err; |
| 6990 | hda_nid_t nid; |
| 6991 | |
| 6992 | nid = spec->autocfg.input_pins[AUTO_PIN_MIC]; |
Takashi Iwai | ce22e03 | 2008-01-11 17:38:35 +0100 | [diff] [blame] | 6993 | if (nid && (get_wcaps(codec, nid) & AC_WCAP_IN_AMP)) { |
Takashi Iwai | 776e184 | 2007-08-29 15:07:11 +0200 | [diff] [blame] | 6994 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 6995 | "Mic Boost", |
| 6996 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_INPUT)); |
| 6997 | if (err < 0) |
| 6998 | return err; |
| 6999 | } |
| 7000 | nid = spec->autocfg.input_pins[AUTO_PIN_FRONT_MIC]; |
Takashi Iwai | ce22e03 | 2008-01-11 17:38:35 +0100 | [diff] [blame] | 7001 | if (nid && (get_wcaps(codec, nid) & AC_WCAP_IN_AMP)) { |
Takashi Iwai | 776e184 | 2007-08-29 15:07:11 +0200 | [diff] [blame] | 7002 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 7003 | "Front Mic Boost", |
| 7004 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_INPUT)); |
| 7005 | if (err < 0) |
| 7006 | return err; |
| 7007 | } |
| 7008 | return 0; |
| 7009 | } |
| 7010 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7011 | /* almost identical with ALC880 parser... */ |
| 7012 | static int alc882_parse_auto_config(struct hda_codec *codec) |
| 7013 | { |
| 7014 | struct alc_spec *spec = codec->spec; |
| 7015 | int err = alc880_parse_auto_config(codec); |
| 7016 | |
| 7017 | if (err < 0) |
| 7018 | return err; |
Takashi Iwai | 776e184 | 2007-08-29 15:07:11 +0200 | [diff] [blame] | 7019 | else if (!err) |
| 7020 | return 0; /* no config found */ |
| 7021 | |
| 7022 | err = alc_auto_add_mic_boost(codec); |
| 7023 | if (err < 0) |
| 7024 | return err; |
| 7025 | |
| 7026 | /* hack - override the init verbs */ |
| 7027 | spec->init_verbs[0] = alc882_auto_init_verbs; |
| 7028 | |
| 7029 | return 1; /* config found */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7030 | } |
| 7031 | |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 7032 | /* additional initialization for auto-configuration model */ |
| 7033 | static void alc882_auto_init(struct hda_codec *codec) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7034 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 7035 | struct alc_spec *spec = codec->spec; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7036 | alc882_auto_init_multi_out(codec); |
| 7037 | alc882_auto_init_hp_out(codec); |
| 7038 | alc882_auto_init_analog_input(codec); |
Takashi Iwai | f511b01 | 2008-08-15 16:46:42 +0200 | [diff] [blame] | 7039 | alc882_auto_init_input_src(codec); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 7040 | if (spec->unsol_event) |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 7041 | alc_inithook(codec); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7042 | } |
| 7043 | |
Takashi Iwai | 7943a8a | 2008-04-16 17:29:09 +0200 | [diff] [blame] | 7044 | static int patch_alc883(struct hda_codec *codec); /* called in patch_alc882() */ |
| 7045 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7046 | static int patch_alc882(struct hda_codec *codec) |
| 7047 | { |
| 7048 | struct alc_spec *spec; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7049 | int err, board_config; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7050 | |
Takashi Iwai | e560d8d | 2005-09-09 14:21:46 +0200 | [diff] [blame] | 7051 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7052 | if (spec == NULL) |
| 7053 | return -ENOMEM; |
| 7054 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7055 | codec->spec = spec; |
| 7056 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 7057 | board_config = snd_hda_check_board_config(codec, ALC882_MODEL_LAST, |
| 7058 | alc882_models, |
| 7059 | alc882_cfg_tbl); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7060 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7061 | if (board_config < 0 || board_config >= ALC882_MODEL_LAST) { |
Tobin Davis | 081d17c | 2007-02-15 17:46:18 +0100 | [diff] [blame] | 7062 | /* Pick up systems that don't supply PCI SSID */ |
| 7063 | switch (codec->subsystem_id) { |
| 7064 | case 0x106b0c00: /* Mac Pro */ |
| 7065 | board_config = ALC885_MACPRO; |
| 7066 | break; |
Nicola Fagnani | c54728d | 2007-07-19 23:28:52 +0200 | [diff] [blame] | 7067 | case 0x106b1000: /* iMac 24 */ |
Peter Korsgaard | f3911c5 | 2008-09-27 09:13:45 +0200 | [diff] [blame] | 7068 | case 0x106b2800: /* AppleTV */ |
Mark Eggleston | 3077e44 | 2009-01-31 17:57:54 +0100 | [diff] [blame] | 7069 | case 0x106b3e00: /* iMac 24 Aluminium */ |
Nicola Fagnani | c54728d | 2007-07-19 23:28:52 +0200 | [diff] [blame] | 7070 | board_config = ALC885_IMAC24; |
| 7071 | break; |
Takashi Iwai | c7e0757 | 2008-06-26 14:42:51 +0200 | [diff] [blame] | 7072 | case 0x106b00a1: /* Macbook (might be wrong - PCI SSID?) */ |
David Woodhouse | 9c95c43 | 2008-09-18 13:37:13 -0700 | [diff] [blame] | 7073 | case 0x106b00a4: /* MacbookPro4,1 */ |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 7074 | case 0x106b2c00: /* Macbook Pro rev3 */ |
Takashi Iwai | c7e0757 | 2008-06-26 14:42:51 +0200 | [diff] [blame] | 7075 | case 0x106b3600: /* Macbook 3.1 */ |
Luke Yelavich | 2a88464 | 2009-01-28 15:58:38 +1100 | [diff] [blame] | 7076 | case 0x106b3800: /* MacbookPro4,1 - latter revision */ |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 7077 | board_config = ALC885_MBP3; |
| 7078 | break; |
Tobin Davis | 081d17c | 2007-02-15 17:46:18 +0100 | [diff] [blame] | 7079 | default: |
Takashi Iwai | 7943a8a | 2008-04-16 17:29:09 +0200 | [diff] [blame] | 7080 | /* ALC889A is handled better as ALC888-compatible */ |
Clive Messer | 669faba | 2008-09-30 15:49:13 +0200 | [diff] [blame] | 7081 | if (codec->revision_id == 0x100101 || |
| 7082 | codec->revision_id == 0x100103) { |
Takashi Iwai | 7943a8a | 2008-04-16 17:29:09 +0200 | [diff] [blame] | 7083 | alc_free(codec); |
| 7084 | return patch_alc883(codec); |
| 7085 | } |
Tobin Davis | 081d17c | 2007-02-15 17:46:18 +0100 | [diff] [blame] | 7086 | printk(KERN_INFO "hda_codec: Unknown model for ALC882, " |
| 7087 | "trying auto-probe from BIOS...\n"); |
| 7088 | board_config = ALC882_AUTO; |
| 7089 | } |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7090 | } |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 7091 | |
Takashi Iwai | f95474e | 2007-07-10 00:47:43 +0200 | [diff] [blame] | 7092 | alc_fix_pincfg(codec, alc882_pinfix_tbl, alc882_pin_fixes); |
| 7093 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7094 | if (board_config == ALC882_AUTO) { |
| 7095 | /* automatic parse from the BIOS config */ |
| 7096 | err = alc882_parse_auto_config(codec); |
| 7097 | if (err < 0) { |
| 7098 | alc_free(codec); |
| 7099 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 7100 | } else if (!err) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7101 | printk(KERN_INFO |
| 7102 | "hda_codec: Cannot set up configuration " |
| 7103 | "from BIOS. Using base mode...\n"); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7104 | board_config = ALC882_3ST_DIG; |
| 7105 | } |
| 7106 | } |
| 7107 | |
Kusanagi Kouichi | 680cd53 | 2009-02-05 00:00:58 +0900 | [diff] [blame] | 7108 | err = snd_hda_attach_beep_device(codec, 0x1); |
| 7109 | if (err < 0) { |
| 7110 | alc_free(codec); |
| 7111 | return err; |
| 7112 | } |
| 7113 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7114 | if (board_config != ALC882_AUTO) |
| 7115 | setup_preset(spec, &alc882_presets[board_config]); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7116 | |
Kailang Yang | 2f89328 | 2008-05-27 12:14:47 +0200 | [diff] [blame] | 7117 | if (codec->vendor_id == 0x10ec0885) { |
| 7118 | spec->stream_name_analog = "ALC885 Analog"; |
| 7119 | spec->stream_name_digital = "ALC885 Digital"; |
| 7120 | } else { |
| 7121 | spec->stream_name_analog = "ALC882 Analog"; |
| 7122 | spec->stream_name_digital = "ALC882 Digital"; |
| 7123 | } |
| 7124 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7125 | spec->stream_analog_playback = &alc882_pcm_analog_playback; |
| 7126 | spec->stream_analog_capture = &alc882_pcm_analog_capture; |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 7127 | /* FIXME: setup DAC5 */ |
| 7128 | /*spec->stream_analog_alt_playback = &alc880_pcm_analog_alt_playback;*/ |
| 7129 | spec->stream_analog_alt_capture = &alc880_pcm_analog_alt_capture; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7130 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7131 | spec->stream_digital_playback = &alc882_pcm_digital_playback; |
| 7132 | spec->stream_digital_capture = &alc882_pcm_digital_capture; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7133 | |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 7134 | spec->capture_style = CAPT_MIX; /* matrix-style capture */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 7135 | if (!spec->adc_nids && spec->input_mux) { |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7136 | /* check whether NID 0x07 is valid */ |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 7137 | unsigned int wcap = get_wcaps(codec, 0x07); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 7138 | /* get type */ |
| 7139 | wcap = (wcap & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7140 | if (wcap != AC_WID_AUD_IN) { |
| 7141 | spec->adc_nids = alc882_adc_nids_alt; |
| 7142 | spec->num_adc_nids = ARRAY_SIZE(alc882_adc_nids_alt); |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 7143 | spec->capsrc_nids = alc882_capsrc_nids_alt; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7144 | } else { |
| 7145 | spec->adc_nids = alc882_adc_nids; |
| 7146 | spec->num_adc_nids = ARRAY_SIZE(alc882_adc_nids); |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 7147 | spec->capsrc_nids = alc882_capsrc_nids; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7148 | } |
| 7149 | } |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 7150 | set_capture_mixer(spec); |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 7151 | set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7152 | |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 7153 | spec->vmaster_nid = 0x0c; |
| 7154 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7155 | codec->patch_ops = alc_patch_ops; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7156 | if (board_config == ALC882_AUTO) |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 7157 | spec->init_hook = alc882_auto_init; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 7158 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 7159 | if (!spec->loopback.amplist) |
| 7160 | spec->loopback.amplist = alc882_loopbacks; |
| 7161 | #endif |
Takashi Iwai | daead53 | 2008-11-28 12:55:36 +0100 | [diff] [blame] | 7162 | codec->proc_widget_hook = print_realtek_coef; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7163 | |
| 7164 | return 0; |
| 7165 | } |
| 7166 | |
| 7167 | /* |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7168 | * ALC883 support |
| 7169 | * |
| 7170 | * ALC883 is almost identical with ALC880 but has cleaner and more flexible |
| 7171 | * configuration. Each pin widget can choose any input DACs and a mixer. |
| 7172 | * Each ADC is connected from a mixer of all inputs. This makes possible |
| 7173 | * 6-channel independent captures. |
| 7174 | * |
| 7175 | * In addition, an independent DAC for the multi-playback (not used in this |
| 7176 | * driver yet). |
| 7177 | */ |
| 7178 | #define ALC883_DIGOUT_NID 0x06 |
| 7179 | #define ALC883_DIGIN_NID 0x0a |
| 7180 | |
Wu Fengguang | 3ab9093 | 2008-11-17 09:51:09 +0100 | [diff] [blame] | 7181 | #define ALC1200_DIGOUT_NID 0x10 |
| 7182 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7183 | static hda_nid_t alc883_dac_nids[4] = { |
| 7184 | /* front, rear, clfe, rear_surr */ |
Herton Ronaldo Krzesinski | f32a19e | 2008-03-18 09:27:08 +0100 | [diff] [blame] | 7185 | 0x02, 0x03, 0x04, 0x05 |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7186 | }; |
| 7187 | |
| 7188 | static hda_nid_t alc883_adc_nids[2] = { |
| 7189 | /* ADC1-2 */ |
| 7190 | 0x08, 0x09, |
| 7191 | }; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 7192 | |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 7193 | static hda_nid_t alc883_adc_nids_alt[1] = { |
| 7194 | /* ADC1 */ |
| 7195 | 0x08, |
| 7196 | }; |
| 7197 | |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 7198 | static hda_nid_t alc883_adc_nids_rev[2] = { |
| 7199 | /* ADC2-1 */ |
| 7200 | 0x09, 0x08 |
| 7201 | }; |
| 7202 | |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 7203 | #define alc889_adc_nids alc880_adc_nids |
| 7204 | |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 7205 | static hda_nid_t alc883_capsrc_nids[2] = { 0x23, 0x22 }; |
| 7206 | |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 7207 | static hda_nid_t alc883_capsrc_nids_rev[2] = { 0x22, 0x23 }; |
| 7208 | |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 7209 | #define alc889_capsrc_nids alc882_capsrc_nids |
| 7210 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7211 | /* input MUX */ |
| 7212 | /* FIXME: should be a matrix-type input source selection */ |
| 7213 | |
| 7214 | static struct hda_input_mux alc883_capture_source = { |
| 7215 | .num_items = 4, |
| 7216 | .items = { |
| 7217 | { "Mic", 0x0 }, |
| 7218 | { "Front Mic", 0x1 }, |
| 7219 | { "Line", 0x2 }, |
| 7220 | { "CD", 0x4 }, |
| 7221 | }, |
| 7222 | }; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 7223 | |
Jiang zhe | 17bba1b | 2008-06-04 12:11:07 +0200 | [diff] [blame] | 7224 | static struct hda_input_mux alc883_3stack_6ch_intel = { |
| 7225 | .num_items = 4, |
| 7226 | .items = { |
| 7227 | { "Mic", 0x1 }, |
| 7228 | { "Front Mic", 0x0 }, |
| 7229 | { "Line", 0x2 }, |
| 7230 | { "CD", 0x4 }, |
| 7231 | }, |
| 7232 | }; |
| 7233 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 7234 | static struct hda_input_mux alc883_lenovo_101e_capture_source = { |
| 7235 | .num_items = 2, |
| 7236 | .items = { |
| 7237 | { "Mic", 0x1 }, |
| 7238 | { "Line", 0x2 }, |
| 7239 | }, |
| 7240 | }; |
| 7241 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7242 | static struct hda_input_mux alc883_lenovo_nb0763_capture_source = { |
| 7243 | .num_items = 4, |
| 7244 | .items = { |
| 7245 | { "Mic", 0x0 }, |
| 7246 | { "iMic", 0x1 }, |
| 7247 | { "Line", 0x2 }, |
| 7248 | { "CD", 0x4 }, |
| 7249 | }, |
| 7250 | }; |
| 7251 | |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 7252 | static struct hda_input_mux alc883_fujitsu_pi2515_capture_source = { |
| 7253 | .num_items = 2, |
| 7254 | .items = { |
| 7255 | { "Mic", 0x0 }, |
| 7256 | { "Int Mic", 0x1 }, |
| 7257 | }, |
| 7258 | }; |
| 7259 | |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 7260 | static struct hda_input_mux alc883_lenovo_sky_capture_source = { |
| 7261 | .num_items = 3, |
| 7262 | .items = { |
| 7263 | { "Mic", 0x0 }, |
| 7264 | { "Front Mic", 0x1 }, |
| 7265 | { "Line", 0x4 }, |
| 7266 | }, |
| 7267 | }; |
| 7268 | |
| 7269 | static struct hda_input_mux alc883_asus_eee1601_capture_source = { |
| 7270 | .num_items = 2, |
| 7271 | .items = { |
| 7272 | { "Mic", 0x0 }, |
| 7273 | { "Line", 0x2 }, |
| 7274 | }, |
| 7275 | }; |
| 7276 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7277 | /* |
| 7278 | * 2ch mode |
| 7279 | */ |
| 7280 | static struct hda_channel_mode alc883_3ST_2ch_modes[1] = { |
| 7281 | { 2, NULL } |
| 7282 | }; |
| 7283 | |
| 7284 | /* |
| 7285 | * 2ch mode |
| 7286 | */ |
| 7287 | static struct hda_verb alc883_3ST_ch2_init[] = { |
| 7288 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 7289 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 7290 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 7291 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 7292 | { } /* end */ |
| 7293 | }; |
| 7294 | |
| 7295 | /* |
Tobin Davis | b201131 | 2007-09-17 12:45:11 +0200 | [diff] [blame] | 7296 | * 4ch mode |
| 7297 | */ |
| 7298 | static struct hda_verb alc883_3ST_ch4_init[] = { |
| 7299 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 7300 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 7301 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7302 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 7303 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 7304 | { } /* end */ |
| 7305 | }; |
| 7306 | |
| 7307 | /* |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7308 | * 6ch mode |
| 7309 | */ |
| 7310 | static struct hda_verb alc883_3ST_ch6_init[] = { |
| 7311 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7312 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 7313 | { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 }, |
| 7314 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7315 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 7316 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 7317 | { } /* end */ |
| 7318 | }; |
| 7319 | |
Tobin Davis | b201131 | 2007-09-17 12:45:11 +0200 | [diff] [blame] | 7320 | static struct hda_channel_mode alc883_3ST_6ch_modes[3] = { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7321 | { 2, alc883_3ST_ch2_init }, |
Tobin Davis | b201131 | 2007-09-17 12:45:11 +0200 | [diff] [blame] | 7322 | { 4, alc883_3ST_ch4_init }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7323 | { 6, alc883_3ST_ch6_init }, |
| 7324 | }; |
| 7325 | |
| 7326 | /* |
Jiang zhe | 17bba1b | 2008-06-04 12:11:07 +0200 | [diff] [blame] | 7327 | * 2ch mode |
| 7328 | */ |
| 7329 | static struct hda_verb alc883_3ST_ch2_intel_init[] = { |
| 7330 | { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 7331 | { 0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 7332 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 7333 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 7334 | { } /* end */ |
| 7335 | }; |
| 7336 | |
| 7337 | /* |
| 7338 | * 4ch mode |
| 7339 | */ |
| 7340 | static struct hda_verb alc883_3ST_ch4_intel_init[] = { |
| 7341 | { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 7342 | { 0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 7343 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7344 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 7345 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 7346 | { } /* end */ |
| 7347 | }; |
| 7348 | |
| 7349 | /* |
| 7350 | * 6ch mode |
| 7351 | */ |
| 7352 | static struct hda_verb alc883_3ST_ch6_intel_init[] = { |
| 7353 | { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7354 | { 0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 7355 | { 0x19, AC_VERB_SET_CONNECT_SEL, 0x02 }, |
| 7356 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7357 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 7358 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 7359 | { } /* end */ |
| 7360 | }; |
| 7361 | |
| 7362 | static struct hda_channel_mode alc883_3ST_6ch_intel_modes[3] = { |
| 7363 | { 2, alc883_3ST_ch2_intel_init }, |
| 7364 | { 4, alc883_3ST_ch4_intel_init }, |
| 7365 | { 6, alc883_3ST_ch6_intel_init }, |
| 7366 | }; |
| 7367 | |
| 7368 | /* |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7369 | * 6ch mode |
| 7370 | */ |
| 7371 | static struct hda_verb alc883_sixstack_ch6_init[] = { |
| 7372 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 7373 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7374 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7375 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7376 | { } /* end */ |
| 7377 | }; |
| 7378 | |
| 7379 | /* |
| 7380 | * 8ch mode |
| 7381 | */ |
| 7382 | static struct hda_verb alc883_sixstack_ch8_init[] = { |
| 7383 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7384 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7385 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7386 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7387 | { } /* end */ |
| 7388 | }; |
| 7389 | |
| 7390 | static struct hda_channel_mode alc883_sixstack_modes[2] = { |
| 7391 | { 6, alc883_sixstack_ch6_init }, |
| 7392 | { 8, alc883_sixstack_ch8_init }, |
| 7393 | }; |
| 7394 | |
Andrew L. Neporada | b373bde | 2006-11-07 11:37:08 +0100 | [diff] [blame] | 7395 | static struct hda_verb alc883_medion_eapd_verbs[] = { |
| 7396 | /* eanable EAPD on medion laptop */ |
| 7397 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 7398 | {0x20, AC_VERB_SET_PROC_COEF, 0x3070}, |
| 7399 | { } |
| 7400 | }; |
| 7401 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7402 | /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17 |
| 7403 | * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b |
| 7404 | */ |
| 7405 | |
| 7406 | static struct snd_kcontrol_new alc883_base_mixer[] = { |
| 7407 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 7408 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 7409 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 7410 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
| 7411 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 7412 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 7413 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 7414 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 7415 | HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
| 7416 | HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT), |
| 7417 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 7418 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 7419 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 7420 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 7421 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 7422 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 7423 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7424 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 7425 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 7426 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7427 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7428 | { } /* end */ |
| 7429 | }; |
| 7430 | |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 7431 | static struct snd_kcontrol_new alc883_mitac_mixer[] = { |
| 7432 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 7433 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 7434 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 7435 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 7436 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 7437 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 7438 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 7439 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 7440 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 7441 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 7442 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 7443 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
| 7444 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 7445 | { } /* end */ |
| 7446 | }; |
| 7447 | |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 7448 | static struct snd_kcontrol_new alc883_clevo_m720_mixer[] = { |
Jiang zhe | 368c7a9 | 2008-03-04 11:20:33 +0100 | [diff] [blame] | 7449 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 7450 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT), |
| 7451 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 7452 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT), |
| 7453 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 7454 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 7455 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 7456 | HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 7457 | HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT), |
| 7458 | HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Jiang zhe | 368c7a9 | 2008-03-04 11:20:33 +0100 | [diff] [blame] | 7459 | { } /* end */ |
| 7460 | }; |
| 7461 | |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 7462 | static struct snd_kcontrol_new alc883_2ch_fujitsu_pi2515_mixer[] = { |
| 7463 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 7464 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT), |
| 7465 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 7466 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT), |
| 7467 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 7468 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 7469 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 7470 | HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 7471 | HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT), |
| 7472 | HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 7473 | { } /* end */ |
| 7474 | }; |
| 7475 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7476 | static struct snd_kcontrol_new alc883_3ST_2ch_mixer[] = { |
| 7477 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 7478 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 7479 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 7480 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 7481 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 7482 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 7483 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 7484 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 7485 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7486 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 7487 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 7488 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7489 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7490 | { } /* end */ |
| 7491 | }; |
| 7492 | |
| 7493 | static struct snd_kcontrol_new alc883_3ST_6ch_mixer[] = { |
| 7494 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 7495 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 7496 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 7497 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
| 7498 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 7499 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 7500 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 7501 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 7502 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 7503 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 7504 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 7505 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 7506 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 7507 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 7508 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7509 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 7510 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 7511 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7512 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7513 | { } /* end */ |
| 7514 | }; |
| 7515 | |
Jiang zhe | 17bba1b | 2008-06-04 12:11:07 +0200 | [diff] [blame] | 7516 | static struct snd_kcontrol_new alc883_3ST_6ch_intel_mixer[] = { |
| 7517 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 7518 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 7519 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 7520 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
| 7521 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, |
| 7522 | HDA_OUTPUT), |
| 7523 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 7524 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 7525 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 7526 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 7527 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 7528 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 7529 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 7530 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 7531 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 7532 | HDA_CODEC_VOLUME("Mic Boost", 0x19, 0, HDA_INPUT), |
| 7533 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 7534 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 7535 | HDA_CODEC_VOLUME("Front Mic Boost", 0x18, 0, HDA_INPUT), |
| 7536 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Jiang zhe | 17bba1b | 2008-06-04 12:11:07 +0200 | [diff] [blame] | 7537 | { } /* end */ |
| 7538 | }; |
| 7539 | |
Takashi Iwai | d1d985f | 2006-11-23 19:27:12 +0100 | [diff] [blame] | 7540 | static struct snd_kcontrol_new alc883_fivestack_mixer[] = { |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 7541 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | 0701e06 | 2008-06-27 16:30:57 +0200 | [diff] [blame] | 7542 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 7543 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
Takashi Iwai | 0701e06 | 2008-06-27 16:30:57 +0200 | [diff] [blame] | 7544 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 7545 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 7546 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
Takashi Iwai | 0701e06 | 2008-06-27 16:30:57 +0200 | [diff] [blame] | 7547 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 7548 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 7549 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 7550 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 7551 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 7552 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 7553 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 7554 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 7555 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 7556 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 7557 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 7558 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 7559 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 7560 | { } /* end */ |
| 7561 | }; |
| 7562 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 7563 | static struct snd_kcontrol_new alc883_tagra_mixer[] = { |
| 7564 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 7565 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 7566 | HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 7567 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 7568 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
| 7569 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 7570 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 7571 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 7572 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 7573 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 7574 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 7575 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 7576 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 7577 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 7578 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 7579 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 7580 | { } /* end */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 7581 | }; |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 7582 | |
| 7583 | static struct snd_kcontrol_new alc883_tagra_2ch_mixer[] = { |
| 7584 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 7585 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 7586 | HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 7587 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 7588 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 7589 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 7590 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 7591 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Jiang zhe | 4383fae | 2008-04-14 12:58:57 +0200 | [diff] [blame] | 7592 | HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 7593 | HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT), |
| 7594 | HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 7595 | { } /* end */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 7596 | }; |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 7597 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 7598 | static struct snd_kcontrol_new alc883_lenovo_101e_2ch_mixer[] = { |
| 7599 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 7600 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Takashi Iwai | 86cd929 | 2008-01-28 18:09:56 +0100 | [diff] [blame] | 7601 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 7602 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 7603 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 7604 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 7605 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 7606 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 7607 | { } /* end */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 7608 | }; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 7609 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7610 | static struct snd_kcontrol_new alc883_lenovo_nb0763_mixer[] = { |
| 7611 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 7612 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0c, 2, HDA_INPUT), |
| 7613 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 7614 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 7615 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 7616 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 7617 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 7618 | HDA_CODEC_VOLUME("iMic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 7619 | HDA_CODEC_MUTE("iMic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7620 | { } /* end */ |
| 7621 | }; |
| 7622 | |
| 7623 | static struct snd_kcontrol_new alc883_medion_md2_mixer[] = { |
| 7624 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 7625 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 7626 | HDA_CODEC_MUTE("Front Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 7627 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 7628 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 7629 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 7630 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 7631 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 7632 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7633 | { } /* end */ |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 7634 | }; |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7635 | |
Tobin Davis | 2880a86 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 7636 | static struct snd_kcontrol_new alc883_acer_aspire_mixer[] = { |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 7637 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 7638 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Tobin Davis | 2880a86 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 7639 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
Tobin Davis | 2880a86 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 7640 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 7641 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 7642 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 7643 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 7644 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Tobin Davis | 2880a86 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 7645 | { } /* end */ |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 7646 | }; |
Tobin Davis | 2880a86 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 7647 | |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 7648 | static struct snd_kcontrol_new alc888_lenovo_sky_mixer[] = { |
| 7649 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 7650 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 7651 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0e, 0x0, HDA_OUTPUT), |
| 7652 | HDA_BIND_MUTE("Surround Playback Switch", 0x0e, 2, HDA_INPUT), |
| 7653 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", |
| 7654 | 0x0d, 1, 0x0, HDA_OUTPUT), |
| 7655 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0d, 2, 0x0, HDA_OUTPUT), |
| 7656 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0d, 1, 2, HDA_INPUT), |
| 7657 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0d, 2, 2, HDA_INPUT), |
| 7658 | HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
| 7659 | HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT), |
| 7660 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 7661 | HDA_CODEC_MUTE("iSpeaker Playback Switch", 0x1a, 0x0, HDA_OUTPUT), |
| 7662 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 7663 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 7664 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 7665 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 7666 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 7667 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 7668 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 7669 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 7670 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
| 7671 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 7672 | { } /* end */ |
| 7673 | }; |
| 7674 | |
| 7675 | static struct hda_bind_ctls alc883_bind_cap_vol = { |
| 7676 | .ops = &snd_hda_bind_vol, |
| 7677 | .values = { |
| 7678 | HDA_COMPOSE_AMP_VAL(0x08, 3, 0, HDA_INPUT), |
| 7679 | HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_INPUT), |
| 7680 | 0 |
| 7681 | }, |
| 7682 | }; |
| 7683 | |
| 7684 | static struct hda_bind_ctls alc883_bind_cap_switch = { |
| 7685 | .ops = &snd_hda_bind_sw, |
| 7686 | .values = { |
| 7687 | HDA_COMPOSE_AMP_VAL(0x08, 3, 0, HDA_INPUT), |
| 7688 | HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_INPUT), |
| 7689 | 0 |
| 7690 | }, |
| 7691 | }; |
| 7692 | |
| 7693 | static struct snd_kcontrol_new alc883_asus_eee1601_mixer[] = { |
| 7694 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 7695 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 7696 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 7697 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 7698 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 7699 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 7700 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 7701 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 7702 | { } /* end */ |
| 7703 | }; |
| 7704 | |
| 7705 | static struct snd_kcontrol_new alc883_asus_eee1601_cap_mixer[] = { |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 7706 | HDA_BIND_VOL("Capture Volume", &alc883_bind_cap_vol), |
| 7707 | HDA_BIND_SW("Capture Switch", &alc883_bind_cap_switch), |
| 7708 | { |
| 7709 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 7710 | /* .name = "Capture Source", */ |
| 7711 | .name = "Input Source", |
| 7712 | .count = 1, |
Takashi Iwai | 54cbc9a | 2008-10-31 15:24:04 +0100 | [diff] [blame] | 7713 | .info = alc_mux_enum_info, |
| 7714 | .get = alc_mux_enum_get, |
| 7715 | .put = alc_mux_enum_put, |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 7716 | }, |
| 7717 | { } /* end */ |
| 7718 | }; |
| 7719 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7720 | static struct snd_kcontrol_new alc883_chmode_mixer[] = { |
| 7721 | { |
| 7722 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 7723 | .name = "Channel Mode", |
| 7724 | .info = alc_ch_mode_info, |
| 7725 | .get = alc_ch_mode_get, |
| 7726 | .put = alc_ch_mode_put, |
| 7727 | }, |
| 7728 | { } /* end */ |
| 7729 | }; |
| 7730 | |
| 7731 | static struct hda_verb alc883_init_verbs[] = { |
| 7732 | /* ADC1: mute amp left and right */ |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 7733 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7734 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7735 | /* ADC2: mute amp left and right */ |
| 7736 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7737 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7738 | /* Front mixer: unmute input/output amp left and right (volume = 0) */ |
| 7739 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 7740 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7741 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 7742 | /* Rear mixer */ |
| 7743 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 7744 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7745 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 7746 | /* CLFE mixer */ |
| 7747 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 7748 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7749 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 7750 | /* Side mixer */ |
| 7751 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 7752 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7753 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 7754 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 7755 | /* mute analog input loopbacks */ |
| 7756 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7757 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 7758 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 7759 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 7760 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7761 | |
| 7762 | /* Front Pin: output 0 (0x0c) */ |
| 7763 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 7764 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 7765 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7766 | /* Rear Pin: output 1 (0x0d) */ |
| 7767 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 7768 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 7769 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 7770 | /* CLFE Pin: output 2 (0x0e) */ |
| 7771 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 7772 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 7773 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 7774 | /* Side Pin: output 3 (0x0f) */ |
| 7775 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 7776 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 7777 | {0x17, AC_VERB_SET_CONNECT_SEL, 0x03}, |
| 7778 | /* Mic (rear) pin: input vref at 80% */ |
| 7779 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 7780 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 7781 | /* Front Mic pin: input vref at 80% */ |
| 7782 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 7783 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 7784 | /* Line In pin: input */ |
| 7785 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 7786 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 7787 | /* Line-2 In: Headphone output (output 0 - 0x0c) */ |
| 7788 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 7789 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 7790 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7791 | /* CD pin widget for input */ |
| 7792 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 7793 | |
| 7794 | /* FIXME: use matrix-type input source selection */ |
| 7795 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 7796 | /* Input mixer2 */ |
| 7797 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 7798 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 7799 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 7800 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7801 | /* Input mixer3 */ |
| 7802 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 7803 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 7804 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 7805 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7806 | { } |
| 7807 | }; |
| 7808 | |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 7809 | /* toggle speaker-output according to the hp-jack state */ |
| 7810 | static void alc883_mitac_hp_automute(struct hda_codec *codec) |
| 7811 | { |
| 7812 | unsigned int present; |
| 7813 | |
| 7814 | present = snd_hda_codec_read(codec, 0x15, 0, |
| 7815 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 7816 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 7817 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
| 7818 | snd_hda_codec_amp_stereo(codec, 0x17, HDA_OUTPUT, 0, |
| 7819 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
| 7820 | } |
| 7821 | |
| 7822 | /* auto-toggle front mic */ |
| 7823 | /* |
| 7824 | static void alc883_mitac_mic_automute(struct hda_codec *codec) |
| 7825 | { |
| 7826 | unsigned int present; |
| 7827 | unsigned char bits; |
| 7828 | |
| 7829 | present = snd_hda_codec_read(codec, 0x18, 0, |
| 7830 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 7831 | bits = present ? HDA_AMP_MUTE : 0; |
| 7832 | snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, 1, HDA_AMP_MUTE, bits); |
| 7833 | } |
| 7834 | */ |
| 7835 | |
| 7836 | static void alc883_mitac_automute(struct hda_codec *codec) |
| 7837 | { |
| 7838 | alc883_mitac_hp_automute(codec); |
| 7839 | /* alc883_mitac_mic_automute(codec); */ |
| 7840 | } |
| 7841 | |
| 7842 | static void alc883_mitac_unsol_event(struct hda_codec *codec, |
| 7843 | unsigned int res) |
| 7844 | { |
| 7845 | switch (res >> 26) { |
| 7846 | case ALC880_HP_EVENT: |
| 7847 | alc883_mitac_hp_automute(codec); |
| 7848 | break; |
| 7849 | case ALC880_MIC_EVENT: |
| 7850 | /* alc883_mitac_mic_automute(codec); */ |
| 7851 | break; |
| 7852 | } |
| 7853 | } |
| 7854 | |
| 7855 | static struct hda_verb alc883_mitac_verbs[] = { |
| 7856 | /* HP */ |
| 7857 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7858 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 7859 | /* Subwoofer */ |
| 7860 | {0x17, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 7861 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 7862 | |
| 7863 | /* enable unsolicited event */ |
| 7864 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 7865 | /* {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN}, */ |
| 7866 | |
| 7867 | { } /* end */ |
| 7868 | }; |
| 7869 | |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 7870 | static struct hda_verb alc883_clevo_m720_verbs[] = { |
Jiang zhe | 368c7a9 | 2008-03-04 11:20:33 +0100 | [diff] [blame] | 7871 | /* HP */ |
| 7872 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7873 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 7874 | /* Int speaker */ |
| 7875 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 7876 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 7877 | |
| 7878 | /* enable unsolicited event */ |
| 7879 | {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] | 7880 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN}, |
Jiang zhe | 368c7a9 | 2008-03-04 11:20:33 +0100 | [diff] [blame] | 7881 | |
| 7882 | { } /* end */ |
| 7883 | }; |
| 7884 | |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 7885 | static struct hda_verb alc883_2ch_fujitsu_pi2515_verbs[] = { |
| 7886 | /* HP */ |
| 7887 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7888 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 7889 | /* Subwoofer */ |
| 7890 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 7891 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 7892 | |
| 7893 | /* enable unsolicited event */ |
| 7894 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 7895 | |
| 7896 | { } /* end */ |
| 7897 | }; |
| 7898 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 7899 | static struct hda_verb alc883_tagra_verbs[] = { |
| 7900 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7901 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 7902 | |
| 7903 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 7904 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 7905 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 7906 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */ |
| 7907 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */ |
| 7908 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 7909 | |
| 7910 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 7911 | {0x01, AC_VERB_SET_GPIO_MASK, 0x03}, |
| 7912 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x03}, |
| 7913 | {0x01, AC_VERB_SET_GPIO_DATA, 0x03}, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 7914 | |
| 7915 | { } /* end */ |
| 7916 | }; |
| 7917 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 7918 | static struct hda_verb alc883_lenovo_101e_verbs[] = { |
| 7919 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7920 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_FRONT_EVENT|AC_USRSP_EN}, |
| 7921 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT|AC_USRSP_EN}, |
| 7922 | { } /* end */ |
| 7923 | }; |
| 7924 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7925 | static struct hda_verb alc883_lenovo_nb0763_verbs[] = { |
| 7926 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7927 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 7928 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 7929 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 7930 | { } /* end */ |
| 7931 | }; |
| 7932 | |
| 7933 | static struct hda_verb alc888_lenovo_ms7195_verbs[] = { |
| 7934 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7935 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 7936 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7937 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_FRONT_EVENT | AC_USRSP_EN}, |
| 7938 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 7939 | { } /* end */ |
| 7940 | }; |
| 7941 | |
Kailang Yang | 189609a | 2007-08-20 11:31:23 +0200 | [diff] [blame] | 7942 | static struct hda_verb alc883_haier_w66_verbs[] = { |
| 7943 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7944 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 7945 | |
| 7946 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 7947 | |
| 7948 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7949 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 7950 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 7951 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 7952 | { } /* end */ |
| 7953 | }; |
| 7954 | |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 7955 | static struct hda_verb alc888_lenovo_sky_verbs[] = { |
| 7956 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7957 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 7958 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7959 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7960 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7961 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 7962 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7963 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 7964 | { } /* end */ |
| 7965 | }; |
| 7966 | |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 7967 | static struct hda_verb alc888_3st_hp_verbs[] = { |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 7968 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front: output 0 (0x0c) */ |
Herton Ronaldo Krzesinski | f32a19e | 2008-03-18 09:27:08 +0100 | [diff] [blame] | 7969 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Rear : output 1 (0x0d) */ |
| 7970 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* CLFE : output 2 (0x0e) */ |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 7971 | { } |
| 7972 | }; |
| 7973 | |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 7974 | static struct hda_verb alc888_6st_dell_verbs[] = { |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 7975 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 7976 | { } |
| 7977 | }; |
| 7978 | |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 7979 | static struct hda_verb alc888_3st_hp_2ch_init[] = { |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 7980 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 7981 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 7982 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 7983 | { 0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 7984 | { } |
| 7985 | }; |
| 7986 | |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 7987 | static struct hda_verb alc888_3st_hp_6ch_init[] = { |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 7988 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7989 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 7990 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7991 | { 0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 7992 | { } |
| 7993 | }; |
| 7994 | |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 7995 | static struct hda_channel_mode alc888_3st_hp_modes[2] = { |
| 7996 | { 2, alc888_3st_hp_2ch_init }, |
| 7997 | { 6, alc888_3st_hp_6ch_init }, |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 7998 | }; |
| 7999 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8000 | /* toggle front-jack and RCA according to the hp-jack state */ |
| 8001 | static void alc888_lenovo_ms7195_front_automute(struct hda_codec *codec) |
| 8002 | { |
| 8003 | unsigned int present; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 8004 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8005 | present = snd_hda_codec_read(codec, 0x1b, 0, |
| 8006 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 8007 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 8008 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
| 8009 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 8010 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8011 | } |
| 8012 | |
| 8013 | /* toggle RCA according to the front-jack state */ |
| 8014 | static void alc888_lenovo_ms7195_rca_automute(struct hda_codec *codec) |
| 8015 | { |
| 8016 | unsigned int present; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 8017 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8018 | present = snd_hda_codec_read(codec, 0x14, 0, |
| 8019 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 8020 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 8021 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8022 | } |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 8023 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8024 | static void alc883_lenovo_ms7195_unsol_event(struct hda_codec *codec, |
| 8025 | unsigned int res) |
| 8026 | { |
| 8027 | if ((res >> 26) == ALC880_HP_EVENT) |
| 8028 | alc888_lenovo_ms7195_front_automute(codec); |
| 8029 | if ((res >> 26) == ALC880_FRONT_EVENT) |
| 8030 | alc888_lenovo_ms7195_rca_automute(codec); |
| 8031 | } |
| 8032 | |
| 8033 | static struct hda_verb alc883_medion_md2_verbs[] = { |
| 8034 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8035 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8036 | |
| 8037 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 8038 | |
| 8039 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 8040 | { } /* end */ |
| 8041 | }; |
| 8042 | |
| 8043 | /* toggle speaker-output according to the hp-jack state */ |
| 8044 | static void alc883_medion_md2_automute(struct hda_codec *codec) |
| 8045 | { |
| 8046 | unsigned int present; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 8047 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8048 | present = snd_hda_codec_read(codec, 0x14, 0, |
| 8049 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 8050 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 8051 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8052 | } |
| 8053 | |
| 8054 | static void alc883_medion_md2_unsol_event(struct hda_codec *codec, |
| 8055 | unsigned int res) |
| 8056 | { |
| 8057 | if ((res >> 26) == ALC880_HP_EVENT) |
| 8058 | alc883_medion_md2_automute(codec); |
| 8059 | } |
| 8060 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8061 | /* toggle speaker-output according to the hp-jack state */ |
| 8062 | static void alc883_tagra_automute(struct hda_codec *codec) |
| 8063 | { |
| 8064 | unsigned int present; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 8065 | unsigned char bits; |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8066 | |
| 8067 | present = snd_hda_codec_read(codec, 0x14, 0, |
| 8068 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 8069 | bits = present ? HDA_AMP_MUTE : 0; |
| 8070 | snd_hda_codec_amp_stereo(codec, 0x1b, HDA_OUTPUT, 0, |
| 8071 | HDA_AMP_MUTE, bits); |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 8072 | snd_hda_codec_write_cache(codec, 1, 0, AC_VERB_SET_GPIO_DATA, |
| 8073 | present ? 1 : 3); |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8074 | } |
| 8075 | |
| 8076 | static void alc883_tagra_unsol_event(struct hda_codec *codec, unsigned int res) |
| 8077 | { |
| 8078 | if ((res >> 26) == ALC880_HP_EVENT) |
| 8079 | alc883_tagra_automute(codec); |
| 8080 | } |
| 8081 | |
Jiang zhe | 368c7a9 | 2008-03-04 11:20:33 +0100 | [diff] [blame] | 8082 | /* toggle speaker-output according to the hp-jack state */ |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 8083 | static void alc883_clevo_m720_hp_automute(struct hda_codec *codec) |
Jiang zhe | 368c7a9 | 2008-03-04 11:20:33 +0100 | [diff] [blame] | 8084 | { |
| 8085 | unsigned int present; |
| 8086 | unsigned char bits; |
| 8087 | |
| 8088 | present = snd_hda_codec_read(codec, 0x15, 0, AC_VERB_GET_PIN_SENSE, 0) |
| 8089 | & AC_PINSENSE_PRESENCE; |
| 8090 | bits = present ? HDA_AMP_MUTE : 0; |
| 8091 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 8092 | HDA_AMP_MUTE, bits); |
| 8093 | } |
| 8094 | |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 8095 | static void alc883_clevo_m720_mic_automute(struct hda_codec *codec) |
| 8096 | { |
| 8097 | unsigned int present; |
| 8098 | |
| 8099 | present = snd_hda_codec_read(codec, 0x18, 0, |
| 8100 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 8101 | snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, 1, |
| 8102 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
| 8103 | } |
| 8104 | |
| 8105 | static void alc883_clevo_m720_automute(struct hda_codec *codec) |
| 8106 | { |
| 8107 | alc883_clevo_m720_hp_automute(codec); |
| 8108 | alc883_clevo_m720_mic_automute(codec); |
| 8109 | } |
| 8110 | |
| 8111 | static void alc883_clevo_m720_unsol_event(struct hda_codec *codec, |
Jiang zhe | 368c7a9 | 2008-03-04 11:20:33 +0100 | [diff] [blame] | 8112 | unsigned int res) |
| 8113 | { |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 8114 | switch (res >> 26) { |
| 8115 | case ALC880_HP_EVENT: |
| 8116 | alc883_clevo_m720_hp_automute(codec); |
| 8117 | break; |
| 8118 | case ALC880_MIC_EVENT: |
| 8119 | alc883_clevo_m720_mic_automute(codec); |
| 8120 | break; |
| 8121 | } |
Jiang zhe | 368c7a9 | 2008-03-04 11:20:33 +0100 | [diff] [blame] | 8122 | } |
| 8123 | |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 8124 | /* toggle speaker-output according to the hp-jack state */ |
| 8125 | static void alc883_2ch_fujitsu_pi2515_automute(struct hda_codec *codec) |
| 8126 | { |
| 8127 | unsigned int present; |
| 8128 | unsigned char bits; |
| 8129 | |
| 8130 | present = snd_hda_codec_read(codec, 0x14, 0, AC_VERB_GET_PIN_SENSE, 0) |
| 8131 | & AC_PINSENSE_PRESENCE; |
| 8132 | bits = present ? HDA_AMP_MUTE : 0; |
| 8133 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 8134 | HDA_AMP_MUTE, bits); |
| 8135 | } |
| 8136 | |
| 8137 | static void alc883_2ch_fujitsu_pi2515_unsol_event(struct hda_codec *codec, |
| 8138 | unsigned int res) |
| 8139 | { |
| 8140 | if ((res >> 26) == ALC880_HP_EVENT) |
| 8141 | alc883_2ch_fujitsu_pi2515_automute(codec); |
| 8142 | } |
| 8143 | |
Kailang Yang | 189609a | 2007-08-20 11:31:23 +0200 | [diff] [blame] | 8144 | static void alc883_haier_w66_automute(struct hda_codec *codec) |
| 8145 | { |
| 8146 | unsigned int present; |
| 8147 | unsigned char bits; |
| 8148 | |
| 8149 | present = snd_hda_codec_read(codec, 0x1b, 0, |
| 8150 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 8151 | bits = present ? 0x80 : 0; |
| 8152 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 8153 | 0x80, bits); |
| 8154 | } |
| 8155 | |
| 8156 | static void alc883_haier_w66_unsol_event(struct hda_codec *codec, |
| 8157 | unsigned int res) |
| 8158 | { |
| 8159 | if ((res >> 26) == ALC880_HP_EVENT) |
| 8160 | alc883_haier_w66_automute(codec); |
| 8161 | } |
| 8162 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 8163 | static void alc883_lenovo_101e_ispeaker_automute(struct hda_codec *codec) |
| 8164 | { |
| 8165 | unsigned int present; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 8166 | unsigned char bits; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 8167 | |
| 8168 | present = snd_hda_codec_read(codec, 0x14, 0, |
| 8169 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 8170 | bits = present ? HDA_AMP_MUTE : 0; |
| 8171 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 8172 | HDA_AMP_MUTE, bits); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 8173 | } |
| 8174 | |
| 8175 | static void alc883_lenovo_101e_all_automute(struct hda_codec *codec) |
| 8176 | { |
| 8177 | unsigned int present; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 8178 | unsigned char bits; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 8179 | |
| 8180 | present = snd_hda_codec_read(codec, 0x1b, 0, |
| 8181 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 8182 | bits = present ? HDA_AMP_MUTE : 0; |
| 8183 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 8184 | HDA_AMP_MUTE, bits); |
| 8185 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 8186 | HDA_AMP_MUTE, bits); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 8187 | } |
| 8188 | |
| 8189 | static void alc883_lenovo_101e_unsol_event(struct hda_codec *codec, |
| 8190 | unsigned int res) |
| 8191 | { |
| 8192 | if ((res >> 26) == ALC880_HP_EVENT) |
| 8193 | alc883_lenovo_101e_all_automute(codec); |
| 8194 | if ((res >> 26) == ALC880_FRONT_EVENT) |
| 8195 | alc883_lenovo_101e_ispeaker_automute(codec); |
| 8196 | } |
| 8197 | |
Takashi Iwai | 676a9b5 | 2007-08-16 15:23:35 +0200 | [diff] [blame] | 8198 | /* toggle speaker-output according to the hp-jack state */ |
| 8199 | static void alc883_acer_aspire_automute(struct hda_codec *codec) |
| 8200 | { |
| 8201 | unsigned int present; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 8202 | |
Takashi Iwai | 676a9b5 | 2007-08-16 15:23:35 +0200 | [diff] [blame] | 8203 | present = snd_hda_codec_read(codec, 0x14, 0, |
| 8204 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 8205 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 8206 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
| 8207 | snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0, |
| 8208 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
| 8209 | } |
| 8210 | |
| 8211 | static void alc883_acer_aspire_unsol_event(struct hda_codec *codec, |
| 8212 | unsigned int res) |
| 8213 | { |
| 8214 | if ((res >> 26) == ALC880_HP_EVENT) |
| 8215 | alc883_acer_aspire_automute(codec); |
| 8216 | } |
| 8217 | |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 8218 | static struct hda_verb alc883_acer_eapd_verbs[] = { |
| 8219 | /* HP Pin: output 0 (0x0c) */ |
| 8220 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 8221 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8222 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8223 | /* Front Pin: output 0 (0x0c) */ |
Takashi Iwai | 676a9b5 | 2007-08-16 15:23:35 +0200 | [diff] [blame] | 8224 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 8225 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 8226 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 8227 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8228 | /* eanable EAPD on medion laptop */ |
| 8229 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 8230 | {0x20, AC_VERB_SET_PROC_COEF, 0x3050}, |
Takashi Iwai | 676a9b5 | 2007-08-16 15:23:35 +0200 | [diff] [blame] | 8231 | /* enable unsolicited event */ |
| 8232 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 8233 | { } |
| 8234 | }; |
| 8235 | |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 8236 | static void alc888_6st_dell_front_automute(struct hda_codec *codec) |
| 8237 | { |
| 8238 | unsigned int present; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 8239 | |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 8240 | present = snd_hda_codec_read(codec, 0x1b, 0, |
| 8241 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 8242 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 8243 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
| 8244 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 8245 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
| 8246 | snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0, |
| 8247 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
| 8248 | snd_hda_codec_amp_stereo(codec, 0x17, HDA_OUTPUT, 0, |
| 8249 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
| 8250 | } |
| 8251 | |
| 8252 | static void alc888_6st_dell_unsol_event(struct hda_codec *codec, |
| 8253 | unsigned int res) |
| 8254 | { |
| 8255 | switch (res >> 26) { |
| 8256 | case ALC880_HP_EVENT: |
Takashi Iwai | 939778a | 2009-02-05 15:57:55 +0100 | [diff] [blame] | 8257 | /* printk(KERN_DEBUG "hp_event\n"); */ |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 8258 | alc888_6st_dell_front_automute(codec); |
| 8259 | break; |
| 8260 | } |
| 8261 | } |
| 8262 | |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 8263 | static void alc888_lenovo_sky_front_automute(struct hda_codec *codec) |
| 8264 | { |
| 8265 | unsigned int mute; |
| 8266 | unsigned int present; |
| 8267 | |
| 8268 | snd_hda_codec_read(codec, 0x1b, 0, AC_VERB_SET_PIN_SENSE, 0); |
| 8269 | present = snd_hda_codec_read(codec, 0x1b, 0, |
| 8270 | AC_VERB_GET_PIN_SENSE, 0); |
| 8271 | present = (present & 0x80000000) != 0; |
| 8272 | if (present) { |
| 8273 | /* mute internal speaker */ |
| 8274 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 8275 | HDA_AMP_MUTE, HDA_AMP_MUTE); |
| 8276 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 8277 | HDA_AMP_MUTE, HDA_AMP_MUTE); |
| 8278 | snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0, |
| 8279 | HDA_AMP_MUTE, HDA_AMP_MUTE); |
| 8280 | snd_hda_codec_amp_stereo(codec, 0x17, HDA_OUTPUT, 0, |
| 8281 | HDA_AMP_MUTE, HDA_AMP_MUTE); |
| 8282 | snd_hda_codec_amp_stereo(codec, 0x1a, HDA_OUTPUT, 0, |
| 8283 | HDA_AMP_MUTE, HDA_AMP_MUTE); |
| 8284 | } else { |
| 8285 | /* unmute internal speaker if necessary */ |
| 8286 | mute = snd_hda_codec_amp_read(codec, 0x1b, 0, HDA_OUTPUT, 0); |
| 8287 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 8288 | HDA_AMP_MUTE, mute); |
| 8289 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 8290 | HDA_AMP_MUTE, mute); |
| 8291 | snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0, |
| 8292 | HDA_AMP_MUTE, mute); |
| 8293 | snd_hda_codec_amp_stereo(codec, 0x17, HDA_OUTPUT, 0, |
| 8294 | HDA_AMP_MUTE, mute); |
| 8295 | snd_hda_codec_amp_stereo(codec, 0x1a, HDA_OUTPUT, 0, |
| 8296 | HDA_AMP_MUTE, mute); |
| 8297 | } |
| 8298 | } |
| 8299 | |
| 8300 | static void alc883_lenovo_sky_unsol_event(struct hda_codec *codec, |
| 8301 | unsigned int res) |
| 8302 | { |
| 8303 | if ((res >> 26) == ALC880_HP_EVENT) |
| 8304 | alc888_lenovo_sky_front_automute(codec); |
| 8305 | } |
| 8306 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8307 | /* |
| 8308 | * generic initialization of ADC, input mixers and output mixers |
| 8309 | */ |
| 8310 | static struct hda_verb alc883_auto_init_verbs[] = { |
| 8311 | /* |
| 8312 | * Unmute ADC0-2 and set the default input to mic-in |
| 8313 | */ |
| 8314 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8315 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8316 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8317 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8318 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 8319 | /* 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] | 8320 | * mixer widget |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 8321 | * Note: PASD motherboards uses the Line In 2 as the input for |
| 8322 | * front panel mic (mic 2) |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8323 | */ |
| 8324 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 8325 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8326 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 8327 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 8328 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 8329 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8330 | |
| 8331 | /* |
| 8332 | * Set up output mixers (0x0c - 0x0f) |
| 8333 | */ |
| 8334 | /* set vol=0 to output mixers */ |
| 8335 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 8336 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 8337 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 8338 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 8339 | /* set up input amps for analog loopback */ |
| 8340 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 8341 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8342 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8343 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8344 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8345 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8346 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8347 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8348 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8349 | {0x26, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8350 | {0x26, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8351 | |
| 8352 | /* FIXME: use matrix-type input source selection */ |
| 8353 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 8354 | /* Input mixer1 */ |
| 8355 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8356 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8357 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 8358 | /* {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, */ |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8359 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)}, |
| 8360 | /* Input mixer2 */ |
| 8361 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8362 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8363 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 8364 | /* {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, */ |
Andy Shevchenko | e3cde64 | 2007-12-03 16:50:58 +0100 | [diff] [blame] | 8365 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)}, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8366 | |
| 8367 | { } |
| 8368 | }; |
| 8369 | |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 8370 | static struct hda_verb alc888_asus_m90v_verbs[] = { |
| 8371 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8372 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8373 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8374 | /* enable unsolicited event */ |
| 8375 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 8376 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN}, |
| 8377 | { } /* end */ |
| 8378 | }; |
| 8379 | |
| 8380 | static void alc883_nb_mic_automute(struct hda_codec *codec) |
| 8381 | { |
| 8382 | unsigned int present; |
| 8383 | |
| 8384 | present = snd_hda_codec_read(codec, 0x18, 0, |
| 8385 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 8386 | snd_hda_codec_write(codec, 0x23, 0, AC_VERB_SET_AMP_GAIN_MUTE, |
| 8387 | 0x7000 | (0x00 << 8) | (present ? 0 : 0x80)); |
| 8388 | snd_hda_codec_write(codec, 0x23, 0, AC_VERB_SET_AMP_GAIN_MUTE, |
| 8389 | 0x7000 | (0x01 << 8) | (present ? 0x80 : 0)); |
| 8390 | } |
| 8391 | |
| 8392 | static void alc883_M90V_speaker_automute(struct hda_codec *codec) |
| 8393 | { |
| 8394 | unsigned int present; |
| 8395 | unsigned char bits; |
| 8396 | |
| 8397 | present = snd_hda_codec_read(codec, 0x1b, 0, |
| 8398 | AC_VERB_GET_PIN_SENSE, 0) |
| 8399 | & AC_PINSENSE_PRESENCE; |
| 8400 | bits = present ? 0 : PIN_OUT; |
| 8401 | snd_hda_codec_write(codec, 0x14, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 8402 | bits); |
| 8403 | snd_hda_codec_write(codec, 0x15, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 8404 | bits); |
| 8405 | snd_hda_codec_write(codec, 0x16, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 8406 | bits); |
| 8407 | } |
| 8408 | |
| 8409 | static void alc883_mode2_unsol_event(struct hda_codec *codec, |
| 8410 | unsigned int res) |
| 8411 | { |
| 8412 | switch (res >> 26) { |
| 8413 | case ALC880_HP_EVENT: |
| 8414 | alc883_M90V_speaker_automute(codec); |
| 8415 | break; |
| 8416 | case ALC880_MIC_EVENT: |
| 8417 | alc883_nb_mic_automute(codec); |
| 8418 | break; |
| 8419 | } |
| 8420 | } |
| 8421 | |
| 8422 | static void alc883_mode2_inithook(struct hda_codec *codec) |
| 8423 | { |
| 8424 | alc883_M90V_speaker_automute(codec); |
| 8425 | alc883_nb_mic_automute(codec); |
| 8426 | } |
| 8427 | |
| 8428 | static struct hda_verb alc888_asus_eee1601_verbs[] = { |
| 8429 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 8430 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 8431 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8432 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8433 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 8434 | {0x20, AC_VERB_SET_COEF_INDEX, 0x0b}, |
| 8435 | {0x20, AC_VERB_SET_PROC_COEF, 0x0838}, |
| 8436 | /* enable unsolicited event */ |
| 8437 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 8438 | { } /* end */ |
| 8439 | }; |
| 8440 | |
| 8441 | static void alc883_eee1601_speaker_automute(struct hda_codec *codec) |
| 8442 | { |
| 8443 | unsigned int present; |
| 8444 | unsigned char bits; |
| 8445 | |
| 8446 | present = snd_hda_codec_read(codec, 0x14, 0, |
| 8447 | AC_VERB_GET_PIN_SENSE, 0) |
| 8448 | & AC_PINSENSE_PRESENCE; |
| 8449 | bits = present ? 0 : PIN_OUT; |
| 8450 | snd_hda_codec_write(codec, 0x1b, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 8451 | bits); |
| 8452 | } |
| 8453 | |
| 8454 | static void alc883_eee1601_unsol_event(struct hda_codec *codec, |
| 8455 | unsigned int res) |
| 8456 | { |
| 8457 | switch (res >> 26) { |
| 8458 | case ALC880_HP_EVENT: |
| 8459 | alc883_eee1601_speaker_automute(codec); |
| 8460 | break; |
| 8461 | } |
| 8462 | } |
| 8463 | |
| 8464 | static void alc883_eee1601_inithook(struct hda_codec *codec) |
| 8465 | { |
| 8466 | alc883_eee1601_speaker_automute(codec); |
| 8467 | } |
| 8468 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 8469 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 8470 | #define alc883_loopbacks alc880_loopbacks |
| 8471 | #endif |
| 8472 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8473 | /* pcm configuration: identiacal with ALC880 */ |
| 8474 | #define alc883_pcm_analog_playback alc880_pcm_analog_playback |
| 8475 | #define alc883_pcm_analog_capture alc880_pcm_analog_capture |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 8476 | #define alc883_pcm_analog_alt_capture alc880_pcm_analog_alt_capture |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8477 | #define alc883_pcm_digital_playback alc880_pcm_digital_playback |
| 8478 | #define alc883_pcm_digital_capture alc880_pcm_digital_capture |
| 8479 | |
| 8480 | /* |
| 8481 | * configuration and preset |
| 8482 | */ |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 8483 | static const char *alc883_models[ALC883_MODEL_LAST] = { |
| 8484 | [ALC883_3ST_2ch_DIG] = "3stack-dig", |
| 8485 | [ALC883_3ST_6ch_DIG] = "3stack-6ch-dig", |
| 8486 | [ALC883_3ST_6ch] = "3stack-6ch", |
| 8487 | [ALC883_6ST_DIG] = "6stack-dig", |
| 8488 | [ALC883_TARGA_DIG] = "targa-dig", |
| 8489 | [ALC883_TARGA_2ch_DIG] = "targa-2ch-dig", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 8490 | [ALC883_ACER] = "acer", |
Tobin Davis | 2880a86 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 8491 | [ALC883_ACER_ASPIRE] = "acer-aspire", |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 8492 | [ALC888_ACER_ASPIRE_4930G] = "acer-aspire-4930g", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 8493 | [ALC883_MEDION] = "medion", |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8494 | [ALC883_MEDION_MD2] = "medion-md2", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 8495 | [ALC883_LAPTOP_EAPD] = "laptop-eapd", |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 8496 | [ALC883_LENOVO_101E_2ch] = "lenovo-101e", |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8497 | [ALC883_LENOVO_NB0763] = "lenovo-nb0763", |
| 8498 | [ALC888_LENOVO_MS7195_DIG] = "lenovo-ms7195-dig", |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 8499 | [ALC888_LENOVO_SKY] = "lenovo-sky", |
Kailang Yang | 189609a | 2007-08-20 11:31:23 +0200 | [diff] [blame] | 8500 | [ALC883_HAIER_W66] = "haier-w66", |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 8501 | [ALC888_3ST_HP] = "3stack-hp", |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 8502 | [ALC888_6ST_DELL] = "6stack-dell", |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 8503 | [ALC883_MITAC] = "mitac", |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 8504 | [ALC883_CLEVO_M720] = "clevo-m720", |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 8505 | [ALC883_FUJITSU_PI2515] = "fujitsu-pi2515", |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 8506 | [ALC888_FUJITSU_XA3530] = "fujitsu-xa3530", |
Jiang zhe | 17bba1b | 2008-06-04 12:11:07 +0200 | [diff] [blame] | 8507 | [ALC883_3ST_6ch_INTEL] = "3stack-6ch-intel", |
Wu Fengguang | 3ab9093 | 2008-11-17 09:51:09 +0100 | [diff] [blame] | 8508 | [ALC1200_ASUS_P5Q] = "asus-p5q", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 8509 | [ALC883_AUTO] = "auto", |
| 8510 | }; |
| 8511 | |
| 8512 | static struct snd_pci_quirk alc883_cfg_tbl[] = { |
| 8513 | SND_PCI_QUIRK(0x1019, 0x6668, "ECS", ALC883_3ST_6ch_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 8514 | SND_PCI_QUIRK(0x1025, 0x006c, "Acer Aspire 9810", ALC883_ACER_ASPIRE), |
Takashi Iwai | 69e5028 | 2008-11-03 10:07:43 +0100 | [diff] [blame] | 8515 | SND_PCI_QUIRK(0x1025, 0x0090, "Acer Aspire", ALC883_ACER_ASPIRE), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 8516 | SND_PCI_QUIRK(0x1025, 0x0110, "Acer Aspire", ALC883_ACER_ASPIRE), |
| 8517 | SND_PCI_QUIRK(0x1025, 0x0112, "Acer Aspire 9303", ALC883_ACER_ASPIRE), |
Jaroslav Kysela | 0b18cb1 | 2008-07-28 17:07:07 +0200 | [diff] [blame] | 8518 | SND_PCI_QUIRK(0x1025, 0x0121, "Acer Aspire 5920G", ALC883_ACER_ASPIRE), |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 8519 | SND_PCI_QUIRK(0x1025, 0x013e, "Acer Aspire 4930G", |
| 8520 | ALC888_ACER_ASPIRE_4930G), |
Lukasz Wojnilowicz | a8e4f9d | 2009-01-08 12:00:49 +0100 | [diff] [blame] | 8521 | SND_PCI_QUIRK(0x1025, 0x013f, "Acer Aspire 5930G", |
| 8522 | ALC888_ACER_ASPIRE_4930G), |
Takashi Iwai | 9468350 | 2009-02-13 09:31:20 +0100 | [diff] [blame^] | 8523 | SND_PCI_QUIRK(0x1025, 0x0158, "Acer AX1700-U3700A", ALC883_AUTO), |
Lukasz Wojnilowicz | a8e4f9d | 2009-01-08 12:00:49 +0100 | [diff] [blame] | 8524 | SND_PCI_QUIRK(0x1025, 0x015e, "Acer Aspire 6930G", |
| 8525 | ALC888_ACER_ASPIRE_4930G), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 8526 | /* default Acer */ |
| 8527 | SND_PCI_QUIRK_VENDOR(0x1025, "Acer laptop", ALC883_ACER), |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 8528 | SND_PCI_QUIRK(0x1028, 0x020d, "Dell Inspiron 530", ALC888_6ST_DELL), |
Tobin Davis | febe337 | 2007-06-12 11:27:46 +0200 | [diff] [blame] | 8529 | SND_PCI_QUIRK(0x103c, 0x2a3d, "HP Pavillion", ALC883_6ST_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 8530 | SND_PCI_QUIRK(0x103c, 0x2a4f, "HP Samba", ALC888_3ST_HP), |
| 8531 | SND_PCI_QUIRK(0x103c, 0x2a60, "HP Lucknow", ALC888_3ST_HP), |
Herton Ronaldo Krzesinski | 5d85f8d | 2008-03-20 12:13:46 +0100 | [diff] [blame] | 8532 | SND_PCI_QUIRK(0x103c, 0x2a61, "HP Nettle", ALC883_6ST_DIG), |
Chris Bagwell | 06bf3e1 | 2009-01-01 10:32:08 +0100 | [diff] [blame] | 8533 | SND_PCI_QUIRK(0x103c, 0x2a66, "HP Acacia", ALC888_3ST_HP), |
Kailang Yang | a01c30c | 2008-10-15 11:14:58 +0200 | [diff] [blame] | 8534 | SND_PCI_QUIRK(0x1043, 0x1873, "Asus M90V", ALC888_ASUS_M90V), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 8535 | 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] | 8536 | SND_PCI_QUIRK(0x1043, 0x8284, "Asus Z37E", ALC883_6ST_DIG), |
Wu Fengguang | 3ab9093 | 2008-11-17 09:51:09 +0100 | [diff] [blame] | 8537 | SND_PCI_QUIRK(0x1043, 0x82fe, "Asus P5Q-EM HDMI", ALC1200_ASUS_P5Q), |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 8538 | SND_PCI_QUIRK(0x1043, 0x835f, "Asus Eee 1601", ALC888_ASUS_EEE1601), |
Travis Place | 97ec710 | 2008-05-23 18:31:46 +0200 | [diff] [blame] | 8539 | SND_PCI_QUIRK(0x105b, 0x0ce8, "Foxconn P35AX-S", ALC883_6ST_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 8540 | SND_PCI_QUIRK(0x105b, 0x6668, "Foxconn", ALC883_6ST_DIG), |
Luke Yelavich | 2de686d | 2009-01-16 15:08:02 +1100 | [diff] [blame] | 8541 | SND_PCI_QUIRK(0x1071, 0x8227, "Mitac 82801H", ALC883_MITAC), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 8542 | SND_PCI_QUIRK(0x1071, 0x8253, "Mitac 8252d", ALC883_MITAC), |
| 8543 | SND_PCI_QUIRK(0x1071, 0x8258, "Evesham Voyaeger", ALC883_LAPTOP_EAPD), |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 8544 | SND_PCI_QUIRK(0x10f1, 0x2350, "TYAN-S2350", ALC888_6ST_DELL), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 8545 | SND_PCI_QUIRK(0x108e, 0x534d, NULL, ALC883_3ST_6ch), |
Tobin Davis | 57b14f2 | 2007-04-18 23:05:36 +0200 | [diff] [blame] | 8546 | SND_PCI_QUIRK(0x1458, 0xa002, "MSI", ALC883_6ST_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 8547 | SND_PCI_QUIRK(0x1462, 0x0349, "MSI", ALC883_TARGA_2ch_DIG), |
| 8548 | SND_PCI_QUIRK(0x1462, 0x040d, "MSI", ALC883_TARGA_2ch_DIG), |
| 8549 | SND_PCI_QUIRK(0x1462, 0x0579, "MSI", ALC883_TARGA_2ch_DIG), |
Jiang zhe | 4383fae | 2008-04-14 12:58:57 +0200 | [diff] [blame] | 8550 | SND_PCI_QUIRK(0x1462, 0x2fb3, "MSI", ALC883_TARGA_2ch_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 8551 | SND_PCI_QUIRK(0x1462, 0x3729, "MSI S420", ALC883_TARGA_DIG), |
Pascal Terjan | 8280823 | 2008-03-04 11:33:28 +0100 | [diff] [blame] | 8552 | SND_PCI_QUIRK(0x1462, 0x3783, "NEC S970", ALC883_TARGA_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 8553 | SND_PCI_QUIRK(0x1462, 0x3b7f, "MSI", ALC883_TARGA_2ch_DIG), |
| 8554 | SND_PCI_QUIRK(0x1462, 0x3ef9, "MSI", ALC883_TARGA_DIG), |
| 8555 | SND_PCI_QUIRK(0x1462, 0x3fc1, "MSI", ALC883_TARGA_DIG), |
| 8556 | SND_PCI_QUIRK(0x1462, 0x3fc3, "MSI", ALC883_TARGA_DIG), |
| 8557 | SND_PCI_QUIRK(0x1462, 0x3fcc, "MSI", ALC883_TARGA_DIG), |
| 8558 | SND_PCI_QUIRK(0x1462, 0x3fdf, "MSI", ALC883_TARGA_DIG), |
| 8559 | SND_PCI_QUIRK(0x1462, 0x4314, "MSI", ALC883_TARGA_DIG), |
| 8560 | SND_PCI_QUIRK(0x1462, 0x4319, "MSI", ALC883_TARGA_DIG), |
| 8561 | SND_PCI_QUIRK(0x1462, 0x4324, "MSI", ALC883_TARGA_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 8562 | SND_PCI_QUIRK(0x1462, 0x6668, "MSI", ALC883_6ST_DIG), |
| 8563 | SND_PCI_QUIRK(0x1462, 0x7187, "MSI", ALC883_6ST_DIG), |
Tobin Davis | 799f88a | 2007-05-29 14:29:08 +0200 | [diff] [blame] | 8564 | SND_PCI_QUIRK(0x1462, 0x7250, "MSI", ALC883_6ST_DIG), |
Takashi Iwai | ee09543 | 2008-11-25 15:03:38 +0100 | [diff] [blame] | 8565 | SND_PCI_QUIRK(0x1462, 0x7260, "MSI 7260", ALC883_TARGA_DIG), |
Herton Ronaldo Krzesinski | 86d34b7 | 2008-03-18 09:27:59 +0100 | [diff] [blame] | 8566 | SND_PCI_QUIRK(0x1462, 0x7267, "MSI", ALC883_3ST_6ch_DIG), |
Leonard Norrgard | 2a296cb | 2007-01-08 11:28:22 +0100 | [diff] [blame] | 8567 | SND_PCI_QUIRK(0x1462, 0x7280, "MSI", ALC883_6ST_DIG), |
Tobin Davis | 2dcd522 | 2007-07-10 17:04:57 +0200 | [diff] [blame] | 8568 | SND_PCI_QUIRK(0x1462, 0x7327, "MSI", ALC883_6ST_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 8569 | SND_PCI_QUIRK(0x1462, 0xa422, "MSI", ALC883_TARGA_2ch_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 8570 | SND_PCI_QUIRK(0x147b, 0x1083, "Abit IP35-PRO", ALC883_6ST_DIG), |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 8571 | SND_PCI_QUIRK(0x1558, 0x0721, "Clevo laptop M720R", ALC883_CLEVO_M720), |
| 8572 | SND_PCI_QUIRK(0x1558, 0x0722, "Clevo laptop M720SR", ALC883_CLEVO_M720), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 8573 | SND_PCI_QUIRK_VENDOR(0x1558, "Clevo laptop", ALC883_LAPTOP_EAPD), |
Daniel T Chen | e60623b | 2007-05-29 03:41:55 -0400 | [diff] [blame] | 8574 | SND_PCI_QUIRK(0x15d9, 0x8780, "Supermicro PDSBA", ALC883_3ST_6ch), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 8575 | SND_PCI_QUIRK(0x161f, 0x2054, "Medion laptop", ALC883_MEDION), |
Takashi Iwai | f67d817 | 2009-02-04 23:30:19 +0100 | [diff] [blame] | 8576 | SND_PCI_QUIRK(0x1734, 0x1107, "FSC AMILO Xi2550", |
| 8577 | ALC883_FUJITSU_PI2515), |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 8578 | SND_PCI_QUIRK(0x1734, 0x1108, "Fujitsu AMILO Pi2515", ALC883_FUJITSU_PI2515), |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 8579 | SND_PCI_QUIRK(0x1734, 0x113d, "Fujitsu AMILO Xa3530", |
| 8580 | ALC888_FUJITSU_XA3530), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8581 | SND_PCI_QUIRK(0x17aa, 0x101e, "Lenovo 101e", ALC883_LENOVO_101E_2ch), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8582 | SND_PCI_QUIRK(0x17aa, 0x2085, "Lenovo NB0763", ALC883_LENOVO_NB0763), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 8583 | SND_PCI_QUIRK(0x17aa, 0x3bfc, "Lenovo NB0763", ALC883_LENOVO_NB0763), |
| 8584 | SND_PCI_QUIRK(0x17aa, 0x3bfd, "Lenovo NB0763", ALC883_LENOVO_NB0763), |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 8585 | SND_PCI_QUIRK(0x17aa, 0x101d, "Lenovo Sky", ALC888_LENOVO_SKY), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8586 | SND_PCI_QUIRK(0x17c0, 0x4071, "MEDION MD2", ALC883_MEDION_MD2), |
Takashi Iwai | 959973b | 2008-11-05 11:30:56 +0100 | [diff] [blame] | 8587 | SND_PCI_QUIRK(0x17c0, 0x4085, "MEDION MD96630", ALC888_LENOVO_MS7195_DIG), |
Andrew Paprocki | 0b167bf | 2008-02-03 10:15:44 +0100 | [diff] [blame] | 8588 | SND_PCI_QUIRK(0x17f2, 0x5000, "Albatron KI690-AM2", ALC883_6ST_DIG), |
Kailang Yang | 189609a | 2007-08-20 11:31:23 +0200 | [diff] [blame] | 8589 | SND_PCI_QUIRK(0x1991, 0x5625, "Haier W66", ALC883_HAIER_W66), |
Jiang zhe | 17bba1b | 2008-06-04 12:11:07 +0200 | [diff] [blame] | 8590 | SND_PCI_QUIRK(0x8086, 0x0001, "DG33BUC", ALC883_3ST_6ch_INTEL), |
| 8591 | SND_PCI_QUIRK(0x8086, 0x0002, "DG33FBC", ALC883_3ST_6ch_INTEL), |
Luke Yelavich | 2de686d | 2009-01-16 15:08:02 +1100 | [diff] [blame] | 8592 | SND_PCI_QUIRK(0x8086, 0x2503, "82801H", ALC883_MITAC), |
Wu Fengguang | 4b55899 | 2009-01-12 09:18:58 +0800 | [diff] [blame] | 8593 | SND_PCI_QUIRK(0x8086, 0x0022, "DX58SO", ALC883_3ST_6ch_INTEL), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 8594 | SND_PCI_QUIRK(0x8086, 0xd601, "D102GGC", ALC883_3ST_6ch), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8595 | {} |
| 8596 | }; |
| 8597 | |
Wu Fengguang | b25c9da | 2009-02-06 15:02:27 +0800 | [diff] [blame] | 8598 | static hda_nid_t alc1200_slave_dig_outs[] = { |
| 8599 | ALC883_DIGOUT_NID, 0, |
| 8600 | }; |
| 8601 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8602 | static struct alc_config_preset alc883_presets[] = { |
| 8603 | [ALC883_3ST_2ch_DIG] = { |
| 8604 | .mixers = { alc883_3ST_2ch_mixer }, |
| 8605 | .init_verbs = { alc883_init_verbs }, |
| 8606 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 8607 | .dac_nids = alc883_dac_nids, |
| 8608 | .dig_out_nid = ALC883_DIGOUT_NID, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8609 | .dig_in_nid = ALC883_DIGIN_NID, |
| 8610 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 8611 | .channel_mode = alc883_3ST_2ch_modes, |
| 8612 | .input_mux = &alc883_capture_source, |
| 8613 | }, |
| 8614 | [ALC883_3ST_6ch_DIG] = { |
| 8615 | .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer }, |
| 8616 | .init_verbs = { alc883_init_verbs }, |
| 8617 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 8618 | .dac_nids = alc883_dac_nids, |
| 8619 | .dig_out_nid = ALC883_DIGOUT_NID, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8620 | .dig_in_nid = ALC883_DIGIN_NID, |
| 8621 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes), |
| 8622 | .channel_mode = alc883_3ST_6ch_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 8623 | .need_dac_fix = 1, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8624 | .input_mux = &alc883_capture_source, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 8625 | }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8626 | [ALC883_3ST_6ch] = { |
| 8627 | .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer }, |
| 8628 | .init_verbs = { alc883_init_verbs }, |
| 8629 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 8630 | .dac_nids = alc883_dac_nids, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8631 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes), |
| 8632 | .channel_mode = alc883_3ST_6ch_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 8633 | .need_dac_fix = 1, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8634 | .input_mux = &alc883_capture_source, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 8635 | }, |
Jiang zhe | 17bba1b | 2008-06-04 12:11:07 +0200 | [diff] [blame] | 8636 | [ALC883_3ST_6ch_INTEL] = { |
| 8637 | .mixers = { alc883_3ST_6ch_intel_mixer, alc883_chmode_mixer }, |
| 8638 | .init_verbs = { alc883_init_verbs }, |
| 8639 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 8640 | .dac_nids = alc883_dac_nids, |
| 8641 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 8642 | .dig_in_nid = ALC883_DIGIN_NID, |
| 8643 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_intel_modes), |
| 8644 | .channel_mode = alc883_3ST_6ch_intel_modes, |
| 8645 | .need_dac_fix = 1, |
| 8646 | .input_mux = &alc883_3stack_6ch_intel, |
| 8647 | }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8648 | [ALC883_6ST_DIG] = { |
| 8649 | .mixers = { alc883_base_mixer, alc883_chmode_mixer }, |
| 8650 | .init_verbs = { alc883_init_verbs }, |
| 8651 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 8652 | .dac_nids = alc883_dac_nids, |
| 8653 | .dig_out_nid = ALC883_DIGOUT_NID, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8654 | .dig_in_nid = ALC883_DIGIN_NID, |
| 8655 | .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes), |
| 8656 | .channel_mode = alc883_sixstack_modes, |
| 8657 | .input_mux = &alc883_capture_source, |
| 8658 | }, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8659 | [ALC883_TARGA_DIG] = { |
| 8660 | .mixers = { alc883_tagra_mixer, alc883_chmode_mixer }, |
| 8661 | .init_verbs = { alc883_init_verbs, alc883_tagra_verbs}, |
| 8662 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 8663 | .dac_nids = alc883_dac_nids, |
| 8664 | .dig_out_nid = ALC883_DIGOUT_NID, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8665 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes), |
| 8666 | .channel_mode = alc883_3ST_6ch_modes, |
| 8667 | .need_dac_fix = 1, |
| 8668 | .input_mux = &alc883_capture_source, |
| 8669 | .unsol_event = alc883_tagra_unsol_event, |
| 8670 | .init_hook = alc883_tagra_automute, |
| 8671 | }, |
| 8672 | [ALC883_TARGA_2ch_DIG] = { |
| 8673 | .mixers = { alc883_tagra_2ch_mixer}, |
| 8674 | .init_verbs = { alc883_init_verbs, alc883_tagra_verbs}, |
| 8675 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 8676 | .dac_nids = alc883_dac_nids, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 8677 | .adc_nids = alc883_adc_nids_alt, |
| 8678 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_alt), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8679 | .dig_out_nid = ALC883_DIGOUT_NID, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8680 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 8681 | .channel_mode = alc883_3ST_2ch_modes, |
| 8682 | .input_mux = &alc883_capture_source, |
| 8683 | .unsol_event = alc883_tagra_unsol_event, |
| 8684 | .init_hook = alc883_tagra_automute, |
| 8685 | }, |
Vladimir Avdonin | bab282b9 | 2006-08-22 13:31:58 +0200 | [diff] [blame] | 8686 | [ALC883_ACER] = { |
Takashi Iwai | 676a9b5 | 2007-08-16 15:23:35 +0200 | [diff] [blame] | 8687 | .mixers = { alc883_base_mixer }, |
Vladimir Avdonin | bab282b9 | 2006-08-22 13:31:58 +0200 | [diff] [blame] | 8688 | /* On TravelMate laptops, GPIO 0 enables the internal speaker |
| 8689 | * and the headphone jack. Turn this on and rely on the |
| 8690 | * standard mute methods whenever the user wants to turn |
| 8691 | * these outputs off. |
| 8692 | */ |
| 8693 | .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs }, |
| 8694 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 8695 | .dac_nids = alc883_dac_nids, |
Vladimir Avdonin | bab282b9 | 2006-08-22 13:31:58 +0200 | [diff] [blame] | 8696 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 8697 | .channel_mode = alc883_3ST_2ch_modes, |
| 8698 | .input_mux = &alc883_capture_source, |
| 8699 | }, |
Tobin Davis | 2880a86 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 8700 | [ALC883_ACER_ASPIRE] = { |
Takashi Iwai | 676a9b5 | 2007-08-16 15:23:35 +0200 | [diff] [blame] | 8701 | .mixers = { alc883_acer_aspire_mixer }, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 8702 | .init_verbs = { alc883_init_verbs, alc883_acer_eapd_verbs }, |
Tobin Davis | 2880a86 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 8703 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 8704 | .dac_nids = alc883_dac_nids, |
| 8705 | .dig_out_nid = ALC883_DIGOUT_NID, |
Tobin Davis | 2880a86 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 8706 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 8707 | .channel_mode = alc883_3ST_2ch_modes, |
| 8708 | .input_mux = &alc883_capture_source, |
Takashi Iwai | 676a9b5 | 2007-08-16 15:23:35 +0200 | [diff] [blame] | 8709 | .unsol_event = alc883_acer_aspire_unsol_event, |
| 8710 | .init_hook = alc883_acer_aspire_automute, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 8711 | }, |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 8712 | [ALC888_ACER_ASPIRE_4930G] = { |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 8713 | .mixers = { alc888_base_mixer, |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 8714 | alc883_chmode_mixer }, |
| 8715 | .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs, |
| 8716 | alc888_acer_aspire_4930g_verbs }, |
| 8717 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 8718 | .dac_nids = alc883_dac_nids, |
| 8719 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev), |
| 8720 | .adc_nids = alc883_adc_nids_rev, |
| 8721 | .capsrc_nids = alc883_capsrc_nids_rev, |
| 8722 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 8723 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes), |
| 8724 | .channel_mode = alc883_3ST_6ch_modes, |
| 8725 | .need_dac_fix = 1, |
| 8726 | .num_mux_defs = |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 8727 | ARRAY_SIZE(alc888_2_capture_sources), |
| 8728 | .input_mux = alc888_2_capture_sources, |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 8729 | .unsol_event = alc888_acer_aspire_4930g_unsol_event, |
| 8730 | .init_hook = alc888_acer_aspire_4930g_automute, |
| 8731 | }, |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 8732 | [ALC883_MEDION] = { |
| 8733 | .mixers = { alc883_fivestack_mixer, |
| 8734 | alc883_chmode_mixer }, |
| 8735 | .init_verbs = { alc883_init_verbs, |
Andrew L. Neporada | b373bde | 2006-11-07 11:37:08 +0100 | [diff] [blame] | 8736 | alc883_medion_eapd_verbs }, |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 8737 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 8738 | .dac_nids = alc883_dac_nids, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 8739 | .adc_nids = alc883_adc_nids_alt, |
| 8740 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_alt), |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 8741 | .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes), |
| 8742 | .channel_mode = alc883_sixstack_modes, |
| 8743 | .input_mux = &alc883_capture_source, |
Andrew L. Neporada | b373bde | 2006-11-07 11:37:08 +0100 | [diff] [blame] | 8744 | }, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8745 | [ALC883_MEDION_MD2] = { |
| 8746 | .mixers = { alc883_medion_md2_mixer}, |
| 8747 | .init_verbs = { alc883_init_verbs, alc883_medion_md2_verbs}, |
| 8748 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 8749 | .dac_nids = alc883_dac_nids, |
| 8750 | .dig_out_nid = ALC883_DIGOUT_NID, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8751 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 8752 | .channel_mode = alc883_3ST_2ch_modes, |
| 8753 | .input_mux = &alc883_capture_source, |
| 8754 | .unsol_event = alc883_medion_md2_unsol_event, |
| 8755 | .init_hook = alc883_medion_md2_automute, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 8756 | }, |
Andrew L. Neporada | b373bde | 2006-11-07 11:37:08 +0100 | [diff] [blame] | 8757 | [ALC883_LAPTOP_EAPD] = { |
Takashi Iwai | 676a9b5 | 2007-08-16 15:23:35 +0200 | [diff] [blame] | 8758 | .mixers = { alc883_base_mixer }, |
Andrew L. Neporada | b373bde | 2006-11-07 11:37:08 +0100 | [diff] [blame] | 8759 | .init_verbs = { alc883_init_verbs, alc882_eapd_verbs }, |
| 8760 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 8761 | .dac_nids = alc883_dac_nids, |
Andrew L. Neporada | b373bde | 2006-11-07 11:37:08 +0100 | [diff] [blame] | 8762 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 8763 | .channel_mode = alc883_3ST_2ch_modes, |
| 8764 | .input_mux = &alc883_capture_source, |
| 8765 | }, |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 8766 | [ALC883_CLEVO_M720] = { |
| 8767 | .mixers = { alc883_clevo_m720_mixer }, |
| 8768 | .init_verbs = { alc883_init_verbs, alc883_clevo_m720_verbs }, |
Jiang zhe | 368c7a9 | 2008-03-04 11:20:33 +0100 | [diff] [blame] | 8769 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 8770 | .dac_nids = alc883_dac_nids, |
| 8771 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 8772 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 8773 | .channel_mode = alc883_3ST_2ch_modes, |
| 8774 | .input_mux = &alc883_capture_source, |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 8775 | .unsol_event = alc883_clevo_m720_unsol_event, |
| 8776 | .init_hook = alc883_clevo_m720_automute, |
Jiang zhe | 368c7a9 | 2008-03-04 11:20:33 +0100 | [diff] [blame] | 8777 | }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 8778 | [ALC883_LENOVO_101E_2ch] = { |
| 8779 | .mixers = { alc883_lenovo_101e_2ch_mixer}, |
| 8780 | .init_verbs = { alc883_init_verbs, alc883_lenovo_101e_verbs}, |
| 8781 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 8782 | .dac_nids = alc883_dac_nids, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 8783 | .adc_nids = alc883_adc_nids_alt, |
| 8784 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_alt), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 8785 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 8786 | .channel_mode = alc883_3ST_2ch_modes, |
| 8787 | .input_mux = &alc883_lenovo_101e_capture_source, |
| 8788 | .unsol_event = alc883_lenovo_101e_unsol_event, |
| 8789 | .init_hook = alc883_lenovo_101e_all_automute, |
| 8790 | }, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8791 | [ALC883_LENOVO_NB0763] = { |
| 8792 | .mixers = { alc883_lenovo_nb0763_mixer }, |
| 8793 | .init_verbs = { alc883_init_verbs, alc883_lenovo_nb0763_verbs}, |
| 8794 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 8795 | .dac_nids = alc883_dac_nids, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8796 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 8797 | .channel_mode = alc883_3ST_2ch_modes, |
| 8798 | .need_dac_fix = 1, |
| 8799 | .input_mux = &alc883_lenovo_nb0763_capture_source, |
| 8800 | .unsol_event = alc883_medion_md2_unsol_event, |
| 8801 | .init_hook = alc883_medion_md2_automute, |
| 8802 | }, |
| 8803 | [ALC888_LENOVO_MS7195_DIG] = { |
| 8804 | .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer }, |
| 8805 | .init_verbs = { alc883_init_verbs, alc888_lenovo_ms7195_verbs}, |
| 8806 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 8807 | .dac_nids = alc883_dac_nids, |
| 8808 | .dig_out_nid = ALC883_DIGOUT_NID, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8809 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes), |
| 8810 | .channel_mode = alc883_3ST_6ch_modes, |
| 8811 | .need_dac_fix = 1, |
| 8812 | .input_mux = &alc883_capture_source, |
| 8813 | .unsol_event = alc883_lenovo_ms7195_unsol_event, |
| 8814 | .init_hook = alc888_lenovo_ms7195_front_automute, |
Kailang Yang | 189609a | 2007-08-20 11:31:23 +0200 | [diff] [blame] | 8815 | }, |
| 8816 | [ALC883_HAIER_W66] = { |
| 8817 | .mixers = { alc883_tagra_2ch_mixer}, |
| 8818 | .init_verbs = { alc883_init_verbs, alc883_haier_w66_verbs}, |
| 8819 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 8820 | .dac_nids = alc883_dac_nids, |
| 8821 | .dig_out_nid = ALC883_DIGOUT_NID, |
Kailang Yang | 189609a | 2007-08-20 11:31:23 +0200 | [diff] [blame] | 8822 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 8823 | .channel_mode = alc883_3ST_2ch_modes, |
| 8824 | .input_mux = &alc883_capture_source, |
| 8825 | .unsol_event = alc883_haier_w66_unsol_event, |
| 8826 | .init_hook = alc883_haier_w66_automute, |
Herton Ronaldo Krzesinski | eea6419 | 2008-03-20 12:14:59 +0100 | [diff] [blame] | 8827 | }, |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 8828 | [ALC888_3ST_HP] = { |
Herton Ronaldo Krzesinski | eea6419 | 2008-03-20 12:14:59 +0100 | [diff] [blame] | 8829 | .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer }, |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 8830 | .init_verbs = { alc883_init_verbs, alc888_3st_hp_verbs }, |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 8831 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 8832 | .dac_nids = alc883_dac_nids, |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 8833 | .num_channel_mode = ARRAY_SIZE(alc888_3st_hp_modes), |
| 8834 | .channel_mode = alc888_3st_hp_modes, |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 8835 | .need_dac_fix = 1, |
| 8836 | .input_mux = &alc883_capture_source, |
| 8837 | }, |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 8838 | [ALC888_6ST_DELL] = { |
Herton Ronaldo Krzesinski | f24dbdc | 2008-03-20 12:14:28 +0100 | [diff] [blame] | 8839 | .mixers = { alc883_base_mixer, alc883_chmode_mixer }, |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 8840 | .init_verbs = { alc883_init_verbs, alc888_6st_dell_verbs }, |
| 8841 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 8842 | .dac_nids = alc883_dac_nids, |
| 8843 | .dig_out_nid = ALC883_DIGOUT_NID, |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 8844 | .dig_in_nid = ALC883_DIGIN_NID, |
| 8845 | .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes), |
| 8846 | .channel_mode = alc883_sixstack_modes, |
| 8847 | .input_mux = &alc883_capture_source, |
| 8848 | .unsol_event = alc888_6st_dell_unsol_event, |
| 8849 | .init_hook = alc888_6st_dell_front_automute, |
| 8850 | }, |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 8851 | [ALC883_MITAC] = { |
| 8852 | .mixers = { alc883_mitac_mixer }, |
| 8853 | .init_verbs = { alc883_init_verbs, alc883_mitac_verbs }, |
| 8854 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 8855 | .dac_nids = alc883_dac_nids, |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 8856 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 8857 | .channel_mode = alc883_3ST_2ch_modes, |
| 8858 | .input_mux = &alc883_capture_source, |
| 8859 | .unsol_event = alc883_mitac_unsol_event, |
| 8860 | .init_hook = alc883_mitac_automute, |
| 8861 | }, |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 8862 | [ALC883_FUJITSU_PI2515] = { |
| 8863 | .mixers = { alc883_2ch_fujitsu_pi2515_mixer }, |
| 8864 | .init_verbs = { alc883_init_verbs, |
| 8865 | alc883_2ch_fujitsu_pi2515_verbs}, |
| 8866 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 8867 | .dac_nids = alc883_dac_nids, |
| 8868 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 8869 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 8870 | .channel_mode = alc883_3ST_2ch_modes, |
| 8871 | .input_mux = &alc883_fujitsu_pi2515_capture_source, |
| 8872 | .unsol_event = alc883_2ch_fujitsu_pi2515_unsol_event, |
| 8873 | .init_hook = alc883_2ch_fujitsu_pi2515_automute, |
| 8874 | }, |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 8875 | [ALC888_FUJITSU_XA3530] = { |
| 8876 | .mixers = { alc888_base_mixer, alc883_chmode_mixer }, |
| 8877 | .init_verbs = { alc883_init_verbs, |
| 8878 | alc888_fujitsu_xa3530_verbs }, |
| 8879 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 8880 | .dac_nids = alc883_dac_nids, |
| 8881 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev), |
| 8882 | .adc_nids = alc883_adc_nids_rev, |
| 8883 | .capsrc_nids = alc883_capsrc_nids_rev, |
| 8884 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 8885 | .num_channel_mode = ARRAY_SIZE(alc888_4ST_8ch_intel_modes), |
| 8886 | .channel_mode = alc888_4ST_8ch_intel_modes, |
| 8887 | .num_mux_defs = |
| 8888 | ARRAY_SIZE(alc888_2_capture_sources), |
| 8889 | .input_mux = alc888_2_capture_sources, |
| 8890 | .unsol_event = alc888_fujitsu_xa3530_unsol_event, |
| 8891 | .init_hook = alc888_fujitsu_xa3530_automute, |
| 8892 | }, |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 8893 | [ALC888_LENOVO_SKY] = { |
| 8894 | .mixers = { alc888_lenovo_sky_mixer, alc883_chmode_mixer }, |
| 8895 | .init_verbs = { alc883_init_verbs, alc888_lenovo_sky_verbs}, |
| 8896 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 8897 | .dac_nids = alc883_dac_nids, |
| 8898 | .dig_out_nid = ALC883_DIGOUT_NID, |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 8899 | .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes), |
| 8900 | .channel_mode = alc883_sixstack_modes, |
| 8901 | .need_dac_fix = 1, |
| 8902 | .input_mux = &alc883_lenovo_sky_capture_source, |
| 8903 | .unsol_event = alc883_lenovo_sky_unsol_event, |
| 8904 | .init_hook = alc888_lenovo_sky_front_automute, |
| 8905 | }, |
| 8906 | [ALC888_ASUS_M90V] = { |
| 8907 | .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer }, |
| 8908 | .init_verbs = { alc883_init_verbs, alc888_asus_m90v_verbs }, |
| 8909 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 8910 | .dac_nids = alc883_dac_nids, |
| 8911 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 8912 | .dig_in_nid = ALC883_DIGIN_NID, |
| 8913 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes), |
| 8914 | .channel_mode = alc883_3ST_6ch_modes, |
| 8915 | .need_dac_fix = 1, |
| 8916 | .input_mux = &alc883_fujitsu_pi2515_capture_source, |
| 8917 | .unsol_event = alc883_mode2_unsol_event, |
| 8918 | .init_hook = alc883_mode2_inithook, |
| 8919 | }, |
| 8920 | [ALC888_ASUS_EEE1601] = { |
| 8921 | .mixers = { alc883_asus_eee1601_mixer }, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 8922 | .cap_mixer = alc883_asus_eee1601_cap_mixer, |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 8923 | .init_verbs = { alc883_init_verbs, alc888_asus_eee1601_verbs }, |
| 8924 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 8925 | .dac_nids = alc883_dac_nids, |
| 8926 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 8927 | .dig_in_nid = ALC883_DIGIN_NID, |
| 8928 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 8929 | .channel_mode = alc883_3ST_2ch_modes, |
| 8930 | .need_dac_fix = 1, |
| 8931 | .input_mux = &alc883_asus_eee1601_capture_source, |
| 8932 | .unsol_event = alc883_eee1601_unsol_event, |
| 8933 | .init_hook = alc883_eee1601_inithook, |
| 8934 | }, |
Wu Fengguang | 3ab9093 | 2008-11-17 09:51:09 +0100 | [diff] [blame] | 8935 | [ALC1200_ASUS_P5Q] = { |
| 8936 | .mixers = { alc883_base_mixer, alc883_chmode_mixer }, |
| 8937 | .init_verbs = { alc883_init_verbs }, |
| 8938 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 8939 | .dac_nids = alc883_dac_nids, |
| 8940 | .dig_out_nid = ALC1200_DIGOUT_NID, |
| 8941 | .dig_in_nid = ALC883_DIGIN_NID, |
Wu Fengguang | b25c9da | 2009-02-06 15:02:27 +0800 | [diff] [blame] | 8942 | .slave_dig_outs = alc1200_slave_dig_outs, |
Wu Fengguang | 3ab9093 | 2008-11-17 09:51:09 +0100 | [diff] [blame] | 8943 | .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes), |
| 8944 | .channel_mode = alc883_sixstack_modes, |
| 8945 | .input_mux = &alc883_capture_source, |
| 8946 | }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8947 | }; |
| 8948 | |
| 8949 | |
| 8950 | /* |
| 8951 | * BIOS auto configuration |
| 8952 | */ |
| 8953 | static void alc883_auto_set_output_and_unmute(struct hda_codec *codec, |
| 8954 | hda_nid_t nid, int pin_type, |
| 8955 | int dac_idx) |
| 8956 | { |
| 8957 | /* set as output */ |
| 8958 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 8959 | int idx; |
| 8960 | |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 8961 | alc_set_pin_output(codec, nid, pin_type); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8962 | if (spec->multiout.dac_nids[dac_idx] == 0x25) |
| 8963 | idx = 4; |
| 8964 | else |
| 8965 | idx = spec->multiout.dac_nids[dac_idx] - 2; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8966 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_CONNECT_SEL, idx); |
| 8967 | |
| 8968 | } |
| 8969 | |
| 8970 | static void alc883_auto_init_multi_out(struct hda_codec *codec) |
| 8971 | { |
| 8972 | struct alc_spec *spec = codec->spec; |
| 8973 | int i; |
| 8974 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 8975 | alc_subsystem_id(codec, 0x15, 0x1b, 0x14); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8976 | for (i = 0; i <= HDA_SIDE; i++) { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 8977 | hda_nid_t nid = spec->autocfg.line_out_pins[i]; |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 8978 | int pin_type = get_pin_type(spec->autocfg.line_out_type); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8979 | if (nid) |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 8980 | alc883_auto_set_output_and_unmute(codec, nid, pin_type, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 8981 | i); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8982 | } |
| 8983 | } |
| 8984 | |
| 8985 | static void alc883_auto_init_hp_out(struct hda_codec *codec) |
| 8986 | { |
| 8987 | struct alc_spec *spec = codec->spec; |
| 8988 | hda_nid_t pin; |
| 8989 | |
Takashi Iwai | eb06ed8 | 2006-09-20 17:10:27 +0200 | [diff] [blame] | 8990 | pin = spec->autocfg.hp_pins[0]; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8991 | if (pin) /* connect to front */ |
| 8992 | /* use dac 0 */ |
| 8993 | alc883_auto_set_output_and_unmute(codec, pin, PIN_HP, 0); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 8994 | pin = spec->autocfg.speaker_pins[0]; |
| 8995 | if (pin) |
| 8996 | alc883_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8997 | } |
| 8998 | |
| 8999 | #define alc883_is_input_pin(nid) alc880_is_input_pin(nid) |
| 9000 | #define ALC883_PIN_CD_NID ALC880_PIN_CD_NID |
| 9001 | |
| 9002 | static void alc883_auto_init_analog_input(struct hda_codec *codec) |
| 9003 | { |
| 9004 | struct alc_spec *spec = codec->spec; |
| 9005 | int i; |
| 9006 | |
| 9007 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
| 9008 | hda_nid_t nid = spec->autocfg.input_pins[i]; |
| 9009 | if (alc883_is_input_pin(nid)) { |
| 9010 | snd_hda_codec_write(codec, nid, 0, |
| 9011 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 9012 | (i <= AUTO_PIN_FRONT_MIC ? |
| 9013 | PIN_VREF80 : PIN_IN)); |
| 9014 | if (nid != ALC883_PIN_CD_NID) |
| 9015 | snd_hda_codec_write(codec, nid, 0, |
| 9016 | AC_VERB_SET_AMP_GAIN_MUTE, |
| 9017 | AMP_OUT_MUTE); |
| 9018 | } |
| 9019 | } |
| 9020 | } |
| 9021 | |
Takashi Iwai | f511b01 | 2008-08-15 16:46:42 +0200 | [diff] [blame] | 9022 | #define alc883_auto_init_input_src alc882_auto_init_input_src |
| 9023 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9024 | /* almost identical with ALC880 parser... */ |
| 9025 | static int alc883_parse_auto_config(struct hda_codec *codec) |
| 9026 | { |
| 9027 | struct alc_spec *spec = codec->spec; |
| 9028 | int err = alc880_parse_auto_config(codec); |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 9029 | struct auto_pin_cfg *cfg = &spec->autocfg; |
| 9030 | int i; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9031 | |
| 9032 | if (err < 0) |
| 9033 | return err; |
Takashi Iwai | 776e184 | 2007-08-29 15:07:11 +0200 | [diff] [blame] | 9034 | else if (!err) |
| 9035 | return 0; /* no config found */ |
| 9036 | |
| 9037 | err = alc_auto_add_mic_boost(codec); |
| 9038 | if (err < 0) |
| 9039 | return err; |
| 9040 | |
| 9041 | /* hack - override the init verbs */ |
| 9042 | spec->init_verbs[0] = alc883_auto_init_verbs; |
Takashi Iwai | 776e184 | 2007-08-29 15:07:11 +0200 | [diff] [blame] | 9043 | |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 9044 | /* setup input_mux for ALC889 */ |
| 9045 | if (codec->vendor_id == 0x10ec0889) { |
| 9046 | /* digital-mic input pin is excluded in alc880_auto_create..() |
| 9047 | * because it's under 0x18 |
| 9048 | */ |
| 9049 | if (cfg->input_pins[AUTO_PIN_MIC] == 0x12 || |
| 9050 | cfg->input_pins[AUTO_PIN_FRONT_MIC] == 0x12) { |
| 9051 | struct hda_input_mux *imux = &spec->private_imux[0]; |
| 9052 | for (i = 1; i < 3; i++) |
| 9053 | memcpy(&spec->private_imux[i], |
| 9054 | &spec->private_imux[0], |
| 9055 | sizeof(spec->private_imux[0])); |
| 9056 | imux->items[imux->num_items].label = "Int DMic"; |
| 9057 | imux->items[imux->num_items].index = 0x0b; |
| 9058 | imux->num_items++; |
| 9059 | spec->num_mux_defs = 3; |
| 9060 | spec->input_mux = spec->private_imux; |
| 9061 | } |
| 9062 | } |
| 9063 | |
Takashi Iwai | 776e184 | 2007-08-29 15:07:11 +0200 | [diff] [blame] | 9064 | return 1; /* config found */ |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9065 | } |
| 9066 | |
| 9067 | /* additional initialization for auto-configuration model */ |
| 9068 | static void alc883_auto_init(struct hda_codec *codec) |
| 9069 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 9070 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9071 | alc883_auto_init_multi_out(codec); |
| 9072 | alc883_auto_init_hp_out(codec); |
| 9073 | alc883_auto_init_analog_input(codec); |
Takashi Iwai | f511b01 | 2008-08-15 16:46:42 +0200 | [diff] [blame] | 9074 | alc883_auto_init_input_src(codec); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 9075 | if (spec->unsol_event) |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 9076 | alc_inithook(codec); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9077 | } |
| 9078 | |
| 9079 | static int patch_alc883(struct hda_codec *codec) |
| 9080 | { |
| 9081 | struct alc_spec *spec; |
| 9082 | int err, board_config; |
| 9083 | |
| 9084 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
| 9085 | if (spec == NULL) |
| 9086 | return -ENOMEM; |
| 9087 | |
| 9088 | codec->spec = spec; |
| 9089 | |
Takashi Iwai | 2c3bf9a | 2008-06-04 12:39:38 +0200 | [diff] [blame] | 9090 | alc_fix_pll_init(codec, 0x20, 0x0a, 10); |
| 9091 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 9092 | board_config = snd_hda_check_board_config(codec, ALC883_MODEL_LAST, |
| 9093 | alc883_models, |
| 9094 | alc883_cfg_tbl); |
| 9095 | if (board_config < 0) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9096 | printk(KERN_INFO "hda_codec: Unknown model for ALC883, " |
| 9097 | "trying auto-probe from BIOS...\n"); |
| 9098 | board_config = ALC883_AUTO; |
| 9099 | } |
| 9100 | |
| 9101 | if (board_config == ALC883_AUTO) { |
| 9102 | /* automatic parse from the BIOS config */ |
| 9103 | err = alc883_parse_auto_config(codec); |
| 9104 | if (err < 0) { |
| 9105 | alc_free(codec); |
| 9106 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9107 | } else if (!err) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9108 | printk(KERN_INFO |
| 9109 | "hda_codec: Cannot set up configuration " |
| 9110 | "from BIOS. Using base mode...\n"); |
| 9111 | board_config = ALC883_3ST_2ch_DIG; |
| 9112 | } |
| 9113 | } |
| 9114 | |
Kusanagi Kouichi | 680cd53 | 2009-02-05 00:00:58 +0900 | [diff] [blame] | 9115 | err = snd_hda_attach_beep_device(codec, 0x1); |
| 9116 | if (err < 0) { |
| 9117 | alc_free(codec); |
| 9118 | return err; |
| 9119 | } |
| 9120 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9121 | if (board_config != ALC883_AUTO) |
| 9122 | setup_preset(spec, &alc883_presets[board_config]); |
| 9123 | |
Kailang Yang | 2f89328 | 2008-05-27 12:14:47 +0200 | [diff] [blame] | 9124 | switch (codec->vendor_id) { |
| 9125 | case 0x10ec0888: |
Kailang Yang | 4442608 | 2008-10-15 11:18:05 +0200 | [diff] [blame] | 9126 | if (codec->revision_id == 0x100101) { |
| 9127 | spec->stream_name_analog = "ALC1200 Analog"; |
| 9128 | spec->stream_name_digital = "ALC1200 Digital"; |
| 9129 | } else { |
| 9130 | spec->stream_name_analog = "ALC888 Analog"; |
| 9131 | spec->stream_name_digital = "ALC888 Digital"; |
| 9132 | } |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 9133 | if (!spec->num_adc_nids) { |
| 9134 | spec->num_adc_nids = ARRAY_SIZE(alc883_adc_nids); |
| 9135 | spec->adc_nids = alc883_adc_nids; |
| 9136 | } |
| 9137 | if (!spec->capsrc_nids) |
| 9138 | spec->capsrc_nids = alc883_capsrc_nids; |
| 9139 | spec->capture_style = CAPT_MIX; /* matrix-style capture */ |
Kailang Yang | 2f89328 | 2008-05-27 12:14:47 +0200 | [diff] [blame] | 9140 | break; |
| 9141 | case 0x10ec0889: |
| 9142 | spec->stream_name_analog = "ALC889 Analog"; |
| 9143 | spec->stream_name_digital = "ALC889 Digital"; |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 9144 | if (!spec->num_adc_nids) { |
| 9145 | spec->num_adc_nids = ARRAY_SIZE(alc889_adc_nids); |
| 9146 | spec->adc_nids = alc889_adc_nids; |
| 9147 | } |
| 9148 | if (!spec->capsrc_nids) |
| 9149 | spec->capsrc_nids = alc889_capsrc_nids; |
| 9150 | spec->capture_style = CAPT_1MUX_MIX; /* 1mux/Nmix-style |
| 9151 | capture */ |
Kailang Yang | 2f89328 | 2008-05-27 12:14:47 +0200 | [diff] [blame] | 9152 | break; |
| 9153 | default: |
| 9154 | spec->stream_name_analog = "ALC883 Analog"; |
| 9155 | spec->stream_name_digital = "ALC883 Digital"; |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 9156 | if (!spec->num_adc_nids) { |
| 9157 | spec->num_adc_nids = ARRAY_SIZE(alc883_adc_nids); |
| 9158 | spec->adc_nids = alc883_adc_nids; |
| 9159 | } |
| 9160 | if (!spec->capsrc_nids) |
| 9161 | spec->capsrc_nids = alc883_capsrc_nids; |
| 9162 | spec->capture_style = CAPT_MIX; /* matrix-style capture */ |
Kailang Yang | 2f89328 | 2008-05-27 12:14:47 +0200 | [diff] [blame] | 9163 | break; |
| 9164 | } |
| 9165 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9166 | spec->stream_analog_playback = &alc883_pcm_analog_playback; |
| 9167 | spec->stream_analog_capture = &alc883_pcm_analog_capture; |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 9168 | spec->stream_analog_alt_capture = &alc883_pcm_analog_alt_capture; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9169 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9170 | spec->stream_digital_playback = &alc883_pcm_digital_playback; |
| 9171 | spec->stream_digital_capture = &alc883_pcm_digital_capture; |
| 9172 | |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 9173 | if (!spec->cap_mixer) |
| 9174 | set_capture_mixer(spec); |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 9175 | set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9176 | |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 9177 | spec->vmaster_nid = 0x0c; |
| 9178 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9179 | codec->patch_ops = alc_patch_ops; |
| 9180 | if (board_config == ALC883_AUTO) |
| 9181 | spec->init_hook = alc883_auto_init; |
Kailang Yang | f9423e7 | 2008-05-27 12:32:25 +0200 | [diff] [blame] | 9182 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 9183 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 9184 | if (!spec->loopback.amplist) |
| 9185 | spec->loopback.amplist = alc883_loopbacks; |
| 9186 | #endif |
Takashi Iwai | daead53 | 2008-11-28 12:55:36 +0100 | [diff] [blame] | 9187 | codec->proc_widget_hook = print_realtek_coef; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9188 | |
| 9189 | return 0; |
| 9190 | } |
| 9191 | |
| 9192 | /* |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9193 | * ALC262 support |
| 9194 | */ |
| 9195 | |
| 9196 | #define ALC262_DIGOUT_NID ALC880_DIGOUT_NID |
| 9197 | #define ALC262_DIGIN_NID ALC880_DIGIN_NID |
| 9198 | |
| 9199 | #define alc262_dac_nids alc260_dac_nids |
| 9200 | #define alc262_adc_nids alc882_adc_nids |
| 9201 | #define alc262_adc_nids_alt alc882_adc_nids_alt |
Takashi Iwai | 88c71a9 | 2008-02-14 17:27:17 +0100 | [diff] [blame] | 9202 | #define alc262_capsrc_nids alc882_capsrc_nids |
| 9203 | #define alc262_capsrc_nids_alt alc882_capsrc_nids_alt |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9204 | |
| 9205 | #define alc262_modes alc260_modes |
Takashi Iwai | c5f2ea0 | 2005-12-06 18:54:31 +0100 | [diff] [blame] | 9206 | #define alc262_capture_source alc882_capture_source |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9207 | |
Kailang Yang | 4e555fe | 2008-08-26 13:05:55 +0200 | [diff] [blame] | 9208 | static hda_nid_t alc262_dmic_adc_nids[1] = { |
| 9209 | /* ADC0 */ |
| 9210 | 0x09 |
| 9211 | }; |
| 9212 | |
| 9213 | static hda_nid_t alc262_dmic_capsrc_nids[1] = { 0x22 }; |
| 9214 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9215 | static struct snd_kcontrol_new alc262_base_mixer[] = { |
| 9216 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 9217 | HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 9218 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 9219 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 9220 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 9221 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 9222 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 9223 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Takashi Iwai | cc69d12 | 2007-02-15 19:29:26 +0100 | [diff] [blame] | 9224 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9225 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 9226 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
Takashi Iwai | cc69d12 | 2007-02-15 19:29:26 +0100 | [diff] [blame] | 9227 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9228 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0D, 0x0, HDA_OUTPUT), |
| 9229 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 9230 | HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 9231 | HDA_CODEC_MUTE_MONO("Mono Playback Switch", 0x16, 2, 0x0, HDA_OUTPUT), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9232 | { } /* end */ |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 9233 | }; |
| 9234 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 9235 | static struct snd_kcontrol_new alc262_hippo1_mixer[] = { |
| 9236 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 9237 | HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 9238 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 9239 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 9240 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 9241 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 9242 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 9243 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Takashi Iwai | cc69d12 | 2007-02-15 19:29:26 +0100 | [diff] [blame] | 9244 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 9245 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 9246 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
Takashi Iwai | cc69d12 | 2007-02-15 19:29:26 +0100 | [diff] [blame] | 9247 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 9248 | /*HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0D, 0x0, HDA_OUTPUT),*/ |
| 9249 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 9250 | { } /* end */ |
| 9251 | }; |
| 9252 | |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 9253 | /* update HP, line and mono-out pins according to the master switch */ |
| 9254 | static void alc262_hp_master_update(struct hda_codec *codec) |
| 9255 | { |
| 9256 | struct alc_spec *spec = codec->spec; |
| 9257 | int val = spec->master_sw; |
| 9258 | |
| 9259 | /* HP & line-out */ |
| 9260 | snd_hda_codec_write_cache(codec, 0x1b, 0, |
| 9261 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 9262 | val ? PIN_HP : 0); |
| 9263 | snd_hda_codec_write_cache(codec, 0x15, 0, |
| 9264 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 9265 | val ? PIN_HP : 0); |
| 9266 | /* mono (speaker) depending on the HP jack sense */ |
| 9267 | val = val && !spec->jack_present; |
| 9268 | snd_hda_codec_write_cache(codec, 0x16, 0, |
| 9269 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 9270 | val ? PIN_OUT : 0); |
| 9271 | } |
| 9272 | |
| 9273 | static void alc262_hp_bpc_automute(struct hda_codec *codec) |
| 9274 | { |
| 9275 | struct alc_spec *spec = codec->spec; |
| 9276 | unsigned int presence; |
| 9277 | presence = snd_hda_codec_read(codec, 0x1b, 0, |
| 9278 | AC_VERB_GET_PIN_SENSE, 0); |
| 9279 | spec->jack_present = !!(presence & AC_PINSENSE_PRESENCE); |
| 9280 | alc262_hp_master_update(codec); |
| 9281 | } |
| 9282 | |
| 9283 | static void alc262_hp_bpc_unsol_event(struct hda_codec *codec, unsigned int res) |
| 9284 | { |
| 9285 | if ((res >> 26) != ALC880_HP_EVENT) |
| 9286 | return; |
| 9287 | alc262_hp_bpc_automute(codec); |
| 9288 | } |
| 9289 | |
| 9290 | static void alc262_hp_wildwest_automute(struct hda_codec *codec) |
| 9291 | { |
| 9292 | struct alc_spec *spec = codec->spec; |
| 9293 | unsigned int presence; |
| 9294 | presence = snd_hda_codec_read(codec, 0x15, 0, |
| 9295 | AC_VERB_GET_PIN_SENSE, 0); |
| 9296 | spec->jack_present = !!(presence & AC_PINSENSE_PRESENCE); |
| 9297 | alc262_hp_master_update(codec); |
| 9298 | } |
| 9299 | |
| 9300 | static void alc262_hp_wildwest_unsol_event(struct hda_codec *codec, |
| 9301 | unsigned int res) |
| 9302 | { |
| 9303 | if ((res >> 26) != ALC880_HP_EVENT) |
| 9304 | return; |
| 9305 | alc262_hp_wildwest_automute(codec); |
| 9306 | } |
| 9307 | |
| 9308 | static int alc262_hp_master_sw_get(struct snd_kcontrol *kcontrol, |
| 9309 | struct snd_ctl_elem_value *ucontrol) |
| 9310 | { |
| 9311 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 9312 | struct alc_spec *spec = codec->spec; |
| 9313 | *ucontrol->value.integer.value = spec->master_sw; |
| 9314 | return 0; |
| 9315 | } |
| 9316 | |
| 9317 | static int alc262_hp_master_sw_put(struct snd_kcontrol *kcontrol, |
| 9318 | struct snd_ctl_elem_value *ucontrol) |
| 9319 | { |
| 9320 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 9321 | struct alc_spec *spec = codec->spec; |
| 9322 | int val = !!*ucontrol->value.integer.value; |
| 9323 | |
| 9324 | if (val == spec->master_sw) |
| 9325 | return 0; |
| 9326 | spec->master_sw = val; |
| 9327 | alc262_hp_master_update(codec); |
| 9328 | return 1; |
| 9329 | } |
| 9330 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9331 | static struct snd_kcontrol_new alc262_HP_BPC_mixer[] = { |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 9332 | { |
| 9333 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 9334 | .name = "Master Playback Switch", |
| 9335 | .info = snd_ctl_boolean_mono_info, |
| 9336 | .get = alc262_hp_master_sw_get, |
| 9337 | .put = alc262_hp_master_sw_put, |
| 9338 | }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9339 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 9340 | HDA_CODEC_MUTE("Front Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 9341 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 9342 | HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0e, 2, 0x0, |
| 9343 | HDA_OUTPUT), |
| 9344 | HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x16, 2, 0x0, |
| 9345 | HDA_OUTPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9346 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 9347 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Takashi Iwai | cc69d12 | 2007-02-15 19:29:26 +0100 | [diff] [blame] | 9348 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9349 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 9350 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
Takashi Iwai | cc69d12 | 2007-02-15 19:29:26 +0100 | [diff] [blame] | 9351 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9352 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 9353 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 9354 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 9355 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9356 | HDA_CODEC_VOLUME("AUX IN Playback Volume", 0x0b, 0x06, HDA_INPUT), |
| 9357 | HDA_CODEC_MUTE("AUX IN Playback Switch", 0x0b, 0x06, HDA_INPUT), |
| 9358 | { } /* end */ |
| 9359 | }; |
| 9360 | |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 9361 | static struct snd_kcontrol_new alc262_HP_BPC_WildWest_mixer[] = { |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 9362 | { |
| 9363 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 9364 | .name = "Master Playback Switch", |
| 9365 | .info = snd_ctl_boolean_mono_info, |
| 9366 | .get = alc262_hp_master_sw_get, |
| 9367 | .put = alc262_hp_master_sw_put, |
| 9368 | }, |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 9369 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 9370 | HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 9371 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 9372 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 9373 | HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0e, 2, 0x0, |
| 9374 | HDA_OUTPUT), |
| 9375 | HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x16, 2, 0x0, |
| 9376 | HDA_OUTPUT), |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 9377 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 9378 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x02, HDA_INPUT), |
Takashi Iwai | cc69d12 | 2007-02-15 19:29:26 +0100 | [diff] [blame] | 9379 | HDA_CODEC_VOLUME("Front Mic Boost", 0x1a, 0, HDA_INPUT), |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 9380 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 9381 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 9382 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 9383 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 9384 | { } /* end */ |
| 9385 | }; |
| 9386 | |
| 9387 | static struct snd_kcontrol_new alc262_HP_BPC_WildWest_option_mixer[] = { |
| 9388 | HDA_CODEC_VOLUME("Rear Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 9389 | HDA_CODEC_MUTE("Rear Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Takashi Iwai | cc69d12 | 2007-02-15 19:29:26 +0100 | [diff] [blame] | 9390 | HDA_CODEC_VOLUME("Rear Mic Boost", 0x18, 0, HDA_INPUT), |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 9391 | { } /* end */ |
| 9392 | }; |
| 9393 | |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 9394 | /* mute/unmute internal speaker according to the hp jack and mute state */ |
| 9395 | static void alc262_hp_t5735_automute(struct hda_codec *codec, int force) |
| 9396 | { |
| 9397 | struct alc_spec *spec = codec->spec; |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 9398 | |
| 9399 | if (force || !spec->sense_updated) { |
| 9400 | unsigned int present; |
| 9401 | present = snd_hda_codec_read(codec, 0x15, 0, |
| 9402 | AC_VERB_GET_PIN_SENSE, 0); |
Takashi Iwai | 4bb2613 | 2008-01-28 18:12:42 +0100 | [diff] [blame] | 9403 | spec->jack_present = (present & AC_PINSENSE_PRESENCE) != 0; |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 9404 | spec->sense_updated = 1; |
| 9405 | } |
Takashi Iwai | 4bb2613 | 2008-01-28 18:12:42 +0100 | [diff] [blame] | 9406 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_OUTPUT, 0, HDA_AMP_MUTE, |
| 9407 | spec->jack_present ? HDA_AMP_MUTE : 0); |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 9408 | } |
| 9409 | |
| 9410 | static void alc262_hp_t5735_unsol_event(struct hda_codec *codec, |
| 9411 | unsigned int res) |
| 9412 | { |
| 9413 | if ((res >> 26) != ALC880_HP_EVENT) |
| 9414 | return; |
| 9415 | alc262_hp_t5735_automute(codec, 1); |
| 9416 | } |
| 9417 | |
| 9418 | static void alc262_hp_t5735_init_hook(struct hda_codec *codec) |
| 9419 | { |
| 9420 | alc262_hp_t5735_automute(codec, 1); |
| 9421 | } |
| 9422 | |
| 9423 | static struct snd_kcontrol_new alc262_hp_t5735_mixer[] = { |
Takashi Iwai | 86cd929 | 2008-01-28 18:09:56 +0100 | [diff] [blame] | 9424 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 9425 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 9426 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 9427 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 9428 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 9429 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 9430 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 9431 | { } /* end */ |
| 9432 | }; |
| 9433 | |
| 9434 | static struct hda_verb alc262_hp_t5735_verbs[] = { |
| 9435 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 9436 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 9437 | |
| 9438 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 9439 | { } |
| 9440 | }; |
| 9441 | |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 9442 | static struct snd_kcontrol_new alc262_hp_rp5700_mixer[] = { |
Takashi Iwai | f2f48e1 | 2008-01-28 18:14:43 +0100 | [diff] [blame] | 9443 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 9444 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
Takashi Iwai | 86cd929 | 2008-01-28 18:09:56 +0100 | [diff] [blame] | 9445 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0e, 0x0, HDA_OUTPUT), |
| 9446 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x16, 0x0, HDA_OUTPUT), |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 9447 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 9448 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 9449 | { } /* end */ |
| 9450 | }; |
| 9451 | |
| 9452 | static struct hda_verb alc262_hp_rp5700_verbs[] = { |
| 9453 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 9454 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 9455 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 9456 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 9457 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 9458 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 9459 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 9460 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 9461 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x00 << 8))}, |
| 9462 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x00 << 8))}, |
| 9463 | {} |
| 9464 | }; |
| 9465 | |
| 9466 | static struct hda_input_mux alc262_hp_rp5700_capture_source = { |
| 9467 | .num_items = 1, |
| 9468 | .items = { |
| 9469 | { "Line", 0x1 }, |
| 9470 | }, |
| 9471 | }; |
| 9472 | |
Takashi Iwai | 0724ea2 | 2007-08-23 00:31:43 +0200 | [diff] [blame] | 9473 | /* bind hp and internal speaker mute (with plug check) */ |
| 9474 | static int alc262_sony_master_sw_put(struct snd_kcontrol *kcontrol, |
| 9475 | struct snd_ctl_elem_value *ucontrol) |
| 9476 | { |
| 9477 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 9478 | long *valp = ucontrol->value.integer.value; |
| 9479 | int change; |
| 9480 | |
| 9481 | /* change hp mute */ |
| 9482 | change = snd_hda_codec_amp_update(codec, 0x15, 0, HDA_OUTPUT, 0, |
| 9483 | HDA_AMP_MUTE, |
| 9484 | valp[0] ? 0 : HDA_AMP_MUTE); |
| 9485 | change |= snd_hda_codec_amp_update(codec, 0x15, 1, HDA_OUTPUT, 0, |
| 9486 | HDA_AMP_MUTE, |
| 9487 | valp[1] ? 0 : HDA_AMP_MUTE); |
| 9488 | if (change) { |
| 9489 | /* change speaker according to HP jack state */ |
| 9490 | struct alc_spec *spec = codec->spec; |
| 9491 | unsigned int mute; |
| 9492 | if (spec->jack_present) |
| 9493 | mute = HDA_AMP_MUTE; |
| 9494 | else |
| 9495 | mute = snd_hda_codec_amp_read(codec, 0x15, 0, |
| 9496 | HDA_OUTPUT, 0); |
| 9497 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 9498 | HDA_AMP_MUTE, mute); |
| 9499 | } |
| 9500 | return change; |
| 9501 | } |
Takashi Iwai | 5b31954 | 2007-07-26 11:49:22 +0200 | [diff] [blame] | 9502 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 9503 | static struct snd_kcontrol_new alc262_sony_mixer[] = { |
Takashi Iwai | 0724ea2 | 2007-08-23 00:31:43 +0200 | [diff] [blame] | 9504 | HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 9505 | { |
| 9506 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 9507 | .name = "Master Playback Switch", |
| 9508 | .info = snd_hda_mixer_amp_switch_info, |
| 9509 | .get = snd_hda_mixer_amp_switch_get, |
| 9510 | .put = alc262_sony_master_sw_put, |
| 9511 | .private_value = HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT), |
| 9512 | }, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 9513 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 9514 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 9515 | HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 9516 | HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 9517 | { } /* end */ |
| 9518 | }; |
| 9519 | |
Kailang Yang | 83c3421 | 2007-07-05 11:43:05 +0200 | [diff] [blame] | 9520 | static struct snd_kcontrol_new alc262_benq_t31_mixer[] = { |
| 9521 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 9522 | HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 9523 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 9524 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 9525 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 9526 | HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 9527 | HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 9528 | { } /* end */ |
| 9529 | }; |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 9530 | |
Tony Vroon | ba340e8 | 2009-02-02 19:01:30 +0000 | [diff] [blame] | 9531 | static struct snd_kcontrol_new alc262_tyan_mixer[] = { |
| 9532 | HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 9533 | HDA_BIND_MUTE("Master Playback Switch", 0x0c, 2, HDA_INPUT), |
| 9534 | HDA_CODEC_VOLUME("Aux Playback Volume", 0x0b, 0x06, HDA_INPUT), |
| 9535 | HDA_CODEC_MUTE("Aux Playback Switch", 0x0b, 0x06, HDA_INPUT), |
| 9536 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 9537 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 9538 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 9539 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 9540 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 9541 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 9542 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 9543 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
| 9544 | { } /* end */ |
| 9545 | }; |
| 9546 | |
| 9547 | static struct hda_verb alc262_tyan_verbs[] = { |
| 9548 | /* Headphone automute */ |
| 9549 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 9550 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 9551 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 9552 | |
| 9553 | /* P11 AUX_IN, white 4-pin connector */ |
| 9554 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 9555 | {0x14, AC_VERB_SET_CONFIG_DEFAULT_BYTES_1, 0xe1}, |
| 9556 | {0x14, AC_VERB_SET_CONFIG_DEFAULT_BYTES_2, 0x93}, |
| 9557 | {0x14, AC_VERB_SET_CONFIG_DEFAULT_BYTES_3, 0x19}, |
| 9558 | |
| 9559 | {} |
| 9560 | }; |
| 9561 | |
| 9562 | /* unsolicited event for HP jack sensing */ |
| 9563 | static void alc262_tyan_automute(struct hda_codec *codec) |
| 9564 | { |
| 9565 | unsigned int mute; |
| 9566 | unsigned int present; |
| 9567 | |
| 9568 | snd_hda_codec_read(codec, 0x1b, 0, AC_VERB_SET_PIN_SENSE, 0); |
| 9569 | present = snd_hda_codec_read(codec, 0x1b, 0, |
| 9570 | AC_VERB_GET_PIN_SENSE, 0); |
| 9571 | present = (present & 0x80000000) != 0; |
| 9572 | if (present) { |
| 9573 | /* mute line output on ATX panel */ |
| 9574 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 9575 | HDA_AMP_MUTE, HDA_AMP_MUTE); |
| 9576 | } else { |
| 9577 | /* unmute line output if necessary */ |
| 9578 | mute = snd_hda_codec_amp_read(codec, 0x1b, 0, HDA_OUTPUT, 0); |
| 9579 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 9580 | HDA_AMP_MUTE, mute); |
| 9581 | } |
| 9582 | } |
| 9583 | |
| 9584 | static void alc262_tyan_unsol_event(struct hda_codec *codec, |
| 9585 | unsigned int res) |
| 9586 | { |
| 9587 | if ((res >> 26) != ALC880_HP_EVENT) |
| 9588 | return; |
| 9589 | alc262_tyan_automute(codec); |
| 9590 | } |
| 9591 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9592 | #define alc262_capture_mixer alc882_capture_mixer |
| 9593 | #define alc262_capture_alt_mixer alc882_capture_alt_mixer |
| 9594 | |
| 9595 | /* |
| 9596 | * generic initialization of ADC, input mixers and output mixers |
| 9597 | */ |
| 9598 | static struct hda_verb alc262_init_verbs[] = { |
| 9599 | /* |
| 9600 | * Unmute ADC0-2 and set the default input to mic-in |
| 9601 | */ |
| 9602 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 9603 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9604 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 9605 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9606 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 9607 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9608 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 9609 | /* 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] | 9610 | * mixer widget |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9611 | * Note: PASD motherboards uses the Line In 2 as the input for |
| 9612 | * front panel mic (mic 2) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9613 | */ |
| 9614 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 9615 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 9616 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 9617 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 9618 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 9619 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9620 | |
| 9621 | /* |
| 9622 | * Set up output mixers (0x0c - 0x0e) |
| 9623 | */ |
| 9624 | /* set vol=0 to output mixers */ |
| 9625 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 9626 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 9627 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 9628 | /* set up input amps for analog loopback */ |
| 9629 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 9630 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9631 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 9632 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9633 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 9634 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9635 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 9636 | |
| 9637 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, |
| 9638 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0}, |
| 9639 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, |
| 9640 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 9641 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 9642 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 9643 | |
| 9644 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
| 9645 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
| 9646 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
| 9647 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
| 9648 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 9649 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9650 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 9651 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 9652 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9653 | /* FIXME: use matrix-type input source selection */ |
| 9654 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 9655 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ |
| 9656 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 9657 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 9658 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 9659 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 9660 | /* Input mixer2 */ |
| 9661 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 9662 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 9663 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 9664 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 9665 | /* Input mixer3 */ |
| 9666 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 9667 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 9668 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9669 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9670 | |
| 9671 | { } |
| 9672 | }; |
| 9673 | |
Kailang Yang | 4e555fe | 2008-08-26 13:05:55 +0200 | [diff] [blame] | 9674 | static struct hda_verb alc262_eapd_verbs[] = { |
| 9675 | {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 9676 | {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 9677 | { } |
| 9678 | }; |
| 9679 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 9680 | static struct hda_verb alc262_hippo_unsol_verbs[] = { |
| 9681 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 9682 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 9683 | {} |
| 9684 | }; |
| 9685 | |
| 9686 | static struct hda_verb alc262_hippo1_unsol_verbs[] = { |
| 9687 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0}, |
| 9688 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 9689 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
| 9690 | |
| 9691 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 9692 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 9693 | {} |
| 9694 | }; |
| 9695 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 9696 | static struct hda_verb alc262_sony_unsol_verbs[] = { |
| 9697 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0}, |
| 9698 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 9699 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, // Front Mic |
| 9700 | |
| 9701 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 9702 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Akio Idehara | 7b1e879 | 2008-06-09 22:46:07 +0900 | [diff] [blame] | 9703 | {} |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 9704 | }; |
| 9705 | |
Kailang Yang | 4e555fe | 2008-08-26 13:05:55 +0200 | [diff] [blame] | 9706 | static struct hda_input_mux alc262_dmic_capture_source = { |
| 9707 | .num_items = 2, |
| 9708 | .items = { |
| 9709 | { "Int DMic", 0x9 }, |
| 9710 | { "Mic", 0x0 }, |
| 9711 | }, |
| 9712 | }; |
| 9713 | |
| 9714 | static struct snd_kcontrol_new alc262_toshiba_s06_mixer[] = { |
| 9715 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 9716 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 9717 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 9718 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 9719 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Kailang Yang | 4e555fe | 2008-08-26 13:05:55 +0200 | [diff] [blame] | 9720 | { } /* end */ |
| 9721 | }; |
| 9722 | |
| 9723 | static struct hda_verb alc262_toshiba_s06_verbs[] = { |
| 9724 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 9725 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 9726 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 9727 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 9728 | {0x22, AC_VERB_SET_CONNECT_SEL, 0x09}, |
| 9729 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 9730 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 9731 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 9732 | {} |
| 9733 | }; |
| 9734 | |
| 9735 | static void alc262_dmic_automute(struct hda_codec *codec) |
| 9736 | { |
| 9737 | unsigned int present; |
| 9738 | |
| 9739 | present = snd_hda_codec_read(codec, 0x18, 0, |
| 9740 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 9741 | snd_hda_codec_write(codec, 0x22, 0, |
| 9742 | AC_VERB_SET_CONNECT_SEL, present ? 0x0 : 0x09); |
| 9743 | } |
| 9744 | |
| 9745 | /* toggle speaker-output according to the hp-jack state */ |
| 9746 | static void alc262_toshiba_s06_speaker_automute(struct hda_codec *codec) |
| 9747 | { |
| 9748 | unsigned int present; |
| 9749 | unsigned char bits; |
| 9750 | |
| 9751 | present = snd_hda_codec_read(codec, 0x15, 0, |
| 9752 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 9753 | bits = present ? 0 : PIN_OUT; |
| 9754 | snd_hda_codec_write(codec, 0x14, 0, |
| 9755 | AC_VERB_SET_PIN_WIDGET_CONTROL, bits); |
| 9756 | } |
| 9757 | |
| 9758 | |
| 9759 | |
| 9760 | /* unsolicited event for HP jack sensing */ |
| 9761 | static void alc262_toshiba_s06_unsol_event(struct hda_codec *codec, |
| 9762 | unsigned int res) |
| 9763 | { |
| 9764 | if ((res >> 26) == ALC880_HP_EVENT) |
| 9765 | alc262_toshiba_s06_speaker_automute(codec); |
| 9766 | if ((res >> 26) == ALC880_MIC_EVENT) |
| 9767 | alc262_dmic_automute(codec); |
| 9768 | |
| 9769 | } |
| 9770 | |
| 9771 | static void alc262_toshiba_s06_init_hook(struct hda_codec *codec) |
| 9772 | { |
| 9773 | alc262_toshiba_s06_speaker_automute(codec); |
| 9774 | alc262_dmic_automute(codec); |
| 9775 | } |
| 9776 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 9777 | /* mute/unmute internal speaker according to the hp jack and mute state */ |
Takashi Iwai | 5b31954 | 2007-07-26 11:49:22 +0200 | [diff] [blame] | 9778 | static void alc262_hippo_automute(struct hda_codec *codec) |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 9779 | { |
| 9780 | struct alc_spec *spec = codec->spec; |
| 9781 | unsigned int mute; |
Takashi Iwai | 5b31954 | 2007-07-26 11:49:22 +0200 | [diff] [blame] | 9782 | unsigned int present; |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 9783 | |
Takashi Iwai | 5b31954 | 2007-07-26 11:49:22 +0200 | [diff] [blame] | 9784 | /* need to execute and sync at first */ |
| 9785 | snd_hda_codec_read(codec, 0x15, 0, AC_VERB_SET_PIN_SENSE, 0); |
| 9786 | present = snd_hda_codec_read(codec, 0x15, 0, |
| 9787 | AC_VERB_GET_PIN_SENSE, 0); |
| 9788 | spec->jack_present = (present & 0x80000000) != 0; |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 9789 | if (spec->jack_present) { |
| 9790 | /* mute internal speaker */ |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 9791 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 9792 | HDA_AMP_MUTE, HDA_AMP_MUTE); |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 9793 | } else { |
| 9794 | /* unmute internal speaker if necessary */ |
| 9795 | mute = snd_hda_codec_amp_read(codec, 0x15, 0, HDA_OUTPUT, 0); |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 9796 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 9797 | HDA_AMP_MUTE, mute); |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 9798 | } |
| 9799 | } |
| 9800 | |
| 9801 | /* unsolicited event for HP jack sensing */ |
| 9802 | static void alc262_hippo_unsol_event(struct hda_codec *codec, |
| 9803 | unsigned int res) |
| 9804 | { |
| 9805 | if ((res >> 26) != ALC880_HP_EVENT) |
| 9806 | return; |
Takashi Iwai | 5b31954 | 2007-07-26 11:49:22 +0200 | [diff] [blame] | 9807 | alc262_hippo_automute(codec); |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 9808 | } |
| 9809 | |
Takashi Iwai | 5b31954 | 2007-07-26 11:49:22 +0200 | [diff] [blame] | 9810 | static void alc262_hippo1_automute(struct hda_codec *codec) |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 9811 | { |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 9812 | unsigned int mute; |
Takashi Iwai | 5b31954 | 2007-07-26 11:49:22 +0200 | [diff] [blame] | 9813 | unsigned int present; |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 9814 | |
Takashi Iwai | 5b31954 | 2007-07-26 11:49:22 +0200 | [diff] [blame] | 9815 | snd_hda_codec_read(codec, 0x1b, 0, AC_VERB_SET_PIN_SENSE, 0); |
| 9816 | present = snd_hda_codec_read(codec, 0x1b, 0, |
| 9817 | AC_VERB_GET_PIN_SENSE, 0); |
| 9818 | present = (present & 0x80000000) != 0; |
| 9819 | if (present) { |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 9820 | /* mute internal speaker */ |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 9821 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 9822 | HDA_AMP_MUTE, HDA_AMP_MUTE); |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 9823 | } else { |
| 9824 | /* unmute internal speaker if necessary */ |
| 9825 | mute = snd_hda_codec_amp_read(codec, 0x1b, 0, HDA_OUTPUT, 0); |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 9826 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 9827 | HDA_AMP_MUTE, mute); |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 9828 | } |
| 9829 | } |
| 9830 | |
| 9831 | /* unsolicited event for HP jack sensing */ |
| 9832 | static void alc262_hippo1_unsol_event(struct hda_codec *codec, |
| 9833 | unsigned int res) |
| 9834 | { |
| 9835 | if ((res >> 26) != ALC880_HP_EVENT) |
| 9836 | return; |
Takashi Iwai | 5b31954 | 2007-07-26 11:49:22 +0200 | [diff] [blame] | 9837 | alc262_hippo1_automute(codec); |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 9838 | } |
| 9839 | |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 9840 | /* |
Pascal Terjan | e8f9ae2 | 2008-08-04 14:36:05 +0200 | [diff] [blame] | 9841 | * nec model |
| 9842 | * 0x15 = headphone |
| 9843 | * 0x16 = internal speaker |
| 9844 | * 0x18 = external mic |
| 9845 | */ |
| 9846 | |
| 9847 | static struct snd_kcontrol_new alc262_nec_mixer[] = { |
| 9848 | HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 9849 | HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x16, 0, 0x0, HDA_OUTPUT), |
| 9850 | |
| 9851 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 9852 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 9853 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 9854 | |
| 9855 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 9856 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 9857 | { } /* end */ |
| 9858 | }; |
| 9859 | |
| 9860 | static struct hda_verb alc262_nec_verbs[] = { |
| 9861 | /* Unmute Speaker */ |
| 9862 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 9863 | |
| 9864 | /* Headphone */ |
| 9865 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 9866 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 9867 | |
| 9868 | /* External mic to headphone */ |
| 9869 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 9870 | /* External mic to speaker */ |
| 9871 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 9872 | {} |
| 9873 | }; |
| 9874 | |
| 9875 | /* |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 9876 | * fujitsu model |
Tony Vroon | 5d9fab2 | 2008-03-14 17:09:18 +0100 | [diff] [blame] | 9877 | * 0x14 = headphone/spdif-out, 0x15 = internal speaker, |
| 9878 | * 0x1b = port replicator headphone out |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 9879 | */ |
| 9880 | |
| 9881 | #define ALC_HP_EVENT 0x37 |
| 9882 | |
| 9883 | static struct hda_verb alc262_fujitsu_unsol_verbs[] = { |
| 9884 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT}, |
| 9885 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Tony Vroon | 5d9fab2 | 2008-03-14 17:09:18 +0100 | [diff] [blame] | 9886 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT}, |
| 9887 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 9888 | {} |
| 9889 | }; |
| 9890 | |
Jiang zhe | 0e31daf | 2008-03-20 12:12:39 +0100 | [diff] [blame] | 9891 | static struct hda_verb alc262_lenovo_3000_unsol_verbs[] = { |
| 9892 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT}, |
| 9893 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 9894 | {} |
| 9895 | }; |
| 9896 | |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 9897 | static struct hda_input_mux alc262_fujitsu_capture_source = { |
Takashi Iwai | 39d3ed3 | 2007-10-12 15:03:48 +0200 | [diff] [blame] | 9898 | .num_items = 3, |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 9899 | .items = { |
| 9900 | { "Mic", 0x0 }, |
Takashi Iwai | 39d3ed3 | 2007-10-12 15:03:48 +0200 | [diff] [blame] | 9901 | { "Int Mic", 0x1 }, |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 9902 | { "CD", 0x4 }, |
| 9903 | }, |
| 9904 | }; |
| 9905 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9906 | static struct hda_input_mux alc262_HP_capture_source = { |
| 9907 | .num_items = 5, |
| 9908 | .items = { |
| 9909 | { "Mic", 0x0 }, |
zhejiang | accbe49 | 2007-08-31 12:36:05 +0200 | [diff] [blame] | 9910 | { "Front Mic", 0x1 }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9911 | { "Line", 0x2 }, |
| 9912 | { "CD", 0x4 }, |
| 9913 | { "AUX IN", 0x6 }, |
| 9914 | }, |
| 9915 | }; |
| 9916 | |
zhejiang | accbe49 | 2007-08-31 12:36:05 +0200 | [diff] [blame] | 9917 | static struct hda_input_mux alc262_HP_D7000_capture_source = { |
| 9918 | .num_items = 4, |
| 9919 | .items = { |
| 9920 | { "Mic", 0x0 }, |
| 9921 | { "Front Mic", 0x2 }, |
| 9922 | { "Line", 0x1 }, |
| 9923 | { "CD", 0x4 }, |
| 9924 | }, |
| 9925 | }; |
| 9926 | |
Takashi Iwai | ebc7a40 | 2008-05-20 09:23:05 +0200 | [diff] [blame] | 9927 | /* mute/unmute internal speaker according to the hp jacks and mute state */ |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 9928 | static void alc262_fujitsu_automute(struct hda_codec *codec, int force) |
| 9929 | { |
| 9930 | struct alc_spec *spec = codec->spec; |
| 9931 | unsigned int mute; |
| 9932 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9933 | if (force || !spec->sense_updated) { |
Takashi Iwai | ebc7a40 | 2008-05-20 09:23:05 +0200 | [diff] [blame] | 9934 | unsigned int present; |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 9935 | /* need to execute and sync at first */ |
| 9936 | 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] | 9937 | /* check laptop HP jack */ |
| 9938 | present = snd_hda_codec_read(codec, 0x14, 0, |
| 9939 | AC_VERB_GET_PIN_SENSE, 0); |
| 9940 | /* need to execute and sync at first */ |
| 9941 | snd_hda_codec_read(codec, 0x1b, 0, AC_VERB_SET_PIN_SENSE, 0); |
| 9942 | /* check docking HP jack */ |
| 9943 | present |= snd_hda_codec_read(codec, 0x1b, 0, |
| 9944 | AC_VERB_GET_PIN_SENSE, 0); |
| 9945 | if (present & AC_PINSENSE_PRESENCE) |
| 9946 | spec->jack_present = 1; |
| 9947 | else |
| 9948 | spec->jack_present = 0; |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 9949 | spec->sense_updated = 1; |
| 9950 | } |
Takashi Iwai | ebc7a40 | 2008-05-20 09:23:05 +0200 | [diff] [blame] | 9951 | /* unmute internal speaker only if both HPs are unplugged and |
| 9952 | * master switch is on |
| 9953 | */ |
| 9954 | if (spec->jack_present) |
| 9955 | mute = HDA_AMP_MUTE; |
| 9956 | else |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 9957 | mute = snd_hda_codec_amp_read(codec, 0x14, 0, HDA_OUTPUT, 0); |
Takashi Iwai | ebc7a40 | 2008-05-20 09:23:05 +0200 | [diff] [blame] | 9958 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 9959 | HDA_AMP_MUTE, mute); |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 9960 | } |
| 9961 | |
| 9962 | /* unsolicited event for HP jack sensing */ |
| 9963 | static void alc262_fujitsu_unsol_event(struct hda_codec *codec, |
| 9964 | unsigned int res) |
| 9965 | { |
| 9966 | if ((res >> 26) != ALC_HP_EVENT) |
| 9967 | return; |
| 9968 | alc262_fujitsu_automute(codec, 1); |
| 9969 | } |
| 9970 | |
Takashi Iwai | ebc7a40 | 2008-05-20 09:23:05 +0200 | [diff] [blame] | 9971 | static void alc262_fujitsu_init_hook(struct hda_codec *codec) |
| 9972 | { |
| 9973 | alc262_fujitsu_automute(codec, 1); |
| 9974 | } |
| 9975 | |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 9976 | /* bind volumes of both NID 0x0c and 0x0d */ |
Takashi Iwai | cca3b37 | 2007-08-10 17:12:15 +0200 | [diff] [blame] | 9977 | static struct hda_bind_ctls alc262_fujitsu_bind_master_vol = { |
| 9978 | .ops = &snd_hda_bind_vol, |
| 9979 | .values = { |
| 9980 | HDA_COMPOSE_AMP_VAL(0x0c, 3, 0, HDA_OUTPUT), |
| 9981 | HDA_COMPOSE_AMP_VAL(0x0d, 3, 0, HDA_OUTPUT), |
| 9982 | 0 |
| 9983 | }, |
| 9984 | }; |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 9985 | |
Jiang zhe | 0e31daf | 2008-03-20 12:12:39 +0100 | [diff] [blame] | 9986 | /* mute/unmute internal speaker according to the hp jack and mute state */ |
| 9987 | static void alc262_lenovo_3000_automute(struct hda_codec *codec, int force) |
| 9988 | { |
| 9989 | struct alc_spec *spec = codec->spec; |
| 9990 | unsigned int mute; |
| 9991 | |
| 9992 | if (force || !spec->sense_updated) { |
| 9993 | unsigned int present_int_hp; |
| 9994 | /* need to execute and sync at first */ |
| 9995 | snd_hda_codec_read(codec, 0x1b, 0, AC_VERB_SET_PIN_SENSE, 0); |
| 9996 | present_int_hp = snd_hda_codec_read(codec, 0x1b, 0, |
| 9997 | AC_VERB_GET_PIN_SENSE, 0); |
| 9998 | spec->jack_present = (present_int_hp & 0x80000000) != 0; |
| 9999 | spec->sense_updated = 1; |
| 10000 | } |
| 10001 | if (spec->jack_present) { |
| 10002 | /* mute internal speaker */ |
| 10003 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 10004 | HDA_AMP_MUTE, HDA_AMP_MUTE); |
| 10005 | snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0, |
| 10006 | HDA_AMP_MUTE, HDA_AMP_MUTE); |
| 10007 | } else { |
| 10008 | /* unmute internal speaker if necessary */ |
| 10009 | mute = snd_hda_codec_amp_read(codec, 0x1b, 0, HDA_OUTPUT, 0); |
| 10010 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 10011 | HDA_AMP_MUTE, mute); |
| 10012 | snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0, |
| 10013 | HDA_AMP_MUTE, mute); |
| 10014 | } |
| 10015 | } |
| 10016 | |
| 10017 | /* unsolicited event for HP jack sensing */ |
| 10018 | static void alc262_lenovo_3000_unsol_event(struct hda_codec *codec, |
| 10019 | unsigned int res) |
| 10020 | { |
| 10021 | if ((res >> 26) != ALC_HP_EVENT) |
| 10022 | return; |
| 10023 | alc262_lenovo_3000_automute(codec, 1); |
| 10024 | } |
| 10025 | |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 10026 | /* bind hp and internal speaker mute (with plug check) */ |
| 10027 | static int alc262_fujitsu_master_sw_put(struct snd_kcontrol *kcontrol, |
| 10028 | struct snd_ctl_elem_value *ucontrol) |
| 10029 | { |
| 10030 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 10031 | long *valp = ucontrol->value.integer.value; |
| 10032 | int change; |
| 10033 | |
Tony Vroon | 5d9fab2 | 2008-03-14 17:09:18 +0100 | [diff] [blame] | 10034 | change = snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 10035 | HDA_AMP_MUTE, |
| 10036 | valp ? 0 : HDA_AMP_MUTE); |
| 10037 | change |= snd_hda_codec_amp_stereo(codec, 0x1b, HDA_OUTPUT, 0, |
| 10038 | HDA_AMP_MUTE, |
| 10039 | valp ? 0 : HDA_AMP_MUTE); |
| 10040 | |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 10041 | if (change) |
| 10042 | alc262_fujitsu_automute(codec, 0); |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 10043 | return change; |
| 10044 | } |
| 10045 | |
| 10046 | static struct snd_kcontrol_new alc262_fujitsu_mixer[] = { |
Takashi Iwai | cca3b37 | 2007-08-10 17:12:15 +0200 | [diff] [blame] | 10047 | HDA_BIND_VOL("Master Playback Volume", &alc262_fujitsu_bind_master_vol), |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 10048 | { |
| 10049 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 10050 | .name = "Master Playback Switch", |
| 10051 | .info = snd_hda_mixer_amp_switch_info, |
| 10052 | .get = snd_hda_mixer_amp_switch_get, |
| 10053 | .put = alc262_fujitsu_master_sw_put, |
| 10054 | .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), |
| 10055 | }, |
| 10056 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 10057 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 10058 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 10059 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 10060 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Takashi Iwai | 39d3ed3 | 2007-10-12 15:03:48 +0200 | [diff] [blame] | 10061 | HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT), |
| 10062 | HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 10063 | HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 10064 | { } /* end */ |
| 10065 | }; |
| 10066 | |
Jiang zhe | 0e31daf | 2008-03-20 12:12:39 +0100 | [diff] [blame] | 10067 | /* bind hp and internal speaker mute (with plug check) */ |
| 10068 | static int alc262_lenovo_3000_master_sw_put(struct snd_kcontrol *kcontrol, |
| 10069 | struct snd_ctl_elem_value *ucontrol) |
| 10070 | { |
| 10071 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 10072 | long *valp = ucontrol->value.integer.value; |
| 10073 | int change; |
| 10074 | |
| 10075 | change = snd_hda_codec_amp_stereo(codec, 0x1b, HDA_OUTPUT, 0, |
| 10076 | HDA_AMP_MUTE, |
| 10077 | valp ? 0 : HDA_AMP_MUTE); |
| 10078 | |
| 10079 | if (change) |
| 10080 | alc262_lenovo_3000_automute(codec, 0); |
| 10081 | return change; |
| 10082 | } |
| 10083 | |
| 10084 | static struct snd_kcontrol_new alc262_lenovo_3000_mixer[] = { |
| 10085 | HDA_BIND_VOL("Master Playback Volume", &alc262_fujitsu_bind_master_vol), |
| 10086 | { |
| 10087 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 10088 | .name = "Master Playback Switch", |
| 10089 | .info = snd_hda_mixer_amp_switch_info, |
| 10090 | .get = snd_hda_mixer_amp_switch_get, |
| 10091 | .put = alc262_lenovo_3000_master_sw_put, |
| 10092 | .private_value = HDA_COMPOSE_AMP_VAL(0x1b, 3, 0, HDA_OUTPUT), |
| 10093 | }, |
| 10094 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 10095 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 10096 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 10097 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 10098 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 10099 | HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT), |
| 10100 | HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 10101 | HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 10102 | { } /* end */ |
| 10103 | }; |
| 10104 | |
Hiroshi Miura | 9f99a63 | 2008-08-28 16:09:06 +0200 | [diff] [blame] | 10105 | static struct snd_kcontrol_new alc262_toshiba_rx1_mixer[] = { |
| 10106 | HDA_BIND_VOL("Master Playback Volume", &alc262_fujitsu_bind_master_vol), |
| 10107 | { |
| 10108 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 10109 | .name = "Master Playback Switch", |
| 10110 | .info = snd_hda_mixer_amp_switch_info, |
| 10111 | .get = snd_hda_mixer_amp_switch_get, |
| 10112 | .put = alc262_sony_master_sw_put, |
| 10113 | .private_value = HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT), |
| 10114 | }, |
| 10115 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 10116 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 10117 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 10118 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 10119 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 10120 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
| 10121 | { } /* end */ |
| 10122 | }; |
| 10123 | |
Takashi Iwai | 304dcaa | 2006-07-25 14:51:16 +0200 | [diff] [blame] | 10124 | /* additional init verbs for Benq laptops */ |
| 10125 | static struct hda_verb alc262_EAPD_verbs[] = { |
| 10126 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 10127 | {0x20, AC_VERB_SET_PROC_COEF, 0x3070}, |
| 10128 | {} |
| 10129 | }; |
| 10130 | |
Kailang Yang | 83c3421 | 2007-07-05 11:43:05 +0200 | [diff] [blame] | 10131 | static struct hda_verb alc262_benq_t31_EAPD_verbs[] = { |
| 10132 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 10133 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 10134 | |
| 10135 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 10136 | {0x20, AC_VERB_SET_PROC_COEF, 0x3050}, |
| 10137 | {} |
| 10138 | }; |
| 10139 | |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 10140 | /* Samsung Q1 Ultra Vista model setup */ |
| 10141 | static struct snd_kcontrol_new alc262_ultra_mixer[] = { |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 10142 | HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 10143 | HDA_BIND_MUTE("Master Playback Switch", 0x0c, 2, HDA_INPUT), |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 10144 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 10145 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 10146 | HDA_CODEC_VOLUME("Mic Boost", 0x19, 0, HDA_INPUT), |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 10147 | HDA_CODEC_VOLUME("Headphone Mic Boost", 0x15, 0, HDA_INPUT), |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 10148 | { } /* end */ |
| 10149 | }; |
| 10150 | |
| 10151 | static struct hda_verb alc262_ultra_verbs[] = { |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 10152 | /* output mixer */ |
| 10153 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 10154 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 10155 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 10156 | /* speaker */ |
| 10157 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 10158 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 10159 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10160 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 10161 | /* HP */ |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 10162 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 10163 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 10164 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10165 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 10166 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 10167 | /* internal mic */ |
| 10168 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 10169 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 10170 | /* ADC, choose mic */ |
| 10171 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 10172 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 10173 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 10174 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 10175 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 10176 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 10177 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, |
| 10178 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, |
| 10179 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, |
| 10180 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(8)}, |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 10181 | {} |
| 10182 | }; |
| 10183 | |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 10184 | /* mute/unmute internal speaker according to the hp jack and mute state */ |
| 10185 | static void alc262_ultra_automute(struct hda_codec *codec) |
| 10186 | { |
| 10187 | struct alc_spec *spec = codec->spec; |
| 10188 | unsigned int mute; |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 10189 | |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 10190 | mute = 0; |
| 10191 | /* auto-mute only when HP is used as HP */ |
| 10192 | if (!spec->cur_mux[0]) { |
| 10193 | unsigned int present; |
| 10194 | /* need to execute and sync at first */ |
| 10195 | snd_hda_codec_read(codec, 0x15, 0, AC_VERB_SET_PIN_SENSE, 0); |
| 10196 | present = snd_hda_codec_read(codec, 0x15, 0, |
| 10197 | AC_VERB_GET_PIN_SENSE, 0); |
| 10198 | spec->jack_present = (present & AC_PINSENSE_PRESENCE) != 0; |
| 10199 | if (spec->jack_present) |
| 10200 | mute = HDA_AMP_MUTE; |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 10201 | } |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 10202 | /* mute/unmute internal speaker */ |
| 10203 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 10204 | HDA_AMP_MUTE, mute); |
| 10205 | /* mute/unmute HP */ |
| 10206 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 10207 | HDA_AMP_MUTE, mute ? 0 : HDA_AMP_MUTE); |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 10208 | } |
| 10209 | |
| 10210 | /* unsolicited event for HP jack sensing */ |
| 10211 | static void alc262_ultra_unsol_event(struct hda_codec *codec, |
| 10212 | unsigned int res) |
| 10213 | { |
| 10214 | if ((res >> 26) != ALC880_HP_EVENT) |
| 10215 | return; |
| 10216 | alc262_ultra_automute(codec); |
| 10217 | } |
| 10218 | |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 10219 | static struct hda_input_mux alc262_ultra_capture_source = { |
| 10220 | .num_items = 2, |
| 10221 | .items = { |
| 10222 | { "Mic", 0x1 }, |
| 10223 | { "Headphone", 0x7 }, |
| 10224 | }, |
| 10225 | }; |
| 10226 | |
| 10227 | static int alc262_ultra_mux_enum_put(struct snd_kcontrol *kcontrol, |
| 10228 | struct snd_ctl_elem_value *ucontrol) |
| 10229 | { |
| 10230 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 10231 | struct alc_spec *spec = codec->spec; |
| 10232 | int ret; |
| 10233 | |
Takashi Iwai | 54cbc9a | 2008-10-31 15:24:04 +0100 | [diff] [blame] | 10234 | ret = alc_mux_enum_put(kcontrol, ucontrol); |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 10235 | if (!ret) |
| 10236 | return 0; |
| 10237 | /* reprogram the HP pin as mic or HP according to the input source */ |
| 10238 | snd_hda_codec_write_cache(codec, 0x15, 0, |
| 10239 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 10240 | spec->cur_mux[0] ? PIN_VREF80 : PIN_HP); |
| 10241 | alc262_ultra_automute(codec); /* mute/unmute HP */ |
| 10242 | return ret; |
| 10243 | } |
| 10244 | |
| 10245 | static struct snd_kcontrol_new alc262_ultra_capture_mixer[] = { |
| 10246 | HDA_CODEC_VOLUME("Capture Volume", 0x07, 0x0, HDA_INPUT), |
| 10247 | HDA_CODEC_MUTE("Capture Switch", 0x07, 0x0, HDA_INPUT), |
| 10248 | { |
| 10249 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 10250 | .name = "Capture Source", |
Takashi Iwai | 54cbc9a | 2008-10-31 15:24:04 +0100 | [diff] [blame] | 10251 | .info = alc_mux_enum_info, |
| 10252 | .get = alc_mux_enum_get, |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 10253 | .put = alc262_ultra_mux_enum_put, |
| 10254 | }, |
| 10255 | { } /* end */ |
| 10256 | }; |
| 10257 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10258 | /* add playback controls from the parsed DAC table */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10259 | static int alc262_auto_create_multi_out_ctls(struct alc_spec *spec, |
| 10260 | const struct auto_pin_cfg *cfg) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10261 | { |
| 10262 | hda_nid_t nid; |
| 10263 | int err; |
| 10264 | |
| 10265 | spec->multiout.num_dacs = 1; /* only use one dac */ |
| 10266 | spec->multiout.dac_nids = spec->private_dac_nids; |
| 10267 | spec->multiout.dac_nids[0] = 2; |
| 10268 | |
| 10269 | nid = cfg->line_out_pins[0]; |
| 10270 | if (nid) { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10271 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 10272 | "Front Playback Volume", |
| 10273 | HDA_COMPOSE_AMP_VAL(0x0c, 3, 0, HDA_OUTPUT)); |
| 10274 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10275 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10276 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, |
| 10277 | "Front Playback Switch", |
| 10278 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT)); |
| 10279 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10280 | return err; |
| 10281 | } |
| 10282 | |
Takashi Iwai | 82bc955 | 2006-03-21 11:24:42 +0100 | [diff] [blame] | 10283 | nid = cfg->speaker_pins[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10284 | if (nid) { |
| 10285 | if (nid == 0x16) { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10286 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 10287 | "Speaker Playback Volume", |
| 10288 | HDA_COMPOSE_AMP_VAL(0x0e, 2, 0, |
| 10289 | HDA_OUTPUT)); |
| 10290 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10291 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10292 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, |
| 10293 | "Speaker Playback Switch", |
| 10294 | HDA_COMPOSE_AMP_VAL(nid, 2, 0, |
| 10295 | HDA_OUTPUT)); |
| 10296 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10297 | return err; |
| 10298 | } else { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10299 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, |
| 10300 | "Speaker Playback Switch", |
| 10301 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, |
| 10302 | HDA_OUTPUT)); |
| 10303 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10304 | return err; |
| 10305 | } |
| 10306 | } |
Takashi Iwai | eb06ed8 | 2006-09-20 17:10:27 +0200 | [diff] [blame] | 10307 | nid = cfg->hp_pins[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10308 | if (nid) { |
| 10309 | /* spec->multiout.hp_nid = 2; */ |
| 10310 | if (nid == 0x16) { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10311 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 10312 | "Headphone Playback Volume", |
| 10313 | HDA_COMPOSE_AMP_VAL(0x0e, 2, 0, |
| 10314 | HDA_OUTPUT)); |
| 10315 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10316 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10317 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, |
| 10318 | "Headphone Playback Switch", |
| 10319 | HDA_COMPOSE_AMP_VAL(nid, 2, 0, |
| 10320 | HDA_OUTPUT)); |
| 10321 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10322 | return err; |
| 10323 | } else { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10324 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, |
| 10325 | "Headphone Playback Switch", |
| 10326 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, |
| 10327 | HDA_OUTPUT)); |
| 10328 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10329 | return err; |
| 10330 | } |
| 10331 | } |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10332 | return 0; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10333 | } |
| 10334 | |
| 10335 | /* identical with ALC880 */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10336 | #define alc262_auto_create_analog_input_ctls \ |
| 10337 | alc880_auto_create_analog_input_ctls |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10338 | |
| 10339 | /* |
| 10340 | * generic initialization of ADC, input mixers and output mixers |
| 10341 | */ |
| 10342 | static struct hda_verb alc262_volume_init_verbs[] = { |
| 10343 | /* |
| 10344 | * Unmute ADC0-2 and set the default input to mic-in |
| 10345 | */ |
| 10346 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 10347 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10348 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 10349 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10350 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 10351 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10352 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 10353 | /* 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] | 10354 | * mixer widget |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10355 | * Note: PASD motherboards uses the Line In 2 as the input for |
| 10356 | * front panel mic (mic 2) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10357 | */ |
| 10358 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 10359 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 10360 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 10361 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 10362 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 10363 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10364 | |
| 10365 | /* |
| 10366 | * Set up output mixers (0x0c - 0x0f) |
| 10367 | */ |
| 10368 | /* set vol=0 to output mixers */ |
| 10369 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 10370 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 10371 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 10372 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10373 | /* set up input amps for analog loopback */ |
| 10374 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 10375 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10376 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 10377 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10378 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 10379 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10380 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 10381 | |
| 10382 | /* FIXME: use matrix-type input source selection */ |
| 10383 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 10384 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ |
| 10385 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 10386 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 10387 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 10388 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 10389 | /* Input mixer2 */ |
| 10390 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 10391 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 10392 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 10393 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 10394 | /* Input mixer3 */ |
| 10395 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 10396 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 10397 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 10398 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 10399 | |
| 10400 | { } |
| 10401 | }; |
| 10402 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10403 | static struct hda_verb alc262_HP_BPC_init_verbs[] = { |
| 10404 | /* |
| 10405 | * Unmute ADC0-2 and set the default input to mic-in |
| 10406 | */ |
| 10407 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 10408 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10409 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 10410 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10411 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 10412 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10413 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 10414 | /* 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] | 10415 | * mixer widget |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10416 | * Note: PASD motherboards uses the Line In 2 as the input for |
| 10417 | * front panel mic (mic 2) |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10418 | */ |
| 10419 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 10420 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 10421 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 10422 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 10423 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 10424 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 10425 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, |
| 10426 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 10427 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10428 | /* |
| 10429 | * Set up output mixers (0x0c - 0x0e) |
| 10430 | */ |
| 10431 | /* set vol=0 to output mixers */ |
| 10432 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 10433 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 10434 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 10435 | |
| 10436 | /* set up input amps for analog loopback */ |
| 10437 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 10438 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10439 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 10440 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10441 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 10442 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10443 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 10444 | |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 10445 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10446 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 10447 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 10448 | |
| 10449 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 10450 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 10451 | |
| 10452 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 10453 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 10454 | |
| 10455 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 10456 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 10457 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 10458 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 10459 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 10460 | |
| 10461 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x7023 }, |
| 10462 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
| 10463 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
| 10464 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, 0x7023 }, |
| 10465 | {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
| 10466 | {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
| 10467 | |
| 10468 | |
| 10469 | /* FIXME: use matrix-type input source selection */ |
| 10470 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 10471 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ |
| 10472 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 10473 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))}, |
| 10474 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))}, |
| 10475 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))}, |
| 10476 | /* Input mixer2 */ |
| 10477 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 10478 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))}, |
| 10479 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))}, |
| 10480 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))}, |
| 10481 | /* Input mixer3 */ |
| 10482 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 10483 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))}, |
| 10484 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))}, |
| 10485 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))}, |
| 10486 | |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 10487 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 10488 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10489 | { } |
| 10490 | }; |
| 10491 | |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 10492 | static struct hda_verb alc262_HP_BPC_WildWest_init_verbs[] = { |
| 10493 | /* |
| 10494 | * Unmute ADC0-2 and set the default input to mic-in |
| 10495 | */ |
| 10496 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 10497 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10498 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 10499 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10500 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 10501 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10502 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 10503 | /* 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] | 10504 | * mixer widget |
| 10505 | * Note: PASD motherboards uses the Line In 2 as the input for front |
| 10506 | * panel mic (mic 2) |
| 10507 | */ |
| 10508 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 10509 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 10510 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 10511 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 10512 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 10513 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 10514 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, |
| 10515 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, |
| 10516 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 10517 | /* |
| 10518 | * Set up output mixers (0x0c - 0x0e) |
| 10519 | */ |
| 10520 | /* set vol=0 to output mixers */ |
| 10521 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 10522 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 10523 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 10524 | |
| 10525 | /* set up input amps for analog loopback */ |
| 10526 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 10527 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10528 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 10529 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10530 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 10531 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10532 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 10533 | |
| 10534 | |
| 10535 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, /* HP */ |
| 10536 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, /* Mono */ |
| 10537 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* rear MIC */ |
| 10538 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, /* Line in */ |
| 10539 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* Front MIC */ |
| 10540 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, /* Line out */ |
| 10541 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, /* CD in */ |
| 10542 | |
| 10543 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 10544 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 10545 | |
| 10546 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 10547 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 10548 | |
| 10549 | /* {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x7023 }, */ |
| 10550 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
| 10551 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
| 10552 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, 0x7023 }, |
| 10553 | {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
| 10554 | {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
| 10555 | |
| 10556 | /* FIXME: use matrix-type input source selection */ |
| 10557 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 10558 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ |
| 10559 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, /*rear MIC*/ |
| 10560 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, /*Line in*/ |
| 10561 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))}, /*F MIC*/ |
| 10562 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))}, /*Front*/ |
| 10563 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))}, /*CD*/ |
| 10564 | /* {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */ |
| 10565 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x07 << 8))}, /*HP*/ |
| 10566 | /* Input mixer2 */ |
| 10567 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 10568 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 10569 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))}, |
| 10570 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))}, |
| 10571 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))}, |
| 10572 | /* {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */ |
| 10573 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x07 << 8))}, |
| 10574 | /* Input mixer3 */ |
| 10575 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 10576 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 10577 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))}, |
| 10578 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))}, |
| 10579 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))}, |
| 10580 | /* {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */ |
| 10581 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x07 << 8))}, |
| 10582 | |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 10583 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 10584 | |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 10585 | { } |
| 10586 | }; |
| 10587 | |
Hiroshi Miura | 9f99a63 | 2008-08-28 16:09:06 +0200 | [diff] [blame] | 10588 | static struct hda_verb alc262_toshiba_rx1_unsol_verbs[] = { |
| 10589 | |
| 10590 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, /* Front Speaker */ |
| 10591 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 10592 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 10593 | |
| 10594 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* MIC jack */ |
| 10595 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* Front MIC */ |
| 10596 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0) }, |
| 10597 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0) }, |
| 10598 | |
| 10599 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, /* HP jack */ |
| 10600 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 10601 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 10602 | {} |
| 10603 | }; |
| 10604 | |
| 10605 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 10606 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 10607 | #define alc262_loopbacks alc880_loopbacks |
| 10608 | #endif |
| 10609 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10610 | /* pcm configuration: identiacal with ALC880 */ |
| 10611 | #define alc262_pcm_analog_playback alc880_pcm_analog_playback |
| 10612 | #define alc262_pcm_analog_capture alc880_pcm_analog_capture |
| 10613 | #define alc262_pcm_digital_playback alc880_pcm_digital_playback |
| 10614 | #define alc262_pcm_digital_capture alc880_pcm_digital_capture |
| 10615 | |
| 10616 | /* |
| 10617 | * BIOS auto configuration |
| 10618 | */ |
| 10619 | static int alc262_parse_auto_config(struct hda_codec *codec) |
| 10620 | { |
| 10621 | struct alc_spec *spec = codec->spec; |
| 10622 | int err; |
| 10623 | static hda_nid_t alc262_ignore[] = { 0x1d, 0 }; |
| 10624 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10625 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 10626 | alc262_ignore); |
| 10627 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10628 | return err; |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 10629 | if (!spec->autocfg.line_outs) { |
Takashi Iwai | 0852d7a | 2009-02-11 11:35:15 +0100 | [diff] [blame] | 10630 | if (spec->autocfg.dig_outs || spec->autocfg.dig_in_pin) { |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 10631 | spec->multiout.max_channels = 2; |
| 10632 | spec->no_analog = 1; |
| 10633 | goto dig_only; |
| 10634 | } |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10635 | return 0; /* can't find valid BIOS pin config */ |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 10636 | } |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10637 | err = alc262_auto_create_multi_out_ctls(spec, &spec->autocfg); |
| 10638 | if (err < 0) |
| 10639 | return err; |
| 10640 | err = alc262_auto_create_analog_input_ctls(spec, &spec->autocfg); |
| 10641 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10642 | return err; |
| 10643 | |
| 10644 | spec->multiout.max_channels = spec->multiout.num_dacs * 2; |
| 10645 | |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 10646 | dig_only: |
Takashi Iwai | 0852d7a | 2009-02-11 11:35:15 +0100 | [diff] [blame] | 10647 | if (spec->autocfg.dig_outs) { |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10648 | spec->multiout.dig_out_nid = ALC262_DIGOUT_NID; |
Takashi Iwai | 0852d7a | 2009-02-11 11:35:15 +0100 | [diff] [blame] | 10649 | spec->dig_out_type = spec->autocfg.dig_out_type[0]; |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 10650 | } |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10651 | if (spec->autocfg.dig_in_pin) |
| 10652 | spec->dig_in_nid = ALC262_DIGIN_NID; |
| 10653 | |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 10654 | if (spec->kctls.list) |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 10655 | add_mixer(spec, spec->kctls.list); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10656 | |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 10657 | add_verb(spec, alc262_volume_init_verbs); |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 10658 | spec->num_mux_defs = 1; |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 10659 | spec->input_mux = &spec->private_imux[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10660 | |
Takashi Iwai | 776e184 | 2007-08-29 15:07:11 +0200 | [diff] [blame] | 10661 | err = alc_auto_add_mic_boost(codec); |
| 10662 | if (err < 0) |
| 10663 | return err; |
| 10664 | |
Takashi Iwai | e044c39 | 2008-10-27 16:56:24 +0100 | [diff] [blame] | 10665 | store_pin_configs(codec); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10666 | return 1; |
| 10667 | } |
| 10668 | |
| 10669 | #define alc262_auto_init_multi_out alc882_auto_init_multi_out |
| 10670 | #define alc262_auto_init_hp_out alc882_auto_init_hp_out |
| 10671 | #define alc262_auto_init_analog_input alc882_auto_init_analog_input |
Takashi Iwai | f511b01 | 2008-08-15 16:46:42 +0200 | [diff] [blame] | 10672 | #define alc262_auto_init_input_src alc882_auto_init_input_src |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10673 | |
| 10674 | |
| 10675 | /* init callback for auto-configuration model -- overriding the default init */ |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 10676 | static void alc262_auto_init(struct hda_codec *codec) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10677 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 10678 | struct alc_spec *spec = codec->spec; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10679 | alc262_auto_init_multi_out(codec); |
| 10680 | alc262_auto_init_hp_out(codec); |
| 10681 | alc262_auto_init_analog_input(codec); |
Takashi Iwai | f511b01 | 2008-08-15 16:46:42 +0200 | [diff] [blame] | 10682 | alc262_auto_init_input_src(codec); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 10683 | if (spec->unsol_event) |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 10684 | alc_inithook(codec); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10685 | } |
| 10686 | |
| 10687 | /* |
| 10688 | * configuration and preset |
| 10689 | */ |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 10690 | static const char *alc262_models[ALC262_MODEL_LAST] = { |
| 10691 | [ALC262_BASIC] = "basic", |
| 10692 | [ALC262_HIPPO] = "hippo", |
| 10693 | [ALC262_HIPPO_1] = "hippo_1", |
| 10694 | [ALC262_FUJITSU] = "fujitsu", |
| 10695 | [ALC262_HP_BPC] = "hp-bpc", |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 10696 | [ALC262_HP_BPC_D7000_WL]= "hp-bpc-d7000", |
Takashi Iwai | 61dc35d | 2007-11-14 12:26:44 +0100 | [diff] [blame] | 10697 | [ALC262_HP_TC_T5735] = "hp-tc-t5735", |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 10698 | [ALC262_HP_RP5700] = "hp-rp5700", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 10699 | [ALC262_BENQ_ED8] = "benq", |
Takashi Iwai | 0f40502 | 2007-07-06 12:24:11 +0200 | [diff] [blame] | 10700 | [ALC262_BENQ_T31] = "benq-t31", |
| 10701 | [ALC262_SONY_ASSAMD] = "sony-assamd", |
Takashi Iwai | 2922c9a | 2008-08-27 18:12:42 +0200 | [diff] [blame] | 10702 | [ALC262_TOSHIBA_S06] = "toshiba-s06", |
Hiroshi Miura | 9f99a63 | 2008-08-28 16:09:06 +0200 | [diff] [blame] | 10703 | [ALC262_TOSHIBA_RX1] = "toshiba-rx1", |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 10704 | [ALC262_ULTRA] = "ultra", |
Jiang zhe | 0e31daf | 2008-03-20 12:12:39 +0100 | [diff] [blame] | 10705 | [ALC262_LENOVO_3000] = "lenovo-3000", |
Pascal Terjan | e8f9ae2 | 2008-08-04 14:36:05 +0200 | [diff] [blame] | 10706 | [ALC262_NEC] = "nec", |
Tony Vroon | ba340e8 | 2009-02-02 19:01:30 +0000 | [diff] [blame] | 10707 | [ALC262_TYAN] = "tyan", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 10708 | [ALC262_AUTO] = "auto", |
| 10709 | }; |
| 10710 | |
| 10711 | static struct snd_pci_quirk alc262_cfg_tbl[] = { |
| 10712 | SND_PCI_QUIRK(0x1002, 0x437b, "Hippo", ALC262_HIPPO), |
Pascal Terjan | e8f9ae2 | 2008-08-04 14:36:05 +0200 | [diff] [blame] | 10713 | SND_PCI_QUIRK(0x1033, 0x8895, "NEC Versa S9100", ALC262_NEC), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 10714 | SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x1200, "HP xw series", |
| 10715 | ALC262_HP_BPC), |
| 10716 | SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x1300, "HP xw series", |
| 10717 | ALC262_HP_BPC), |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 10718 | SND_PCI_QUIRK(0x103c, 0x2800, "HP D7000", ALC262_HP_BPC_D7000_WL), |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 10719 | SND_PCI_QUIRK(0x103c, 0x2801, "HP D7000", ALC262_HP_BPC_D7000_WF), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 10720 | SND_PCI_QUIRK(0x103c, 0x2802, "HP D7000", ALC262_HP_BPC_D7000_WL), |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 10721 | SND_PCI_QUIRK(0x103c, 0x2803, "HP D7000", ALC262_HP_BPC_D7000_WF), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 10722 | SND_PCI_QUIRK(0x103c, 0x2804, "HP D7000", ALC262_HP_BPC_D7000_WL), |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 10723 | SND_PCI_QUIRK(0x103c, 0x2805, "HP D7000", ALC262_HP_BPC_D7000_WF), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 10724 | SND_PCI_QUIRK(0x103c, 0x2806, "HP D7000", ALC262_HP_BPC_D7000_WL), |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 10725 | SND_PCI_QUIRK(0x103c, 0x2807, "HP D7000", ALC262_HP_BPC_D7000_WF), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 10726 | SND_PCI_QUIRK(0x103c, 0x280c, "HP xw4400", ALC262_HP_BPC), |
| 10727 | SND_PCI_QUIRK(0x103c, 0x3014, "HP xw6400", ALC262_HP_BPC), |
| 10728 | SND_PCI_QUIRK(0x103c, 0x3015, "HP xw8400", ALC262_HP_BPC), |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 10729 | SND_PCI_QUIRK(0x103c, 0x302f, "HP Thin Client T5735", |
| 10730 | ALC262_HP_TC_T5735), |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 10731 | SND_PCI_QUIRK(0x103c, 0x2817, "HP RP5700", ALC262_HP_RP5700), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 10732 | SND_PCI_QUIRK(0x104d, 0x1f00, "Sony ASSAMD", ALC262_SONY_ASSAMD), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 10733 | SND_PCI_QUIRK(0x104d, 0x8203, "Sony UX-90", ALC262_HIPPO), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 10734 | SND_PCI_QUIRK(0x104d, 0x820f, "Sony ASSAMD", ALC262_SONY_ASSAMD), |
| 10735 | SND_PCI_QUIRK(0x104d, 0x900e, "Sony ASSAMD", ALC262_SONY_ASSAMD), |
| 10736 | SND_PCI_QUIRK(0x104d, 0x9015, "Sony 0x9015", ALC262_SONY_ASSAMD), |
Takashi Iwai | 57a5ef4 | 2008-11-28 14:46:28 +0100 | [diff] [blame] | 10737 | SND_PCI_QUIRK(0x104d, 0x9033, "Sony VAIO VGN-SR19XN", |
| 10738 | ALC262_SONY_ASSAMD), |
Akio Idehara | 36ca6e1 | 2008-06-09 22:57:40 +0900 | [diff] [blame] | 10739 | SND_PCI_QUIRK(0x1179, 0x0001, "Toshiba dynabook SS RX1", |
Hiroshi Miura | 9f99a63 | 2008-08-28 16:09:06 +0200 | [diff] [blame] | 10740 | ALC262_TOSHIBA_RX1), |
Kailang Yang | 80ffe86 | 2008-10-15 11:23:27 +0200 | [diff] [blame] | 10741 | SND_PCI_QUIRK(0x1179, 0xff7b, "Toshiba S06", ALC262_TOSHIBA_S06), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 10742 | SND_PCI_QUIRK(0x10cf, 0x1397, "Fujitsu", ALC262_FUJITSU), |
Tony Vroon | 3f1eeae | 2008-02-25 16:44:13 +0100 | [diff] [blame] | 10743 | SND_PCI_QUIRK(0x10cf, 0x142d, "Fujitsu Lifebook E8410", ALC262_FUJITSU), |
Tony Vroon | ba340e8 | 2009-02-02 19:01:30 +0000 | [diff] [blame] | 10744 | SND_PCI_QUIRK(0x10f1, 0x2915, "Tyan Thunder n6650W", ALC262_TYAN), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 10745 | SND_PCI_QUIRK_MASK(0x144d, 0xff00, 0xc032, "Samsung Q1", |
| 10746 | ALC262_ULTRA), |
Luke Yelavich | 3e420e7 | 2008-12-16 12:37:47 +1100 | [diff] [blame] | 10747 | SND_PCI_QUIRK(0x144d, 0xc510, "Samsung Q45", ALC262_HIPPO), |
Jiang zhe | 0e31daf | 2008-03-20 12:12:39 +0100 | [diff] [blame] | 10748 | SND_PCI_QUIRK(0x17aa, 0x384e, "Lenovo 3000 y410", ALC262_LENOVO_3000), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 10749 | SND_PCI_QUIRK(0x17ff, 0x0560, "Benq ED8", ALC262_BENQ_ED8), |
Kailang Yang | 83c3421 | 2007-07-05 11:43:05 +0200 | [diff] [blame] | 10750 | SND_PCI_QUIRK(0x17ff, 0x058d, "Benq T31-16", ALC262_BENQ_T31), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 10751 | SND_PCI_QUIRK(0x17ff, 0x058f, "Benq Hippo", ALC262_HIPPO_1), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10752 | {} |
| 10753 | }; |
| 10754 | |
| 10755 | static struct alc_config_preset alc262_presets[] = { |
| 10756 | [ALC262_BASIC] = { |
| 10757 | .mixers = { alc262_base_mixer }, |
| 10758 | .init_verbs = { alc262_init_verbs }, |
| 10759 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 10760 | .dac_nids = alc262_dac_nids, |
| 10761 | .hp_nid = 0x03, |
| 10762 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 10763 | .channel_mode = alc262_modes, |
Takashi Iwai | a3bcba3 | 2005-12-06 19:05:29 +0100 | [diff] [blame] | 10764 | .input_mux = &alc262_capture_source, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10765 | }, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 10766 | [ALC262_HIPPO] = { |
| 10767 | .mixers = { alc262_base_mixer }, |
| 10768 | .init_verbs = { alc262_init_verbs, alc262_hippo_unsol_verbs}, |
| 10769 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 10770 | .dac_nids = alc262_dac_nids, |
| 10771 | .hp_nid = 0x03, |
| 10772 | .dig_out_nid = ALC262_DIGOUT_NID, |
| 10773 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 10774 | .channel_mode = alc262_modes, |
| 10775 | .input_mux = &alc262_capture_source, |
| 10776 | .unsol_event = alc262_hippo_unsol_event, |
Takashi Iwai | 5b31954 | 2007-07-26 11:49:22 +0200 | [diff] [blame] | 10777 | .init_hook = alc262_hippo_automute, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 10778 | }, |
| 10779 | [ALC262_HIPPO_1] = { |
| 10780 | .mixers = { alc262_hippo1_mixer }, |
| 10781 | .init_verbs = { alc262_init_verbs, alc262_hippo1_unsol_verbs}, |
| 10782 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 10783 | .dac_nids = alc262_dac_nids, |
| 10784 | .hp_nid = 0x02, |
| 10785 | .dig_out_nid = ALC262_DIGOUT_NID, |
| 10786 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 10787 | .channel_mode = alc262_modes, |
| 10788 | .input_mux = &alc262_capture_source, |
| 10789 | .unsol_event = alc262_hippo1_unsol_event, |
Takashi Iwai | 5b31954 | 2007-07-26 11:49:22 +0200 | [diff] [blame] | 10790 | .init_hook = alc262_hippo1_automute, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 10791 | }, |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 10792 | [ALC262_FUJITSU] = { |
| 10793 | .mixers = { alc262_fujitsu_mixer }, |
Takashi Iwai | 39d3ed3 | 2007-10-12 15:03:48 +0200 | [diff] [blame] | 10794 | .init_verbs = { alc262_init_verbs, alc262_EAPD_verbs, |
| 10795 | alc262_fujitsu_unsol_verbs }, |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 10796 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 10797 | .dac_nids = alc262_dac_nids, |
| 10798 | .hp_nid = 0x03, |
| 10799 | .dig_out_nid = ALC262_DIGOUT_NID, |
| 10800 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 10801 | .channel_mode = alc262_modes, |
| 10802 | .input_mux = &alc262_fujitsu_capture_source, |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 10803 | .unsol_event = alc262_fujitsu_unsol_event, |
Takashi Iwai | ebc7a40 | 2008-05-20 09:23:05 +0200 | [diff] [blame] | 10804 | .init_hook = alc262_fujitsu_init_hook, |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 10805 | }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10806 | [ALC262_HP_BPC] = { |
| 10807 | .mixers = { alc262_HP_BPC_mixer }, |
| 10808 | .init_verbs = { alc262_HP_BPC_init_verbs }, |
| 10809 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 10810 | .dac_nids = alc262_dac_nids, |
| 10811 | .hp_nid = 0x03, |
| 10812 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 10813 | .channel_mode = alc262_modes, |
| 10814 | .input_mux = &alc262_HP_capture_source, |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 10815 | .unsol_event = alc262_hp_bpc_unsol_event, |
| 10816 | .init_hook = alc262_hp_bpc_automute, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10817 | }, |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 10818 | [ALC262_HP_BPC_D7000_WF] = { |
| 10819 | .mixers = { alc262_HP_BPC_WildWest_mixer }, |
| 10820 | .init_verbs = { alc262_HP_BPC_WildWest_init_verbs }, |
| 10821 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 10822 | .dac_nids = alc262_dac_nids, |
| 10823 | .hp_nid = 0x03, |
| 10824 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 10825 | .channel_mode = alc262_modes, |
zhejiang | accbe49 | 2007-08-31 12:36:05 +0200 | [diff] [blame] | 10826 | .input_mux = &alc262_HP_D7000_capture_source, |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 10827 | .unsol_event = alc262_hp_wildwest_unsol_event, |
| 10828 | .init_hook = alc262_hp_wildwest_automute, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10829 | }, |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 10830 | [ALC262_HP_BPC_D7000_WL] = { |
| 10831 | .mixers = { alc262_HP_BPC_WildWest_mixer, |
| 10832 | alc262_HP_BPC_WildWest_option_mixer }, |
| 10833 | .init_verbs = { alc262_HP_BPC_WildWest_init_verbs }, |
| 10834 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 10835 | .dac_nids = alc262_dac_nids, |
| 10836 | .hp_nid = 0x03, |
| 10837 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 10838 | .channel_mode = alc262_modes, |
zhejiang | accbe49 | 2007-08-31 12:36:05 +0200 | [diff] [blame] | 10839 | .input_mux = &alc262_HP_D7000_capture_source, |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 10840 | .unsol_event = alc262_hp_wildwest_unsol_event, |
| 10841 | .init_hook = alc262_hp_wildwest_automute, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10842 | }, |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 10843 | [ALC262_HP_TC_T5735] = { |
| 10844 | .mixers = { alc262_hp_t5735_mixer }, |
| 10845 | .init_verbs = { alc262_init_verbs, alc262_hp_t5735_verbs }, |
| 10846 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 10847 | .dac_nids = alc262_dac_nids, |
| 10848 | .hp_nid = 0x03, |
| 10849 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 10850 | .channel_mode = alc262_modes, |
| 10851 | .input_mux = &alc262_capture_source, |
| 10852 | .unsol_event = alc262_hp_t5735_unsol_event, |
| 10853 | .init_hook = alc262_hp_t5735_init_hook, |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 10854 | }, |
| 10855 | [ALC262_HP_RP5700] = { |
| 10856 | .mixers = { alc262_hp_rp5700_mixer }, |
| 10857 | .init_verbs = { alc262_init_verbs, alc262_hp_rp5700_verbs }, |
| 10858 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 10859 | .dac_nids = alc262_dac_nids, |
| 10860 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 10861 | .channel_mode = alc262_modes, |
| 10862 | .input_mux = &alc262_hp_rp5700_capture_source, |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 10863 | }, |
Takashi Iwai | 304dcaa | 2006-07-25 14:51:16 +0200 | [diff] [blame] | 10864 | [ALC262_BENQ_ED8] = { |
| 10865 | .mixers = { alc262_base_mixer }, |
| 10866 | .init_verbs = { alc262_init_verbs, alc262_EAPD_verbs }, |
| 10867 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 10868 | .dac_nids = alc262_dac_nids, |
| 10869 | .hp_nid = 0x03, |
| 10870 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 10871 | .channel_mode = alc262_modes, |
| 10872 | .input_mux = &alc262_capture_source, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10873 | }, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 10874 | [ALC262_SONY_ASSAMD] = { |
| 10875 | .mixers = { alc262_sony_mixer }, |
| 10876 | .init_verbs = { alc262_init_verbs, alc262_sony_unsol_verbs}, |
| 10877 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 10878 | .dac_nids = alc262_dac_nids, |
| 10879 | .hp_nid = 0x02, |
| 10880 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 10881 | .channel_mode = alc262_modes, |
| 10882 | .input_mux = &alc262_capture_source, |
| 10883 | .unsol_event = alc262_hippo_unsol_event, |
Takashi Iwai | 5b31954 | 2007-07-26 11:49:22 +0200 | [diff] [blame] | 10884 | .init_hook = alc262_hippo_automute, |
Kailang Yang | 83c3421 | 2007-07-05 11:43:05 +0200 | [diff] [blame] | 10885 | }, |
| 10886 | [ALC262_BENQ_T31] = { |
| 10887 | .mixers = { alc262_benq_t31_mixer }, |
| 10888 | .init_verbs = { alc262_init_verbs, alc262_benq_t31_EAPD_verbs, alc262_hippo_unsol_verbs }, |
| 10889 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 10890 | .dac_nids = alc262_dac_nids, |
| 10891 | .hp_nid = 0x03, |
| 10892 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 10893 | .channel_mode = alc262_modes, |
| 10894 | .input_mux = &alc262_capture_source, |
| 10895 | .unsol_event = alc262_hippo_unsol_event, |
Takashi Iwai | 5b31954 | 2007-07-26 11:49:22 +0200 | [diff] [blame] | 10896 | .init_hook = alc262_hippo_automute, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 10897 | }, |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 10898 | [ALC262_ULTRA] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 10899 | .mixers = { alc262_ultra_mixer }, |
| 10900 | .cap_mixer = alc262_ultra_capture_mixer, |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 10901 | .init_verbs = { alc262_ultra_verbs }, |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 10902 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 10903 | .dac_nids = alc262_dac_nids, |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 10904 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 10905 | .channel_mode = alc262_modes, |
| 10906 | .input_mux = &alc262_ultra_capture_source, |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 10907 | .adc_nids = alc262_adc_nids, /* ADC0 */ |
| 10908 | .capsrc_nids = alc262_capsrc_nids, |
| 10909 | .num_adc_nids = 1, /* single ADC */ |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 10910 | .unsol_event = alc262_ultra_unsol_event, |
| 10911 | .init_hook = alc262_ultra_automute, |
| 10912 | }, |
Jiang zhe | 0e31daf | 2008-03-20 12:12:39 +0100 | [diff] [blame] | 10913 | [ALC262_LENOVO_3000] = { |
| 10914 | .mixers = { alc262_lenovo_3000_mixer }, |
| 10915 | .init_verbs = { alc262_init_verbs, alc262_EAPD_verbs, |
| 10916 | alc262_lenovo_3000_unsol_verbs }, |
| 10917 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 10918 | .dac_nids = alc262_dac_nids, |
| 10919 | .hp_nid = 0x03, |
| 10920 | .dig_out_nid = ALC262_DIGOUT_NID, |
| 10921 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 10922 | .channel_mode = alc262_modes, |
| 10923 | .input_mux = &alc262_fujitsu_capture_source, |
| 10924 | .unsol_event = alc262_lenovo_3000_unsol_event, |
| 10925 | }, |
Pascal Terjan | e8f9ae2 | 2008-08-04 14:36:05 +0200 | [diff] [blame] | 10926 | [ALC262_NEC] = { |
| 10927 | .mixers = { alc262_nec_mixer }, |
| 10928 | .init_verbs = { alc262_nec_verbs }, |
| 10929 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 10930 | .dac_nids = alc262_dac_nids, |
| 10931 | .hp_nid = 0x03, |
| 10932 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 10933 | .channel_mode = alc262_modes, |
| 10934 | .input_mux = &alc262_capture_source, |
| 10935 | }, |
Kailang Yang | 4e555fe | 2008-08-26 13:05:55 +0200 | [diff] [blame] | 10936 | [ALC262_TOSHIBA_S06] = { |
| 10937 | .mixers = { alc262_toshiba_s06_mixer }, |
| 10938 | .init_verbs = { alc262_init_verbs, alc262_toshiba_s06_verbs, |
| 10939 | alc262_eapd_verbs }, |
| 10940 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 10941 | .capsrc_nids = alc262_dmic_capsrc_nids, |
| 10942 | .dac_nids = alc262_dac_nids, |
| 10943 | .adc_nids = alc262_dmic_adc_nids, /* ADC0 */ |
| 10944 | .dig_out_nid = ALC262_DIGOUT_NID, |
| 10945 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 10946 | .channel_mode = alc262_modes, |
| 10947 | .input_mux = &alc262_dmic_capture_source, |
| 10948 | .unsol_event = alc262_toshiba_s06_unsol_event, |
| 10949 | .init_hook = alc262_toshiba_s06_init_hook, |
| 10950 | }, |
Hiroshi Miura | 9f99a63 | 2008-08-28 16:09:06 +0200 | [diff] [blame] | 10951 | [ALC262_TOSHIBA_RX1] = { |
| 10952 | .mixers = { alc262_toshiba_rx1_mixer }, |
| 10953 | .init_verbs = { alc262_init_verbs, alc262_toshiba_rx1_unsol_verbs }, |
| 10954 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 10955 | .dac_nids = alc262_dac_nids, |
| 10956 | .hp_nid = 0x03, |
| 10957 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 10958 | .channel_mode = alc262_modes, |
| 10959 | .input_mux = &alc262_capture_source, |
| 10960 | .unsol_event = alc262_hippo_unsol_event, |
| 10961 | .init_hook = alc262_hippo_automute, |
| 10962 | }, |
Tony Vroon | ba340e8 | 2009-02-02 19:01:30 +0000 | [diff] [blame] | 10963 | [ALC262_TYAN] = { |
| 10964 | .mixers = { alc262_tyan_mixer }, |
| 10965 | .init_verbs = { alc262_init_verbs, alc262_tyan_verbs}, |
| 10966 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 10967 | .dac_nids = alc262_dac_nids, |
| 10968 | .hp_nid = 0x02, |
| 10969 | .dig_out_nid = ALC262_DIGOUT_NID, |
| 10970 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 10971 | .channel_mode = alc262_modes, |
| 10972 | .input_mux = &alc262_capture_source, |
| 10973 | .unsol_event = alc262_tyan_unsol_event, |
| 10974 | .init_hook = alc262_tyan_automute, |
| 10975 | }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10976 | }; |
| 10977 | |
| 10978 | static int patch_alc262(struct hda_codec *codec) |
| 10979 | { |
| 10980 | struct alc_spec *spec; |
| 10981 | int board_config; |
| 10982 | int err; |
| 10983 | |
Robert P. J. Day | dc041e0 | 2006-12-19 14:44:15 +0100 | [diff] [blame] | 10984 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10985 | if (spec == NULL) |
| 10986 | return -ENOMEM; |
| 10987 | |
| 10988 | codec->spec = spec; |
| 10989 | #if 0 |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10990 | /* pshou 07/11/05 set a zero PCM sample to DAC when FIFO is |
| 10991 | * under-run |
| 10992 | */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10993 | { |
| 10994 | int tmp; |
| 10995 | snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_COEF_INDEX, 7); |
| 10996 | tmp = snd_hda_codec_read(codec, 0x20, 0, AC_VERB_GET_PROC_COEF, 0); |
| 10997 | snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_COEF_INDEX, 7); |
| 10998 | snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_PROC_COEF, tmp | 0x80); |
| 10999 | } |
| 11000 | #endif |
| 11001 | |
Takashi Iwai | 2c3bf9a | 2008-06-04 12:39:38 +0200 | [diff] [blame] | 11002 | alc_fix_pll_init(codec, 0x20, 0x0a, 10); |
| 11003 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 11004 | board_config = snd_hda_check_board_config(codec, ALC262_MODEL_LAST, |
| 11005 | alc262_models, |
| 11006 | alc262_cfg_tbl); |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 11007 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 11008 | if (board_config < 0) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11009 | printk(KERN_INFO "hda_codec: Unknown model for ALC262, " |
| 11010 | "trying auto-probe from BIOS...\n"); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11011 | board_config = ALC262_AUTO; |
| 11012 | } |
| 11013 | |
| 11014 | if (board_config == ALC262_AUTO) { |
| 11015 | /* automatic parse from the BIOS config */ |
| 11016 | err = alc262_parse_auto_config(codec); |
| 11017 | if (err < 0) { |
| 11018 | alc_free(codec); |
| 11019 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11020 | } else if (!err) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11021 | printk(KERN_INFO |
| 11022 | "hda_codec: Cannot set up configuration " |
| 11023 | "from BIOS. Using base mode...\n"); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11024 | board_config = ALC262_BASIC; |
| 11025 | } |
| 11026 | } |
| 11027 | |
Kusanagi Kouichi | 680cd53 | 2009-02-05 00:00:58 +0900 | [diff] [blame] | 11028 | err = snd_hda_attach_beep_device(codec, 0x1); |
| 11029 | if (err < 0) { |
| 11030 | alc_free(codec); |
| 11031 | return err; |
| 11032 | } |
| 11033 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11034 | if (board_config != ALC262_AUTO) |
| 11035 | setup_preset(spec, &alc262_presets[board_config]); |
| 11036 | |
| 11037 | spec->stream_name_analog = "ALC262 Analog"; |
| 11038 | spec->stream_analog_playback = &alc262_pcm_analog_playback; |
| 11039 | spec->stream_analog_capture = &alc262_pcm_analog_capture; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 11040 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11041 | spec->stream_name_digital = "ALC262 Digital"; |
| 11042 | spec->stream_digital_playback = &alc262_pcm_digital_playback; |
| 11043 | spec->stream_digital_capture = &alc262_pcm_digital_capture; |
| 11044 | |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 11045 | spec->capture_style = CAPT_MIX; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11046 | if (!spec->adc_nids && spec->input_mux) { |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11047 | /* check whether NID 0x07 is valid */ |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 11048 | unsigned int wcap = get_wcaps(codec, 0x07); |
| 11049 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11050 | /* get type */ |
| 11051 | wcap = (wcap & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11052 | if (wcap != AC_WID_AUD_IN) { |
| 11053 | spec->adc_nids = alc262_adc_nids_alt; |
| 11054 | spec->num_adc_nids = ARRAY_SIZE(alc262_adc_nids_alt); |
Takashi Iwai | 88c71a9 | 2008-02-14 17:27:17 +0100 | [diff] [blame] | 11055 | spec->capsrc_nids = alc262_capsrc_nids_alt; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11056 | } else { |
| 11057 | spec->adc_nids = alc262_adc_nids; |
| 11058 | spec->num_adc_nids = ARRAY_SIZE(alc262_adc_nids); |
Takashi Iwai | 88c71a9 | 2008-02-14 17:27:17 +0100 | [diff] [blame] | 11059 | spec->capsrc_nids = alc262_capsrc_nids; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11060 | } |
| 11061 | } |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 11062 | if (!spec->cap_mixer && !spec->no_analog) |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 11063 | set_capture_mixer(spec); |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 11064 | set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11065 | |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 11066 | spec->vmaster_nid = 0x0c; |
| 11067 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11068 | codec->patch_ops = alc_patch_ops; |
| 11069 | if (board_config == ALC262_AUTO) |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 11070 | spec->init_hook = alc262_auto_init; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 11071 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 11072 | if (!spec->loopback.amplist) |
| 11073 | spec->loopback.amplist = alc262_loopbacks; |
| 11074 | #endif |
Takashi Iwai | daead53 | 2008-11-28 12:55:36 +0100 | [diff] [blame] | 11075 | codec->proc_widget_hook = print_realtek_coef; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 11076 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11077 | return 0; |
| 11078 | } |
| 11079 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11080 | /* |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11081 | * ALC268 channel source setting (2 channel) |
| 11082 | */ |
| 11083 | #define ALC268_DIGOUT_NID ALC880_DIGOUT_NID |
| 11084 | #define alc268_modes alc260_modes |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 11085 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11086 | static hda_nid_t alc268_dac_nids[2] = { |
| 11087 | /* front, hp */ |
| 11088 | 0x02, 0x03 |
| 11089 | }; |
| 11090 | |
| 11091 | static hda_nid_t alc268_adc_nids[2] = { |
| 11092 | /* ADC0-1 */ |
| 11093 | 0x08, 0x07 |
| 11094 | }; |
| 11095 | |
| 11096 | static hda_nid_t alc268_adc_nids_alt[1] = { |
| 11097 | /* ADC0 */ |
| 11098 | 0x08 |
| 11099 | }; |
| 11100 | |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 11101 | static hda_nid_t alc268_capsrc_nids[2] = { 0x23, 0x24 }; |
| 11102 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11103 | static struct snd_kcontrol_new alc268_base_mixer[] = { |
| 11104 | /* output mixer control */ |
| 11105 | HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT), |
| 11106 | HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 11107 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x3, 0x0, HDA_OUTPUT), |
| 11108 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
Takashi Iwai | 33bf17a | 2007-08-21 11:51:42 +0200 | [diff] [blame] | 11109 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 11110 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
| 11111 | HDA_CODEC_VOLUME("Line In Boost", 0x1a, 0, HDA_INPUT), |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11112 | { } |
| 11113 | }; |
| 11114 | |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 11115 | /* bind Beep switches of both NID 0x0f and 0x10 */ |
| 11116 | static struct hda_bind_ctls alc268_bind_beep_sw = { |
| 11117 | .ops = &snd_hda_bind_sw, |
| 11118 | .values = { |
| 11119 | HDA_COMPOSE_AMP_VAL(0x0f, 3, 1, HDA_INPUT), |
| 11120 | HDA_COMPOSE_AMP_VAL(0x10, 3, 1, HDA_INPUT), |
| 11121 | 0 |
| 11122 | }, |
| 11123 | }; |
| 11124 | |
| 11125 | static struct snd_kcontrol_new alc268_beep_mixer[] = { |
| 11126 | HDA_CODEC_VOLUME("Beep Playback Volume", 0x1d, 0x0, HDA_INPUT), |
| 11127 | HDA_BIND_SW("Beep Playback Switch", &alc268_bind_beep_sw), |
| 11128 | { } |
| 11129 | }; |
| 11130 | |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 11131 | static struct hda_verb alc268_eapd_verbs[] = { |
| 11132 | {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 11133 | {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 11134 | { } |
| 11135 | }; |
| 11136 | |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 11137 | /* Toshiba specific */ |
| 11138 | #define alc268_toshiba_automute alc262_hippo_automute |
| 11139 | |
| 11140 | static struct hda_verb alc268_toshiba_verbs[] = { |
| 11141 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 11142 | { } /* end */ |
| 11143 | }; |
| 11144 | |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 11145 | static struct hda_input_mux alc268_acer_lc_capture_source = { |
| 11146 | .num_items = 2, |
| 11147 | .items = { |
| 11148 | { "i-Mic", 0x6 }, |
| 11149 | { "E-Mic", 0x0 }, |
| 11150 | }, |
| 11151 | }; |
| 11152 | |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 11153 | /* Acer specific */ |
Takashi Iwai | 889c439 | 2007-08-23 18:56:52 +0200 | [diff] [blame] | 11154 | /* bind volumes of both NID 0x02 and 0x03 */ |
Takashi Iwai | 6bc9685 | 2007-08-17 09:02:12 +0200 | [diff] [blame] | 11155 | static struct hda_bind_ctls alc268_acer_bind_master_vol = { |
| 11156 | .ops = &snd_hda_bind_vol, |
| 11157 | .values = { |
| 11158 | HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT), |
| 11159 | HDA_COMPOSE_AMP_VAL(0x03, 3, 0, HDA_OUTPUT), |
| 11160 | 0 |
| 11161 | }, |
| 11162 | }; |
| 11163 | |
Takashi Iwai | 889c439 | 2007-08-23 18:56:52 +0200 | [diff] [blame] | 11164 | /* mute/unmute internal speaker according to the hp jack and mute state */ |
| 11165 | static void alc268_acer_automute(struct hda_codec *codec, int force) |
| 11166 | { |
| 11167 | struct alc_spec *spec = codec->spec; |
| 11168 | unsigned int mute; |
| 11169 | |
| 11170 | if (force || !spec->sense_updated) { |
| 11171 | unsigned int present; |
| 11172 | present = snd_hda_codec_read(codec, 0x14, 0, |
| 11173 | AC_VERB_GET_PIN_SENSE, 0); |
| 11174 | spec->jack_present = (present & 0x80000000) != 0; |
| 11175 | spec->sense_updated = 1; |
| 11176 | } |
| 11177 | if (spec->jack_present) |
| 11178 | mute = HDA_AMP_MUTE; /* mute internal speaker */ |
| 11179 | else /* unmute internal speaker if necessary */ |
| 11180 | mute = snd_hda_codec_amp_read(codec, 0x14, 0, HDA_OUTPUT, 0); |
| 11181 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 11182 | HDA_AMP_MUTE, mute); |
| 11183 | } |
| 11184 | |
| 11185 | |
| 11186 | /* bind hp and internal speaker mute (with plug check) */ |
| 11187 | static int alc268_acer_master_sw_put(struct snd_kcontrol *kcontrol, |
| 11188 | struct snd_ctl_elem_value *ucontrol) |
| 11189 | { |
| 11190 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 11191 | long *valp = ucontrol->value.integer.value; |
| 11192 | int change; |
| 11193 | |
| 11194 | change = snd_hda_codec_amp_update(codec, 0x14, 0, HDA_OUTPUT, 0, |
| 11195 | HDA_AMP_MUTE, |
| 11196 | valp[0] ? 0 : HDA_AMP_MUTE); |
| 11197 | change |= snd_hda_codec_amp_update(codec, 0x14, 1, HDA_OUTPUT, 0, |
| 11198 | HDA_AMP_MUTE, |
| 11199 | valp[1] ? 0 : HDA_AMP_MUTE); |
| 11200 | if (change) |
| 11201 | alc268_acer_automute(codec, 0); |
| 11202 | return change; |
| 11203 | } |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 11204 | |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 11205 | static struct snd_kcontrol_new alc268_acer_aspire_one_mixer[] = { |
| 11206 | /* output mixer control */ |
| 11207 | HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol), |
| 11208 | { |
| 11209 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 11210 | .name = "Master Playback Switch", |
| 11211 | .info = snd_hda_mixer_amp_switch_info, |
| 11212 | .get = snd_hda_mixer_amp_switch_get, |
| 11213 | .put = alc268_acer_master_sw_put, |
| 11214 | .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), |
| 11215 | }, |
| 11216 | HDA_CODEC_VOLUME("Mic Boost Capture Volume", 0x18, 0, HDA_INPUT), |
| 11217 | { } |
| 11218 | }; |
| 11219 | |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 11220 | static struct snd_kcontrol_new alc268_acer_mixer[] = { |
| 11221 | /* output mixer control */ |
| 11222 | HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol), |
| 11223 | { |
| 11224 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 11225 | .name = "Master Playback Switch", |
| 11226 | .info = snd_hda_mixer_amp_switch_info, |
| 11227 | .get = snd_hda_mixer_amp_switch_get, |
| 11228 | .put = alc268_acer_master_sw_put, |
| 11229 | .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), |
| 11230 | }, |
Takashi Iwai | 33bf17a | 2007-08-21 11:51:42 +0200 | [diff] [blame] | 11231 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 11232 | HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT), |
| 11233 | HDA_CODEC_VOLUME("Line In Boost", 0x1a, 0, HDA_INPUT), |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 11234 | { } |
| 11235 | }; |
| 11236 | |
Takashi Iwai | c238b4f | 2008-11-05 14:57:20 +0100 | [diff] [blame] | 11237 | static struct snd_kcontrol_new alc268_acer_dmic_mixer[] = { |
| 11238 | /* output mixer control */ |
| 11239 | HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol), |
| 11240 | { |
| 11241 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 11242 | .name = "Master Playback Switch", |
| 11243 | .info = snd_hda_mixer_amp_switch_info, |
| 11244 | .get = snd_hda_mixer_amp_switch_get, |
| 11245 | .put = alc268_acer_master_sw_put, |
| 11246 | .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), |
| 11247 | }, |
| 11248 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 11249 | HDA_CODEC_VOLUME("Line In Boost", 0x1a, 0, HDA_INPUT), |
| 11250 | { } |
| 11251 | }; |
| 11252 | |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 11253 | static struct hda_verb alc268_acer_aspire_one_verbs[] = { |
| 11254 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 11255 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 11256 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 11257 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 11258 | {0x23, AC_VERB_SET_CONNECT_SEL, 0x06}, |
| 11259 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, 0xa017}, |
| 11260 | { } |
| 11261 | }; |
| 11262 | |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 11263 | static struct hda_verb alc268_acer_verbs[] = { |
Takashi Iwai | 0ccb541 | 2008-03-06 16:58:35 +0100 | [diff] [blame] | 11264 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, /* internal dmic? */ |
| 11265 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 11266 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 11267 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | 0ccb541 | 2008-03-06 16:58:35 +0100 | [diff] [blame] | 11268 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 11269 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 11270 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 11271 | { } |
| 11272 | }; |
| 11273 | |
| 11274 | /* unsolicited event for HP jack sensing */ |
| 11275 | static void alc268_toshiba_unsol_event(struct hda_codec *codec, |
| 11276 | unsigned int res) |
| 11277 | { |
Takashi Iwai | 889c439 | 2007-08-23 18:56:52 +0200 | [diff] [blame] | 11278 | if ((res >> 26) != ALC880_HP_EVENT) |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 11279 | return; |
| 11280 | alc268_toshiba_automute(codec); |
| 11281 | } |
| 11282 | |
| 11283 | static void alc268_acer_unsol_event(struct hda_codec *codec, |
| 11284 | unsigned int res) |
| 11285 | { |
Takashi Iwai | 889c439 | 2007-08-23 18:56:52 +0200 | [diff] [blame] | 11286 | if ((res >> 26) != ALC880_HP_EVENT) |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 11287 | return; |
| 11288 | alc268_acer_automute(codec, 1); |
| 11289 | } |
| 11290 | |
Takashi Iwai | 889c439 | 2007-08-23 18:56:52 +0200 | [diff] [blame] | 11291 | static void alc268_acer_init_hook(struct hda_codec *codec) |
| 11292 | { |
| 11293 | alc268_acer_automute(codec, 1); |
| 11294 | } |
| 11295 | |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 11296 | /* toggle speaker-output according to the hp-jack state */ |
| 11297 | static void alc268_aspire_one_speaker_automute(struct hda_codec *codec) |
| 11298 | { |
| 11299 | unsigned int present; |
| 11300 | unsigned char bits; |
| 11301 | |
| 11302 | present = snd_hda_codec_read(codec, 0x15, 0, |
| 11303 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 11304 | bits = present ? AMP_IN_MUTE(0) : 0; |
| 11305 | snd_hda_codec_amp_stereo(codec, 0x0f, HDA_INPUT, 0, |
| 11306 | AMP_IN_MUTE(0), bits); |
| 11307 | snd_hda_codec_amp_stereo(codec, 0x0f, HDA_INPUT, 1, |
| 11308 | AMP_IN_MUTE(0), bits); |
| 11309 | } |
| 11310 | |
| 11311 | |
| 11312 | static void alc268_acer_mic_automute(struct hda_codec *codec) |
| 11313 | { |
| 11314 | unsigned int present; |
| 11315 | |
| 11316 | present = snd_hda_codec_read(codec, 0x18, 0, |
| 11317 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 11318 | snd_hda_codec_write(codec, 0x23, 0, AC_VERB_SET_CONNECT_SEL, |
| 11319 | present ? 0x0 : 0x6); |
| 11320 | } |
| 11321 | |
| 11322 | static void alc268_acer_lc_unsol_event(struct hda_codec *codec, |
| 11323 | unsigned int res) |
| 11324 | { |
| 11325 | if ((res >> 26) == ALC880_HP_EVENT) |
| 11326 | alc268_aspire_one_speaker_automute(codec); |
| 11327 | if ((res >> 26) == ALC880_MIC_EVENT) |
| 11328 | alc268_acer_mic_automute(codec); |
| 11329 | } |
| 11330 | |
| 11331 | static void alc268_acer_lc_init_hook(struct hda_codec *codec) |
| 11332 | { |
| 11333 | alc268_aspire_one_speaker_automute(codec); |
| 11334 | alc268_acer_mic_automute(codec); |
| 11335 | } |
| 11336 | |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 11337 | static struct snd_kcontrol_new alc268_dell_mixer[] = { |
| 11338 | /* output mixer control */ |
| 11339 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 11340 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 11341 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 11342 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 11343 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 11344 | HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT), |
| 11345 | { } |
| 11346 | }; |
| 11347 | |
| 11348 | static struct hda_verb alc268_dell_verbs[] = { |
| 11349 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 11350 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 11351 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 11352 | { } |
| 11353 | }; |
| 11354 | |
| 11355 | /* mute/unmute internal speaker according to the hp jack and mute state */ |
| 11356 | static void alc268_dell_automute(struct hda_codec *codec) |
| 11357 | { |
| 11358 | unsigned int present; |
| 11359 | unsigned int mute; |
| 11360 | |
| 11361 | present = snd_hda_codec_read(codec, 0x15, 0, AC_VERB_GET_PIN_SENSE, 0); |
| 11362 | if (present & 0x80000000) |
| 11363 | mute = HDA_AMP_MUTE; |
| 11364 | else |
| 11365 | mute = snd_hda_codec_amp_read(codec, 0x15, 0, HDA_OUTPUT, 0); |
| 11366 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 11367 | HDA_AMP_MUTE, mute); |
| 11368 | } |
| 11369 | |
| 11370 | static void alc268_dell_unsol_event(struct hda_codec *codec, |
| 11371 | unsigned int res) |
| 11372 | { |
| 11373 | if ((res >> 26) != ALC880_HP_EVENT) |
| 11374 | return; |
| 11375 | alc268_dell_automute(codec); |
| 11376 | } |
| 11377 | |
| 11378 | #define alc268_dell_init_hook alc268_dell_automute |
| 11379 | |
Herton Ronaldo Krzesinski | eb5a662 | 2008-04-14 13:46:28 +0200 | [diff] [blame] | 11380 | static struct snd_kcontrol_new alc267_quanta_il1_mixer[] = { |
| 11381 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x2, 0x0, HDA_OUTPUT), |
| 11382 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 11383 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x3, 0x0, HDA_OUTPUT), |
| 11384 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 11385 | HDA_CODEC_VOLUME("Mic Capture Volume", 0x23, 0x0, HDA_OUTPUT), |
| 11386 | HDA_BIND_MUTE("Mic Capture Switch", 0x23, 2, HDA_OUTPUT), |
| 11387 | HDA_CODEC_VOLUME("Ext Mic Boost", 0x18, 0, HDA_INPUT), |
| 11388 | HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT), |
| 11389 | { } |
| 11390 | }; |
| 11391 | |
| 11392 | static struct hda_verb alc267_quanta_il1_verbs[] = { |
| 11393 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 11394 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN}, |
| 11395 | { } |
| 11396 | }; |
| 11397 | |
| 11398 | static void alc267_quanta_il1_hp_automute(struct hda_codec *codec) |
| 11399 | { |
| 11400 | unsigned int present; |
| 11401 | |
| 11402 | present = snd_hda_codec_read(codec, 0x15, 0, AC_VERB_GET_PIN_SENSE, 0) |
| 11403 | & AC_PINSENSE_PRESENCE; |
| 11404 | snd_hda_codec_write(codec, 0x14, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 11405 | present ? 0 : PIN_OUT); |
| 11406 | } |
| 11407 | |
| 11408 | static void alc267_quanta_il1_mic_automute(struct hda_codec *codec) |
| 11409 | { |
| 11410 | unsigned int present; |
| 11411 | |
| 11412 | present = snd_hda_codec_read(codec, 0x18, 0, |
| 11413 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 11414 | snd_hda_codec_write(codec, 0x23, 0, |
| 11415 | AC_VERB_SET_CONNECT_SEL, |
| 11416 | present ? 0x00 : 0x01); |
| 11417 | } |
| 11418 | |
| 11419 | static void alc267_quanta_il1_automute(struct hda_codec *codec) |
| 11420 | { |
| 11421 | alc267_quanta_il1_hp_automute(codec); |
| 11422 | alc267_quanta_il1_mic_automute(codec); |
| 11423 | } |
| 11424 | |
| 11425 | static void alc267_quanta_il1_unsol_event(struct hda_codec *codec, |
| 11426 | unsigned int res) |
| 11427 | { |
| 11428 | switch (res >> 26) { |
| 11429 | case ALC880_HP_EVENT: |
| 11430 | alc267_quanta_il1_hp_automute(codec); |
| 11431 | break; |
| 11432 | case ALC880_MIC_EVENT: |
| 11433 | alc267_quanta_il1_mic_automute(codec); |
| 11434 | break; |
| 11435 | } |
| 11436 | } |
| 11437 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11438 | /* |
| 11439 | * generic initialization of ADC, input mixers and output mixers |
| 11440 | */ |
| 11441 | static struct hda_verb alc268_base_init_verbs[] = { |
| 11442 | /* Unmute DAC0-1 and set vol = 0 */ |
| 11443 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11444 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11445 | |
| 11446 | /* |
| 11447 | * Set up output mixers (0x0c - 0x0e) |
| 11448 | */ |
| 11449 | /* set vol=0 to output mixers */ |
| 11450 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11451 | {0x0e, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 11452 | |
| 11453 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11454 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11455 | |
| 11456 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, |
| 11457 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0}, |
| 11458 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, |
| 11459 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 11460 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 11461 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 11462 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 11463 | {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 11464 | |
| 11465 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 11466 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 11467 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 11468 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11469 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 11470 | |
| 11471 | /* set PCBEEP vol = 0, mute connections */ |
| 11472 | {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11473 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 11474 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11475 | |
Jiang Zhe | a9b3aa8 | 2007-12-20 13:13:13 +0100 | [diff] [blame] | 11476 | /* Unmute Selector 23h,24h and set the default input to mic-in */ |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 11477 | |
Jiang Zhe | a9b3aa8 | 2007-12-20 13:13:13 +0100 | [diff] [blame] | 11478 | {0x23, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 11479 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 11480 | {0x24, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 11481 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11482 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11483 | { } |
| 11484 | }; |
| 11485 | |
| 11486 | /* |
| 11487 | * generic initialization of ADC, input mixers and output mixers |
| 11488 | */ |
| 11489 | static struct hda_verb alc268_volume_init_verbs[] = { |
| 11490 | /* set output DAC */ |
Takashi Iwai | 4cfb91c | 2009-01-23 12:53:09 +0100 | [diff] [blame] | 11491 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 11492 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11493 | |
| 11494 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 11495 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 11496 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 11497 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 11498 | {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 11499 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11500 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11501 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11502 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11503 | |
| 11504 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11505 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11506 | |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 11507 | /* set PCBEEP vol = 0, mute connections */ |
| 11508 | {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11509 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 11510 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11511 | |
| 11512 | { } |
| 11513 | }; |
| 11514 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11515 | static struct snd_kcontrol_new alc268_capture_alt_mixer[] = { |
| 11516 | HDA_CODEC_VOLUME("Capture Volume", 0x23, 0x0, HDA_OUTPUT), |
| 11517 | HDA_CODEC_MUTE("Capture Switch", 0x23, 0x0, HDA_OUTPUT), |
| 11518 | { |
| 11519 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 11520 | /* The multiple "Capture Source" controls confuse alsamixer |
| 11521 | * So call somewhat different.. |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11522 | */ |
| 11523 | /* .name = "Capture Source", */ |
| 11524 | .name = "Input Source", |
| 11525 | .count = 1, |
Takashi Iwai | 54cbc9a | 2008-10-31 15:24:04 +0100 | [diff] [blame] | 11526 | .info = alc_mux_enum_info, |
| 11527 | .get = alc_mux_enum_get, |
| 11528 | .put = alc_mux_enum_put, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11529 | }, |
| 11530 | { } /* end */ |
| 11531 | }; |
| 11532 | |
| 11533 | static struct snd_kcontrol_new alc268_capture_mixer[] = { |
| 11534 | HDA_CODEC_VOLUME("Capture Volume", 0x23, 0x0, HDA_OUTPUT), |
| 11535 | HDA_CODEC_MUTE("Capture Switch", 0x23, 0x0, HDA_OUTPUT), |
| 11536 | HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x24, 0x0, HDA_OUTPUT), |
| 11537 | HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x24, 0x0, HDA_OUTPUT), |
| 11538 | { |
| 11539 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 11540 | /* The multiple "Capture Source" controls confuse alsamixer |
| 11541 | * So call somewhat different.. |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11542 | */ |
| 11543 | /* .name = "Capture Source", */ |
| 11544 | .name = "Input Source", |
| 11545 | .count = 2, |
Takashi Iwai | 54cbc9a | 2008-10-31 15:24:04 +0100 | [diff] [blame] | 11546 | .info = alc_mux_enum_info, |
| 11547 | .get = alc_mux_enum_get, |
| 11548 | .put = alc_mux_enum_put, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11549 | }, |
| 11550 | { } /* end */ |
| 11551 | }; |
| 11552 | |
| 11553 | static struct hda_input_mux alc268_capture_source = { |
| 11554 | .num_items = 4, |
| 11555 | .items = { |
| 11556 | { "Mic", 0x0 }, |
| 11557 | { "Front Mic", 0x1 }, |
| 11558 | { "Line", 0x2 }, |
| 11559 | { "CD", 0x3 }, |
| 11560 | }, |
| 11561 | }; |
| 11562 | |
Takashi Iwai | 0ccb541 | 2008-03-06 16:58:35 +0100 | [diff] [blame] | 11563 | static struct hda_input_mux alc268_acer_capture_source = { |
| 11564 | .num_items = 3, |
| 11565 | .items = { |
| 11566 | { "Mic", 0x0 }, |
Takashi Iwai | c238b4f | 2008-11-05 14:57:20 +0100 | [diff] [blame] | 11567 | { "Internal Mic", 0x1 }, |
| 11568 | { "Line", 0x2 }, |
| 11569 | }, |
| 11570 | }; |
| 11571 | |
| 11572 | static struct hda_input_mux alc268_acer_dmic_capture_source = { |
| 11573 | .num_items = 3, |
| 11574 | .items = { |
| 11575 | { "Mic", 0x0 }, |
Takashi Iwai | 0ccb541 | 2008-03-06 16:58:35 +0100 | [diff] [blame] | 11576 | { "Internal Mic", 0x6 }, |
| 11577 | { "Line", 0x2 }, |
| 11578 | }, |
| 11579 | }; |
| 11580 | |
Jonathan Woithe | 86c53bd | 2008-01-08 12:33:19 +0100 | [diff] [blame] | 11581 | #ifdef CONFIG_SND_DEBUG |
| 11582 | static struct snd_kcontrol_new alc268_test_mixer[] = { |
Jonathan Woithe | 86c53bd | 2008-01-08 12:33:19 +0100 | [diff] [blame] | 11583 | /* Volume widgets */ |
| 11584 | HDA_CODEC_VOLUME("LOUT1 Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 11585 | HDA_CODEC_VOLUME("LOUT2 Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 11586 | HDA_BIND_MUTE_MONO("Mono sum Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 11587 | HDA_BIND_MUTE("LINE-OUT sum Playback Switch", 0x0f, 2, HDA_INPUT), |
| 11588 | HDA_BIND_MUTE("HP-OUT sum Playback Switch", 0x10, 2, HDA_INPUT), |
| 11589 | HDA_BIND_MUTE("LINE-OUT Playback Switch", 0x14, 2, HDA_OUTPUT), |
| 11590 | HDA_BIND_MUTE("HP-OUT Playback Switch", 0x15, 2, HDA_OUTPUT), |
| 11591 | HDA_BIND_MUTE("Mono Playback Switch", 0x16, 2, HDA_OUTPUT), |
| 11592 | HDA_CODEC_VOLUME("MIC1 Capture Volume", 0x18, 0x0, HDA_INPUT), |
| 11593 | HDA_BIND_MUTE("MIC1 Capture Switch", 0x18, 2, HDA_OUTPUT), |
| 11594 | HDA_CODEC_VOLUME("MIC2 Capture Volume", 0x19, 0x0, HDA_INPUT), |
| 11595 | HDA_CODEC_VOLUME("LINE1 Capture Volume", 0x1a, 0x0, HDA_INPUT), |
| 11596 | HDA_BIND_MUTE("LINE1 Capture Switch", 0x1a, 2, HDA_OUTPUT), |
Takashi Iwai | f0747ee | 2008-01-15 11:41:41 +0100 | [diff] [blame] | 11597 | /* The below appears problematic on some hardwares */ |
| 11598 | /*HDA_CODEC_VOLUME("PCBEEP Playback Volume", 0x1d, 0x0, HDA_INPUT),*/ |
Jonathan Woithe | 86c53bd | 2008-01-08 12:33:19 +0100 | [diff] [blame] | 11599 | HDA_CODEC_VOLUME("PCM-IN1 Capture Volume", 0x23, 0x0, HDA_OUTPUT), |
| 11600 | HDA_BIND_MUTE("PCM-IN1 Capture Switch", 0x23, 2, HDA_OUTPUT), |
| 11601 | HDA_CODEC_VOLUME("PCM-IN2 Capture Volume", 0x24, 0x0, HDA_OUTPUT), |
| 11602 | HDA_BIND_MUTE("PCM-IN2 Capture Switch", 0x24, 2, HDA_OUTPUT), |
| 11603 | |
| 11604 | /* Modes for retasking pin widgets */ |
| 11605 | ALC_PIN_MODE("LINE-OUT pin mode", 0x14, ALC_PIN_DIR_INOUT), |
| 11606 | ALC_PIN_MODE("HP-OUT pin mode", 0x15, ALC_PIN_DIR_INOUT), |
| 11607 | ALC_PIN_MODE("MIC1 pin mode", 0x18, ALC_PIN_DIR_INOUT), |
| 11608 | ALC_PIN_MODE("LINE1 pin mode", 0x1a, ALC_PIN_DIR_INOUT), |
| 11609 | |
| 11610 | /* Controls for GPIO pins, assuming they are configured as outputs */ |
| 11611 | ALC_GPIO_DATA_SWITCH("GPIO pin 0", 0x01, 0x01), |
| 11612 | ALC_GPIO_DATA_SWITCH("GPIO pin 1", 0x01, 0x02), |
| 11613 | ALC_GPIO_DATA_SWITCH("GPIO pin 2", 0x01, 0x04), |
| 11614 | ALC_GPIO_DATA_SWITCH("GPIO pin 3", 0x01, 0x08), |
| 11615 | |
| 11616 | /* Switches to allow the digital SPDIF output pin to be enabled. |
| 11617 | * The ALC268 does not have an SPDIF input. |
| 11618 | */ |
| 11619 | ALC_SPDIF_CTRL_SWITCH("SPDIF Playback Switch", 0x06, 0x01), |
| 11620 | |
| 11621 | /* A switch allowing EAPD to be enabled. Some laptops seem to use |
| 11622 | * this output to turn on an external amplifier. |
| 11623 | */ |
| 11624 | ALC_EAPD_CTRL_SWITCH("LINE-OUT EAPD Enable Switch", 0x0f, 0x02), |
| 11625 | ALC_EAPD_CTRL_SWITCH("HP-OUT EAPD Enable Switch", 0x10, 0x02), |
| 11626 | |
| 11627 | { } /* end */ |
| 11628 | }; |
| 11629 | #endif |
| 11630 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11631 | /* create input playback/capture controls for the given pin */ |
| 11632 | static int alc268_new_analog_output(struct alc_spec *spec, hda_nid_t nid, |
| 11633 | const char *ctlname, int idx) |
| 11634 | { |
| 11635 | char name[32]; |
| 11636 | int err; |
| 11637 | |
| 11638 | sprintf(name, "%s Playback Volume", ctlname); |
| 11639 | if (nid == 0x14) { |
| 11640 | err = add_control(spec, ALC_CTL_WIDGET_VOL, name, |
| 11641 | HDA_COMPOSE_AMP_VAL(0x02, 3, idx, |
| 11642 | HDA_OUTPUT)); |
| 11643 | if (err < 0) |
| 11644 | return err; |
| 11645 | } else if (nid == 0x15) { |
| 11646 | err = add_control(spec, ALC_CTL_WIDGET_VOL, name, |
| 11647 | HDA_COMPOSE_AMP_VAL(0x03, 3, idx, |
| 11648 | HDA_OUTPUT)); |
| 11649 | if (err < 0) |
| 11650 | return err; |
| 11651 | } else |
| 11652 | return -1; |
| 11653 | sprintf(name, "%s Playback Switch", ctlname); |
| 11654 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, name, |
| 11655 | HDA_COMPOSE_AMP_VAL(nid, 3, idx, HDA_OUTPUT)); |
| 11656 | if (err < 0) |
| 11657 | return err; |
| 11658 | return 0; |
| 11659 | } |
| 11660 | |
| 11661 | /* add playback controls from the parsed DAC table */ |
| 11662 | static int alc268_auto_create_multi_out_ctls(struct alc_spec *spec, |
| 11663 | const struct auto_pin_cfg *cfg) |
| 11664 | { |
| 11665 | hda_nid_t nid; |
| 11666 | int err; |
| 11667 | |
| 11668 | spec->multiout.num_dacs = 2; /* only use one dac */ |
| 11669 | spec->multiout.dac_nids = spec->private_dac_nids; |
| 11670 | spec->multiout.dac_nids[0] = 2; |
| 11671 | spec->multiout.dac_nids[1] = 3; |
| 11672 | |
| 11673 | nid = cfg->line_out_pins[0]; |
| 11674 | if (nid) |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 11675 | alc268_new_analog_output(spec, nid, "Front", 0); |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11676 | |
| 11677 | nid = cfg->speaker_pins[0]; |
| 11678 | if (nid == 0x1d) { |
| 11679 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 11680 | "Speaker Playback Volume", |
| 11681 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_INPUT)); |
| 11682 | if (err < 0) |
| 11683 | return err; |
| 11684 | } |
| 11685 | nid = cfg->hp_pins[0]; |
| 11686 | if (nid) |
| 11687 | alc268_new_analog_output(spec, nid, "Headphone", 0); |
| 11688 | |
| 11689 | nid = cfg->line_out_pins[1] | cfg->line_out_pins[2]; |
| 11690 | if (nid == 0x16) { |
| 11691 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, |
| 11692 | "Mono Playback Switch", |
| 11693 | HDA_COMPOSE_AMP_VAL(nid, 2, 0, HDA_INPUT)); |
| 11694 | if (err < 0) |
| 11695 | return err; |
| 11696 | } |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 11697 | return 0; |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11698 | } |
| 11699 | |
| 11700 | /* create playback/capture controls for input pins */ |
| 11701 | static int alc268_auto_create_analog_input_ctls(struct alc_spec *spec, |
| 11702 | const struct auto_pin_cfg *cfg) |
| 11703 | { |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 11704 | struct hda_input_mux *imux = &spec->private_imux[0]; |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11705 | int i, idx1; |
| 11706 | |
| 11707 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
| 11708 | switch(cfg->input_pins[i]) { |
| 11709 | case 0x18: |
| 11710 | idx1 = 0; /* Mic 1 */ |
| 11711 | break; |
| 11712 | case 0x19: |
| 11713 | idx1 = 1; /* Mic 2 */ |
| 11714 | break; |
| 11715 | case 0x1a: |
| 11716 | idx1 = 2; /* Line In */ |
| 11717 | break; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 11718 | case 0x1c: |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11719 | idx1 = 3; /* CD */ |
| 11720 | break; |
Takashi Iwai | 7194cae | 2008-03-06 16:58:17 +0100 | [diff] [blame] | 11721 | case 0x12: |
| 11722 | case 0x13: |
| 11723 | idx1 = 6; /* digital mics */ |
| 11724 | break; |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11725 | default: |
| 11726 | continue; |
| 11727 | } |
| 11728 | imux->items[imux->num_items].label = auto_pin_cfg_labels[i]; |
| 11729 | imux->items[imux->num_items].index = idx1; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 11730 | imux->num_items++; |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11731 | } |
| 11732 | return 0; |
| 11733 | } |
| 11734 | |
| 11735 | static void alc268_auto_init_mono_speaker_out(struct hda_codec *codec) |
| 11736 | { |
| 11737 | struct alc_spec *spec = codec->spec; |
| 11738 | hda_nid_t speaker_nid = spec->autocfg.speaker_pins[0]; |
| 11739 | hda_nid_t hp_nid = spec->autocfg.hp_pins[0]; |
| 11740 | hda_nid_t line_nid = spec->autocfg.line_out_pins[0]; |
| 11741 | unsigned int dac_vol1, dac_vol2; |
| 11742 | |
| 11743 | if (speaker_nid) { |
| 11744 | snd_hda_codec_write(codec, speaker_nid, 0, |
| 11745 | AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT); |
| 11746 | snd_hda_codec_write(codec, 0x0f, 0, |
| 11747 | AC_VERB_SET_AMP_GAIN_MUTE, |
| 11748 | AMP_IN_UNMUTE(1)); |
| 11749 | snd_hda_codec_write(codec, 0x10, 0, |
| 11750 | AC_VERB_SET_AMP_GAIN_MUTE, |
| 11751 | AMP_IN_UNMUTE(1)); |
| 11752 | } else { |
| 11753 | snd_hda_codec_write(codec, 0x0f, 0, |
| 11754 | AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)); |
| 11755 | snd_hda_codec_write(codec, 0x10, 0, |
| 11756 | AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)); |
| 11757 | } |
| 11758 | |
| 11759 | dac_vol1 = dac_vol2 = 0xb000 | 0x40; /* set max volume */ |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 11760 | if (line_nid == 0x14) |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11761 | dac_vol2 = AMP_OUT_ZERO; |
| 11762 | else if (line_nid == 0x15) |
| 11763 | dac_vol1 = AMP_OUT_ZERO; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 11764 | if (hp_nid == 0x14) |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11765 | dac_vol2 = AMP_OUT_ZERO; |
| 11766 | else if (hp_nid == 0x15) |
| 11767 | dac_vol1 = AMP_OUT_ZERO; |
| 11768 | if (line_nid != 0x16 || hp_nid != 0x16 || |
| 11769 | spec->autocfg.line_out_pins[1] != 0x16 || |
| 11770 | spec->autocfg.line_out_pins[2] != 0x16) |
| 11771 | dac_vol1 = dac_vol2 = AMP_OUT_ZERO; |
| 11772 | |
| 11773 | snd_hda_codec_write(codec, 0x02, 0, |
| 11774 | AC_VERB_SET_AMP_GAIN_MUTE, dac_vol1); |
| 11775 | snd_hda_codec_write(codec, 0x03, 0, |
| 11776 | AC_VERB_SET_AMP_GAIN_MUTE, dac_vol2); |
| 11777 | } |
| 11778 | |
| 11779 | /* pcm configuration: identiacal with ALC880 */ |
| 11780 | #define alc268_pcm_analog_playback alc880_pcm_analog_playback |
| 11781 | #define alc268_pcm_analog_capture alc880_pcm_analog_capture |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 11782 | #define alc268_pcm_analog_alt_capture alc880_pcm_analog_alt_capture |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11783 | #define alc268_pcm_digital_playback alc880_pcm_digital_playback |
| 11784 | |
| 11785 | /* |
| 11786 | * BIOS auto configuration |
| 11787 | */ |
| 11788 | static int alc268_parse_auto_config(struct hda_codec *codec) |
| 11789 | { |
| 11790 | struct alc_spec *spec = codec->spec; |
| 11791 | int err; |
| 11792 | static hda_nid_t alc268_ignore[] = { 0 }; |
| 11793 | |
| 11794 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 11795 | alc268_ignore); |
| 11796 | if (err < 0) |
| 11797 | return err; |
| 11798 | if (!spec->autocfg.line_outs) |
| 11799 | return 0; /* can't find valid BIOS pin config */ |
| 11800 | |
| 11801 | err = alc268_auto_create_multi_out_ctls(spec, &spec->autocfg); |
| 11802 | if (err < 0) |
| 11803 | return err; |
| 11804 | err = alc268_auto_create_analog_input_ctls(spec, &spec->autocfg); |
| 11805 | if (err < 0) |
| 11806 | return err; |
| 11807 | |
| 11808 | spec->multiout.max_channels = 2; |
| 11809 | |
| 11810 | /* digital only support output */ |
Takashi Iwai | 0852d7a | 2009-02-11 11:35:15 +0100 | [diff] [blame] | 11811 | if (spec->autocfg.dig_outs) |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11812 | spec->multiout.dig_out_nid = ALC268_DIGOUT_NID; |
| 11813 | |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 11814 | if (spec->kctls.list) |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 11815 | add_mixer(spec, spec->kctls.list); |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11816 | |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 11817 | if (spec->autocfg.speaker_pins[0] != 0x1d) |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 11818 | add_mixer(spec, alc268_beep_mixer); |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 11819 | |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 11820 | add_verb(spec, alc268_volume_init_verbs); |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11821 | spec->num_mux_defs = 1; |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 11822 | spec->input_mux = &spec->private_imux[0]; |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11823 | |
Takashi Iwai | 776e184 | 2007-08-29 15:07:11 +0200 | [diff] [blame] | 11824 | err = alc_auto_add_mic_boost(codec); |
| 11825 | if (err < 0) |
| 11826 | return err; |
| 11827 | |
Takashi Iwai | e044c39 | 2008-10-27 16:56:24 +0100 | [diff] [blame] | 11828 | store_pin_configs(codec); |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11829 | return 1; |
| 11830 | } |
| 11831 | |
| 11832 | #define alc268_auto_init_multi_out alc882_auto_init_multi_out |
| 11833 | #define alc268_auto_init_hp_out alc882_auto_init_hp_out |
| 11834 | #define alc268_auto_init_analog_input alc882_auto_init_analog_input |
| 11835 | |
| 11836 | /* init callback for auto-configuration model -- overriding the default init */ |
| 11837 | static void alc268_auto_init(struct hda_codec *codec) |
| 11838 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 11839 | struct alc_spec *spec = codec->spec; |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11840 | alc268_auto_init_multi_out(codec); |
| 11841 | alc268_auto_init_hp_out(codec); |
| 11842 | alc268_auto_init_mono_speaker_out(codec); |
| 11843 | alc268_auto_init_analog_input(codec); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 11844 | if (spec->unsol_event) |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 11845 | alc_inithook(codec); |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11846 | } |
| 11847 | |
| 11848 | /* |
| 11849 | * configuration and preset |
| 11850 | */ |
| 11851 | static const char *alc268_models[ALC268_MODEL_LAST] = { |
Herton Ronaldo Krzesinski | eb5a662 | 2008-04-14 13:46:28 +0200 | [diff] [blame] | 11852 | [ALC267_QUANTA_IL1] = "quanta-il1", |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11853 | [ALC268_3ST] = "3stack", |
Takashi Iwai | 983f8ae | 2007-08-15 16:44:04 +0200 | [diff] [blame] | 11854 | [ALC268_TOSHIBA] = "toshiba", |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 11855 | [ALC268_ACER] = "acer", |
Takashi Iwai | c238b4f | 2008-11-05 14:57:20 +0100 | [diff] [blame] | 11856 | [ALC268_ACER_DMIC] = "acer-dmic", |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 11857 | [ALC268_ACER_ASPIRE_ONE] = "acer-aspire", |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 11858 | [ALC268_DELL] = "dell", |
Mirco Tischler | f12462c | 2008-02-04 12:33:59 +0100 | [diff] [blame] | 11859 | [ALC268_ZEPTO] = "zepto", |
Jonathan Woithe | 86c53bd | 2008-01-08 12:33:19 +0100 | [diff] [blame] | 11860 | #ifdef CONFIG_SND_DEBUG |
| 11861 | [ALC268_TEST] = "test", |
| 11862 | #endif |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11863 | [ALC268_AUTO] = "auto", |
| 11864 | }; |
| 11865 | |
| 11866 | static struct snd_pci_quirk alc268_cfg_tbl[] = { |
Takashi Iwai | a0b8f7d | 2008-04-22 19:39:49 +0200 | [diff] [blame] | 11867 | SND_PCI_QUIRK(0x1025, 0x011e, "Acer Aspire 5720z", ALC268_ACER), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 11868 | SND_PCI_QUIRK(0x1025, 0x0126, "Acer", ALC268_ACER), |
Andy Shevchenko | dafc835 | 2008-01-25 11:53:50 +0100 | [diff] [blame] | 11869 | SND_PCI_QUIRK(0x1025, 0x012e, "Acer Aspire 5310", ALC268_ACER), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 11870 | SND_PCI_QUIRK(0x1025, 0x0130, "Acer Extensa 5210", ALC268_ACER), |
Andy Shevchenko | 29a52c2 | 2008-01-24 17:29:00 +0100 | [diff] [blame] | 11871 | SND_PCI_QUIRK(0x1025, 0x0136, "Acer Aspire 5315", ALC268_ACER), |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 11872 | SND_PCI_QUIRK(0x1025, 0x015b, "Acer Aspire One", |
| 11873 | ALC268_ACER_ASPIRE_ONE), |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 11874 | SND_PCI_QUIRK(0x1028, 0x0253, "Dell OEM", ALC268_DELL), |
Takashi Iwai | 57d1392 | 2009-01-08 15:52:09 +0100 | [diff] [blame] | 11875 | SND_PCI_QUIRK(0x1028, 0x02b0, "Dell Inspiron Mini9", ALC268_DELL), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 11876 | SND_PCI_QUIRK(0x103c, 0x30cc, "TOSHIBA", ALC268_TOSHIBA), |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11877 | SND_PCI_QUIRK(0x1043, 0x1205, "ASUS W7J", ALC268_3ST), |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 11878 | SND_PCI_QUIRK(0x1179, 0xff10, "TOSHIBA A205", ALC268_TOSHIBA), |
Takashi Iwai | 8e7f00f | 2007-09-07 10:58:58 +0200 | [diff] [blame] | 11879 | SND_PCI_QUIRK(0x1179, 0xff50, "TOSHIBA A305", ALC268_TOSHIBA), |
Travis Place | 2346d0c | 2008-09-01 08:24:00 +0200 | [diff] [blame] | 11880 | SND_PCI_QUIRK(0x1179, 0xff64, "TOSHIBA L305", ALC268_TOSHIBA), |
Tony Vroon | 378bd6a | 2008-06-04 12:08:30 +0200 | [diff] [blame] | 11881 | SND_PCI_QUIRK(0x14c0, 0x0025, "COMPAL IFL90/JFL-92", ALC268_TOSHIBA), |
Takashi Iwai | b875bf3 | 2007-09-06 15:00:27 +0200 | [diff] [blame] | 11882 | SND_PCI_QUIRK(0x152d, 0x0763, "Diverse (CPR2000)", ALC268_ACER), |
Herton Ronaldo Krzesinski | eb5a662 | 2008-04-14 13:46:28 +0200 | [diff] [blame] | 11883 | SND_PCI_QUIRK(0x152d, 0x0771, "Quanta IL1", ALC267_QUANTA_IL1), |
Mirco Tischler | f12462c | 2008-02-04 12:33:59 +0100 | [diff] [blame] | 11884 | SND_PCI_QUIRK(0x1170, 0x0040, "ZEPTO", ALC268_ZEPTO), |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11885 | {} |
| 11886 | }; |
| 11887 | |
| 11888 | static struct alc_config_preset alc268_presets[] = { |
Herton Ronaldo Krzesinski | eb5a662 | 2008-04-14 13:46:28 +0200 | [diff] [blame] | 11889 | [ALC267_QUANTA_IL1] = { |
Takashi Iwai | 22971e3 | 2009-02-10 11:56:44 +0100 | [diff] [blame] | 11890 | .mixers = { alc267_quanta_il1_mixer, alc268_beep_mixer }, |
Herton Ronaldo Krzesinski | eb5a662 | 2008-04-14 13:46:28 +0200 | [diff] [blame] | 11891 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, |
| 11892 | alc267_quanta_il1_verbs }, |
| 11893 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), |
| 11894 | .dac_nids = alc268_dac_nids, |
| 11895 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), |
| 11896 | .adc_nids = alc268_adc_nids_alt, |
| 11897 | .hp_nid = 0x03, |
| 11898 | .num_channel_mode = ARRAY_SIZE(alc268_modes), |
| 11899 | .channel_mode = alc268_modes, |
| 11900 | .input_mux = &alc268_capture_source, |
| 11901 | .unsol_event = alc267_quanta_il1_unsol_event, |
| 11902 | .init_hook = alc267_quanta_il1_automute, |
| 11903 | }, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11904 | [ALC268_3ST] = { |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 11905 | .mixers = { alc268_base_mixer, alc268_capture_alt_mixer, |
| 11906 | alc268_beep_mixer }, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11907 | .init_verbs = { alc268_base_init_verbs }, |
| 11908 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), |
| 11909 | .dac_nids = alc268_dac_nids, |
| 11910 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), |
| 11911 | .adc_nids = alc268_adc_nids_alt, |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 11912 | .capsrc_nids = alc268_capsrc_nids, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11913 | .hp_nid = 0x03, |
| 11914 | .dig_out_nid = ALC268_DIGOUT_NID, |
| 11915 | .num_channel_mode = ARRAY_SIZE(alc268_modes), |
| 11916 | .channel_mode = alc268_modes, |
| 11917 | .input_mux = &alc268_capture_source, |
| 11918 | }, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 11919 | [ALC268_TOSHIBA] = { |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 11920 | .mixers = { alc268_base_mixer, alc268_capture_alt_mixer, |
| 11921 | alc268_beep_mixer }, |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 11922 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, |
| 11923 | alc268_toshiba_verbs }, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 11924 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), |
| 11925 | .dac_nids = alc268_dac_nids, |
| 11926 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), |
| 11927 | .adc_nids = alc268_adc_nids_alt, |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 11928 | .capsrc_nids = alc268_capsrc_nids, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 11929 | .hp_nid = 0x03, |
| 11930 | .num_channel_mode = ARRAY_SIZE(alc268_modes), |
| 11931 | .channel_mode = alc268_modes, |
| 11932 | .input_mux = &alc268_capture_source, |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 11933 | .unsol_event = alc268_toshiba_unsol_event, |
| 11934 | .init_hook = alc268_toshiba_automute, |
| 11935 | }, |
| 11936 | [ALC268_ACER] = { |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 11937 | .mixers = { alc268_acer_mixer, alc268_capture_alt_mixer, |
| 11938 | alc268_beep_mixer }, |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 11939 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, |
| 11940 | alc268_acer_verbs }, |
| 11941 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), |
| 11942 | .dac_nids = alc268_dac_nids, |
| 11943 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), |
| 11944 | .adc_nids = alc268_adc_nids_alt, |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 11945 | .capsrc_nids = alc268_capsrc_nids, |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 11946 | .hp_nid = 0x02, |
| 11947 | .num_channel_mode = ARRAY_SIZE(alc268_modes), |
| 11948 | .channel_mode = alc268_modes, |
Takashi Iwai | 0ccb541 | 2008-03-06 16:58:35 +0100 | [diff] [blame] | 11949 | .input_mux = &alc268_acer_capture_source, |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 11950 | .unsol_event = alc268_acer_unsol_event, |
Takashi Iwai | 889c439 | 2007-08-23 18:56:52 +0200 | [diff] [blame] | 11951 | .init_hook = alc268_acer_init_hook, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 11952 | }, |
Takashi Iwai | c238b4f | 2008-11-05 14:57:20 +0100 | [diff] [blame] | 11953 | [ALC268_ACER_DMIC] = { |
| 11954 | .mixers = { alc268_acer_dmic_mixer, alc268_capture_alt_mixer, |
| 11955 | alc268_beep_mixer }, |
| 11956 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, |
| 11957 | alc268_acer_verbs }, |
| 11958 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), |
| 11959 | .dac_nids = alc268_dac_nids, |
| 11960 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), |
| 11961 | .adc_nids = alc268_adc_nids_alt, |
| 11962 | .capsrc_nids = alc268_capsrc_nids, |
| 11963 | .hp_nid = 0x02, |
| 11964 | .num_channel_mode = ARRAY_SIZE(alc268_modes), |
| 11965 | .channel_mode = alc268_modes, |
| 11966 | .input_mux = &alc268_acer_dmic_capture_source, |
| 11967 | .unsol_event = alc268_acer_unsol_event, |
| 11968 | .init_hook = alc268_acer_init_hook, |
| 11969 | }, |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 11970 | [ALC268_ACER_ASPIRE_ONE] = { |
| 11971 | .mixers = { alc268_acer_aspire_one_mixer, |
Takashi Iwai | 22971e3 | 2009-02-10 11:56:44 +0100 | [diff] [blame] | 11972 | alc268_beep_mixer, |
| 11973 | alc268_capture_alt_mixer }, |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 11974 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, |
| 11975 | alc268_acer_aspire_one_verbs }, |
| 11976 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), |
| 11977 | .dac_nids = alc268_dac_nids, |
| 11978 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), |
| 11979 | .adc_nids = alc268_adc_nids_alt, |
| 11980 | .capsrc_nids = alc268_capsrc_nids, |
| 11981 | .hp_nid = 0x03, |
| 11982 | .num_channel_mode = ARRAY_SIZE(alc268_modes), |
| 11983 | .channel_mode = alc268_modes, |
| 11984 | .input_mux = &alc268_acer_lc_capture_source, |
| 11985 | .unsol_event = alc268_acer_lc_unsol_event, |
| 11986 | .init_hook = alc268_acer_lc_init_hook, |
| 11987 | }, |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 11988 | [ALC268_DELL] = { |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 11989 | .mixers = { alc268_dell_mixer, alc268_beep_mixer }, |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 11990 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, |
| 11991 | alc268_dell_verbs }, |
| 11992 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), |
| 11993 | .dac_nids = alc268_dac_nids, |
| 11994 | .hp_nid = 0x02, |
| 11995 | .num_channel_mode = ARRAY_SIZE(alc268_modes), |
| 11996 | .channel_mode = alc268_modes, |
| 11997 | .unsol_event = alc268_dell_unsol_event, |
| 11998 | .init_hook = alc268_dell_init_hook, |
| 11999 | .input_mux = &alc268_capture_source, |
| 12000 | }, |
Mirco Tischler | f12462c | 2008-02-04 12:33:59 +0100 | [diff] [blame] | 12001 | [ALC268_ZEPTO] = { |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 12002 | .mixers = { alc268_base_mixer, alc268_capture_alt_mixer, |
| 12003 | alc268_beep_mixer }, |
Mirco Tischler | f12462c | 2008-02-04 12:33:59 +0100 | [diff] [blame] | 12004 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, |
| 12005 | alc268_toshiba_verbs }, |
| 12006 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), |
| 12007 | .dac_nids = alc268_dac_nids, |
| 12008 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), |
| 12009 | .adc_nids = alc268_adc_nids_alt, |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 12010 | .capsrc_nids = alc268_capsrc_nids, |
Mirco Tischler | f12462c | 2008-02-04 12:33:59 +0100 | [diff] [blame] | 12011 | .hp_nid = 0x03, |
| 12012 | .dig_out_nid = ALC268_DIGOUT_NID, |
| 12013 | .num_channel_mode = ARRAY_SIZE(alc268_modes), |
| 12014 | .channel_mode = alc268_modes, |
| 12015 | .input_mux = &alc268_capture_source, |
| 12016 | .unsol_event = alc268_toshiba_unsol_event, |
| 12017 | .init_hook = alc268_toshiba_automute |
| 12018 | }, |
Jonathan Woithe | 86c53bd | 2008-01-08 12:33:19 +0100 | [diff] [blame] | 12019 | #ifdef CONFIG_SND_DEBUG |
| 12020 | [ALC268_TEST] = { |
| 12021 | .mixers = { alc268_test_mixer, alc268_capture_mixer }, |
| 12022 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, |
| 12023 | alc268_volume_init_verbs }, |
| 12024 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), |
| 12025 | .dac_nids = alc268_dac_nids, |
| 12026 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), |
| 12027 | .adc_nids = alc268_adc_nids_alt, |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 12028 | .capsrc_nids = alc268_capsrc_nids, |
Jonathan Woithe | 86c53bd | 2008-01-08 12:33:19 +0100 | [diff] [blame] | 12029 | .hp_nid = 0x03, |
| 12030 | .dig_out_nid = ALC268_DIGOUT_NID, |
| 12031 | .num_channel_mode = ARRAY_SIZE(alc268_modes), |
| 12032 | .channel_mode = alc268_modes, |
| 12033 | .input_mux = &alc268_capture_source, |
| 12034 | }, |
| 12035 | #endif |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12036 | }; |
| 12037 | |
| 12038 | static int patch_alc268(struct hda_codec *codec) |
| 12039 | { |
| 12040 | struct alc_spec *spec; |
| 12041 | int board_config; |
Takashi Iwai | 22971e3 | 2009-02-10 11:56:44 +0100 | [diff] [blame] | 12042 | int i, has_beep, err; |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12043 | |
| 12044 | spec = kcalloc(1, sizeof(*spec), GFP_KERNEL); |
| 12045 | if (spec == NULL) |
| 12046 | return -ENOMEM; |
| 12047 | |
| 12048 | codec->spec = spec; |
| 12049 | |
| 12050 | board_config = snd_hda_check_board_config(codec, ALC268_MODEL_LAST, |
| 12051 | alc268_models, |
| 12052 | alc268_cfg_tbl); |
| 12053 | |
| 12054 | if (board_config < 0 || board_config >= ALC268_MODEL_LAST) { |
| 12055 | printk(KERN_INFO "hda_codec: Unknown model for ALC268, " |
| 12056 | "trying auto-probe from BIOS...\n"); |
| 12057 | board_config = ALC268_AUTO; |
| 12058 | } |
| 12059 | |
| 12060 | if (board_config == ALC268_AUTO) { |
| 12061 | /* automatic parse from the BIOS config */ |
| 12062 | err = alc268_parse_auto_config(codec); |
| 12063 | if (err < 0) { |
| 12064 | alc_free(codec); |
| 12065 | return err; |
| 12066 | } else if (!err) { |
| 12067 | printk(KERN_INFO |
| 12068 | "hda_codec: Cannot set up configuration " |
| 12069 | "from BIOS. Using base mode...\n"); |
| 12070 | board_config = ALC268_3ST; |
| 12071 | } |
| 12072 | } |
| 12073 | |
Kusanagi Kouichi | 680cd53 | 2009-02-05 00:00:58 +0900 | [diff] [blame] | 12074 | err = snd_hda_attach_beep_device(codec, 0x1); |
| 12075 | if (err < 0) { |
| 12076 | alc_free(codec); |
| 12077 | return err; |
| 12078 | } |
| 12079 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12080 | if (board_config != ALC268_AUTO) |
| 12081 | setup_preset(spec, &alc268_presets[board_config]); |
| 12082 | |
Kailang Yang | 2f89328 | 2008-05-27 12:14:47 +0200 | [diff] [blame] | 12083 | if (codec->vendor_id == 0x10ec0267) { |
| 12084 | spec->stream_name_analog = "ALC267 Analog"; |
| 12085 | spec->stream_name_digital = "ALC267 Digital"; |
| 12086 | } else { |
| 12087 | spec->stream_name_analog = "ALC268 Analog"; |
| 12088 | spec->stream_name_digital = "ALC268 Digital"; |
| 12089 | } |
| 12090 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12091 | spec->stream_analog_playback = &alc268_pcm_analog_playback; |
| 12092 | spec->stream_analog_capture = &alc268_pcm_analog_capture; |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 12093 | spec->stream_analog_alt_capture = &alc268_pcm_analog_alt_capture; |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12094 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12095 | spec->stream_digital_playback = &alc268_pcm_digital_playback; |
| 12096 | |
Takashi Iwai | 22971e3 | 2009-02-10 11:56:44 +0100 | [diff] [blame] | 12097 | has_beep = 0; |
| 12098 | for (i = 0; i < spec->num_mixers; i++) { |
| 12099 | if (spec->mixers[i] == alc268_beep_mixer) { |
| 12100 | has_beep = 1; |
| 12101 | break; |
| 12102 | } |
| 12103 | } |
| 12104 | |
| 12105 | if (has_beep) { |
| 12106 | err = snd_hda_attach_beep_device(codec, 0x1); |
| 12107 | if (err < 0) { |
| 12108 | alc_free(codec); |
| 12109 | return err; |
| 12110 | } |
| 12111 | if (!query_amp_caps(codec, 0x1d, HDA_INPUT)) |
| 12112 | /* override the amp caps for beep generator */ |
| 12113 | snd_hda_override_amp_caps(codec, 0x1d, HDA_INPUT, |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 12114 | (0x0c << AC_AMPCAP_OFFSET_SHIFT) | |
| 12115 | (0x0c << AC_AMPCAP_NUM_STEPS_SHIFT) | |
| 12116 | (0x07 << AC_AMPCAP_STEP_SIZE_SHIFT) | |
| 12117 | (0 << AC_AMPCAP_MUTE_SHIFT)); |
Takashi Iwai | 22971e3 | 2009-02-10 11:56:44 +0100 | [diff] [blame] | 12118 | } |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 12119 | |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 12120 | if (!spec->adc_nids && spec->input_mux) { |
| 12121 | /* check whether NID 0x07 is valid */ |
| 12122 | unsigned int wcap = get_wcaps(codec, 0x07); |
Takashi Iwai | 85860c0 | 2008-02-19 15:00:15 +0100 | [diff] [blame] | 12123 | int i; |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12124 | |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 12125 | /* get type */ |
| 12126 | wcap = (wcap & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT; |
Takashi Iwai | 67ebcb0 | 2008-02-19 15:03:57 +0100 | [diff] [blame] | 12127 | if (wcap != AC_WID_AUD_IN || spec->input_mux->num_items == 1) { |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 12128 | spec->adc_nids = alc268_adc_nids_alt; |
| 12129 | spec->num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt); |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 12130 | add_mixer(spec, alc268_capture_alt_mixer); |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 12131 | } else { |
| 12132 | spec->adc_nids = alc268_adc_nids; |
| 12133 | spec->num_adc_nids = ARRAY_SIZE(alc268_adc_nids); |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 12134 | add_mixer(spec, alc268_capture_mixer); |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12135 | } |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 12136 | spec->capsrc_nids = alc268_capsrc_nids; |
Takashi Iwai | 85860c0 | 2008-02-19 15:00:15 +0100 | [diff] [blame] | 12137 | /* set default input source */ |
| 12138 | for (i = 0; i < spec->num_adc_nids; i++) |
| 12139 | snd_hda_codec_write_cache(codec, alc268_capsrc_nids[i], |
| 12140 | 0, AC_VERB_SET_CONNECT_SEL, |
| 12141 | spec->input_mux->items[0].index); |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12142 | } |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 12143 | |
| 12144 | spec->vmaster_nid = 0x02; |
| 12145 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12146 | codec->patch_ops = alc_patch_ops; |
| 12147 | if (board_config == ALC268_AUTO) |
| 12148 | spec->init_hook = alc268_auto_init; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 12149 | |
Takashi Iwai | daead53 | 2008-11-28 12:55:36 +0100 | [diff] [blame] | 12150 | codec->proc_widget_hook = print_realtek_coef; |
| 12151 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12152 | return 0; |
| 12153 | } |
| 12154 | |
| 12155 | /* |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 12156 | * ALC269 channel source setting (2 channel) |
| 12157 | */ |
| 12158 | #define ALC269_DIGOUT_NID ALC880_DIGOUT_NID |
| 12159 | |
| 12160 | #define alc269_dac_nids alc260_dac_nids |
| 12161 | |
| 12162 | static hda_nid_t alc269_adc_nids[1] = { |
| 12163 | /* ADC1 */ |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 12164 | 0x08, |
| 12165 | }; |
| 12166 | |
Takashi Iwai | e01bf50 | 2008-08-21 16:25:07 +0200 | [diff] [blame] | 12167 | static hda_nid_t alc269_capsrc_nids[1] = { |
| 12168 | 0x23, |
| 12169 | }; |
| 12170 | |
| 12171 | /* NOTE: ADC2 (0x07) is connected from a recording *MIXER* (0x24), |
| 12172 | * not a mux! |
| 12173 | */ |
| 12174 | |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 12175 | static struct hda_input_mux alc269_eeepc_dmic_capture_source = { |
| 12176 | .num_items = 2, |
| 12177 | .items = { |
| 12178 | { "i-Mic", 0x5 }, |
| 12179 | { "e-Mic", 0x0 }, |
| 12180 | }, |
| 12181 | }; |
| 12182 | |
| 12183 | static struct hda_input_mux alc269_eeepc_amic_capture_source = { |
| 12184 | .num_items = 2, |
| 12185 | .items = { |
| 12186 | { "i-Mic", 0x1 }, |
| 12187 | { "e-Mic", 0x0 }, |
| 12188 | }, |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 12189 | }; |
| 12190 | |
| 12191 | #define alc269_modes alc260_modes |
| 12192 | #define alc269_capture_source alc880_lg_lw_capture_source |
| 12193 | |
| 12194 | static struct snd_kcontrol_new alc269_base_mixer[] = { |
| 12195 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 12196 | HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 12197 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 12198 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 12199 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 12200 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 12201 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 12202 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 12203 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 12204 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
| 12205 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 12206 | HDA_CODEC_MUTE_MONO("Mono Playback Switch", 0x16, 2, 0x0, HDA_OUTPUT), |
| 12207 | { } /* end */ |
| 12208 | }; |
| 12209 | |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 12210 | static struct snd_kcontrol_new alc269_quanta_fl1_mixer[] = { |
| 12211 | /* output mixer control */ |
| 12212 | HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol), |
| 12213 | { |
| 12214 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 12215 | .name = "Master Playback Switch", |
| 12216 | .info = snd_hda_mixer_amp_switch_info, |
| 12217 | .get = snd_hda_mixer_amp_switch_get, |
| 12218 | .put = alc268_acer_master_sw_put, |
| 12219 | .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), |
| 12220 | }, |
| 12221 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 12222 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 12223 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 12224 | HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 12225 | HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 12226 | HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT), |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 12227 | { } |
| 12228 | }; |
| 12229 | |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 12230 | static struct snd_kcontrol_new alc269_lifebook_mixer[] = { |
| 12231 | /* output mixer control */ |
| 12232 | HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol), |
| 12233 | { |
| 12234 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 12235 | .name = "Master Playback Switch", |
| 12236 | .info = snd_hda_mixer_amp_switch_info, |
| 12237 | .get = snd_hda_mixer_amp_switch_get, |
| 12238 | .put = alc268_acer_master_sw_put, |
| 12239 | .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), |
| 12240 | }, |
| 12241 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 12242 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 12243 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 12244 | HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 12245 | HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 12246 | HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT), |
| 12247 | HDA_CODEC_VOLUME("Dock Mic Playback Volume", 0x0b, 0x03, HDA_INPUT), |
| 12248 | HDA_CODEC_MUTE("Dock Mic Playback Switch", 0x0b, 0x03, HDA_INPUT), |
| 12249 | HDA_CODEC_VOLUME("Dock Mic Boost", 0x1b, 0, HDA_INPUT), |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 12250 | { } |
| 12251 | }; |
| 12252 | |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 12253 | /* bind volumes of both NID 0x0c and 0x0d */ |
| 12254 | static struct hda_bind_ctls alc269_epc_bind_vol = { |
| 12255 | .ops = &snd_hda_bind_vol, |
| 12256 | .values = { |
| 12257 | HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT), |
| 12258 | HDA_COMPOSE_AMP_VAL(0x03, 3, 0, HDA_OUTPUT), |
| 12259 | 0 |
| 12260 | }, |
| 12261 | }; |
| 12262 | |
| 12263 | static struct snd_kcontrol_new alc269_eeepc_mixer[] = { |
| 12264 | HDA_CODEC_MUTE("iSpeaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 12265 | HDA_BIND_VOL("LineOut Playback Volume", &alc269_epc_bind_vol), |
| 12266 | HDA_CODEC_MUTE("LineOut Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 12267 | { } /* end */ |
| 12268 | }; |
| 12269 | |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 12270 | /* capture mixer elements */ |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 12271 | static struct snd_kcontrol_new alc269_epc_capture_mixer[] = { |
| 12272 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 12273 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
Takashi Iwai | 26f5df2 | 2008-11-03 17:39:46 +0100 | [diff] [blame] | 12274 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 12275 | { } /* end */ |
| 12276 | }; |
| 12277 | |
| 12278 | /* FSC amilo */ |
| 12279 | static struct snd_kcontrol_new alc269_fujitsu_mixer[] = { |
| 12280 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 12281 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 12282 | HDA_BIND_VOL("PCM Playback Volume", &alc269_epc_bind_vol), |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 12283 | { } /* end */ |
| 12284 | }; |
| 12285 | |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 12286 | static struct hda_verb alc269_quanta_fl1_verbs[] = { |
| 12287 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 12288 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 12289 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 12290 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 12291 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 12292 | {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 12293 | { } |
| 12294 | }; |
| 12295 | |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 12296 | static struct hda_verb alc269_lifebook_verbs[] = { |
| 12297 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 12298 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 12299 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 12300 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 12301 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 12302 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 12303 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 12304 | {0x1a, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 12305 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 12306 | {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 12307 | { } |
| 12308 | }; |
| 12309 | |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 12310 | /* toggle speaker-output according to the hp-jack state */ |
| 12311 | static void alc269_quanta_fl1_speaker_automute(struct hda_codec *codec) |
| 12312 | { |
| 12313 | unsigned int present; |
| 12314 | unsigned char bits; |
| 12315 | |
| 12316 | present = snd_hda_codec_read(codec, 0x15, 0, |
| 12317 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 12318 | bits = present ? AMP_IN_MUTE(0) : 0; |
| 12319 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0, |
| 12320 | AMP_IN_MUTE(0), bits); |
| 12321 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1, |
| 12322 | AMP_IN_MUTE(0), bits); |
| 12323 | |
| 12324 | snd_hda_codec_write(codec, 0x20, 0, |
| 12325 | AC_VERB_SET_COEF_INDEX, 0x0c); |
| 12326 | snd_hda_codec_write(codec, 0x20, 0, |
| 12327 | AC_VERB_SET_PROC_COEF, 0x680); |
| 12328 | |
| 12329 | snd_hda_codec_write(codec, 0x20, 0, |
| 12330 | AC_VERB_SET_COEF_INDEX, 0x0c); |
| 12331 | snd_hda_codec_write(codec, 0x20, 0, |
| 12332 | AC_VERB_SET_PROC_COEF, 0x480); |
| 12333 | } |
| 12334 | |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 12335 | /* toggle speaker-output according to the hp-jacks state */ |
| 12336 | static void alc269_lifebook_speaker_automute(struct hda_codec *codec) |
| 12337 | { |
| 12338 | unsigned int present; |
| 12339 | unsigned char bits; |
| 12340 | |
| 12341 | /* Check laptop headphone socket */ |
| 12342 | present = snd_hda_codec_read(codec, 0x15, 0, |
| 12343 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 12344 | |
| 12345 | /* Check port replicator headphone socket */ |
| 12346 | present |= snd_hda_codec_read(codec, 0x1a, 0, |
| 12347 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 12348 | |
| 12349 | bits = present ? AMP_IN_MUTE(0) : 0; |
| 12350 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0, |
| 12351 | AMP_IN_MUTE(0), bits); |
| 12352 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1, |
| 12353 | AMP_IN_MUTE(0), bits); |
| 12354 | |
| 12355 | snd_hda_codec_write(codec, 0x20, 0, |
| 12356 | AC_VERB_SET_COEF_INDEX, 0x0c); |
| 12357 | snd_hda_codec_write(codec, 0x20, 0, |
| 12358 | AC_VERB_SET_PROC_COEF, 0x680); |
| 12359 | |
| 12360 | snd_hda_codec_write(codec, 0x20, 0, |
| 12361 | AC_VERB_SET_COEF_INDEX, 0x0c); |
| 12362 | snd_hda_codec_write(codec, 0x20, 0, |
| 12363 | AC_VERB_SET_PROC_COEF, 0x480); |
| 12364 | } |
| 12365 | |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 12366 | static void alc269_quanta_fl1_mic_automute(struct hda_codec *codec) |
| 12367 | { |
| 12368 | unsigned int present; |
| 12369 | |
| 12370 | present = snd_hda_codec_read(codec, 0x18, 0, |
| 12371 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 12372 | snd_hda_codec_write(codec, 0x23, 0, |
| 12373 | AC_VERB_SET_CONNECT_SEL, present ? 0x0 : 0x1); |
| 12374 | } |
| 12375 | |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 12376 | static void alc269_lifebook_mic_autoswitch(struct hda_codec *codec) |
| 12377 | { |
| 12378 | unsigned int present_laptop; |
| 12379 | unsigned int present_dock; |
| 12380 | |
| 12381 | present_laptop = snd_hda_codec_read(codec, 0x18, 0, |
| 12382 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 12383 | |
| 12384 | present_dock = snd_hda_codec_read(codec, 0x1b, 0, |
| 12385 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 12386 | |
| 12387 | /* Laptop mic port overrides dock mic port, design decision */ |
| 12388 | if (present_dock) |
| 12389 | snd_hda_codec_write(codec, 0x23, 0, |
| 12390 | AC_VERB_SET_CONNECT_SEL, 0x3); |
| 12391 | if (present_laptop) |
| 12392 | snd_hda_codec_write(codec, 0x23, 0, |
| 12393 | AC_VERB_SET_CONNECT_SEL, 0x0); |
| 12394 | if (!present_dock && !present_laptop) |
| 12395 | snd_hda_codec_write(codec, 0x23, 0, |
| 12396 | AC_VERB_SET_CONNECT_SEL, 0x1); |
| 12397 | } |
| 12398 | |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 12399 | static void alc269_quanta_fl1_unsol_event(struct hda_codec *codec, |
| 12400 | unsigned int res) |
| 12401 | { |
| 12402 | if ((res >> 26) == ALC880_HP_EVENT) |
| 12403 | alc269_quanta_fl1_speaker_automute(codec); |
| 12404 | if ((res >> 26) == ALC880_MIC_EVENT) |
| 12405 | alc269_quanta_fl1_mic_automute(codec); |
| 12406 | } |
| 12407 | |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 12408 | static void alc269_lifebook_unsol_event(struct hda_codec *codec, |
| 12409 | unsigned int res) |
| 12410 | { |
| 12411 | if ((res >> 26) == ALC880_HP_EVENT) |
| 12412 | alc269_lifebook_speaker_automute(codec); |
| 12413 | if ((res >> 26) == ALC880_MIC_EVENT) |
| 12414 | alc269_lifebook_mic_autoswitch(codec); |
| 12415 | } |
| 12416 | |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 12417 | static void alc269_quanta_fl1_init_hook(struct hda_codec *codec) |
| 12418 | { |
| 12419 | alc269_quanta_fl1_speaker_automute(codec); |
| 12420 | alc269_quanta_fl1_mic_automute(codec); |
| 12421 | } |
| 12422 | |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 12423 | static void alc269_lifebook_init_hook(struct hda_codec *codec) |
| 12424 | { |
| 12425 | alc269_lifebook_speaker_automute(codec); |
| 12426 | alc269_lifebook_mic_autoswitch(codec); |
| 12427 | } |
| 12428 | |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 12429 | static struct hda_verb alc269_eeepc_dmic_init_verbs[] = { |
| 12430 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 12431 | {0x23, AC_VERB_SET_CONNECT_SEL, 0x05}, |
| 12432 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, 0xb026 }, |
| 12433 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7019 | (0x00 << 8))}, |
| 12434 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 12435 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 12436 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 12437 | {} |
| 12438 | }; |
| 12439 | |
| 12440 | static struct hda_verb alc269_eeepc_amic_init_verbs[] = { |
| 12441 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 12442 | {0x23, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 12443 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, 0xb026 }, |
| 12444 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x701b | (0x00 << 8))}, |
| 12445 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 12446 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 12447 | {} |
| 12448 | }; |
| 12449 | |
| 12450 | /* toggle speaker-output according to the hp-jack state */ |
| 12451 | static void alc269_speaker_automute(struct hda_codec *codec) |
| 12452 | { |
| 12453 | unsigned int present; |
| 12454 | unsigned char bits; |
| 12455 | |
| 12456 | present = snd_hda_codec_read(codec, 0x15, 0, |
| 12457 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 12458 | bits = present ? AMP_IN_MUTE(0) : 0; |
| 12459 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0, |
| 12460 | AMP_IN_MUTE(0), bits); |
| 12461 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1, |
| 12462 | AMP_IN_MUTE(0), bits); |
| 12463 | } |
| 12464 | |
| 12465 | static void alc269_eeepc_dmic_automute(struct hda_codec *codec) |
| 12466 | { |
| 12467 | unsigned int present; |
| 12468 | |
| 12469 | present = snd_hda_codec_read(codec, 0x18, 0, |
| 12470 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 12471 | snd_hda_codec_write(codec, 0x23, 0, |
| 12472 | AC_VERB_SET_CONNECT_SEL, (present ? 0 : 5)); |
| 12473 | } |
| 12474 | |
| 12475 | static void alc269_eeepc_amic_automute(struct hda_codec *codec) |
| 12476 | { |
| 12477 | unsigned int present; |
| 12478 | |
| 12479 | present = snd_hda_codec_read(codec, 0x18, 0, |
| 12480 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 12481 | snd_hda_codec_write(codec, 0x24, 0, AC_VERB_SET_AMP_GAIN_MUTE, |
| 12482 | 0x7000 | (0x00 << 8) | (present ? 0 : 0x80)); |
| 12483 | snd_hda_codec_write(codec, 0x24, 0, AC_VERB_SET_AMP_GAIN_MUTE, |
| 12484 | 0x7000 | (0x01 << 8) | (present ? 0x80 : 0)); |
| 12485 | } |
| 12486 | |
| 12487 | /* unsolicited event for HP jack sensing */ |
| 12488 | static void alc269_eeepc_dmic_unsol_event(struct hda_codec *codec, |
| 12489 | unsigned int res) |
| 12490 | { |
| 12491 | if ((res >> 26) == ALC880_HP_EVENT) |
| 12492 | alc269_speaker_automute(codec); |
| 12493 | |
| 12494 | if ((res >> 26) == ALC880_MIC_EVENT) |
| 12495 | alc269_eeepc_dmic_automute(codec); |
| 12496 | } |
| 12497 | |
| 12498 | static void alc269_eeepc_dmic_inithook(struct hda_codec *codec) |
| 12499 | { |
| 12500 | alc269_speaker_automute(codec); |
| 12501 | alc269_eeepc_dmic_automute(codec); |
| 12502 | } |
| 12503 | |
| 12504 | /* unsolicited event for HP jack sensing */ |
| 12505 | static void alc269_eeepc_amic_unsol_event(struct hda_codec *codec, |
| 12506 | unsigned int res) |
| 12507 | { |
| 12508 | if ((res >> 26) == ALC880_HP_EVENT) |
| 12509 | alc269_speaker_automute(codec); |
| 12510 | |
| 12511 | if ((res >> 26) == ALC880_MIC_EVENT) |
| 12512 | alc269_eeepc_amic_automute(codec); |
| 12513 | } |
| 12514 | |
| 12515 | static void alc269_eeepc_amic_inithook(struct hda_codec *codec) |
| 12516 | { |
| 12517 | alc269_speaker_automute(codec); |
| 12518 | alc269_eeepc_amic_automute(codec); |
| 12519 | } |
| 12520 | |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 12521 | /* |
| 12522 | * generic initialization of ADC, input mixers and output mixers |
| 12523 | */ |
| 12524 | static struct hda_verb alc269_init_verbs[] = { |
| 12525 | /* |
| 12526 | * Unmute ADC0 and set the default input to mic-in |
| 12527 | */ |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 12528 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 12529 | |
| 12530 | /* Mute input amps (PCBeep, Line In, Mic 1 & Mic 2) of the |
| 12531 | * analog-loopback mixer widget |
| 12532 | * Note: PASD motherboards uses the Line In 2 as the input for |
| 12533 | * front panel mic (mic 2) |
| 12534 | */ |
| 12535 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
| 12536 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 12537 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 12538 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 12539 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 12540 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 12541 | |
| 12542 | /* |
| 12543 | * Set up output mixers (0x0c - 0x0e) |
| 12544 | */ |
| 12545 | /* set vol=0 to output mixers */ |
| 12546 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 12547 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 12548 | |
| 12549 | /* set up input amps for analog loopback */ |
| 12550 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 12551 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12552 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 12553 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12554 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 12555 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12556 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 12557 | |
| 12558 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 12559 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 12560 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 12561 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 12562 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 12563 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 12564 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 12565 | |
| 12566 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 12567 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 12568 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 12569 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 12570 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 12571 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 12572 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 12573 | |
| 12574 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 12575 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 12576 | |
| 12577 | /* FIXME: use matrix-type input source selection */ |
| 12578 | /* Mixer elements: 0x18, 19, 1a, 1b, 1d, 0b */ |
| 12579 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 12580 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 12581 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 12582 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 12583 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 12584 | |
| 12585 | /* set EAPD */ |
| 12586 | {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 12587 | {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 12588 | { } |
| 12589 | }; |
| 12590 | |
| 12591 | /* add playback controls from the parsed DAC table */ |
| 12592 | static int alc269_auto_create_multi_out_ctls(struct alc_spec *spec, |
| 12593 | const struct auto_pin_cfg *cfg) |
| 12594 | { |
| 12595 | hda_nid_t nid; |
| 12596 | int err; |
| 12597 | |
| 12598 | spec->multiout.num_dacs = 1; /* only use one dac */ |
| 12599 | spec->multiout.dac_nids = spec->private_dac_nids; |
| 12600 | spec->multiout.dac_nids[0] = 2; |
| 12601 | |
| 12602 | nid = cfg->line_out_pins[0]; |
| 12603 | if (nid) { |
| 12604 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 12605 | "Front Playback Volume", |
| 12606 | HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT)); |
| 12607 | if (err < 0) |
| 12608 | return err; |
| 12609 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, |
| 12610 | "Front Playback Switch", |
| 12611 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT)); |
| 12612 | if (err < 0) |
| 12613 | return err; |
| 12614 | } |
| 12615 | |
| 12616 | nid = cfg->speaker_pins[0]; |
| 12617 | if (nid) { |
| 12618 | if (!cfg->line_out_pins[0]) { |
| 12619 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 12620 | "Speaker Playback Volume", |
| 12621 | HDA_COMPOSE_AMP_VAL(0x02, 3, 0, |
| 12622 | HDA_OUTPUT)); |
| 12623 | if (err < 0) |
| 12624 | return err; |
| 12625 | } |
| 12626 | if (nid == 0x16) { |
| 12627 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, |
| 12628 | "Speaker Playback Switch", |
| 12629 | HDA_COMPOSE_AMP_VAL(nid, 2, 0, |
| 12630 | HDA_OUTPUT)); |
| 12631 | if (err < 0) |
| 12632 | return err; |
| 12633 | } else { |
| 12634 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, |
| 12635 | "Speaker Playback Switch", |
| 12636 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, |
| 12637 | HDA_OUTPUT)); |
| 12638 | if (err < 0) |
| 12639 | return err; |
| 12640 | } |
| 12641 | } |
| 12642 | nid = cfg->hp_pins[0]; |
| 12643 | if (nid) { |
| 12644 | /* spec->multiout.hp_nid = 2; */ |
| 12645 | if (!cfg->line_out_pins[0] && !cfg->speaker_pins[0]) { |
| 12646 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 12647 | "Headphone Playback Volume", |
| 12648 | HDA_COMPOSE_AMP_VAL(0x02, 3, 0, |
| 12649 | HDA_OUTPUT)); |
| 12650 | if (err < 0) |
| 12651 | return err; |
| 12652 | } |
| 12653 | if (nid == 0x16) { |
| 12654 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, |
| 12655 | "Headphone Playback Switch", |
| 12656 | HDA_COMPOSE_AMP_VAL(nid, 2, 0, |
| 12657 | HDA_OUTPUT)); |
| 12658 | if (err < 0) |
| 12659 | return err; |
| 12660 | } else { |
| 12661 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, |
| 12662 | "Headphone Playback Switch", |
| 12663 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, |
| 12664 | HDA_OUTPUT)); |
| 12665 | if (err < 0) |
| 12666 | return err; |
| 12667 | } |
| 12668 | } |
| 12669 | return 0; |
| 12670 | } |
| 12671 | |
Takashi Iwai | ee956e0 | 2008-10-31 17:16:31 +0100 | [diff] [blame] | 12672 | static int alc269_auto_create_analog_input_ctls(struct alc_spec *spec, |
| 12673 | const struct auto_pin_cfg *cfg) |
| 12674 | { |
| 12675 | int err; |
| 12676 | |
| 12677 | err = alc880_auto_create_analog_input_ctls(spec, cfg); |
| 12678 | if (err < 0) |
| 12679 | return err; |
| 12680 | /* digital-mic input pin is excluded in alc880_auto_create..() |
| 12681 | * because it's under 0x18 |
| 12682 | */ |
| 12683 | if (cfg->input_pins[AUTO_PIN_MIC] == 0x12 || |
| 12684 | cfg->input_pins[AUTO_PIN_FRONT_MIC] == 0x12) { |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 12685 | struct hda_input_mux *imux = &spec->private_imux[0]; |
Takashi Iwai | ee956e0 | 2008-10-31 17:16:31 +0100 | [diff] [blame] | 12686 | imux->items[imux->num_items].label = "Int Mic"; |
| 12687 | imux->items[imux->num_items].index = 0x05; |
| 12688 | imux->num_items++; |
| 12689 | } |
| 12690 | return 0; |
| 12691 | } |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 12692 | |
| 12693 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 12694 | #define alc269_loopbacks alc880_loopbacks |
| 12695 | #endif |
| 12696 | |
| 12697 | /* pcm configuration: identiacal with ALC880 */ |
| 12698 | #define alc269_pcm_analog_playback alc880_pcm_analog_playback |
| 12699 | #define alc269_pcm_analog_capture alc880_pcm_analog_capture |
| 12700 | #define alc269_pcm_digital_playback alc880_pcm_digital_playback |
| 12701 | #define alc269_pcm_digital_capture alc880_pcm_digital_capture |
| 12702 | |
| 12703 | /* |
| 12704 | * BIOS auto configuration |
| 12705 | */ |
| 12706 | static int alc269_parse_auto_config(struct hda_codec *codec) |
| 12707 | { |
| 12708 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | cfb9fb5 | 2009-02-06 17:34:03 +0100 | [diff] [blame] | 12709 | int err; |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 12710 | static hda_nid_t alc269_ignore[] = { 0x1d, 0 }; |
| 12711 | |
| 12712 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 12713 | alc269_ignore); |
| 12714 | if (err < 0) |
| 12715 | return err; |
| 12716 | |
| 12717 | err = alc269_auto_create_multi_out_ctls(spec, &spec->autocfg); |
| 12718 | if (err < 0) |
| 12719 | return err; |
| 12720 | err = alc269_auto_create_analog_input_ctls(spec, &spec->autocfg); |
| 12721 | if (err < 0) |
| 12722 | return err; |
| 12723 | |
| 12724 | spec->multiout.max_channels = spec->multiout.num_dacs * 2; |
| 12725 | |
Takashi Iwai | 0852d7a | 2009-02-11 11:35:15 +0100 | [diff] [blame] | 12726 | if (spec->autocfg.dig_outs) |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 12727 | spec->multiout.dig_out_nid = ALC269_DIGOUT_NID; |
| 12728 | |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 12729 | if (spec->kctls.list) |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 12730 | add_mixer(spec, spec->kctls.list); |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 12731 | |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 12732 | add_verb(spec, alc269_init_verbs); |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 12733 | spec->num_mux_defs = 1; |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 12734 | spec->input_mux = &spec->private_imux[0]; |
Takashi Iwai | e01bf50 | 2008-08-21 16:25:07 +0200 | [diff] [blame] | 12735 | /* set default input source */ |
| 12736 | snd_hda_codec_write_cache(codec, alc269_capsrc_nids[0], |
| 12737 | 0, AC_VERB_SET_CONNECT_SEL, |
| 12738 | spec->input_mux->items[0].index); |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 12739 | |
| 12740 | err = alc_auto_add_mic_boost(codec); |
| 12741 | if (err < 0) |
| 12742 | return err; |
| 12743 | |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 12744 | if (!spec->cap_mixer) |
| 12745 | set_capture_mixer(spec); |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 12746 | |
Takashi Iwai | e044c39 | 2008-10-27 16:56:24 +0100 | [diff] [blame] | 12747 | store_pin_configs(codec); |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 12748 | return 1; |
| 12749 | } |
| 12750 | |
| 12751 | #define alc269_auto_init_multi_out alc882_auto_init_multi_out |
| 12752 | #define alc269_auto_init_hp_out alc882_auto_init_hp_out |
| 12753 | #define alc269_auto_init_analog_input alc882_auto_init_analog_input |
| 12754 | |
| 12755 | |
| 12756 | /* init callback for auto-configuration model -- overriding the default init */ |
| 12757 | static void alc269_auto_init(struct hda_codec *codec) |
| 12758 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 12759 | struct alc_spec *spec = codec->spec; |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 12760 | alc269_auto_init_multi_out(codec); |
| 12761 | alc269_auto_init_hp_out(codec); |
| 12762 | alc269_auto_init_analog_input(codec); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 12763 | if (spec->unsol_event) |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 12764 | alc_inithook(codec); |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 12765 | } |
| 12766 | |
| 12767 | /* |
| 12768 | * configuration and preset |
| 12769 | */ |
| 12770 | static const char *alc269_models[ALC269_MODEL_LAST] = { |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 12771 | [ALC269_BASIC] = "basic", |
Takashi Iwai | 2922c9a | 2008-08-27 18:12:42 +0200 | [diff] [blame] | 12772 | [ALC269_QUANTA_FL1] = "quanta", |
| 12773 | [ALC269_ASUS_EEEPC_P703] = "eeepc-p703", |
Takashi Iwai | 26f5df2 | 2008-11-03 17:39:46 +0100 | [diff] [blame] | 12774 | [ALC269_ASUS_EEEPC_P901] = "eeepc-p901", |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 12775 | [ALC269_FUJITSU] = "fujitsu", |
| 12776 | [ALC269_LIFEBOOK] = "lifebook" |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 12777 | }; |
| 12778 | |
| 12779 | static struct snd_pci_quirk alc269_cfg_tbl[] = { |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 12780 | SND_PCI_QUIRK(0x17aa, 0x3bf8, "Quanta FL1", ALC269_QUANTA_FL1), |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 12781 | SND_PCI_QUIRK(0x1043, 0x8330, "ASUS Eeepc P703 P900A", |
| 12782 | ALC269_ASUS_EEEPC_P703), |
| 12783 | SND_PCI_QUIRK(0x1043, 0x831a, "ASUS Eeepc P901", |
| 12784 | ALC269_ASUS_EEEPC_P901), |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 12785 | SND_PCI_QUIRK(0x1043, 0x834a, "ASUS Eeepc S101", |
| 12786 | ALC269_ASUS_EEEPC_P901), |
Takashi Iwai | 26f5df2 | 2008-11-03 17:39:46 +0100 | [diff] [blame] | 12787 | SND_PCI_QUIRK(0x1734, 0x115d, "FSC Amilo", ALC269_FUJITSU), |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 12788 | SND_PCI_QUIRK(0x10cf, 0x1475, "Lifebook ICH9M-based", ALC269_LIFEBOOK), |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 12789 | {} |
| 12790 | }; |
| 12791 | |
| 12792 | static struct alc_config_preset alc269_presets[] = { |
| 12793 | [ALC269_BASIC] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 12794 | .mixers = { alc269_base_mixer }, |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 12795 | .init_verbs = { alc269_init_verbs }, |
| 12796 | .num_dacs = ARRAY_SIZE(alc269_dac_nids), |
| 12797 | .dac_nids = alc269_dac_nids, |
| 12798 | .hp_nid = 0x03, |
| 12799 | .num_channel_mode = ARRAY_SIZE(alc269_modes), |
| 12800 | .channel_mode = alc269_modes, |
| 12801 | .input_mux = &alc269_capture_source, |
| 12802 | }, |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 12803 | [ALC269_QUANTA_FL1] = { |
| 12804 | .mixers = { alc269_quanta_fl1_mixer }, |
| 12805 | .init_verbs = { alc269_init_verbs, alc269_quanta_fl1_verbs }, |
| 12806 | .num_dacs = ARRAY_SIZE(alc269_dac_nids), |
| 12807 | .dac_nids = alc269_dac_nids, |
| 12808 | .hp_nid = 0x03, |
| 12809 | .num_channel_mode = ARRAY_SIZE(alc269_modes), |
| 12810 | .channel_mode = alc269_modes, |
| 12811 | .input_mux = &alc269_capture_source, |
| 12812 | .unsol_event = alc269_quanta_fl1_unsol_event, |
| 12813 | .init_hook = alc269_quanta_fl1_init_hook, |
| 12814 | }, |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 12815 | [ALC269_ASUS_EEEPC_P703] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 12816 | .mixers = { alc269_eeepc_mixer }, |
| 12817 | .cap_mixer = alc269_epc_capture_mixer, |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 12818 | .init_verbs = { alc269_init_verbs, |
| 12819 | alc269_eeepc_amic_init_verbs }, |
| 12820 | .num_dacs = ARRAY_SIZE(alc269_dac_nids), |
| 12821 | .dac_nids = alc269_dac_nids, |
| 12822 | .hp_nid = 0x03, |
| 12823 | .num_channel_mode = ARRAY_SIZE(alc269_modes), |
| 12824 | .channel_mode = alc269_modes, |
| 12825 | .input_mux = &alc269_eeepc_amic_capture_source, |
| 12826 | .unsol_event = alc269_eeepc_amic_unsol_event, |
| 12827 | .init_hook = alc269_eeepc_amic_inithook, |
| 12828 | }, |
| 12829 | [ALC269_ASUS_EEEPC_P901] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 12830 | .mixers = { alc269_eeepc_mixer }, |
| 12831 | .cap_mixer = alc269_epc_capture_mixer, |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 12832 | .init_verbs = { alc269_init_verbs, |
| 12833 | alc269_eeepc_dmic_init_verbs }, |
| 12834 | .num_dacs = ARRAY_SIZE(alc269_dac_nids), |
| 12835 | .dac_nids = alc269_dac_nids, |
| 12836 | .hp_nid = 0x03, |
| 12837 | .num_channel_mode = ARRAY_SIZE(alc269_modes), |
| 12838 | .channel_mode = alc269_modes, |
| 12839 | .input_mux = &alc269_eeepc_dmic_capture_source, |
| 12840 | .unsol_event = alc269_eeepc_dmic_unsol_event, |
| 12841 | .init_hook = alc269_eeepc_dmic_inithook, |
| 12842 | }, |
Takashi Iwai | 26f5df2 | 2008-11-03 17:39:46 +0100 | [diff] [blame] | 12843 | [ALC269_FUJITSU] = { |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 12844 | .mixers = { alc269_fujitsu_mixer }, |
Takashi Iwai | 26f5df2 | 2008-11-03 17:39:46 +0100 | [diff] [blame] | 12845 | .cap_mixer = alc269_epc_capture_mixer, |
| 12846 | .init_verbs = { alc269_init_verbs, |
| 12847 | alc269_eeepc_dmic_init_verbs }, |
| 12848 | .num_dacs = ARRAY_SIZE(alc269_dac_nids), |
| 12849 | .dac_nids = alc269_dac_nids, |
| 12850 | .hp_nid = 0x03, |
| 12851 | .num_channel_mode = ARRAY_SIZE(alc269_modes), |
| 12852 | .channel_mode = alc269_modes, |
| 12853 | .input_mux = &alc269_eeepc_dmic_capture_source, |
| 12854 | .unsol_event = alc269_eeepc_dmic_unsol_event, |
| 12855 | .init_hook = alc269_eeepc_dmic_inithook, |
| 12856 | }, |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 12857 | [ALC269_LIFEBOOK] = { |
| 12858 | .mixers = { alc269_lifebook_mixer }, |
| 12859 | .init_verbs = { alc269_init_verbs, alc269_lifebook_verbs }, |
| 12860 | .num_dacs = ARRAY_SIZE(alc269_dac_nids), |
| 12861 | .dac_nids = alc269_dac_nids, |
| 12862 | .hp_nid = 0x03, |
| 12863 | .num_channel_mode = ARRAY_SIZE(alc269_modes), |
| 12864 | .channel_mode = alc269_modes, |
| 12865 | .input_mux = &alc269_capture_source, |
| 12866 | .unsol_event = alc269_lifebook_unsol_event, |
| 12867 | .init_hook = alc269_lifebook_init_hook, |
| 12868 | }, |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 12869 | }; |
| 12870 | |
| 12871 | static int patch_alc269(struct hda_codec *codec) |
| 12872 | { |
| 12873 | struct alc_spec *spec; |
| 12874 | int board_config; |
| 12875 | int err; |
| 12876 | |
| 12877 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
| 12878 | if (spec == NULL) |
| 12879 | return -ENOMEM; |
| 12880 | |
| 12881 | codec->spec = spec; |
| 12882 | |
Takashi Iwai | 2c3bf9a | 2008-06-04 12:39:38 +0200 | [diff] [blame] | 12883 | alc_fix_pll_init(codec, 0x20, 0x04, 15); |
| 12884 | |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 12885 | board_config = snd_hda_check_board_config(codec, ALC269_MODEL_LAST, |
| 12886 | alc269_models, |
| 12887 | alc269_cfg_tbl); |
| 12888 | |
| 12889 | if (board_config < 0) { |
| 12890 | printk(KERN_INFO "hda_codec: Unknown model for ALC269, " |
| 12891 | "trying auto-probe from BIOS...\n"); |
| 12892 | board_config = ALC269_AUTO; |
| 12893 | } |
| 12894 | |
| 12895 | if (board_config == ALC269_AUTO) { |
| 12896 | /* automatic parse from the BIOS config */ |
| 12897 | err = alc269_parse_auto_config(codec); |
| 12898 | if (err < 0) { |
| 12899 | alc_free(codec); |
| 12900 | return err; |
| 12901 | } else if (!err) { |
| 12902 | printk(KERN_INFO |
| 12903 | "hda_codec: Cannot set up configuration " |
| 12904 | "from BIOS. Using base mode...\n"); |
| 12905 | board_config = ALC269_BASIC; |
| 12906 | } |
| 12907 | } |
| 12908 | |
Kusanagi Kouichi | 680cd53 | 2009-02-05 00:00:58 +0900 | [diff] [blame] | 12909 | err = snd_hda_attach_beep_device(codec, 0x1); |
| 12910 | if (err < 0) { |
| 12911 | alc_free(codec); |
| 12912 | return err; |
| 12913 | } |
| 12914 | |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 12915 | if (board_config != ALC269_AUTO) |
| 12916 | setup_preset(spec, &alc269_presets[board_config]); |
| 12917 | |
| 12918 | spec->stream_name_analog = "ALC269 Analog"; |
| 12919 | spec->stream_analog_playback = &alc269_pcm_analog_playback; |
| 12920 | spec->stream_analog_capture = &alc269_pcm_analog_capture; |
| 12921 | |
| 12922 | spec->stream_name_digital = "ALC269 Digital"; |
| 12923 | spec->stream_digital_playback = &alc269_pcm_digital_playback; |
| 12924 | spec->stream_digital_capture = &alc269_pcm_digital_capture; |
| 12925 | |
| 12926 | spec->adc_nids = alc269_adc_nids; |
| 12927 | spec->num_adc_nids = ARRAY_SIZE(alc269_adc_nids); |
Takashi Iwai | e01bf50 | 2008-08-21 16:25:07 +0200 | [diff] [blame] | 12928 | spec->capsrc_nids = alc269_capsrc_nids; |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 12929 | if (!spec->cap_mixer) |
| 12930 | set_capture_mixer(spec); |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 12931 | set_beep_amp(spec, 0x0b, 0x04, HDA_INPUT); |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 12932 | |
| 12933 | codec->patch_ops = alc_patch_ops; |
| 12934 | if (board_config == ALC269_AUTO) |
| 12935 | spec->init_hook = alc269_auto_init; |
| 12936 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 12937 | if (!spec->loopback.amplist) |
| 12938 | spec->loopback.amplist = alc269_loopbacks; |
| 12939 | #endif |
Takashi Iwai | daead53 | 2008-11-28 12:55:36 +0100 | [diff] [blame] | 12940 | codec->proc_widget_hook = print_realtek_coef; |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 12941 | |
| 12942 | return 0; |
| 12943 | } |
| 12944 | |
| 12945 | /* |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12946 | * ALC861 channel source setting (2/6 channel selection for 3-stack) |
| 12947 | */ |
| 12948 | |
| 12949 | /* |
| 12950 | * set the path ways for 2 channel output |
| 12951 | * need to set the codec line out and mic 1 pin widgets to inputs |
| 12952 | */ |
| 12953 | static struct hda_verb alc861_threestack_ch2_init[] = { |
| 12954 | /* set pin widget 1Ah (line in) for input */ |
| 12955 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12956 | /* set pin widget 18h (mic1/2) for input, for mic also enable |
| 12957 | * the vref |
| 12958 | */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12959 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 12960 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 12961 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c }, |
| 12962 | #if 0 |
| 12963 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/ |
| 12964 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8)) }, /*line-in*/ |
| 12965 | #endif |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12966 | { } /* end */ |
| 12967 | }; |
| 12968 | /* |
| 12969 | * 6ch mode |
| 12970 | * need to set the codec line out and mic 1 pin widgets to outputs |
| 12971 | */ |
| 12972 | static struct hda_verb alc861_threestack_ch6_init[] = { |
| 12973 | /* set pin widget 1Ah (line in) for output (Back Surround)*/ |
| 12974 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 12975 | /* set pin widget 18h (mic1) for output (CLFE)*/ |
| 12976 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 12977 | |
| 12978 | { 0x0c, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 12979 | { 0x0d, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12980 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 12981 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb080 }, |
| 12982 | #if 0 |
| 12983 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/ |
| 12984 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8)) }, /*line in*/ |
| 12985 | #endif |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12986 | { } /* end */ |
| 12987 | }; |
| 12988 | |
| 12989 | static struct hda_channel_mode alc861_threestack_modes[2] = { |
| 12990 | { 2, alc861_threestack_ch2_init }, |
| 12991 | { 6, alc861_threestack_ch6_init }, |
| 12992 | }; |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 12993 | /* Set mic1 as input and unmute the mixer */ |
| 12994 | static struct hda_verb alc861_uniwill_m31_ch2_init[] = { |
| 12995 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 12996 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/ |
| 12997 | { } /* end */ |
| 12998 | }; |
| 12999 | /* Set mic1 as output and mute mixer */ |
| 13000 | static struct hda_verb alc861_uniwill_m31_ch4_init[] = { |
| 13001 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 13002 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/ |
| 13003 | { } /* end */ |
| 13004 | }; |
| 13005 | |
| 13006 | static struct hda_channel_mode alc861_uniwill_m31_modes[2] = { |
| 13007 | { 2, alc861_uniwill_m31_ch2_init }, |
| 13008 | { 4, alc861_uniwill_m31_ch4_init }, |
| 13009 | }; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13010 | |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 13011 | /* Set mic1 and line-in as input and unmute the mixer */ |
| 13012 | static struct hda_verb alc861_asus_ch2_init[] = { |
| 13013 | /* set pin widget 1Ah (line in) for input */ |
| 13014 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13015 | /* set pin widget 18h (mic1/2) for input, for mic also enable |
| 13016 | * the vref |
| 13017 | */ |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 13018 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 13019 | |
| 13020 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c }, |
| 13021 | #if 0 |
| 13022 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/ |
| 13023 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8)) }, /*line-in*/ |
| 13024 | #endif |
| 13025 | { } /* end */ |
| 13026 | }; |
| 13027 | /* Set mic1 nad line-in as output and mute mixer */ |
| 13028 | static struct hda_verb alc861_asus_ch6_init[] = { |
| 13029 | /* set pin widget 1Ah (line in) for output (Back Surround)*/ |
| 13030 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 13031 | /* { 0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, */ |
| 13032 | /* set pin widget 18h (mic1) for output (CLFE)*/ |
| 13033 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 13034 | /* { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, */ |
| 13035 | { 0x0c, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 13036 | { 0x0d, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 13037 | |
| 13038 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb080 }, |
| 13039 | #if 0 |
| 13040 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/ |
| 13041 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8)) }, /*line in*/ |
| 13042 | #endif |
| 13043 | { } /* end */ |
| 13044 | }; |
| 13045 | |
| 13046 | static struct hda_channel_mode alc861_asus_modes[2] = { |
| 13047 | { 2, alc861_asus_ch2_init }, |
| 13048 | { 6, alc861_asus_ch6_init }, |
| 13049 | }; |
| 13050 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13051 | /* patch-ALC861 */ |
| 13052 | |
| 13053 | static struct snd_kcontrol_new alc861_base_mixer[] = { |
| 13054 | /* output mixer control */ |
| 13055 | HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT), |
| 13056 | HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT), |
| 13057 | HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT), |
| 13058 | HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT), |
| 13059 | HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), |
| 13060 | |
| 13061 | /*Input mixer control */ |
| 13062 | /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT), |
| 13063 | HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */ |
| 13064 | HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT), |
| 13065 | HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT), |
| 13066 | HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT), |
| 13067 | HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT), |
| 13068 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT), |
| 13069 | HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT), |
| 13070 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT), |
| 13071 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT), |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13072 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13073 | { } /* end */ |
| 13074 | }; |
| 13075 | |
| 13076 | static struct snd_kcontrol_new alc861_3ST_mixer[] = { |
| 13077 | /* output mixer control */ |
| 13078 | HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT), |
| 13079 | HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT), |
| 13080 | HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT), |
| 13081 | HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT), |
| 13082 | /*HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), */ |
| 13083 | |
| 13084 | /* Input mixer control */ |
| 13085 | /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT), |
| 13086 | HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */ |
| 13087 | HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT), |
| 13088 | HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT), |
| 13089 | HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT), |
| 13090 | HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT), |
| 13091 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT), |
| 13092 | HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT), |
| 13093 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT), |
| 13094 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT), |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13095 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13096 | { |
| 13097 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 13098 | .name = "Channel Mode", |
| 13099 | .info = alc_ch_mode_info, |
| 13100 | .get = alc_ch_mode_get, |
| 13101 | .put = alc_ch_mode_put, |
| 13102 | .private_value = ARRAY_SIZE(alc861_threestack_modes), |
| 13103 | }, |
| 13104 | { } /* end */ |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 13105 | }; |
| 13106 | |
Takashi Iwai | d1d985f | 2006-11-23 19:27:12 +0100 | [diff] [blame] | 13107 | static struct snd_kcontrol_new alc861_toshiba_mixer[] = { |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 13108 | /* output mixer control */ |
| 13109 | HDA_CODEC_MUTE("Master Playback Switch", 0x03, 0x0, HDA_OUTPUT), |
| 13110 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT), |
| 13111 | HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT), |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 13112 | |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 13113 | { } /* end */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13114 | }; |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 13115 | |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 13116 | static struct snd_kcontrol_new alc861_uniwill_m31_mixer[] = { |
| 13117 | /* output mixer control */ |
| 13118 | HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT), |
| 13119 | HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT), |
| 13120 | HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT), |
| 13121 | HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT), |
| 13122 | /*HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), */ |
| 13123 | |
| 13124 | /* Input mixer control */ |
| 13125 | /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT), |
| 13126 | HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */ |
| 13127 | HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT), |
| 13128 | HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT), |
| 13129 | HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT), |
| 13130 | HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT), |
| 13131 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT), |
| 13132 | HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT), |
| 13133 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT), |
| 13134 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT), |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13135 | |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 13136 | { |
| 13137 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 13138 | .name = "Channel Mode", |
| 13139 | .info = alc_ch_mode_info, |
| 13140 | .get = alc_ch_mode_get, |
| 13141 | .put = alc_ch_mode_put, |
| 13142 | .private_value = ARRAY_SIZE(alc861_uniwill_m31_modes), |
| 13143 | }, |
| 13144 | { } /* end */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13145 | }; |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 13146 | |
| 13147 | static struct snd_kcontrol_new alc861_asus_mixer[] = { |
| 13148 | /* output mixer control */ |
| 13149 | HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT), |
| 13150 | HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT), |
| 13151 | HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT), |
| 13152 | HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT), |
| 13153 | HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), |
| 13154 | |
| 13155 | /* Input mixer control */ |
| 13156 | HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT), |
| 13157 | HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 13158 | HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT), |
| 13159 | HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT), |
| 13160 | HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT), |
| 13161 | HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT), |
| 13162 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT), |
| 13163 | HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT), |
| 13164 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT), |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13165 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_OUTPUT), |
| 13166 | |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 13167 | { |
| 13168 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 13169 | .name = "Channel Mode", |
| 13170 | .info = alc_ch_mode_info, |
| 13171 | .get = alc_ch_mode_get, |
| 13172 | .put = alc_ch_mode_put, |
| 13173 | .private_value = ARRAY_SIZE(alc861_asus_modes), |
| 13174 | }, |
| 13175 | { } |
Takashi Iwai | 56bb0ca | 2006-11-22 11:52:52 +0100 | [diff] [blame] | 13176 | }; |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 13177 | |
Takashi Iwai | 56bb0ca | 2006-11-22 11:52:52 +0100 | [diff] [blame] | 13178 | /* additional mixer */ |
Takashi Iwai | d1d985f | 2006-11-23 19:27:12 +0100 | [diff] [blame] | 13179 | static struct snd_kcontrol_new alc861_asus_laptop_mixer[] = { |
Takashi Iwai | 56bb0ca | 2006-11-22 11:52:52 +0100 | [diff] [blame] | 13180 | HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT), |
| 13181 | HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT), |
Takashi Iwai | 56bb0ca | 2006-11-22 11:52:52 +0100 | [diff] [blame] | 13182 | { } |
| 13183 | }; |
| 13184 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13185 | /* |
| 13186 | * generic initialization of ADC, input mixers and output mixers |
| 13187 | */ |
| 13188 | static struct hda_verb alc861_base_init_verbs[] = { |
| 13189 | /* |
| 13190 | * Unmute ADC0 and set the default input to mic-in |
| 13191 | */ |
| 13192 | /* port-A for surround (rear panel) */ |
| 13193 | { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 13194 | { 0x0e, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 13195 | /* port-B for mic-in (rear panel) with vref */ |
| 13196 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 13197 | /* port-C for line-in (rear panel) */ |
| 13198 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 13199 | /* port-D for Front */ |
| 13200 | { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 13201 | { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 13202 | /* port-E for HP out (front panel) */ |
| 13203 | { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 }, |
| 13204 | /* route front PCM to HP */ |
Takashi Iwai | 9dece1d | 2006-11-16 17:12:49 +0100 | [diff] [blame] | 13205 | { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13206 | /* port-F for mic-in (front panel) with vref */ |
| 13207 | { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 13208 | /* port-G for CLFE (rear panel) */ |
| 13209 | { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 13210 | { 0x1f, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 13211 | /* port-H for side (rear panel) */ |
| 13212 | { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 13213 | { 0x20, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 13214 | /* CD-in */ |
| 13215 | { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 13216 | /* route front mic to ADC1*/ |
| 13217 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 13218 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 13219 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13220 | /* Unmute DAC0~3 & spdif out*/ |
| 13221 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 13222 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 13223 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 13224 | {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 13225 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 13226 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13227 | /* Unmute Mixer 14 (mic) 1c (Line in)*/ |
| 13228 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13229 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 13230 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13231 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 13232 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13233 | /* Unmute Stereo Mixer 15 */ |
| 13234 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13235 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 13236 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13237 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13238 | |
| 13239 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13240 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 13241 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13242 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 13243 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13244 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 13245 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13246 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13247 | /* hp used DAC 3 (Front) */ |
| 13248 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13249 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 13250 | |
| 13251 | { } |
| 13252 | }; |
| 13253 | |
| 13254 | static struct hda_verb alc861_threestack_init_verbs[] = { |
| 13255 | /* |
| 13256 | * Unmute ADC0 and set the default input to mic-in |
| 13257 | */ |
| 13258 | /* port-A for surround (rear panel) */ |
| 13259 | { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 13260 | /* port-B for mic-in (rear panel) with vref */ |
| 13261 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 13262 | /* port-C for line-in (rear panel) */ |
| 13263 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 13264 | /* port-D for Front */ |
| 13265 | { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 13266 | { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 13267 | /* port-E for HP out (front panel) */ |
| 13268 | { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 }, |
| 13269 | /* route front PCM to HP */ |
Takashi Iwai | 9dece1d | 2006-11-16 17:12:49 +0100 | [diff] [blame] | 13270 | { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13271 | /* port-F for mic-in (front panel) with vref */ |
| 13272 | { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 13273 | /* port-G for CLFE (rear panel) */ |
| 13274 | { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 13275 | /* port-H for side (rear panel) */ |
| 13276 | { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 13277 | /* CD-in */ |
| 13278 | { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 13279 | /* route front mic to ADC1*/ |
| 13280 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 13281 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13282 | /* Unmute DAC0~3 & spdif out*/ |
| 13283 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 13284 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 13285 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 13286 | {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 13287 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 13288 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13289 | /* Unmute Mixer 14 (mic) 1c (Line in)*/ |
| 13290 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13291 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 13292 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13293 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 13294 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13295 | /* Unmute Stereo Mixer 15 */ |
| 13296 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13297 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 13298 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13299 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13300 | |
| 13301 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13302 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 13303 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13304 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 13305 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13306 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 13307 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13308 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13309 | /* hp used DAC 3 (Front) */ |
| 13310 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13311 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 13312 | { } |
| 13313 | }; |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 13314 | |
| 13315 | static struct hda_verb alc861_uniwill_m31_init_verbs[] = { |
| 13316 | /* |
| 13317 | * Unmute ADC0 and set the default input to mic-in |
| 13318 | */ |
| 13319 | /* port-A for surround (rear panel) */ |
| 13320 | { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 13321 | /* port-B for mic-in (rear panel) with vref */ |
| 13322 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 13323 | /* port-C for line-in (rear panel) */ |
| 13324 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 13325 | /* port-D for Front */ |
| 13326 | { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 13327 | { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 13328 | /* port-E for HP out (front panel) */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13329 | /* this has to be set to VREF80 */ |
| 13330 | { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 13331 | /* route front PCM to HP */ |
Takashi Iwai | 9dece1d | 2006-11-16 17:12:49 +0100 | [diff] [blame] | 13332 | { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 13333 | /* port-F for mic-in (front panel) with vref */ |
| 13334 | { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 13335 | /* port-G for CLFE (rear panel) */ |
| 13336 | { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 13337 | /* port-H for side (rear panel) */ |
| 13338 | { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 13339 | /* CD-in */ |
| 13340 | { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 13341 | /* route front mic to ADC1*/ |
| 13342 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 13343 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13344 | /* Unmute DAC0~3 & spdif out*/ |
| 13345 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 13346 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 13347 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 13348 | {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 13349 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 13350 | |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 13351 | /* Unmute Mixer 14 (mic) 1c (Line in)*/ |
| 13352 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13353 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 13354 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13355 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 13356 | |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 13357 | /* Unmute Stereo Mixer 15 */ |
| 13358 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13359 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 13360 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13361 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */ |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 13362 | |
| 13363 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13364 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 13365 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13366 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 13367 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13368 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 13369 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13370 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13371 | /* hp used DAC 3 (Front) */ |
| 13372 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 13373 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 13374 | { } |
| 13375 | }; |
| 13376 | |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 13377 | static struct hda_verb alc861_asus_init_verbs[] = { |
| 13378 | /* |
| 13379 | * Unmute ADC0 and set the default input to mic-in |
| 13380 | */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13381 | /* port-A for surround (rear panel) |
| 13382 | * according to codec#0 this is the HP jack |
| 13383 | */ |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 13384 | { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 }, /* was 0x00 */ |
| 13385 | /* route front PCM to HP */ |
| 13386 | { 0x0e, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 13387 | /* port-B for mic-in (rear panel) with vref */ |
| 13388 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 13389 | /* port-C for line-in (rear panel) */ |
| 13390 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 13391 | /* port-D for Front */ |
| 13392 | { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 13393 | { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 13394 | /* port-E for HP out (front panel) */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13395 | /* this has to be set to VREF80 */ |
| 13396 | { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 13397 | /* route front PCM to HP */ |
Takashi Iwai | 9dece1d | 2006-11-16 17:12:49 +0100 | [diff] [blame] | 13398 | { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 13399 | /* port-F for mic-in (front panel) with vref */ |
| 13400 | { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 13401 | /* port-G for CLFE (rear panel) */ |
| 13402 | { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 13403 | /* port-H for side (rear panel) */ |
| 13404 | { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 13405 | /* CD-in */ |
| 13406 | { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 13407 | /* route front mic to ADC1*/ |
| 13408 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 13409 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13410 | /* Unmute DAC0~3 & spdif out*/ |
| 13411 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 13412 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 13413 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 13414 | {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 13415 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 13416 | /* Unmute Mixer 14 (mic) 1c (Line in)*/ |
| 13417 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13418 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 13419 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13420 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 13421 | |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 13422 | /* Unmute Stereo Mixer 15 */ |
| 13423 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13424 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 13425 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13426 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */ |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 13427 | |
| 13428 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13429 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 13430 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13431 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 13432 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13433 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 13434 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13435 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13436 | /* hp used DAC 3 (Front) */ |
| 13437 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 13438 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 13439 | { } |
| 13440 | }; |
| 13441 | |
Takashi Iwai | 56bb0ca | 2006-11-22 11:52:52 +0100 | [diff] [blame] | 13442 | /* additional init verbs for ASUS laptops */ |
| 13443 | static struct hda_verb alc861_asus_laptop_init_verbs[] = { |
| 13444 | { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x45 }, /* HP-out */ |
| 13445 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2) }, /* mute line-in */ |
| 13446 | { } |
| 13447 | }; |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 13448 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13449 | /* |
| 13450 | * generic initialization of ADC, input mixers and output mixers |
| 13451 | */ |
| 13452 | static struct hda_verb alc861_auto_init_verbs[] = { |
| 13453 | /* |
| 13454 | * Unmute ADC0 and set the default input to mic-in |
| 13455 | */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13456 | /* {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13457 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 13458 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13459 | /* Unmute DAC0~3 & spdif out*/ |
| 13460 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 13461 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 13462 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 13463 | {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 13464 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 13465 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13466 | /* Unmute Mixer 14 (mic) 1c (Line in)*/ |
| 13467 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13468 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 13469 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13470 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 13471 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13472 | /* Unmute Stereo Mixer 15 */ |
| 13473 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13474 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 13475 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 13476 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, |
| 13477 | |
| 13478 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13479 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 13480 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13481 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 13482 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13483 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 13484 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13485 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 13486 | |
| 13487 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 13488 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13489 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 13490 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13491 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 13492 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13493 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 13494 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13495 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13496 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, /* set Mic 1 */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13497 | |
| 13498 | { } |
| 13499 | }; |
| 13500 | |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 13501 | static struct hda_verb alc861_toshiba_init_verbs[] = { |
| 13502 | {0x0f, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13503 | |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 13504 | { } |
| 13505 | }; |
| 13506 | |
| 13507 | /* toggle speaker-output according to the hp-jack state */ |
| 13508 | static void alc861_toshiba_automute(struct hda_codec *codec) |
| 13509 | { |
| 13510 | unsigned int present; |
| 13511 | |
| 13512 | present = snd_hda_codec_read(codec, 0x0f, 0, |
| 13513 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 13514 | snd_hda_codec_amp_stereo(codec, 0x16, HDA_INPUT, 0, |
| 13515 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
| 13516 | snd_hda_codec_amp_stereo(codec, 0x1a, HDA_INPUT, 3, |
| 13517 | HDA_AMP_MUTE, present ? 0 : HDA_AMP_MUTE); |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 13518 | } |
| 13519 | |
| 13520 | static void alc861_toshiba_unsol_event(struct hda_codec *codec, |
| 13521 | unsigned int res) |
| 13522 | { |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 13523 | if ((res >> 26) == ALC880_HP_EVENT) |
| 13524 | alc861_toshiba_automute(codec); |
| 13525 | } |
| 13526 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13527 | /* pcm configuration: identiacal with ALC880 */ |
| 13528 | #define alc861_pcm_analog_playback alc880_pcm_analog_playback |
| 13529 | #define alc861_pcm_analog_capture alc880_pcm_analog_capture |
| 13530 | #define alc861_pcm_digital_playback alc880_pcm_digital_playback |
| 13531 | #define alc861_pcm_digital_capture alc880_pcm_digital_capture |
| 13532 | |
| 13533 | |
| 13534 | #define ALC861_DIGOUT_NID 0x07 |
| 13535 | |
| 13536 | static struct hda_channel_mode alc861_8ch_modes[1] = { |
| 13537 | { 8, NULL } |
| 13538 | }; |
| 13539 | |
| 13540 | static hda_nid_t alc861_dac_nids[4] = { |
| 13541 | /* front, surround, clfe, side */ |
| 13542 | 0x03, 0x06, 0x05, 0x04 |
| 13543 | }; |
| 13544 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 13545 | static hda_nid_t alc660_dac_nids[3] = { |
| 13546 | /* front, clfe, surround */ |
| 13547 | 0x03, 0x05, 0x06 |
| 13548 | }; |
| 13549 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13550 | static hda_nid_t alc861_adc_nids[1] = { |
| 13551 | /* ADC0-2 */ |
| 13552 | 0x08, |
| 13553 | }; |
| 13554 | |
| 13555 | static struct hda_input_mux alc861_capture_source = { |
| 13556 | .num_items = 5, |
| 13557 | .items = { |
| 13558 | { "Mic", 0x0 }, |
| 13559 | { "Front Mic", 0x3 }, |
| 13560 | { "Line", 0x1 }, |
| 13561 | { "CD", 0x4 }, |
| 13562 | { "Mixer", 0x5 }, |
| 13563 | }, |
| 13564 | }; |
| 13565 | |
| 13566 | /* fill in the dac_nids table from the parsed pin configuration */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13567 | static int alc861_auto_fill_dac_nids(struct alc_spec *spec, |
| 13568 | const struct auto_pin_cfg *cfg) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13569 | { |
| 13570 | int i; |
| 13571 | hda_nid_t nid; |
| 13572 | |
| 13573 | spec->multiout.dac_nids = spec->private_dac_nids; |
| 13574 | for (i = 0; i < cfg->line_outs; i++) { |
| 13575 | nid = cfg->line_out_pins[i]; |
| 13576 | if (nid) { |
| 13577 | if (i >= ARRAY_SIZE(alc861_dac_nids)) |
| 13578 | continue; |
| 13579 | spec->multiout.dac_nids[i] = alc861_dac_nids[i]; |
| 13580 | } |
| 13581 | } |
| 13582 | spec->multiout.num_dacs = cfg->line_outs; |
| 13583 | return 0; |
| 13584 | } |
| 13585 | |
| 13586 | /* add playback controls from the parsed DAC table */ |
| 13587 | static int alc861_auto_create_multi_out_ctls(struct alc_spec *spec, |
| 13588 | const struct auto_pin_cfg *cfg) |
| 13589 | { |
| 13590 | char name[32]; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13591 | static const char *chname[4] = { |
| 13592 | "Front", "Surround", NULL /*CLFE*/, "Side" |
| 13593 | }; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13594 | hda_nid_t nid; |
| 13595 | int i, idx, err; |
| 13596 | |
| 13597 | for (i = 0; i < cfg->line_outs; i++) { |
| 13598 | nid = spec->multiout.dac_nids[i]; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13599 | if (!nid) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13600 | continue; |
| 13601 | if (nid == 0x05) { |
| 13602 | /* Center/LFE */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13603 | err = add_control(spec, ALC_CTL_BIND_MUTE, |
| 13604 | "Center Playback Switch", |
| 13605 | HDA_COMPOSE_AMP_VAL(nid, 1, 0, |
| 13606 | HDA_OUTPUT)); |
| 13607 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13608 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13609 | err = add_control(spec, ALC_CTL_BIND_MUTE, |
| 13610 | "LFE Playback Switch", |
| 13611 | HDA_COMPOSE_AMP_VAL(nid, 2, 0, |
| 13612 | HDA_OUTPUT)); |
| 13613 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13614 | return err; |
| 13615 | } else { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13616 | for (idx = 0; idx < ARRAY_SIZE(alc861_dac_nids) - 1; |
| 13617 | idx++) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13618 | if (nid == alc861_dac_nids[idx]) |
| 13619 | break; |
| 13620 | sprintf(name, "%s Playback Switch", chname[idx]); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13621 | err = add_control(spec, ALC_CTL_BIND_MUTE, name, |
| 13622 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, |
| 13623 | HDA_OUTPUT)); |
| 13624 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13625 | return err; |
| 13626 | } |
| 13627 | } |
| 13628 | return 0; |
| 13629 | } |
| 13630 | |
| 13631 | static int alc861_auto_create_hp_ctls(struct alc_spec *spec, hda_nid_t pin) |
| 13632 | { |
| 13633 | int err; |
| 13634 | hda_nid_t nid; |
| 13635 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13636 | if (!pin) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13637 | return 0; |
| 13638 | |
| 13639 | if ((pin >= 0x0b && pin <= 0x10) || pin == 0x1f || pin == 0x20) { |
| 13640 | nid = 0x03; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13641 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, |
| 13642 | "Headphone Playback Switch", |
| 13643 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT)); |
| 13644 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13645 | return err; |
| 13646 | spec->multiout.hp_nid = nid; |
| 13647 | } |
| 13648 | return 0; |
| 13649 | } |
| 13650 | |
| 13651 | /* create playback/capture controls for input pins */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13652 | static int alc861_auto_create_analog_input_ctls(struct alc_spec *spec, |
| 13653 | const struct auto_pin_cfg *cfg) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13654 | { |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 13655 | struct hda_input_mux *imux = &spec->private_imux[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13656 | int i, err, idx, idx1; |
| 13657 | |
| 13658 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13659 | switch (cfg->input_pins[i]) { |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13660 | case 0x0c: |
| 13661 | idx1 = 1; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13662 | idx = 2; /* Line In */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13663 | break; |
| 13664 | case 0x0f: |
| 13665 | idx1 = 2; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13666 | idx = 2; /* Line In */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13667 | break; |
| 13668 | case 0x0d: |
| 13669 | idx1 = 0; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13670 | idx = 1; /* Mic In */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13671 | break; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13672 | case 0x10: |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13673 | idx1 = 3; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13674 | idx = 1; /* Mic In */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13675 | break; |
| 13676 | case 0x11: |
| 13677 | idx1 = 4; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13678 | idx = 0; /* CD */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13679 | break; |
| 13680 | default: |
| 13681 | continue; |
| 13682 | } |
| 13683 | |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 13684 | err = new_analog_input(spec, cfg->input_pins[i], |
| 13685 | auto_pin_cfg_labels[i], idx, 0x15); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13686 | if (err < 0) |
| 13687 | return err; |
| 13688 | |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 13689 | imux->items[imux->num_items].label = auto_pin_cfg_labels[i]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13690 | imux->items[imux->num_items].index = idx1; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13691 | imux->num_items++; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13692 | } |
| 13693 | return 0; |
| 13694 | } |
| 13695 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13696 | static void alc861_auto_set_output_and_unmute(struct hda_codec *codec, |
| 13697 | hda_nid_t nid, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13698 | int pin_type, int dac_idx) |
| 13699 | { |
Jacek Luczak | 564c5be | 2008-05-03 18:41:23 +0200 | [diff] [blame] | 13700 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 13701 | pin_type); |
| 13702 | snd_hda_codec_write(codec, dac_idx, 0, AC_VERB_SET_AMP_GAIN_MUTE, |
| 13703 | AMP_OUT_UNMUTE); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13704 | } |
| 13705 | |
| 13706 | static void alc861_auto_init_multi_out(struct hda_codec *codec) |
| 13707 | { |
| 13708 | struct alc_spec *spec = codec->spec; |
| 13709 | int i; |
| 13710 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13711 | alc_subsystem_id(codec, 0x0e, 0x0f, 0x0b); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13712 | for (i = 0; i < spec->autocfg.line_outs; i++) { |
| 13713 | hda_nid_t nid = spec->autocfg.line_out_pins[i]; |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 13714 | int pin_type = get_pin_type(spec->autocfg.line_out_type); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13715 | if (nid) |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 13716 | alc861_auto_set_output_and_unmute(codec, nid, pin_type, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13717 | spec->multiout.dac_nids[i]); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13718 | } |
| 13719 | } |
| 13720 | |
| 13721 | static void alc861_auto_init_hp_out(struct hda_codec *codec) |
| 13722 | { |
| 13723 | struct alc_spec *spec = codec->spec; |
| 13724 | hda_nid_t pin; |
| 13725 | |
Takashi Iwai | eb06ed8 | 2006-09-20 17:10:27 +0200 | [diff] [blame] | 13726 | pin = spec->autocfg.hp_pins[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13727 | if (pin) /* connect to front */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13728 | alc861_auto_set_output_and_unmute(codec, pin, PIN_HP, |
| 13729 | spec->multiout.dac_nids[0]); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 13730 | pin = spec->autocfg.speaker_pins[0]; |
| 13731 | if (pin) |
| 13732 | alc861_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13733 | } |
| 13734 | |
| 13735 | static void alc861_auto_init_analog_input(struct hda_codec *codec) |
| 13736 | { |
| 13737 | struct alc_spec *spec = codec->spec; |
| 13738 | int i; |
| 13739 | |
| 13740 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
| 13741 | hda_nid_t nid = spec->autocfg.input_pins[i]; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13742 | if (nid >= 0x0c && nid <= 0x11) { |
| 13743 | snd_hda_codec_write(codec, nid, 0, |
| 13744 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 13745 | i <= AUTO_PIN_FRONT_MIC ? |
| 13746 | PIN_VREF80 : PIN_IN); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13747 | } |
| 13748 | } |
| 13749 | } |
| 13750 | |
| 13751 | /* parse the BIOS configuration and set up the alc_spec */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13752 | /* return 1 if successful, 0 if the proper config is not found, |
| 13753 | * or a negative error code |
| 13754 | */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13755 | static int alc861_parse_auto_config(struct hda_codec *codec) |
| 13756 | { |
| 13757 | struct alc_spec *spec = codec->spec; |
| 13758 | int err; |
| 13759 | static hda_nid_t alc861_ignore[] = { 0x1d, 0 }; |
| 13760 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13761 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 13762 | alc861_ignore); |
| 13763 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13764 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13765 | if (!spec->autocfg.line_outs) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13766 | return 0; /* can't find valid BIOS pin config */ |
| 13767 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13768 | err = alc861_auto_fill_dac_nids(spec, &spec->autocfg); |
| 13769 | if (err < 0) |
| 13770 | return err; |
| 13771 | err = alc861_auto_create_multi_out_ctls(spec, &spec->autocfg); |
| 13772 | if (err < 0) |
| 13773 | return err; |
| 13774 | err = alc861_auto_create_hp_ctls(spec, spec->autocfg.hp_pins[0]); |
| 13775 | if (err < 0) |
| 13776 | return err; |
| 13777 | err = alc861_auto_create_analog_input_ctls(spec, &spec->autocfg); |
| 13778 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13779 | return err; |
| 13780 | |
| 13781 | spec->multiout.max_channels = spec->multiout.num_dacs * 2; |
| 13782 | |
Takashi Iwai | 0852d7a | 2009-02-11 11:35:15 +0100 | [diff] [blame] | 13783 | if (spec->autocfg.dig_outs) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13784 | spec->multiout.dig_out_nid = ALC861_DIGOUT_NID; |
| 13785 | |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 13786 | if (spec->kctls.list) |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 13787 | add_mixer(spec, spec->kctls.list); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13788 | |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 13789 | add_verb(spec, alc861_auto_init_verbs); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13790 | |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 13791 | spec->num_mux_defs = 1; |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 13792 | spec->input_mux = &spec->private_imux[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13793 | |
| 13794 | spec->adc_nids = alc861_adc_nids; |
| 13795 | spec->num_adc_nids = ARRAY_SIZE(alc861_adc_nids); |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 13796 | set_capture_mixer(spec); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13797 | |
Takashi Iwai | e044c39 | 2008-10-27 16:56:24 +0100 | [diff] [blame] | 13798 | store_pin_configs(codec); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13799 | return 1; |
| 13800 | } |
| 13801 | |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 13802 | /* additional initialization for auto-configuration model */ |
| 13803 | static void alc861_auto_init(struct hda_codec *codec) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13804 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 13805 | struct alc_spec *spec = codec->spec; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13806 | alc861_auto_init_multi_out(codec); |
| 13807 | alc861_auto_init_hp_out(codec); |
| 13808 | alc861_auto_init_analog_input(codec); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 13809 | if (spec->unsol_event) |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 13810 | alc_inithook(codec); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13811 | } |
| 13812 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 13813 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 13814 | static struct hda_amp_list alc861_loopbacks[] = { |
| 13815 | { 0x15, HDA_INPUT, 0 }, |
| 13816 | { 0x15, HDA_INPUT, 1 }, |
| 13817 | { 0x15, HDA_INPUT, 2 }, |
| 13818 | { 0x15, HDA_INPUT, 3 }, |
| 13819 | { } /* end */ |
| 13820 | }; |
| 13821 | #endif |
| 13822 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13823 | |
| 13824 | /* |
| 13825 | * configuration and preset |
| 13826 | */ |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 13827 | static const char *alc861_models[ALC861_MODEL_LAST] = { |
| 13828 | [ALC861_3ST] = "3stack", |
| 13829 | [ALC660_3ST] = "3stack-660", |
| 13830 | [ALC861_3ST_DIG] = "3stack-dig", |
| 13831 | [ALC861_6ST_DIG] = "6stack-dig", |
| 13832 | [ALC861_UNIWILL_M31] = "uniwill-m31", |
| 13833 | [ALC861_TOSHIBA] = "toshiba", |
| 13834 | [ALC861_ASUS] = "asus", |
| 13835 | [ALC861_ASUS_LAPTOP] = "asus-laptop", |
| 13836 | [ALC861_AUTO] = "auto", |
| 13837 | }; |
| 13838 | |
| 13839 | static struct snd_pci_quirk alc861_cfg_tbl[] = { |
Takashi Iwai | 687a47b | 2007-01-10 11:25:58 +0100 | [diff] [blame] | 13840 | SND_PCI_QUIRK(0x1043, 0x1205, "ASUS W7J", ALC861_3ST), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 13841 | SND_PCI_QUIRK(0x1043, 0x1335, "ASUS F2/3", ALC861_ASUS_LAPTOP), |
| 13842 | SND_PCI_QUIRK(0x1043, 0x1338, "ASUS F2/3", ALC861_ASUS_LAPTOP), |
| 13843 | SND_PCI_QUIRK(0x1043, 0x1393, "ASUS", ALC861_ASUS), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 13844 | SND_PCI_QUIRK(0x1043, 0x13d7, "ASUS A9rp", ALC861_ASUS_LAPTOP), |
Kailang Yang | 83c3421 | 2007-07-05 11:43:05 +0200 | [diff] [blame] | 13845 | SND_PCI_QUIRK(0x1043, 0x81cb, "ASUS P1-AH2", ALC861_3ST_DIG), |
Tobin Davis | ad5e773 | 2007-01-08 10:57:32 +0100 | [diff] [blame] | 13846 | SND_PCI_QUIRK(0x1179, 0xff00, "Toshiba", ALC861_TOSHIBA), |
Takashi Iwai | 341d4eb | 2007-07-09 17:53:18 +0200 | [diff] [blame] | 13847 | /* FIXME: the entry below breaks Toshiba A100 (model=auto works!) |
| 13848 | * Any other models that need this preset? |
| 13849 | */ |
| 13850 | /* SND_PCI_QUIRK(0x1179, 0xff10, "Toshiba", ALC861_TOSHIBA), */ |
Claudio Matsuoka | ef64adb | 2007-07-14 00:26:16 +0200 | [diff] [blame] | 13851 | SND_PCI_QUIRK(0x1462, 0x7254, "HP dx2200 (MSI MS-7254)", ALC861_3ST), |
| 13852 | SND_PCI_QUIRK(0x1462, 0x7297, "HP dx2250 (MSI MS-7297)", ALC861_3ST), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 13853 | SND_PCI_QUIRK(0x1584, 0x2b01, "Uniwill X40AIx", ALC861_UNIWILL_M31), |
| 13854 | SND_PCI_QUIRK(0x1584, 0x9072, "Uniwill m31", ALC861_UNIWILL_M31), |
| 13855 | SND_PCI_QUIRK(0x1584, 0x9075, "Airis Praxis N1212", ALC861_ASUS_LAPTOP), |
| 13856 | /* FIXME: the below seems conflict */ |
| 13857 | /* SND_PCI_QUIRK(0x1584, 0x9075, "Uniwill", ALC861_UNIWILL_M31), */ |
| 13858 | SND_PCI_QUIRK(0x1849, 0x0660, "Asrock 939SLI32", ALC660_3ST), |
| 13859 | SND_PCI_QUIRK(0x8086, 0xd600, "Intel", ALC861_3ST), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13860 | {} |
| 13861 | }; |
| 13862 | |
| 13863 | static struct alc_config_preset alc861_presets[] = { |
| 13864 | [ALC861_3ST] = { |
| 13865 | .mixers = { alc861_3ST_mixer }, |
| 13866 | .init_verbs = { alc861_threestack_init_verbs }, |
| 13867 | .num_dacs = ARRAY_SIZE(alc861_dac_nids), |
| 13868 | .dac_nids = alc861_dac_nids, |
| 13869 | .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes), |
| 13870 | .channel_mode = alc861_threestack_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 13871 | .need_dac_fix = 1, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13872 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
| 13873 | .adc_nids = alc861_adc_nids, |
| 13874 | .input_mux = &alc861_capture_source, |
| 13875 | }, |
| 13876 | [ALC861_3ST_DIG] = { |
| 13877 | .mixers = { alc861_base_mixer }, |
| 13878 | .init_verbs = { alc861_threestack_init_verbs }, |
| 13879 | .num_dacs = ARRAY_SIZE(alc861_dac_nids), |
| 13880 | .dac_nids = alc861_dac_nids, |
| 13881 | .dig_out_nid = ALC861_DIGOUT_NID, |
| 13882 | .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes), |
| 13883 | .channel_mode = alc861_threestack_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 13884 | .need_dac_fix = 1, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13885 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
| 13886 | .adc_nids = alc861_adc_nids, |
| 13887 | .input_mux = &alc861_capture_source, |
| 13888 | }, |
| 13889 | [ALC861_6ST_DIG] = { |
| 13890 | .mixers = { alc861_base_mixer }, |
| 13891 | .init_verbs = { alc861_base_init_verbs }, |
| 13892 | .num_dacs = ARRAY_SIZE(alc861_dac_nids), |
| 13893 | .dac_nids = alc861_dac_nids, |
| 13894 | .dig_out_nid = ALC861_DIGOUT_NID, |
| 13895 | .num_channel_mode = ARRAY_SIZE(alc861_8ch_modes), |
| 13896 | .channel_mode = alc861_8ch_modes, |
| 13897 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
| 13898 | .adc_nids = alc861_adc_nids, |
| 13899 | .input_mux = &alc861_capture_source, |
| 13900 | }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 13901 | [ALC660_3ST] = { |
| 13902 | .mixers = { alc861_3ST_mixer }, |
| 13903 | .init_verbs = { alc861_threestack_init_verbs }, |
| 13904 | .num_dacs = ARRAY_SIZE(alc660_dac_nids), |
| 13905 | .dac_nids = alc660_dac_nids, |
| 13906 | .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes), |
| 13907 | .channel_mode = alc861_threestack_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 13908 | .need_dac_fix = 1, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 13909 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
| 13910 | .adc_nids = alc861_adc_nids, |
| 13911 | .input_mux = &alc861_capture_source, |
| 13912 | }, |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 13913 | [ALC861_UNIWILL_M31] = { |
| 13914 | .mixers = { alc861_uniwill_m31_mixer }, |
| 13915 | .init_verbs = { alc861_uniwill_m31_init_verbs }, |
| 13916 | .num_dacs = ARRAY_SIZE(alc861_dac_nids), |
| 13917 | .dac_nids = alc861_dac_nids, |
| 13918 | .dig_out_nid = ALC861_DIGOUT_NID, |
| 13919 | .num_channel_mode = ARRAY_SIZE(alc861_uniwill_m31_modes), |
| 13920 | .channel_mode = alc861_uniwill_m31_modes, |
| 13921 | .need_dac_fix = 1, |
| 13922 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
| 13923 | .adc_nids = alc861_adc_nids, |
| 13924 | .input_mux = &alc861_capture_source, |
| 13925 | }, |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 13926 | [ALC861_TOSHIBA] = { |
| 13927 | .mixers = { alc861_toshiba_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13928 | .init_verbs = { alc861_base_init_verbs, |
| 13929 | alc861_toshiba_init_verbs }, |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 13930 | .num_dacs = ARRAY_SIZE(alc861_dac_nids), |
| 13931 | .dac_nids = alc861_dac_nids, |
| 13932 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 13933 | .channel_mode = alc883_3ST_2ch_modes, |
| 13934 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
| 13935 | .adc_nids = alc861_adc_nids, |
| 13936 | .input_mux = &alc861_capture_source, |
| 13937 | .unsol_event = alc861_toshiba_unsol_event, |
| 13938 | .init_hook = alc861_toshiba_automute, |
| 13939 | }, |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 13940 | [ALC861_ASUS] = { |
| 13941 | .mixers = { alc861_asus_mixer }, |
| 13942 | .init_verbs = { alc861_asus_init_verbs }, |
| 13943 | .num_dacs = ARRAY_SIZE(alc861_dac_nids), |
| 13944 | .dac_nids = alc861_dac_nids, |
| 13945 | .dig_out_nid = ALC861_DIGOUT_NID, |
| 13946 | .num_channel_mode = ARRAY_SIZE(alc861_asus_modes), |
| 13947 | .channel_mode = alc861_asus_modes, |
| 13948 | .need_dac_fix = 1, |
| 13949 | .hp_nid = 0x06, |
| 13950 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
| 13951 | .adc_nids = alc861_adc_nids, |
| 13952 | .input_mux = &alc861_capture_source, |
| 13953 | }, |
Takashi Iwai | 56bb0ca | 2006-11-22 11:52:52 +0100 | [diff] [blame] | 13954 | [ALC861_ASUS_LAPTOP] = { |
| 13955 | .mixers = { alc861_toshiba_mixer, alc861_asus_laptop_mixer }, |
| 13956 | .init_verbs = { alc861_asus_init_verbs, |
| 13957 | alc861_asus_laptop_init_verbs }, |
| 13958 | .num_dacs = ARRAY_SIZE(alc861_dac_nids), |
| 13959 | .dac_nids = alc861_dac_nids, |
| 13960 | .dig_out_nid = ALC861_DIGOUT_NID, |
| 13961 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 13962 | .channel_mode = alc883_3ST_2ch_modes, |
| 13963 | .need_dac_fix = 1, |
| 13964 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
| 13965 | .adc_nids = alc861_adc_nids, |
| 13966 | .input_mux = &alc861_capture_source, |
| 13967 | }, |
| 13968 | }; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13969 | |
| 13970 | |
| 13971 | static int patch_alc861(struct hda_codec *codec) |
| 13972 | { |
| 13973 | struct alc_spec *spec; |
| 13974 | int board_config; |
| 13975 | int err; |
| 13976 | |
Robert P. J. Day | dc041e0 | 2006-12-19 14:44:15 +0100 | [diff] [blame] | 13977 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13978 | if (spec == NULL) |
| 13979 | return -ENOMEM; |
| 13980 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13981 | codec->spec = spec; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13982 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 13983 | board_config = snd_hda_check_board_config(codec, ALC861_MODEL_LAST, |
| 13984 | alc861_models, |
| 13985 | alc861_cfg_tbl); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 13986 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 13987 | if (board_config < 0) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 13988 | printk(KERN_INFO "hda_codec: Unknown model for ALC861, " |
| 13989 | "trying auto-probe from BIOS...\n"); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13990 | board_config = ALC861_AUTO; |
| 13991 | } |
| 13992 | |
| 13993 | if (board_config == ALC861_AUTO) { |
| 13994 | /* automatic parse from the BIOS config */ |
| 13995 | err = alc861_parse_auto_config(codec); |
| 13996 | if (err < 0) { |
| 13997 | alc_free(codec); |
| 13998 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13999 | } else if (!err) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 14000 | printk(KERN_INFO |
| 14001 | "hda_codec: Cannot set up configuration " |
| 14002 | "from BIOS. Using base mode...\n"); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14003 | board_config = ALC861_3ST_DIG; |
| 14004 | } |
| 14005 | } |
| 14006 | |
Kusanagi Kouichi | 680cd53 | 2009-02-05 00:00:58 +0900 | [diff] [blame] | 14007 | err = snd_hda_attach_beep_device(codec, 0x23); |
| 14008 | if (err < 0) { |
| 14009 | alc_free(codec); |
| 14010 | return err; |
| 14011 | } |
| 14012 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14013 | if (board_config != ALC861_AUTO) |
| 14014 | setup_preset(spec, &alc861_presets[board_config]); |
| 14015 | |
| 14016 | spec->stream_name_analog = "ALC861 Analog"; |
| 14017 | spec->stream_analog_playback = &alc861_pcm_analog_playback; |
| 14018 | spec->stream_analog_capture = &alc861_pcm_analog_capture; |
| 14019 | |
| 14020 | spec->stream_name_digital = "ALC861 Digital"; |
| 14021 | spec->stream_digital_playback = &alc861_pcm_digital_playback; |
| 14022 | spec->stream_digital_capture = &alc861_pcm_digital_capture; |
| 14023 | |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 14024 | set_beep_amp(spec, 0x23, 0, HDA_OUTPUT); |
| 14025 | |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 14026 | spec->vmaster_nid = 0x03; |
| 14027 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14028 | codec->patch_ops = alc_patch_ops; |
| 14029 | if (board_config == ALC861_AUTO) |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 14030 | spec->init_hook = alc861_auto_init; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 14031 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 14032 | if (!spec->loopback.amplist) |
| 14033 | spec->loopback.amplist = alc861_loopbacks; |
| 14034 | #endif |
Takashi Iwai | daead53 | 2008-11-28 12:55:36 +0100 | [diff] [blame] | 14035 | codec->proc_widget_hook = print_realtek_coef; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 14036 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14037 | return 0; |
| 14038 | } |
| 14039 | |
| 14040 | /* |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14041 | * ALC861-VD support |
| 14042 | * |
| 14043 | * Based on ALC882 |
| 14044 | * |
| 14045 | * In addition, an independent DAC |
| 14046 | */ |
| 14047 | #define ALC861VD_DIGOUT_NID 0x06 |
| 14048 | |
| 14049 | static hda_nid_t alc861vd_dac_nids[4] = { |
| 14050 | /* front, surr, clfe, side surr */ |
| 14051 | 0x02, 0x03, 0x04, 0x05 |
| 14052 | }; |
| 14053 | |
| 14054 | /* dac_nids for ALC660vd are in a different order - according to |
| 14055 | * Realtek's driver. |
| 14056 | * This should probably tesult in a different mixer for 6stack models |
| 14057 | * of ALC660vd codecs, but for now there is only 3stack mixer |
| 14058 | * - and it is the same as in 861vd. |
| 14059 | * adc_nids in ALC660vd are (is) the same as in 861vd |
| 14060 | */ |
| 14061 | static hda_nid_t alc660vd_dac_nids[3] = { |
| 14062 | /* front, rear, clfe, rear_surr */ |
| 14063 | 0x02, 0x04, 0x03 |
| 14064 | }; |
| 14065 | |
| 14066 | static hda_nid_t alc861vd_adc_nids[1] = { |
| 14067 | /* ADC0 */ |
| 14068 | 0x09, |
| 14069 | }; |
| 14070 | |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 14071 | static hda_nid_t alc861vd_capsrc_nids[1] = { 0x22 }; |
| 14072 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14073 | /* input MUX */ |
| 14074 | /* FIXME: should be a matrix-type input source selection */ |
| 14075 | static struct hda_input_mux alc861vd_capture_source = { |
| 14076 | .num_items = 4, |
| 14077 | .items = { |
| 14078 | { "Mic", 0x0 }, |
| 14079 | { "Front Mic", 0x1 }, |
| 14080 | { "Line", 0x2 }, |
| 14081 | { "CD", 0x4 }, |
| 14082 | }, |
| 14083 | }; |
| 14084 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 14085 | static struct hda_input_mux alc861vd_dallas_capture_source = { |
Tobin Davis | b419f34 | 2008-03-07 11:57:51 +0100 | [diff] [blame] | 14086 | .num_items = 2, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 14087 | .items = { |
Tobin Davis | b419f34 | 2008-03-07 11:57:51 +0100 | [diff] [blame] | 14088 | { "Ext Mic", 0x0 }, |
| 14089 | { "Int Mic", 0x1 }, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 14090 | }, |
| 14091 | }; |
| 14092 | |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 14093 | static struct hda_input_mux alc861vd_hp_capture_source = { |
| 14094 | .num_items = 2, |
| 14095 | .items = { |
| 14096 | { "Front Mic", 0x0 }, |
| 14097 | { "ATAPI Mic", 0x1 }, |
| 14098 | }, |
| 14099 | }; |
| 14100 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14101 | /* |
| 14102 | * 2ch mode |
| 14103 | */ |
| 14104 | static struct hda_channel_mode alc861vd_3stack_2ch_modes[1] = { |
| 14105 | { 2, NULL } |
| 14106 | }; |
| 14107 | |
| 14108 | /* |
| 14109 | * 6ch mode |
| 14110 | */ |
| 14111 | static struct hda_verb alc861vd_6stack_ch6_init[] = { |
| 14112 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 14113 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 14114 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 14115 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 14116 | { } /* end */ |
| 14117 | }; |
| 14118 | |
| 14119 | /* |
| 14120 | * 8ch mode |
| 14121 | */ |
| 14122 | static struct hda_verb alc861vd_6stack_ch8_init[] = { |
| 14123 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 14124 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 14125 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 14126 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 14127 | { } /* end */ |
| 14128 | }; |
| 14129 | |
| 14130 | static struct hda_channel_mode alc861vd_6stack_modes[2] = { |
| 14131 | { 6, alc861vd_6stack_ch6_init }, |
| 14132 | { 8, alc861vd_6stack_ch8_init }, |
| 14133 | }; |
| 14134 | |
| 14135 | static struct snd_kcontrol_new alc861vd_chmode_mixer[] = { |
| 14136 | { |
| 14137 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 14138 | .name = "Channel Mode", |
| 14139 | .info = alc_ch_mode_info, |
| 14140 | .get = alc_ch_mode_get, |
| 14141 | .put = alc_ch_mode_put, |
| 14142 | }, |
| 14143 | { } /* end */ |
| 14144 | }; |
| 14145 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14146 | /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17 |
| 14147 | * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b |
| 14148 | */ |
| 14149 | static struct snd_kcontrol_new alc861vd_6st_mixer[] = { |
| 14150 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 14151 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 14152 | |
| 14153 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 14154 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
| 14155 | |
| 14156 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, |
| 14157 | HDA_OUTPUT), |
| 14158 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, |
| 14159 | HDA_OUTPUT), |
| 14160 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 14161 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 14162 | |
| 14163 | HDA_CODEC_VOLUME("Side Playback Volume", 0x05, 0x0, HDA_OUTPUT), |
| 14164 | HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT), |
| 14165 | |
| 14166 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 14167 | |
| 14168 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 14169 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 14170 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 14171 | |
| 14172 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
| 14173 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 14174 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 14175 | |
| 14176 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 14177 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 14178 | |
| 14179 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 14180 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 14181 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14182 | { } /* end */ |
| 14183 | }; |
| 14184 | |
| 14185 | static struct snd_kcontrol_new alc861vd_3st_mixer[] = { |
| 14186 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 14187 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 14188 | |
| 14189 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 14190 | |
| 14191 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 14192 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 14193 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 14194 | |
| 14195 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
| 14196 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 14197 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 14198 | |
| 14199 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 14200 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 14201 | |
| 14202 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 14203 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 14204 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14205 | { } /* end */ |
| 14206 | }; |
| 14207 | |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 14208 | static struct snd_kcontrol_new alc861vd_lenovo_mixer[] = { |
| 14209 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 14210 | /*HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),*/ |
| 14211 | HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 14212 | |
| 14213 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 14214 | |
| 14215 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 14216 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 14217 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 14218 | |
| 14219 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
| 14220 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 14221 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 14222 | |
| 14223 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 14224 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 14225 | |
| 14226 | { } /* end */ |
| 14227 | }; |
| 14228 | |
Tobin Davis | b419f34 | 2008-03-07 11:57:51 +0100 | [diff] [blame] | 14229 | /* Pin assignment: Speaker=0x14, HP = 0x15, |
| 14230 | * Ext Mic=0x18, Int Mic = 0x19, CD = 0x1c, PC Beep = 0x1d |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 14231 | */ |
| 14232 | static struct snd_kcontrol_new alc861vd_dallas_mixer[] = { |
Tobin Davis | b419f34 | 2008-03-07 11:57:51 +0100 | [diff] [blame] | 14233 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 14234 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0c, 2, HDA_INPUT), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 14235 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 14236 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT), |
Tobin Davis | b419f34 | 2008-03-07 11:57:51 +0100 | [diff] [blame] | 14237 | HDA_CODEC_VOLUME("Ext Mic Boost", 0x18, 0, HDA_INPUT), |
| 14238 | HDA_CODEC_VOLUME("Ext Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 14239 | HDA_CODEC_MUTE("Ext Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 14240 | HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT), |
| 14241 | HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 14242 | HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 14243 | { } /* end */ |
| 14244 | }; |
| 14245 | |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 14246 | /* Pin assignment: Speaker=0x14, Line-out = 0x15, |
| 14247 | * Front Mic=0x18, ATAPI Mic = 0x19, |
| 14248 | */ |
| 14249 | static struct snd_kcontrol_new alc861vd_hp_mixer[] = { |
| 14250 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 14251 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 14252 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 14253 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT), |
| 14254 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 14255 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 14256 | HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 14257 | HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 14258 | |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 14259 | { } /* end */ |
| 14260 | }; |
| 14261 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14262 | /* |
| 14263 | * generic initialization of ADC, input mixers and output mixers |
| 14264 | */ |
| 14265 | static struct hda_verb alc861vd_volume_init_verbs[] = { |
| 14266 | /* |
| 14267 | * Unmute ADC0 and set the default input to mic-in |
| 14268 | */ |
| 14269 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 14270 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14271 | |
| 14272 | /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of |
| 14273 | * the analog-loopback mixer widget |
| 14274 | */ |
| 14275 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 14276 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 14277 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 14278 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 14279 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 14280 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14281 | |
| 14282 | /* Capture mixer: unmute Mic, F-Mic, Line, CD inputs */ |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 14283 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14284 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 14285 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14286 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)}, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14287 | |
| 14288 | /* |
| 14289 | * Set up output mixers (0x02 - 0x05) |
| 14290 | */ |
| 14291 | /* set vol=0 to output mixers */ |
| 14292 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 14293 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 14294 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 14295 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 14296 | |
| 14297 | /* set up input amps for analog loopback */ |
| 14298 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 14299 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 14300 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 14301 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 14302 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 14303 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 14304 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 14305 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 14306 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 14307 | |
| 14308 | { } |
| 14309 | }; |
| 14310 | |
| 14311 | /* |
| 14312 | * 3-stack pin configuration: |
| 14313 | * front = 0x14, mic/clfe = 0x18, HP = 0x19, line/surr = 0x1a, f-mic = 0x1b |
| 14314 | */ |
| 14315 | static struct hda_verb alc861vd_3stack_init_verbs[] = { |
| 14316 | /* |
| 14317 | * Set pin mode and muting |
| 14318 | */ |
| 14319 | /* set front pin widgets 0x14 for output */ |
| 14320 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 14321 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 14322 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 14323 | |
| 14324 | /* Mic (rear) pin: input vref at 80% */ |
| 14325 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 14326 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 14327 | /* Front Mic pin: input vref at 80% */ |
| 14328 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 14329 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 14330 | /* Line In pin: input */ |
| 14331 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 14332 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 14333 | /* Line-2 In: Headphone output (output 0 - 0x0c) */ |
| 14334 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 14335 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 14336 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 14337 | /* CD pin widget for input */ |
| 14338 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 14339 | |
| 14340 | { } |
| 14341 | }; |
| 14342 | |
| 14343 | /* |
| 14344 | * 6-stack pin configuration: |
| 14345 | */ |
| 14346 | static struct hda_verb alc861vd_6stack_init_verbs[] = { |
| 14347 | /* |
| 14348 | * Set pin mode and muting |
| 14349 | */ |
| 14350 | /* set front pin widgets 0x14 for output */ |
| 14351 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 14352 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 14353 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 14354 | |
| 14355 | /* Rear Pin: output 1 (0x0d) */ |
| 14356 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 14357 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 14358 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 14359 | /* CLFE Pin: output 2 (0x0e) */ |
| 14360 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 14361 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 14362 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 14363 | /* Side Pin: output 3 (0x0f) */ |
| 14364 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 14365 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 14366 | {0x17, AC_VERB_SET_CONNECT_SEL, 0x03}, |
| 14367 | |
| 14368 | /* Mic (rear) pin: input vref at 80% */ |
| 14369 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 14370 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 14371 | /* Front Mic pin: input vref at 80% */ |
| 14372 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 14373 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 14374 | /* Line In pin: input */ |
| 14375 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 14376 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 14377 | /* Line-2 In: Headphone output (output 0 - 0x0c) */ |
| 14378 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 14379 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 14380 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 14381 | /* CD pin widget for input */ |
| 14382 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 14383 | |
| 14384 | { } |
| 14385 | }; |
| 14386 | |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 14387 | static struct hda_verb alc861vd_eapd_verbs[] = { |
| 14388 | {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 14389 | { } |
| 14390 | }; |
| 14391 | |
Kailang Yang | f9423e7 | 2008-05-27 12:32:25 +0200 | [diff] [blame] | 14392 | static struct hda_verb alc660vd_eapd_verbs[] = { |
| 14393 | {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 14394 | {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 14395 | { } |
| 14396 | }; |
| 14397 | |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 14398 | static struct hda_verb alc861vd_lenovo_unsol_verbs[] = { |
| 14399 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14400 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 14401 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, |
| 14402 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 14403 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 14404 | {} |
| 14405 | }; |
| 14406 | |
| 14407 | /* toggle speaker-output according to the hp-jack state */ |
| 14408 | static void alc861vd_lenovo_hp_automute(struct hda_codec *codec) |
| 14409 | { |
| 14410 | unsigned int present; |
| 14411 | unsigned char bits; |
| 14412 | |
| 14413 | present = snd_hda_codec_read(codec, 0x1b, 0, |
| 14414 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 14415 | bits = present ? HDA_AMP_MUTE : 0; |
| 14416 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 14417 | HDA_AMP_MUTE, bits); |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 14418 | } |
| 14419 | |
| 14420 | static void alc861vd_lenovo_mic_automute(struct hda_codec *codec) |
| 14421 | { |
| 14422 | unsigned int present; |
| 14423 | unsigned char bits; |
| 14424 | |
| 14425 | present = snd_hda_codec_read(codec, 0x18, 0, |
| 14426 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 14427 | bits = present ? HDA_AMP_MUTE : 0; |
| 14428 | snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, 1, |
| 14429 | HDA_AMP_MUTE, bits); |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 14430 | } |
| 14431 | |
| 14432 | static void alc861vd_lenovo_automute(struct hda_codec *codec) |
| 14433 | { |
| 14434 | alc861vd_lenovo_hp_automute(codec); |
| 14435 | alc861vd_lenovo_mic_automute(codec); |
| 14436 | } |
| 14437 | |
| 14438 | static void alc861vd_lenovo_unsol_event(struct hda_codec *codec, |
| 14439 | unsigned int res) |
| 14440 | { |
| 14441 | switch (res >> 26) { |
| 14442 | case ALC880_HP_EVENT: |
| 14443 | alc861vd_lenovo_hp_automute(codec); |
| 14444 | break; |
| 14445 | case ALC880_MIC_EVENT: |
| 14446 | alc861vd_lenovo_mic_automute(codec); |
| 14447 | break; |
| 14448 | } |
| 14449 | } |
| 14450 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 14451 | static struct hda_verb alc861vd_dallas_verbs[] = { |
| 14452 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 14453 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 14454 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 14455 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 14456 | |
| 14457 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14458 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 14459 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 14460 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 14461 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 14462 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 14463 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 14464 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 14465 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 14466 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 14467 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 14468 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 14469 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 14470 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 14471 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 14472 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 14473 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 14474 | |
| 14475 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50}, |
| 14476 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 14477 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50}, |
| 14478 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 14479 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 14480 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 14481 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 14482 | {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 14483 | |
| 14484 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14485 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 14486 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 14487 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 14488 | |
| 14489 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 14490 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 14491 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 14492 | |
| 14493 | { } /* end */ |
| 14494 | }; |
| 14495 | |
| 14496 | /* toggle speaker-output according to the hp-jack state */ |
| 14497 | static void alc861vd_dallas_automute(struct hda_codec *codec) |
| 14498 | { |
| 14499 | unsigned int present; |
| 14500 | |
| 14501 | present = snd_hda_codec_read(codec, 0x15, 0, |
| 14502 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 14503 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 14504 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 14505 | } |
| 14506 | |
| 14507 | static void alc861vd_dallas_unsol_event(struct hda_codec *codec, unsigned int res) |
| 14508 | { |
| 14509 | if ((res >> 26) == ALC880_HP_EVENT) |
| 14510 | alc861vd_dallas_automute(codec); |
| 14511 | } |
| 14512 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 14513 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 14514 | #define alc861vd_loopbacks alc880_loopbacks |
| 14515 | #endif |
| 14516 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14517 | /* pcm configuration: identiacal with ALC880 */ |
| 14518 | #define alc861vd_pcm_analog_playback alc880_pcm_analog_playback |
| 14519 | #define alc861vd_pcm_analog_capture alc880_pcm_analog_capture |
| 14520 | #define alc861vd_pcm_digital_playback alc880_pcm_digital_playback |
| 14521 | #define alc861vd_pcm_digital_capture alc880_pcm_digital_capture |
| 14522 | |
| 14523 | /* |
| 14524 | * configuration and preset |
| 14525 | */ |
| 14526 | static const char *alc861vd_models[ALC861VD_MODEL_LAST] = { |
| 14527 | [ALC660VD_3ST] = "3stack-660", |
Takashi Iwai | 983f8ae | 2007-08-15 16:44:04 +0200 | [diff] [blame] | 14528 | [ALC660VD_3ST_DIG] = "3stack-660-digout", |
Takashi Iwai | 13c9474 | 2008-11-05 08:06:08 +0100 | [diff] [blame] | 14529 | [ALC660VD_ASUS_V1S] = "asus-v1s", |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14530 | [ALC861VD_3ST] = "3stack", |
| 14531 | [ALC861VD_3ST_DIG] = "3stack-digout", |
| 14532 | [ALC861VD_6ST_DIG] = "6stack-digout", |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 14533 | [ALC861VD_LENOVO] = "lenovo", |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 14534 | [ALC861VD_DALLAS] = "dallas", |
Takashi Iwai | 983f8ae | 2007-08-15 16:44:04 +0200 | [diff] [blame] | 14535 | [ALC861VD_HP] = "hp", |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14536 | [ALC861VD_AUTO] = "auto", |
| 14537 | }; |
| 14538 | |
| 14539 | static struct snd_pci_quirk alc861vd_cfg_tbl[] = { |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 14540 | SND_PCI_QUIRK(0x1019, 0xa88d, "Realtek ALC660 demo", ALC660VD_3ST), |
| 14541 | SND_PCI_QUIRK(0x103c, 0x30bf, "HP TX1000", ALC861VD_HP), |
Takashi Iwai | 07e038b | 2007-02-15 18:23:41 +0100 | [diff] [blame] | 14542 | SND_PCI_QUIRK(0x1043, 0x12e2, "Asus z35m", ALC660VD_3ST), |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14543 | SND_PCI_QUIRK(0x1043, 0x1339, "Asus G1", ALC660VD_3ST), |
Takashi Iwai | 13c9474 | 2008-11-05 08:06:08 +0100 | [diff] [blame] | 14544 | SND_PCI_QUIRK(0x1043, 0x1633, "Asus V1Sn", ALC660VD_ASUS_V1S), |
Mike Crash | 6963f84 | 2007-06-25 12:12:51 +0200 | [diff] [blame] | 14545 | SND_PCI_QUIRK(0x1043, 0x81e7, "ASUS", ALC660VD_3ST_DIG), |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14546 | SND_PCI_QUIRK(0x10de, 0x03f0, "Realtek ALC660 demo", ALC660VD_3ST), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 14547 | SND_PCI_QUIRK(0x1179, 0xff00, "Toshiba A135", ALC861VD_LENOVO), |
Takashi Iwai | 38baf5a | 2007-08-16 17:52:43 +0200 | [diff] [blame] | 14548 | /*SND_PCI_QUIRK(0x1179, 0xff00, "DALLAS", ALC861VD_DALLAS),*/ /*lenovo*/ |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 14549 | SND_PCI_QUIRK(0x1179, 0xff01, "DALLAS", ALC861VD_DALLAS), |
Takashi Iwai | 542d7c6 | 2007-08-16 18:57:30 +0200 | [diff] [blame] | 14550 | SND_PCI_QUIRK(0x1179, 0xff03, "Toshiba P205", ALC861VD_LENOVO), |
Tobin Davis | b419f34 | 2008-03-07 11:57:51 +0100 | [diff] [blame] | 14551 | SND_PCI_QUIRK(0x1179, 0xff31, "Toshiba L30-149", ALC861VD_DALLAS), |
Takashi Iwai | 39c5d41 | 2007-08-15 16:24:17 +0200 | [diff] [blame] | 14552 | SND_PCI_QUIRK(0x1565, 0x820d, "Biostar NF61S SE", ALC861VD_6ST_DIG), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 14553 | SND_PCI_QUIRK_VENDOR(0x17aa, "Lenovo", ALC861VD_LENOVO), |
Tobin Davis | 625dc0b | 2007-07-30 21:42:10 +0200 | [diff] [blame] | 14554 | SND_PCI_QUIRK(0x1849, 0x0862, "ASRock K8NF6G-VSTA", ALC861VD_6ST_DIG), |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14555 | {} |
| 14556 | }; |
| 14557 | |
| 14558 | static struct alc_config_preset alc861vd_presets[] = { |
| 14559 | [ALC660VD_3ST] = { |
| 14560 | .mixers = { alc861vd_3st_mixer }, |
| 14561 | .init_verbs = { alc861vd_volume_init_verbs, |
| 14562 | alc861vd_3stack_init_verbs }, |
| 14563 | .num_dacs = ARRAY_SIZE(alc660vd_dac_nids), |
| 14564 | .dac_nids = alc660vd_dac_nids, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14565 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), |
| 14566 | .channel_mode = alc861vd_3stack_2ch_modes, |
| 14567 | .input_mux = &alc861vd_capture_source, |
| 14568 | }, |
Mike Crash | 6963f84 | 2007-06-25 12:12:51 +0200 | [diff] [blame] | 14569 | [ALC660VD_3ST_DIG] = { |
| 14570 | .mixers = { alc861vd_3st_mixer }, |
| 14571 | .init_verbs = { alc861vd_volume_init_verbs, |
| 14572 | alc861vd_3stack_init_verbs }, |
| 14573 | .num_dacs = ARRAY_SIZE(alc660vd_dac_nids), |
| 14574 | .dac_nids = alc660vd_dac_nids, |
| 14575 | .dig_out_nid = ALC861VD_DIGOUT_NID, |
Mike Crash | 6963f84 | 2007-06-25 12:12:51 +0200 | [diff] [blame] | 14576 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), |
| 14577 | .channel_mode = alc861vd_3stack_2ch_modes, |
| 14578 | .input_mux = &alc861vd_capture_source, |
| 14579 | }, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14580 | [ALC861VD_3ST] = { |
| 14581 | .mixers = { alc861vd_3st_mixer }, |
| 14582 | .init_verbs = { alc861vd_volume_init_verbs, |
| 14583 | alc861vd_3stack_init_verbs }, |
| 14584 | .num_dacs = ARRAY_SIZE(alc861vd_dac_nids), |
| 14585 | .dac_nids = alc861vd_dac_nids, |
| 14586 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), |
| 14587 | .channel_mode = alc861vd_3stack_2ch_modes, |
| 14588 | .input_mux = &alc861vd_capture_source, |
| 14589 | }, |
| 14590 | [ALC861VD_3ST_DIG] = { |
| 14591 | .mixers = { alc861vd_3st_mixer }, |
| 14592 | .init_verbs = { alc861vd_volume_init_verbs, |
| 14593 | alc861vd_3stack_init_verbs }, |
| 14594 | .num_dacs = ARRAY_SIZE(alc861vd_dac_nids), |
| 14595 | .dac_nids = alc861vd_dac_nids, |
| 14596 | .dig_out_nid = ALC861VD_DIGOUT_NID, |
| 14597 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), |
| 14598 | .channel_mode = alc861vd_3stack_2ch_modes, |
| 14599 | .input_mux = &alc861vd_capture_source, |
| 14600 | }, |
| 14601 | [ALC861VD_6ST_DIG] = { |
| 14602 | .mixers = { alc861vd_6st_mixer, alc861vd_chmode_mixer }, |
| 14603 | .init_verbs = { alc861vd_volume_init_verbs, |
| 14604 | alc861vd_6stack_init_verbs }, |
| 14605 | .num_dacs = ARRAY_SIZE(alc861vd_dac_nids), |
| 14606 | .dac_nids = alc861vd_dac_nids, |
| 14607 | .dig_out_nid = ALC861VD_DIGOUT_NID, |
| 14608 | .num_channel_mode = ARRAY_SIZE(alc861vd_6stack_modes), |
| 14609 | .channel_mode = alc861vd_6stack_modes, |
| 14610 | .input_mux = &alc861vd_capture_source, |
| 14611 | }, |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 14612 | [ALC861VD_LENOVO] = { |
| 14613 | .mixers = { alc861vd_lenovo_mixer }, |
| 14614 | .init_verbs = { alc861vd_volume_init_verbs, |
| 14615 | alc861vd_3stack_init_verbs, |
| 14616 | alc861vd_eapd_verbs, |
| 14617 | alc861vd_lenovo_unsol_verbs }, |
| 14618 | .num_dacs = ARRAY_SIZE(alc660vd_dac_nids), |
| 14619 | .dac_nids = alc660vd_dac_nids, |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 14620 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), |
| 14621 | .channel_mode = alc861vd_3stack_2ch_modes, |
| 14622 | .input_mux = &alc861vd_capture_source, |
| 14623 | .unsol_event = alc861vd_lenovo_unsol_event, |
| 14624 | .init_hook = alc861vd_lenovo_automute, |
| 14625 | }, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 14626 | [ALC861VD_DALLAS] = { |
| 14627 | .mixers = { alc861vd_dallas_mixer }, |
| 14628 | .init_verbs = { alc861vd_dallas_verbs }, |
| 14629 | .num_dacs = ARRAY_SIZE(alc861vd_dac_nids), |
| 14630 | .dac_nids = alc861vd_dac_nids, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 14631 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), |
| 14632 | .channel_mode = alc861vd_3stack_2ch_modes, |
| 14633 | .input_mux = &alc861vd_dallas_capture_source, |
| 14634 | .unsol_event = alc861vd_dallas_unsol_event, |
| 14635 | .init_hook = alc861vd_dallas_automute, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 14636 | }, |
| 14637 | [ALC861VD_HP] = { |
| 14638 | .mixers = { alc861vd_hp_mixer }, |
| 14639 | .init_verbs = { alc861vd_dallas_verbs, alc861vd_eapd_verbs }, |
| 14640 | .num_dacs = ARRAY_SIZE(alc861vd_dac_nids), |
| 14641 | .dac_nids = alc861vd_dac_nids, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 14642 | .dig_out_nid = ALC861VD_DIGOUT_NID, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 14643 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), |
| 14644 | .channel_mode = alc861vd_3stack_2ch_modes, |
| 14645 | .input_mux = &alc861vd_hp_capture_source, |
| 14646 | .unsol_event = alc861vd_dallas_unsol_event, |
| 14647 | .init_hook = alc861vd_dallas_automute, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 14648 | }, |
Takashi Iwai | 13c9474 | 2008-11-05 08:06:08 +0100 | [diff] [blame] | 14649 | [ALC660VD_ASUS_V1S] = { |
| 14650 | .mixers = { alc861vd_lenovo_mixer }, |
| 14651 | .init_verbs = { alc861vd_volume_init_verbs, |
| 14652 | alc861vd_3stack_init_verbs, |
| 14653 | alc861vd_eapd_verbs, |
| 14654 | alc861vd_lenovo_unsol_verbs }, |
| 14655 | .num_dacs = ARRAY_SIZE(alc660vd_dac_nids), |
| 14656 | .dac_nids = alc660vd_dac_nids, |
| 14657 | .dig_out_nid = ALC861VD_DIGOUT_NID, |
| 14658 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), |
| 14659 | .channel_mode = alc861vd_3stack_2ch_modes, |
| 14660 | .input_mux = &alc861vd_capture_source, |
| 14661 | .unsol_event = alc861vd_lenovo_unsol_event, |
| 14662 | .init_hook = alc861vd_lenovo_automute, |
| 14663 | }, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14664 | }; |
| 14665 | |
| 14666 | /* |
| 14667 | * BIOS auto configuration |
| 14668 | */ |
| 14669 | static void alc861vd_auto_set_output_and_unmute(struct hda_codec *codec, |
| 14670 | hda_nid_t nid, int pin_type, int dac_idx) |
| 14671 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 14672 | alc_set_pin_output(codec, nid, pin_type); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14673 | } |
| 14674 | |
| 14675 | static void alc861vd_auto_init_multi_out(struct hda_codec *codec) |
| 14676 | { |
| 14677 | struct alc_spec *spec = codec->spec; |
| 14678 | int i; |
| 14679 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 14680 | alc_subsystem_id(codec, 0x15, 0x1b, 0x14); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14681 | for (i = 0; i <= HDA_SIDE; i++) { |
| 14682 | hda_nid_t nid = spec->autocfg.line_out_pins[i]; |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 14683 | int pin_type = get_pin_type(spec->autocfg.line_out_type); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14684 | if (nid) |
| 14685 | alc861vd_auto_set_output_and_unmute(codec, nid, |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 14686 | pin_type, i); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14687 | } |
| 14688 | } |
| 14689 | |
| 14690 | |
| 14691 | static void alc861vd_auto_init_hp_out(struct hda_codec *codec) |
| 14692 | { |
| 14693 | struct alc_spec *spec = codec->spec; |
| 14694 | hda_nid_t pin; |
| 14695 | |
| 14696 | pin = spec->autocfg.hp_pins[0]; |
| 14697 | if (pin) /* connect to front and use dac 0 */ |
| 14698 | alc861vd_auto_set_output_and_unmute(codec, pin, PIN_HP, 0); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 14699 | pin = spec->autocfg.speaker_pins[0]; |
| 14700 | if (pin) |
| 14701 | alc861vd_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14702 | } |
| 14703 | |
| 14704 | #define alc861vd_is_input_pin(nid) alc880_is_input_pin(nid) |
| 14705 | #define ALC861VD_PIN_CD_NID ALC880_PIN_CD_NID |
| 14706 | |
| 14707 | static void alc861vd_auto_init_analog_input(struct hda_codec *codec) |
| 14708 | { |
| 14709 | struct alc_spec *spec = codec->spec; |
| 14710 | int i; |
| 14711 | |
| 14712 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
| 14713 | hda_nid_t nid = spec->autocfg.input_pins[i]; |
| 14714 | if (alc861vd_is_input_pin(nid)) { |
| 14715 | snd_hda_codec_write(codec, nid, 0, |
| 14716 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 14717 | i <= AUTO_PIN_FRONT_MIC ? |
| 14718 | PIN_VREF80 : PIN_IN); |
| 14719 | if (nid != ALC861VD_PIN_CD_NID) |
| 14720 | snd_hda_codec_write(codec, nid, 0, |
| 14721 | AC_VERB_SET_AMP_GAIN_MUTE, |
| 14722 | AMP_OUT_MUTE); |
| 14723 | } |
| 14724 | } |
| 14725 | } |
| 14726 | |
Takashi Iwai | f511b01 | 2008-08-15 16:46:42 +0200 | [diff] [blame] | 14727 | #define alc861vd_auto_init_input_src alc882_auto_init_input_src |
| 14728 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14729 | #define alc861vd_idx_to_mixer_vol(nid) ((nid) + 0x02) |
| 14730 | #define alc861vd_idx_to_mixer_switch(nid) ((nid) + 0x0c) |
| 14731 | |
| 14732 | /* add playback controls from the parsed DAC table */ |
| 14733 | /* Based on ALC880 version. But ALC861VD has separate, |
| 14734 | * different NIDs for mute/unmute switch and volume control */ |
| 14735 | static int alc861vd_auto_create_multi_out_ctls(struct alc_spec *spec, |
| 14736 | const struct auto_pin_cfg *cfg) |
| 14737 | { |
| 14738 | char name[32]; |
| 14739 | static const char *chname[4] = {"Front", "Surround", "CLFE", "Side"}; |
| 14740 | hda_nid_t nid_v, nid_s; |
| 14741 | int i, err; |
| 14742 | |
| 14743 | for (i = 0; i < cfg->line_outs; i++) { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14744 | if (!spec->multiout.dac_nids[i]) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14745 | continue; |
| 14746 | nid_v = alc861vd_idx_to_mixer_vol( |
| 14747 | alc880_dac_to_idx( |
| 14748 | spec->multiout.dac_nids[i])); |
| 14749 | nid_s = alc861vd_idx_to_mixer_switch( |
| 14750 | alc880_dac_to_idx( |
| 14751 | spec->multiout.dac_nids[i])); |
| 14752 | |
| 14753 | if (i == 2) { |
| 14754 | /* Center/LFE */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14755 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 14756 | "Center Playback Volume", |
| 14757 | HDA_COMPOSE_AMP_VAL(nid_v, 1, 0, |
| 14758 | HDA_OUTPUT)); |
| 14759 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14760 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14761 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 14762 | "LFE Playback Volume", |
| 14763 | HDA_COMPOSE_AMP_VAL(nid_v, 2, 0, |
| 14764 | HDA_OUTPUT)); |
| 14765 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14766 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14767 | err = add_control(spec, ALC_CTL_BIND_MUTE, |
| 14768 | "Center Playback Switch", |
| 14769 | HDA_COMPOSE_AMP_VAL(nid_s, 1, 2, |
| 14770 | HDA_INPUT)); |
| 14771 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14772 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14773 | err = add_control(spec, ALC_CTL_BIND_MUTE, |
| 14774 | "LFE Playback Switch", |
| 14775 | HDA_COMPOSE_AMP_VAL(nid_s, 2, 2, |
| 14776 | HDA_INPUT)); |
| 14777 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14778 | return err; |
| 14779 | } else { |
| 14780 | sprintf(name, "%s Playback Volume", chname[i]); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14781 | err = add_control(spec, ALC_CTL_WIDGET_VOL, name, |
| 14782 | HDA_COMPOSE_AMP_VAL(nid_v, 3, 0, |
| 14783 | HDA_OUTPUT)); |
| 14784 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14785 | return err; |
| 14786 | sprintf(name, "%s Playback Switch", chname[i]); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14787 | err = add_control(spec, ALC_CTL_BIND_MUTE, name, |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 14788 | HDA_COMPOSE_AMP_VAL(nid_s, 3, 2, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14789 | HDA_INPUT)); |
| 14790 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14791 | return err; |
| 14792 | } |
| 14793 | } |
| 14794 | return 0; |
| 14795 | } |
| 14796 | |
| 14797 | /* add playback controls for speaker and HP outputs */ |
| 14798 | /* Based on ALC880 version. But ALC861VD has separate, |
| 14799 | * different NIDs for mute/unmute switch and volume control */ |
| 14800 | static int alc861vd_auto_create_extra_out(struct alc_spec *spec, |
| 14801 | hda_nid_t pin, const char *pfx) |
| 14802 | { |
| 14803 | hda_nid_t nid_v, nid_s; |
| 14804 | int err; |
| 14805 | char name[32]; |
| 14806 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14807 | if (!pin) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14808 | return 0; |
| 14809 | |
| 14810 | if (alc880_is_fixed_pin(pin)) { |
| 14811 | nid_v = alc880_idx_to_dac(alc880_fixed_pin_idx(pin)); |
| 14812 | /* specify the DAC as the extra output */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14813 | if (!spec->multiout.hp_nid) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14814 | spec->multiout.hp_nid = nid_v; |
| 14815 | else |
| 14816 | spec->multiout.extra_out_nid[0] = nid_v; |
| 14817 | /* control HP volume/switch on the output mixer amp */ |
| 14818 | nid_v = alc861vd_idx_to_mixer_vol( |
| 14819 | alc880_fixed_pin_idx(pin)); |
| 14820 | nid_s = alc861vd_idx_to_mixer_switch( |
| 14821 | alc880_fixed_pin_idx(pin)); |
| 14822 | |
| 14823 | sprintf(name, "%s Playback Volume", pfx); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14824 | err = add_control(spec, ALC_CTL_WIDGET_VOL, name, |
| 14825 | HDA_COMPOSE_AMP_VAL(nid_v, 3, 0, HDA_OUTPUT)); |
| 14826 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14827 | return err; |
| 14828 | sprintf(name, "%s Playback Switch", pfx); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14829 | err = add_control(spec, ALC_CTL_BIND_MUTE, name, |
| 14830 | HDA_COMPOSE_AMP_VAL(nid_s, 3, 2, HDA_INPUT)); |
| 14831 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14832 | return err; |
| 14833 | } else if (alc880_is_multi_pin(pin)) { |
| 14834 | /* set manual connection */ |
| 14835 | /* we have only a switch on HP-out PIN */ |
| 14836 | sprintf(name, "%s Playback Switch", pfx); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14837 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, name, |
| 14838 | HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT)); |
| 14839 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14840 | return err; |
| 14841 | } |
| 14842 | return 0; |
| 14843 | } |
| 14844 | |
| 14845 | /* parse the BIOS configuration and set up the alc_spec |
| 14846 | * return 1 if successful, 0 if the proper config is not found, |
| 14847 | * or a negative error code |
| 14848 | * Based on ALC880 version - had to change it to override |
| 14849 | * alc880_auto_create_extra_out and alc880_auto_create_multi_out_ctls */ |
| 14850 | static int alc861vd_parse_auto_config(struct hda_codec *codec) |
| 14851 | { |
| 14852 | struct alc_spec *spec = codec->spec; |
| 14853 | int err; |
| 14854 | static hda_nid_t alc861vd_ignore[] = { 0x1d, 0 }; |
| 14855 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14856 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 14857 | alc861vd_ignore); |
| 14858 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14859 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14860 | if (!spec->autocfg.line_outs) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14861 | return 0; /* can't find valid BIOS pin config */ |
| 14862 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14863 | err = alc880_auto_fill_dac_nids(spec, &spec->autocfg); |
| 14864 | if (err < 0) |
| 14865 | return err; |
| 14866 | err = alc861vd_auto_create_multi_out_ctls(spec, &spec->autocfg); |
| 14867 | if (err < 0) |
| 14868 | return err; |
| 14869 | err = alc861vd_auto_create_extra_out(spec, |
| 14870 | spec->autocfg.speaker_pins[0], |
| 14871 | "Speaker"); |
| 14872 | if (err < 0) |
| 14873 | return err; |
| 14874 | err = alc861vd_auto_create_extra_out(spec, |
| 14875 | spec->autocfg.hp_pins[0], |
| 14876 | "Headphone"); |
| 14877 | if (err < 0) |
| 14878 | return err; |
| 14879 | err = alc880_auto_create_analog_input_ctls(spec, &spec->autocfg); |
| 14880 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14881 | return err; |
| 14882 | |
| 14883 | spec->multiout.max_channels = spec->multiout.num_dacs * 2; |
| 14884 | |
Takashi Iwai | 0852d7a | 2009-02-11 11:35:15 +0100 | [diff] [blame] | 14885 | if (spec->autocfg.dig_outs) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14886 | spec->multiout.dig_out_nid = ALC861VD_DIGOUT_NID; |
| 14887 | |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 14888 | if (spec->kctls.list) |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 14889 | add_mixer(spec, spec->kctls.list); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14890 | |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 14891 | add_verb(spec, alc861vd_volume_init_verbs); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14892 | |
| 14893 | spec->num_mux_defs = 1; |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 14894 | spec->input_mux = &spec->private_imux[0]; |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14895 | |
Takashi Iwai | 776e184 | 2007-08-29 15:07:11 +0200 | [diff] [blame] | 14896 | err = alc_auto_add_mic_boost(codec); |
| 14897 | if (err < 0) |
| 14898 | return err; |
| 14899 | |
Takashi Iwai | e044c39 | 2008-10-27 16:56:24 +0100 | [diff] [blame] | 14900 | store_pin_configs(codec); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14901 | return 1; |
| 14902 | } |
| 14903 | |
| 14904 | /* additional initialization for auto-configuration model */ |
| 14905 | static void alc861vd_auto_init(struct hda_codec *codec) |
| 14906 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 14907 | struct alc_spec *spec = codec->spec; |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14908 | alc861vd_auto_init_multi_out(codec); |
| 14909 | alc861vd_auto_init_hp_out(codec); |
| 14910 | alc861vd_auto_init_analog_input(codec); |
Takashi Iwai | f511b01 | 2008-08-15 16:46:42 +0200 | [diff] [blame] | 14911 | alc861vd_auto_init_input_src(codec); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 14912 | if (spec->unsol_event) |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 14913 | alc_inithook(codec); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14914 | } |
| 14915 | |
| 14916 | static int patch_alc861vd(struct hda_codec *codec) |
| 14917 | { |
| 14918 | struct alc_spec *spec; |
| 14919 | int err, board_config; |
| 14920 | |
| 14921 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
| 14922 | if (spec == NULL) |
| 14923 | return -ENOMEM; |
| 14924 | |
| 14925 | codec->spec = spec; |
| 14926 | |
| 14927 | board_config = snd_hda_check_board_config(codec, ALC861VD_MODEL_LAST, |
| 14928 | alc861vd_models, |
| 14929 | alc861vd_cfg_tbl); |
| 14930 | |
| 14931 | if (board_config < 0 || board_config >= ALC861VD_MODEL_LAST) { |
| 14932 | printk(KERN_INFO "hda_codec: Unknown model for ALC660VD/" |
| 14933 | "ALC861VD, trying auto-probe from BIOS...\n"); |
| 14934 | board_config = ALC861VD_AUTO; |
| 14935 | } |
| 14936 | |
| 14937 | if (board_config == ALC861VD_AUTO) { |
| 14938 | /* automatic parse from the BIOS config */ |
| 14939 | err = alc861vd_parse_auto_config(codec); |
| 14940 | if (err < 0) { |
| 14941 | alc_free(codec); |
| 14942 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14943 | } else if (!err) { |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14944 | printk(KERN_INFO |
| 14945 | "hda_codec: Cannot set up configuration " |
| 14946 | "from BIOS. Using base mode...\n"); |
| 14947 | board_config = ALC861VD_3ST; |
| 14948 | } |
| 14949 | } |
| 14950 | |
Kusanagi Kouichi | 680cd53 | 2009-02-05 00:00:58 +0900 | [diff] [blame] | 14951 | err = snd_hda_attach_beep_device(codec, 0x23); |
| 14952 | if (err < 0) { |
| 14953 | alc_free(codec); |
| 14954 | return err; |
| 14955 | } |
| 14956 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14957 | if (board_config != ALC861VD_AUTO) |
| 14958 | setup_preset(spec, &alc861vd_presets[board_config]); |
| 14959 | |
Kailang Yang | 2f89328 | 2008-05-27 12:14:47 +0200 | [diff] [blame] | 14960 | if (codec->vendor_id == 0x10ec0660) { |
| 14961 | spec->stream_name_analog = "ALC660-VD Analog"; |
| 14962 | spec->stream_name_digital = "ALC660-VD Digital"; |
Kailang Yang | f9423e7 | 2008-05-27 12:32:25 +0200 | [diff] [blame] | 14963 | /* always turn on EAPD */ |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 14964 | add_verb(spec, alc660vd_eapd_verbs); |
Kailang Yang | 2f89328 | 2008-05-27 12:14:47 +0200 | [diff] [blame] | 14965 | } else { |
| 14966 | spec->stream_name_analog = "ALC861VD Analog"; |
| 14967 | spec->stream_name_digital = "ALC861VD Digital"; |
| 14968 | } |
| 14969 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14970 | spec->stream_analog_playback = &alc861vd_pcm_analog_playback; |
| 14971 | spec->stream_analog_capture = &alc861vd_pcm_analog_capture; |
| 14972 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14973 | spec->stream_digital_playback = &alc861vd_pcm_digital_playback; |
| 14974 | spec->stream_digital_capture = &alc861vd_pcm_digital_capture; |
| 14975 | |
| 14976 | spec->adc_nids = alc861vd_adc_nids; |
| 14977 | spec->num_adc_nids = ARRAY_SIZE(alc861vd_adc_nids); |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 14978 | spec->capsrc_nids = alc861vd_capsrc_nids; |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 14979 | spec->capture_style = CAPT_MIX; |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14980 | |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 14981 | set_capture_mixer(spec); |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 14982 | set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14983 | |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 14984 | spec->vmaster_nid = 0x02; |
| 14985 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14986 | codec->patch_ops = alc_patch_ops; |
| 14987 | |
| 14988 | if (board_config == ALC861VD_AUTO) |
| 14989 | spec->init_hook = alc861vd_auto_init; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 14990 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 14991 | if (!spec->loopback.amplist) |
| 14992 | spec->loopback.amplist = alc861vd_loopbacks; |
| 14993 | #endif |
Takashi Iwai | daead53 | 2008-11-28 12:55:36 +0100 | [diff] [blame] | 14994 | codec->proc_widget_hook = print_realtek_coef; |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14995 | |
| 14996 | return 0; |
| 14997 | } |
| 14998 | |
| 14999 | /* |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15000 | * ALC662 support |
| 15001 | * |
| 15002 | * ALC662 is almost identical with ALC880 but has cleaner and more flexible |
| 15003 | * configuration. Each pin widget can choose any input DACs and a mixer. |
| 15004 | * Each ADC is connected from a mixer of all inputs. This makes possible |
| 15005 | * 6-channel independent captures. |
| 15006 | * |
| 15007 | * In addition, an independent DAC for the multi-playback (not used in this |
| 15008 | * driver yet). |
| 15009 | */ |
| 15010 | #define ALC662_DIGOUT_NID 0x06 |
| 15011 | #define ALC662_DIGIN_NID 0x0a |
| 15012 | |
| 15013 | static hda_nid_t alc662_dac_nids[4] = { |
| 15014 | /* front, rear, clfe, rear_surr */ |
| 15015 | 0x02, 0x03, 0x04 |
| 15016 | }; |
| 15017 | |
| 15018 | static hda_nid_t alc662_adc_nids[1] = { |
| 15019 | /* ADC1-2 */ |
| 15020 | 0x09, |
| 15021 | }; |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 15022 | |
Kailang Yang | 77a261b | 2008-02-19 11:38:05 +0100 | [diff] [blame] | 15023 | static hda_nid_t alc662_capsrc_nids[1] = { 0x22 }; |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 15024 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15025 | /* input MUX */ |
| 15026 | /* FIXME: should be a matrix-type input source selection */ |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15027 | static struct hda_input_mux alc662_capture_source = { |
| 15028 | .num_items = 4, |
| 15029 | .items = { |
| 15030 | { "Mic", 0x0 }, |
| 15031 | { "Front Mic", 0x1 }, |
| 15032 | { "Line", 0x2 }, |
| 15033 | { "CD", 0x4 }, |
| 15034 | }, |
| 15035 | }; |
| 15036 | |
| 15037 | static struct hda_input_mux alc662_lenovo_101e_capture_source = { |
| 15038 | .num_items = 2, |
| 15039 | .items = { |
| 15040 | { "Mic", 0x1 }, |
| 15041 | { "Line", 0x2 }, |
| 15042 | }, |
| 15043 | }; |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 15044 | |
| 15045 | static struct hda_input_mux alc662_eeepc_capture_source = { |
| 15046 | .num_items = 2, |
| 15047 | .items = { |
| 15048 | { "i-Mic", 0x1 }, |
| 15049 | { "e-Mic", 0x0 }, |
| 15050 | }, |
| 15051 | }; |
| 15052 | |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 15053 | static struct hda_input_mux alc663_capture_source = { |
| 15054 | .num_items = 3, |
| 15055 | .items = { |
| 15056 | { "Mic", 0x0 }, |
| 15057 | { "Front Mic", 0x1 }, |
| 15058 | { "Line", 0x2 }, |
| 15059 | }, |
| 15060 | }; |
| 15061 | |
| 15062 | static struct hda_input_mux alc663_m51va_capture_source = { |
| 15063 | .num_items = 2, |
| 15064 | .items = { |
| 15065 | { "Ext-Mic", 0x0 }, |
| 15066 | { "D-Mic", 0x9 }, |
| 15067 | }, |
| 15068 | }; |
| 15069 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15070 | /* |
| 15071 | * 2ch mode |
| 15072 | */ |
| 15073 | static struct hda_channel_mode alc662_3ST_2ch_modes[1] = { |
| 15074 | { 2, NULL } |
| 15075 | }; |
| 15076 | |
| 15077 | /* |
| 15078 | * 2ch mode |
| 15079 | */ |
| 15080 | static struct hda_verb alc662_3ST_ch2_init[] = { |
| 15081 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 15082 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 15083 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 15084 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 15085 | { } /* end */ |
| 15086 | }; |
| 15087 | |
| 15088 | /* |
| 15089 | * 6ch mode |
| 15090 | */ |
| 15091 | static struct hda_verb alc662_3ST_ch6_init[] = { |
| 15092 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 15093 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 15094 | { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 }, |
| 15095 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 15096 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 15097 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 15098 | { } /* end */ |
| 15099 | }; |
| 15100 | |
| 15101 | static struct hda_channel_mode alc662_3ST_6ch_modes[2] = { |
| 15102 | { 2, alc662_3ST_ch2_init }, |
| 15103 | { 6, alc662_3ST_ch6_init }, |
| 15104 | }; |
| 15105 | |
| 15106 | /* |
| 15107 | * 2ch mode |
| 15108 | */ |
| 15109 | static struct hda_verb alc662_sixstack_ch6_init[] = { |
| 15110 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 15111 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 15112 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 15113 | { } /* end */ |
| 15114 | }; |
| 15115 | |
| 15116 | /* |
| 15117 | * 6ch mode |
| 15118 | */ |
| 15119 | static struct hda_verb alc662_sixstack_ch8_init[] = { |
| 15120 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 15121 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 15122 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 15123 | { } /* end */ |
| 15124 | }; |
| 15125 | |
| 15126 | static struct hda_channel_mode alc662_5stack_modes[2] = { |
| 15127 | { 2, alc662_sixstack_ch6_init }, |
| 15128 | { 6, alc662_sixstack_ch8_init }, |
| 15129 | }; |
| 15130 | |
| 15131 | /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17 |
| 15132 | * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b |
| 15133 | */ |
| 15134 | |
| 15135 | static struct snd_kcontrol_new alc662_base_mixer[] = { |
| 15136 | /* output mixer control */ |
| 15137 | HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT), |
Herton Ronaldo Krzesinski | 7055ad8 | 2008-03-14 12:52:20 +0100 | [diff] [blame] | 15138 | HDA_CODEC_MUTE("Front Playback Switch", 0x0c, 0x0, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15139 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x3, 0x0, HDA_OUTPUT), |
Herton Ronaldo Krzesinski | 7055ad8 | 2008-03-14 12:52:20 +0100 | [diff] [blame] | 15140 | HDA_CODEC_MUTE("Surround Playback Switch", 0x0d, 0x0, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15141 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT), |
| 15142 | 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] | 15143 | HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x0e, 1, 0x0, HDA_INPUT), |
| 15144 | HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 0x0, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15145 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 15146 | |
| 15147 | /*Input mixer control */ |
| 15148 | HDA_CODEC_VOLUME("CD Playback Volume", 0xb, 0x4, HDA_INPUT), |
| 15149 | HDA_CODEC_MUTE("CD Playback Switch", 0xb, 0x4, HDA_INPUT), |
| 15150 | HDA_CODEC_VOLUME("Line Playback Volume", 0xb, 0x02, HDA_INPUT), |
| 15151 | HDA_CODEC_MUTE("Line Playback Switch", 0xb, 0x02, HDA_INPUT), |
| 15152 | HDA_CODEC_VOLUME("Mic Playback Volume", 0xb, 0x0, HDA_INPUT), |
| 15153 | HDA_CODEC_MUTE("Mic Playback Switch", 0xb, 0x0, HDA_INPUT), |
| 15154 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0xb, 0x01, HDA_INPUT), |
| 15155 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0xb, 0x01, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15156 | { } /* end */ |
| 15157 | }; |
| 15158 | |
| 15159 | static struct snd_kcontrol_new alc662_3ST_2ch_mixer[] = { |
| 15160 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
Herton Ronaldo Krzesinski | 7055ad8 | 2008-03-14 12:52:20 +0100 | [diff] [blame] | 15161 | HDA_CODEC_MUTE("Front Playback Switch", 0x0c, 0x0, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15162 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 15163 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 15164 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 15165 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 15166 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 15167 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 15168 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 15169 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 15170 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15171 | { } /* end */ |
| 15172 | }; |
| 15173 | |
| 15174 | static struct snd_kcontrol_new alc662_3ST_6ch_mixer[] = { |
| 15175 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
Herton Ronaldo Krzesinski | 7055ad8 | 2008-03-14 12:52:20 +0100 | [diff] [blame] | 15176 | HDA_CODEC_MUTE("Front Playback Switch", 0x0c, 0x0, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15177 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
Herton Ronaldo Krzesinski | 7055ad8 | 2008-03-14 12:52:20 +0100 | [diff] [blame] | 15178 | HDA_CODEC_MUTE("Surround Playback Switch", 0x0d, 0x0, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15179 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT), |
| 15180 | 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] | 15181 | HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x0e, 1, 0x0, HDA_INPUT), |
| 15182 | HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 0x0, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15183 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 15184 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 15185 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 15186 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 15187 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 15188 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 15189 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 15190 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 15191 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15192 | { } /* end */ |
| 15193 | }; |
| 15194 | |
| 15195 | static struct snd_kcontrol_new alc662_lenovo_101e_mixer[] = { |
| 15196 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 15197 | HDA_BIND_MUTE("Front Playback Switch", 0x02, 2, HDA_INPUT), |
Takashi Iwai | 86cd929 | 2008-01-28 18:09:56 +0100 | [diff] [blame] | 15198 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 15199 | HDA_BIND_MUTE("Speaker Playback Switch", 0x03, 2, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15200 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 15201 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 15202 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 15203 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 15204 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15205 | { } /* end */ |
| 15206 | }; |
| 15207 | |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 15208 | static struct snd_kcontrol_new alc662_eeepc_p701_mixer[] = { |
Takashi Iwai | 86cd929 | 2008-01-28 18:09:56 +0100 | [diff] [blame] | 15209 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 15210 | |
Herton Ronaldo Krzesinski | b481849 | 2008-02-23 11:34:12 +0100 | [diff] [blame] | 15211 | HDA_CODEC_VOLUME("Line-Out Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 15212 | HDA_CODEC_MUTE("Line-Out Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 15213 | |
| 15214 | HDA_CODEC_VOLUME("e-Mic Boost", 0x18, 0, HDA_INPUT), |
| 15215 | HDA_CODEC_VOLUME("e-Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 15216 | HDA_CODEC_MUTE("e-Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 15217 | |
| 15218 | HDA_CODEC_VOLUME("i-Mic Boost", 0x19, 0, HDA_INPUT), |
| 15219 | HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 15220 | HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 15221 | { } /* end */ |
| 15222 | }; |
| 15223 | |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 15224 | static struct snd_kcontrol_new alc662_eeepc_ep20_mixer[] = { |
Takashi Iwai | 31bffaa | 2008-02-27 16:10:44 +0100 | [diff] [blame] | 15225 | HDA_CODEC_VOLUME("Line-Out Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 15226 | HDA_CODEC_MUTE("Line-Out Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 15227 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 15228 | HDA_BIND_MUTE("Surround Playback Switch", 0x03, 2, HDA_INPUT), |
| 15229 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT), |
| 15230 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, HDA_OUTPUT), |
| 15231 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x04, 1, 2, HDA_INPUT), |
| 15232 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x04, 2, 2, HDA_INPUT), |
Takashi Iwai | 86cd929 | 2008-01-28 18:09:56 +0100 | [diff] [blame] | 15233 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 15234 | HDA_BIND_MUTE("MuteCtrl Playback Switch", 0x0c, 2, HDA_INPUT), |
| 15235 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 15236 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 15237 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 15238 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 15239 | { } /* end */ |
| 15240 | }; |
| 15241 | |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 15242 | static struct hda_bind_ctls alc663_asus_bind_master_vol = { |
| 15243 | .ops = &snd_hda_bind_vol, |
| 15244 | .values = { |
| 15245 | HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT), |
| 15246 | HDA_COMPOSE_AMP_VAL(0x03, 3, 0, HDA_OUTPUT), |
| 15247 | 0 |
| 15248 | }, |
| 15249 | }; |
| 15250 | |
| 15251 | static struct hda_bind_ctls alc663_asus_one_bind_switch = { |
| 15252 | .ops = &snd_hda_bind_sw, |
| 15253 | .values = { |
| 15254 | HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), |
| 15255 | HDA_COMPOSE_AMP_VAL(0x21, 3, 0, HDA_OUTPUT), |
| 15256 | 0 |
| 15257 | }, |
| 15258 | }; |
| 15259 | |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 15260 | static struct snd_kcontrol_new alc663_m51va_mixer[] = { |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 15261 | HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol), |
| 15262 | HDA_BIND_SW("Master Playback Switch", &alc663_asus_one_bind_switch), |
| 15263 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 15264 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 15265 | { } /* end */ |
| 15266 | }; |
| 15267 | |
| 15268 | static struct hda_bind_ctls alc663_asus_tree_bind_switch = { |
| 15269 | .ops = &snd_hda_bind_sw, |
| 15270 | .values = { |
| 15271 | HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), |
| 15272 | HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT), |
| 15273 | HDA_COMPOSE_AMP_VAL(0x21, 3, 0, HDA_OUTPUT), |
| 15274 | 0 |
| 15275 | }, |
| 15276 | }; |
| 15277 | |
| 15278 | static struct snd_kcontrol_new alc663_two_hp_m1_mixer[] = { |
| 15279 | HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol), |
| 15280 | HDA_BIND_SW("Master Playback Switch", &alc663_asus_tree_bind_switch), |
| 15281 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 15282 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 15283 | HDA_CODEC_VOLUME("F-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 15284 | HDA_CODEC_MUTE("F-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 15285 | |
| 15286 | { } /* end */ |
| 15287 | }; |
| 15288 | |
| 15289 | static struct hda_bind_ctls alc663_asus_four_bind_switch = { |
| 15290 | .ops = &snd_hda_bind_sw, |
| 15291 | .values = { |
| 15292 | HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), |
| 15293 | HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT), |
| 15294 | HDA_COMPOSE_AMP_VAL(0x1b, 3, 0, HDA_OUTPUT), |
| 15295 | 0 |
| 15296 | }, |
| 15297 | }; |
| 15298 | |
| 15299 | static struct snd_kcontrol_new alc663_two_hp_m2_mixer[] = { |
| 15300 | HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol), |
| 15301 | HDA_BIND_SW("Master Playback Switch", &alc663_asus_four_bind_switch), |
| 15302 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 15303 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 15304 | HDA_CODEC_VOLUME("F-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 15305 | HDA_CODEC_MUTE("F-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 15306 | { } /* end */ |
| 15307 | }; |
| 15308 | |
| 15309 | static struct snd_kcontrol_new alc662_1bjd_mixer[] = { |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 15310 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 15311 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 15312 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 15313 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 15314 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 15315 | HDA_CODEC_VOLUME("F-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 15316 | HDA_CODEC_MUTE("F-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 15317 | { } /* end */ |
| 15318 | }; |
| 15319 | |
| 15320 | static struct hda_bind_ctls alc663_asus_two_bind_master_vol = { |
| 15321 | .ops = &snd_hda_bind_vol, |
| 15322 | .values = { |
| 15323 | HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT), |
| 15324 | HDA_COMPOSE_AMP_VAL(0x04, 3, 0, HDA_OUTPUT), |
| 15325 | 0 |
| 15326 | }, |
| 15327 | }; |
| 15328 | |
| 15329 | static struct hda_bind_ctls alc663_asus_two_bind_switch = { |
| 15330 | .ops = &snd_hda_bind_sw, |
| 15331 | .values = { |
| 15332 | HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), |
| 15333 | HDA_COMPOSE_AMP_VAL(0x16, 3, 0, HDA_OUTPUT), |
| 15334 | 0 |
| 15335 | }, |
| 15336 | }; |
| 15337 | |
| 15338 | static struct snd_kcontrol_new alc663_asus_21jd_clfe_mixer[] = { |
| 15339 | HDA_BIND_VOL("Master Playback Volume", |
| 15340 | &alc663_asus_two_bind_master_vol), |
| 15341 | HDA_BIND_SW("Master Playback Switch", &alc663_asus_two_bind_switch), |
| 15342 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 15343 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT), |
| 15344 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 15345 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 15346 | { } /* end */ |
| 15347 | }; |
| 15348 | |
| 15349 | static struct snd_kcontrol_new alc663_asus_15jd_clfe_mixer[] = { |
| 15350 | HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol), |
| 15351 | HDA_BIND_SW("Master Playback Switch", &alc663_asus_two_bind_switch), |
| 15352 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 15353 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 15354 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 15355 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 15356 | { } /* end */ |
| 15357 | }; |
| 15358 | |
| 15359 | static struct snd_kcontrol_new alc663_g71v_mixer[] = { |
| 15360 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 15361 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 15362 | HDA_CODEC_VOLUME("Front Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 15363 | HDA_CODEC_MUTE("Front Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 15364 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT), |
| 15365 | |
| 15366 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 15367 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 15368 | HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 15369 | HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 15370 | { } /* end */ |
| 15371 | }; |
| 15372 | |
| 15373 | static struct snd_kcontrol_new alc663_g50v_mixer[] = { |
| 15374 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 15375 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 15376 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT), |
| 15377 | |
| 15378 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 15379 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 15380 | HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 15381 | HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 15382 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 15383 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 15384 | { } /* end */ |
| 15385 | }; |
| 15386 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15387 | static struct snd_kcontrol_new alc662_chmode_mixer[] = { |
| 15388 | { |
| 15389 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 15390 | .name = "Channel Mode", |
| 15391 | .info = alc_ch_mode_info, |
| 15392 | .get = alc_ch_mode_get, |
| 15393 | .put = alc_ch_mode_put, |
| 15394 | }, |
| 15395 | { } /* end */ |
| 15396 | }; |
| 15397 | |
| 15398 | static struct hda_verb alc662_init_verbs[] = { |
| 15399 | /* ADC: mute amp left and right */ |
| 15400 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 15401 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 15402 | /* Front mixer: unmute input/output amp left and right (volume = 0) */ |
| 15403 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 15404 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 15405 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 15406 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 15407 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 15408 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15409 | |
Kailang Yang | b60dd39 | 2007-09-20 12:50:29 +0200 | [diff] [blame] | 15410 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15411 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15412 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15413 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15414 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15415 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15416 | |
| 15417 | /* Front Pin: output 0 (0x0c) */ |
| 15418 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 15419 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15420 | |
| 15421 | /* Rear Pin: output 1 (0x0d) */ |
| 15422 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 15423 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15424 | |
| 15425 | /* CLFE Pin: output 2 (0x0e) */ |
| 15426 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 15427 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15428 | |
| 15429 | /* Mic (rear) pin: input vref at 80% */ |
| 15430 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 15431 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 15432 | /* Front Mic pin: input vref at 80% */ |
| 15433 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 15434 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 15435 | /* Line In pin: input */ |
| 15436 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 15437 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 15438 | /* Line-2 In: Headphone output (output 0 - 0x0c) */ |
| 15439 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 15440 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15441 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 15442 | /* CD pin widget for input */ |
| 15443 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 15444 | |
| 15445 | /* FIXME: use matrix-type input source selection */ |
| 15446 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 15447 | /* Input mixer */ |
| 15448 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15449 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15450 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 15451 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)}, |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 15452 | |
| 15453 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15454 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15455 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 15456 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)}, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 15457 | |
| 15458 | /* always trun on EAPD */ |
| 15459 | {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 15460 | {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 15461 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15462 | { } |
| 15463 | }; |
| 15464 | |
| 15465 | static struct hda_verb alc662_sue_init_verbs[] = { |
| 15466 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_FRONT_EVENT}, |
| 15467 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_HP_EVENT}, |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 15468 | {} |
| 15469 | }; |
| 15470 | |
| 15471 | static struct hda_verb alc662_eeepc_sue_init_verbs[] = { |
| 15472 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 15473 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 15474 | {} |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15475 | }; |
| 15476 | |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 15477 | /* Set Unsolicited Event*/ |
| 15478 | static struct hda_verb alc662_eeepc_ep20_sue_init_verbs[] = { |
| 15479 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 15480 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 15481 | {} |
| 15482 | }; |
| 15483 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15484 | /* |
| 15485 | * generic initialization of ADC, input mixers and output mixers |
| 15486 | */ |
| 15487 | static struct hda_verb alc662_auto_init_verbs[] = { |
| 15488 | /* |
| 15489 | * Unmute ADC and set the default input to mic-in |
| 15490 | */ |
| 15491 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 15492 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15493 | |
| 15494 | /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback |
| 15495 | * mixer widget |
| 15496 | * Note: PASD motherboards uses the Line In 2 as the input for front |
| 15497 | * panel mic (mic 2) |
| 15498 | */ |
| 15499 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 15500 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 15501 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 15502 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 15503 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 15504 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15505 | |
| 15506 | /* |
| 15507 | * Set up output mixers (0x0c - 0x0f) |
| 15508 | */ |
| 15509 | /* set vol=0 to output mixers */ |
| 15510 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 15511 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 15512 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 15513 | |
| 15514 | /* set up input amps for analog loopback */ |
| 15515 | /* Amp Indices: DAC = 0, mixer = 1 */ |
Kailang Yang | b60dd39 | 2007-09-20 12:50:29 +0200 | [diff] [blame] | 15516 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15517 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15518 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15519 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15520 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15521 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15522 | |
| 15523 | |
| 15524 | /* FIXME: use matrix-type input source selection */ |
| 15525 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 15526 | /* Input mixer */ |
| 15527 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 15528 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15529 | { } |
| 15530 | }; |
| 15531 | |
Takashi Iwai | 24fb917 | 2008-09-02 14:48:20 +0200 | [diff] [blame] | 15532 | /* additional verbs for ALC663 */ |
| 15533 | static struct hda_verb alc663_auto_init_verbs[] = { |
| 15534 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15535 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15536 | { } |
| 15537 | }; |
| 15538 | |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 15539 | static struct hda_verb alc663_m51va_init_verbs[] = { |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 15540 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 15541 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 15542 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 15543 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 15544 | {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */ |
| 15545 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 15546 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)}, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 15547 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 15548 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 15549 | {} |
| 15550 | }; |
| 15551 | |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 15552 | static struct hda_verb alc663_21jd_amic_init_verbs[] = { |
| 15553 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 15554 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15555 | {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */ |
| 15556 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 15557 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15558 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 15559 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 15560 | {} |
| 15561 | }; |
| 15562 | |
| 15563 | static struct hda_verb alc662_1bjd_amic_init_verbs[] = { |
| 15564 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 15565 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 15566 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15567 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Headphone */ |
| 15568 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 15569 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15570 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 15571 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 15572 | {} |
| 15573 | }; |
| 15574 | |
| 15575 | static struct hda_verb alc663_15jd_amic_init_verbs[] = { |
| 15576 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 15577 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15578 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */ |
| 15579 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 15580 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15581 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 15582 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 15583 | {} |
| 15584 | }; |
| 15585 | |
| 15586 | static struct hda_verb alc663_two_hp_amic_m1_init_verbs[] = { |
| 15587 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 15588 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 15589 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15590 | {0x21, AC_VERB_SET_CONNECT_SEL, 0x0}, /* Headphone */ |
| 15591 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 15592 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15593 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x0}, /* Headphone */ |
| 15594 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 15595 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15596 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 15597 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 15598 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 15599 | {} |
| 15600 | }; |
| 15601 | |
| 15602 | static struct hda_verb alc663_two_hp_amic_m2_init_verbs[] = { |
| 15603 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 15604 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 15605 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15606 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */ |
| 15607 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 15608 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15609 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */ |
| 15610 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 15611 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15612 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 15613 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 15614 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 15615 | {} |
| 15616 | }; |
| 15617 | |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 15618 | static struct hda_verb alc663_g71v_init_verbs[] = { |
| 15619 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 15620 | /* {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, */ |
| 15621 | /* {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, */ /* Headphone */ |
| 15622 | |
| 15623 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 15624 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15625 | {0x21, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Headphone */ |
| 15626 | |
| 15627 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_FRONT_EVENT}, |
| 15628 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_MIC_EVENT}, |
| 15629 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_HP_EVENT}, |
| 15630 | {} |
| 15631 | }; |
| 15632 | |
| 15633 | static struct hda_verb alc663_g50v_init_verbs[] = { |
| 15634 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 15635 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15636 | {0x21, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Headphone */ |
| 15637 | |
| 15638 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 15639 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 15640 | {} |
| 15641 | }; |
| 15642 | |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 15643 | static struct hda_verb alc662_ecs_init_verbs[] = { |
| 15644 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, 0x701f}, |
| 15645 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 15646 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 15647 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 15648 | {} |
| 15649 | }; |
| 15650 | |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 15651 | static struct snd_kcontrol_new alc662_auto_capture_mixer[] = { |
| 15652 | HDA_CODEC_VOLUME("Capture Volume", 0x09, 0x0, HDA_INPUT), |
| 15653 | HDA_CODEC_MUTE("Capture Switch", 0x09, 0x0, HDA_INPUT), |
| 15654 | { } /* end */ |
| 15655 | }; |
| 15656 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15657 | static void alc662_lenovo_101e_ispeaker_automute(struct hda_codec *codec) |
| 15658 | { |
| 15659 | unsigned int present; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15660 | unsigned char bits; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15661 | |
| 15662 | present = snd_hda_codec_read(codec, 0x14, 0, |
| 15663 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 15664 | bits = present ? HDA_AMP_MUTE : 0; |
| 15665 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 15666 | HDA_AMP_MUTE, bits); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15667 | } |
| 15668 | |
| 15669 | static void alc662_lenovo_101e_all_automute(struct hda_codec *codec) |
| 15670 | { |
| 15671 | unsigned int present; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15672 | unsigned char bits; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15673 | |
| 15674 | present = snd_hda_codec_read(codec, 0x1b, 0, |
| 15675 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 15676 | bits = present ? HDA_AMP_MUTE : 0; |
| 15677 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 15678 | HDA_AMP_MUTE, bits); |
| 15679 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 15680 | HDA_AMP_MUTE, bits); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15681 | } |
| 15682 | |
| 15683 | static void alc662_lenovo_101e_unsol_event(struct hda_codec *codec, |
| 15684 | unsigned int res) |
| 15685 | { |
| 15686 | if ((res >> 26) == ALC880_HP_EVENT) |
| 15687 | alc662_lenovo_101e_all_automute(codec); |
| 15688 | if ((res >> 26) == ALC880_FRONT_EVENT) |
| 15689 | alc662_lenovo_101e_ispeaker_automute(codec); |
| 15690 | } |
| 15691 | |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 15692 | static void alc662_eeepc_mic_automute(struct hda_codec *codec) |
| 15693 | { |
| 15694 | unsigned int present; |
| 15695 | |
| 15696 | present = snd_hda_codec_read(codec, 0x18, 0, |
| 15697 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 15698 | snd_hda_codec_write(codec, 0x22, 0, AC_VERB_SET_AMP_GAIN_MUTE, |
| 15699 | 0x7000 | (0x00 << 8) | (present ? 0 : 0x80)); |
| 15700 | snd_hda_codec_write(codec, 0x23, 0, AC_VERB_SET_AMP_GAIN_MUTE, |
| 15701 | 0x7000 | (0x00 << 8) | (present ? 0 : 0x80)); |
| 15702 | snd_hda_codec_write(codec, 0x22, 0, AC_VERB_SET_AMP_GAIN_MUTE, |
| 15703 | 0x7000 | (0x01 << 8) | (present ? 0x80 : 0)); |
| 15704 | snd_hda_codec_write(codec, 0x23, 0, AC_VERB_SET_AMP_GAIN_MUTE, |
| 15705 | 0x7000 | (0x01 << 8) | (present ? 0x80 : 0)); |
| 15706 | } |
| 15707 | |
| 15708 | /* unsolicited event for HP jack sensing */ |
| 15709 | static void alc662_eeepc_unsol_event(struct hda_codec *codec, |
| 15710 | unsigned int res) |
| 15711 | { |
| 15712 | if ((res >> 26) == ALC880_HP_EVENT) |
| 15713 | alc262_hippo1_automute( codec ); |
| 15714 | |
| 15715 | if ((res >> 26) == ALC880_MIC_EVENT) |
| 15716 | alc662_eeepc_mic_automute(codec); |
| 15717 | } |
| 15718 | |
| 15719 | static void alc662_eeepc_inithook(struct hda_codec *codec) |
| 15720 | { |
| 15721 | alc262_hippo1_automute( codec ); |
| 15722 | alc662_eeepc_mic_automute(codec); |
| 15723 | } |
| 15724 | |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 15725 | static void alc662_eeepc_ep20_automute(struct hda_codec *codec) |
| 15726 | { |
| 15727 | unsigned int mute; |
| 15728 | unsigned int present; |
| 15729 | |
| 15730 | snd_hda_codec_read(codec, 0x14, 0, AC_VERB_SET_PIN_SENSE, 0); |
| 15731 | present = snd_hda_codec_read(codec, 0x14, 0, |
| 15732 | AC_VERB_GET_PIN_SENSE, 0); |
| 15733 | present = (present & 0x80000000) != 0; |
| 15734 | if (present) { |
| 15735 | /* mute internal speaker */ |
| 15736 | snd_hda_codec_amp_stereo(codec, 0x1b, HDA_OUTPUT, 0, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 15737 | HDA_AMP_MUTE, HDA_AMP_MUTE); |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 15738 | } else { |
| 15739 | /* unmute internal speaker if necessary */ |
| 15740 | mute = snd_hda_codec_amp_read(codec, 0x14, 0, HDA_OUTPUT, 0); |
| 15741 | snd_hda_codec_amp_stereo(codec, 0x1b, HDA_OUTPUT, 0, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 15742 | HDA_AMP_MUTE, mute); |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 15743 | } |
| 15744 | } |
| 15745 | |
| 15746 | /* unsolicited event for HP jack sensing */ |
| 15747 | static void alc662_eeepc_ep20_unsol_event(struct hda_codec *codec, |
| 15748 | unsigned int res) |
| 15749 | { |
| 15750 | if ((res >> 26) == ALC880_HP_EVENT) |
| 15751 | alc662_eeepc_ep20_automute(codec); |
| 15752 | } |
| 15753 | |
| 15754 | static void alc662_eeepc_ep20_inithook(struct hda_codec *codec) |
| 15755 | { |
| 15756 | alc662_eeepc_ep20_automute(codec); |
| 15757 | } |
| 15758 | |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 15759 | static void alc663_m51va_speaker_automute(struct hda_codec *codec) |
| 15760 | { |
| 15761 | unsigned int present; |
| 15762 | unsigned char bits; |
| 15763 | |
| 15764 | present = snd_hda_codec_read(codec, 0x21, 0, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 15765 | AC_VERB_GET_PIN_SENSE, 0) |
| 15766 | & AC_PINSENSE_PRESENCE; |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 15767 | bits = present ? HDA_AMP_MUTE : 0; |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 15768 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0, |
| 15769 | AMP_IN_MUTE(0), bits); |
| 15770 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1, |
| 15771 | AMP_IN_MUTE(0), bits); |
| 15772 | } |
| 15773 | |
| 15774 | static void alc663_21jd_two_speaker_automute(struct hda_codec *codec) |
| 15775 | { |
| 15776 | unsigned int present; |
| 15777 | unsigned char bits; |
| 15778 | |
| 15779 | present = snd_hda_codec_read(codec, 0x21, 0, |
| 15780 | AC_VERB_GET_PIN_SENSE, 0) |
| 15781 | & AC_PINSENSE_PRESENCE; |
| 15782 | bits = present ? HDA_AMP_MUTE : 0; |
| 15783 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0, |
| 15784 | AMP_IN_MUTE(0), bits); |
| 15785 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1, |
| 15786 | AMP_IN_MUTE(0), bits); |
| 15787 | snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 0, |
| 15788 | AMP_IN_MUTE(0), bits); |
| 15789 | snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 1, |
| 15790 | AMP_IN_MUTE(0), bits); |
| 15791 | } |
| 15792 | |
| 15793 | static void alc663_15jd_two_speaker_automute(struct hda_codec *codec) |
| 15794 | { |
| 15795 | unsigned int present; |
| 15796 | unsigned char bits; |
| 15797 | |
| 15798 | present = snd_hda_codec_read(codec, 0x15, 0, |
| 15799 | AC_VERB_GET_PIN_SENSE, 0) |
| 15800 | & AC_PINSENSE_PRESENCE; |
| 15801 | bits = present ? HDA_AMP_MUTE : 0; |
| 15802 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0, |
| 15803 | AMP_IN_MUTE(0), bits); |
| 15804 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1, |
| 15805 | AMP_IN_MUTE(0), bits); |
| 15806 | snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 0, |
| 15807 | AMP_IN_MUTE(0), bits); |
| 15808 | snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 1, |
| 15809 | AMP_IN_MUTE(0), bits); |
| 15810 | } |
| 15811 | |
| 15812 | static void alc662_f5z_speaker_automute(struct hda_codec *codec) |
| 15813 | { |
| 15814 | unsigned int present; |
| 15815 | unsigned char bits; |
| 15816 | |
| 15817 | present = snd_hda_codec_read(codec, 0x1b, 0, |
| 15818 | AC_VERB_GET_PIN_SENSE, 0) |
| 15819 | & AC_PINSENSE_PRESENCE; |
| 15820 | bits = present ? 0 : PIN_OUT; |
| 15821 | snd_hda_codec_write(codec, 0x14, 0, |
| 15822 | AC_VERB_SET_PIN_WIDGET_CONTROL, bits); |
| 15823 | } |
| 15824 | |
| 15825 | static void alc663_two_hp_m1_speaker_automute(struct hda_codec *codec) |
| 15826 | { |
| 15827 | unsigned int present1, present2; |
| 15828 | |
| 15829 | present1 = snd_hda_codec_read(codec, 0x21, 0, |
| 15830 | AC_VERB_GET_PIN_SENSE, 0) |
| 15831 | & AC_PINSENSE_PRESENCE; |
| 15832 | present2 = snd_hda_codec_read(codec, 0x15, 0, |
| 15833 | AC_VERB_GET_PIN_SENSE, 0) |
| 15834 | & AC_PINSENSE_PRESENCE; |
| 15835 | |
| 15836 | if (present1 || present2) { |
| 15837 | snd_hda_codec_write_cache(codec, 0x14, 0, |
| 15838 | AC_VERB_SET_PIN_WIDGET_CONTROL, 0); |
| 15839 | } else { |
| 15840 | snd_hda_codec_write_cache(codec, 0x14, 0, |
| 15841 | AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT); |
| 15842 | } |
| 15843 | } |
| 15844 | |
| 15845 | static void alc663_two_hp_m2_speaker_automute(struct hda_codec *codec) |
| 15846 | { |
| 15847 | unsigned int present1, present2; |
| 15848 | |
| 15849 | present1 = snd_hda_codec_read(codec, 0x1b, 0, |
| 15850 | AC_VERB_GET_PIN_SENSE, 0) |
| 15851 | & AC_PINSENSE_PRESENCE; |
| 15852 | present2 = snd_hda_codec_read(codec, 0x15, 0, |
| 15853 | AC_VERB_GET_PIN_SENSE, 0) |
| 15854 | & AC_PINSENSE_PRESENCE; |
| 15855 | |
| 15856 | if (present1 || present2) { |
| 15857 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0, |
| 15858 | AMP_IN_MUTE(0), AMP_IN_MUTE(0)); |
| 15859 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1, |
| 15860 | AMP_IN_MUTE(0), AMP_IN_MUTE(0)); |
| 15861 | } else { |
| 15862 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0, |
| 15863 | AMP_IN_MUTE(0), 0); |
| 15864 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1, |
| 15865 | AMP_IN_MUTE(0), 0); |
| 15866 | } |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 15867 | } |
| 15868 | |
| 15869 | static void alc663_m51va_mic_automute(struct hda_codec *codec) |
| 15870 | { |
| 15871 | unsigned int present; |
| 15872 | |
| 15873 | present = snd_hda_codec_read(codec, 0x18, 0, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 15874 | AC_VERB_GET_PIN_SENSE, 0) |
| 15875 | & AC_PINSENSE_PRESENCE; |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 15876 | 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] | 15877 | 0x7000 | (0x00 << 8) | (present ? 0 : 0x80)); |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 15878 | 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] | 15879 | 0x7000 | (0x00 << 8) | (present ? 0 : 0x80)); |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 15880 | 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] | 15881 | 0x7000 | (0x09 << 8) | (present ? 0x80 : 0)); |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 15882 | 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] | 15883 | 0x7000 | (0x09 << 8) | (present ? 0x80 : 0)); |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 15884 | } |
| 15885 | |
| 15886 | static void alc663_m51va_unsol_event(struct hda_codec *codec, |
| 15887 | unsigned int res) |
| 15888 | { |
| 15889 | switch (res >> 26) { |
| 15890 | case ALC880_HP_EVENT: |
| 15891 | alc663_m51va_speaker_automute(codec); |
| 15892 | break; |
| 15893 | case ALC880_MIC_EVENT: |
| 15894 | alc663_m51va_mic_automute(codec); |
| 15895 | break; |
| 15896 | } |
| 15897 | } |
| 15898 | |
| 15899 | static void alc663_m51va_inithook(struct hda_codec *codec) |
| 15900 | { |
| 15901 | alc663_m51va_speaker_automute(codec); |
| 15902 | alc663_m51va_mic_automute(codec); |
| 15903 | } |
| 15904 | |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 15905 | /* ***************** Mode1 ******************************/ |
| 15906 | static void alc663_mode1_unsol_event(struct hda_codec *codec, |
| 15907 | unsigned int res) |
| 15908 | { |
| 15909 | switch (res >> 26) { |
| 15910 | case ALC880_HP_EVENT: |
| 15911 | alc663_m51va_speaker_automute(codec); |
| 15912 | break; |
| 15913 | case ALC880_MIC_EVENT: |
| 15914 | alc662_eeepc_mic_automute(codec); |
| 15915 | break; |
| 15916 | } |
| 15917 | } |
| 15918 | |
| 15919 | static void alc663_mode1_inithook(struct hda_codec *codec) |
| 15920 | { |
| 15921 | alc663_m51va_speaker_automute(codec); |
| 15922 | alc662_eeepc_mic_automute(codec); |
| 15923 | } |
| 15924 | /* ***************** Mode2 ******************************/ |
| 15925 | static void alc662_mode2_unsol_event(struct hda_codec *codec, |
| 15926 | unsigned int res) |
| 15927 | { |
| 15928 | switch (res >> 26) { |
| 15929 | case ALC880_HP_EVENT: |
| 15930 | alc662_f5z_speaker_automute(codec); |
| 15931 | break; |
| 15932 | case ALC880_MIC_EVENT: |
| 15933 | alc662_eeepc_mic_automute(codec); |
| 15934 | break; |
| 15935 | } |
| 15936 | } |
| 15937 | |
| 15938 | static void alc662_mode2_inithook(struct hda_codec *codec) |
| 15939 | { |
| 15940 | alc662_f5z_speaker_automute(codec); |
| 15941 | alc662_eeepc_mic_automute(codec); |
| 15942 | } |
| 15943 | /* ***************** Mode3 ******************************/ |
| 15944 | static void alc663_mode3_unsol_event(struct hda_codec *codec, |
| 15945 | unsigned int res) |
| 15946 | { |
| 15947 | switch (res >> 26) { |
| 15948 | case ALC880_HP_EVENT: |
| 15949 | alc663_two_hp_m1_speaker_automute(codec); |
| 15950 | break; |
| 15951 | case ALC880_MIC_EVENT: |
| 15952 | alc662_eeepc_mic_automute(codec); |
| 15953 | break; |
| 15954 | } |
| 15955 | } |
| 15956 | |
| 15957 | static void alc663_mode3_inithook(struct hda_codec *codec) |
| 15958 | { |
| 15959 | alc663_two_hp_m1_speaker_automute(codec); |
| 15960 | alc662_eeepc_mic_automute(codec); |
| 15961 | } |
| 15962 | /* ***************** Mode4 ******************************/ |
| 15963 | static void alc663_mode4_unsol_event(struct hda_codec *codec, |
| 15964 | unsigned int res) |
| 15965 | { |
| 15966 | switch (res >> 26) { |
| 15967 | case ALC880_HP_EVENT: |
| 15968 | alc663_21jd_two_speaker_automute(codec); |
| 15969 | break; |
| 15970 | case ALC880_MIC_EVENT: |
| 15971 | alc662_eeepc_mic_automute(codec); |
| 15972 | break; |
| 15973 | } |
| 15974 | } |
| 15975 | |
| 15976 | static void alc663_mode4_inithook(struct hda_codec *codec) |
| 15977 | { |
| 15978 | alc663_21jd_two_speaker_automute(codec); |
| 15979 | alc662_eeepc_mic_automute(codec); |
| 15980 | } |
| 15981 | /* ***************** Mode5 ******************************/ |
| 15982 | static void alc663_mode5_unsol_event(struct hda_codec *codec, |
| 15983 | unsigned int res) |
| 15984 | { |
| 15985 | switch (res >> 26) { |
| 15986 | case ALC880_HP_EVENT: |
| 15987 | alc663_15jd_two_speaker_automute(codec); |
| 15988 | break; |
| 15989 | case ALC880_MIC_EVENT: |
| 15990 | alc662_eeepc_mic_automute(codec); |
| 15991 | break; |
| 15992 | } |
| 15993 | } |
| 15994 | |
| 15995 | static void alc663_mode5_inithook(struct hda_codec *codec) |
| 15996 | { |
| 15997 | alc663_15jd_two_speaker_automute(codec); |
| 15998 | alc662_eeepc_mic_automute(codec); |
| 15999 | } |
| 16000 | /* ***************** Mode6 ******************************/ |
| 16001 | static void alc663_mode6_unsol_event(struct hda_codec *codec, |
| 16002 | unsigned int res) |
| 16003 | { |
| 16004 | switch (res >> 26) { |
| 16005 | case ALC880_HP_EVENT: |
| 16006 | alc663_two_hp_m2_speaker_automute(codec); |
| 16007 | break; |
| 16008 | case ALC880_MIC_EVENT: |
| 16009 | alc662_eeepc_mic_automute(codec); |
| 16010 | break; |
| 16011 | } |
| 16012 | } |
| 16013 | |
| 16014 | static void alc663_mode6_inithook(struct hda_codec *codec) |
| 16015 | { |
| 16016 | alc663_two_hp_m2_speaker_automute(codec); |
| 16017 | alc662_eeepc_mic_automute(codec); |
| 16018 | } |
| 16019 | |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 16020 | static void alc663_g71v_hp_automute(struct hda_codec *codec) |
| 16021 | { |
| 16022 | unsigned int present; |
| 16023 | unsigned char bits; |
| 16024 | |
| 16025 | present = snd_hda_codec_read(codec, 0x21, 0, |
| 16026 | AC_VERB_GET_PIN_SENSE, 0) |
| 16027 | & AC_PINSENSE_PRESENCE; |
| 16028 | bits = present ? HDA_AMP_MUTE : 0; |
| 16029 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 16030 | HDA_AMP_MUTE, bits); |
| 16031 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 16032 | HDA_AMP_MUTE, bits); |
| 16033 | } |
| 16034 | |
| 16035 | static void alc663_g71v_front_automute(struct hda_codec *codec) |
| 16036 | { |
| 16037 | unsigned int present; |
| 16038 | unsigned char bits; |
| 16039 | |
| 16040 | present = snd_hda_codec_read(codec, 0x15, 0, |
| 16041 | AC_VERB_GET_PIN_SENSE, 0) |
| 16042 | & AC_PINSENSE_PRESENCE; |
| 16043 | bits = present ? HDA_AMP_MUTE : 0; |
| 16044 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 16045 | HDA_AMP_MUTE, bits); |
| 16046 | } |
| 16047 | |
| 16048 | static void alc663_g71v_unsol_event(struct hda_codec *codec, |
| 16049 | unsigned int res) |
| 16050 | { |
| 16051 | switch (res >> 26) { |
| 16052 | case ALC880_HP_EVENT: |
| 16053 | alc663_g71v_hp_automute(codec); |
| 16054 | break; |
| 16055 | case ALC880_FRONT_EVENT: |
| 16056 | alc663_g71v_front_automute(codec); |
| 16057 | break; |
| 16058 | case ALC880_MIC_EVENT: |
| 16059 | alc662_eeepc_mic_automute(codec); |
| 16060 | break; |
| 16061 | } |
| 16062 | } |
| 16063 | |
| 16064 | static void alc663_g71v_inithook(struct hda_codec *codec) |
| 16065 | { |
| 16066 | alc663_g71v_front_automute(codec); |
| 16067 | alc663_g71v_hp_automute(codec); |
| 16068 | alc662_eeepc_mic_automute(codec); |
| 16069 | } |
| 16070 | |
| 16071 | static void alc663_g50v_unsol_event(struct hda_codec *codec, |
| 16072 | unsigned int res) |
| 16073 | { |
| 16074 | switch (res >> 26) { |
| 16075 | case ALC880_HP_EVENT: |
| 16076 | alc663_m51va_speaker_automute(codec); |
| 16077 | break; |
| 16078 | case ALC880_MIC_EVENT: |
| 16079 | alc662_eeepc_mic_automute(codec); |
| 16080 | break; |
| 16081 | } |
| 16082 | } |
| 16083 | |
| 16084 | static void alc663_g50v_inithook(struct hda_codec *codec) |
| 16085 | { |
| 16086 | alc663_m51va_speaker_automute(codec); |
| 16087 | alc662_eeepc_mic_automute(codec); |
| 16088 | } |
| 16089 | |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 16090 | /* bind hp and internal speaker mute (with plug check) */ |
| 16091 | static int alc662_ecs_master_sw_put(struct snd_kcontrol *kcontrol, |
| 16092 | struct snd_ctl_elem_value *ucontrol) |
| 16093 | { |
| 16094 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 16095 | long *valp = ucontrol->value.integer.value; |
| 16096 | int change; |
| 16097 | |
| 16098 | change = snd_hda_codec_amp_update(codec, 0x1b, 0, HDA_OUTPUT, 0, |
| 16099 | HDA_AMP_MUTE, |
| 16100 | valp[0] ? 0 : HDA_AMP_MUTE); |
| 16101 | change |= snd_hda_codec_amp_update(codec, 0x1b, 1, HDA_OUTPUT, 0, |
| 16102 | HDA_AMP_MUTE, |
| 16103 | valp[1] ? 0 : HDA_AMP_MUTE); |
| 16104 | if (change) |
| 16105 | alc262_hippo1_automute(codec); |
| 16106 | return change; |
| 16107 | } |
| 16108 | |
| 16109 | static struct snd_kcontrol_new alc662_ecs_mixer[] = { |
| 16110 | HDA_CODEC_VOLUME("Master Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 16111 | { |
| 16112 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 16113 | .name = "Master Playback Switch", |
| 16114 | .info = snd_hda_mixer_amp_switch_info, |
| 16115 | .get = snd_hda_mixer_amp_switch_get, |
| 16116 | .put = alc662_ecs_master_sw_put, |
| 16117 | .private_value = HDA_COMPOSE_AMP_VAL(0x1b, 3, 0, HDA_OUTPUT), |
| 16118 | }, |
| 16119 | |
| 16120 | HDA_CODEC_VOLUME("e-Mic/LineIn Boost", 0x18, 0, HDA_INPUT), |
| 16121 | HDA_CODEC_VOLUME("e-Mic/LineIn Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 16122 | HDA_CODEC_MUTE("e-Mic/LineIn Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 16123 | |
| 16124 | HDA_CODEC_VOLUME("i-Mic Boost", 0x19, 0, HDA_INPUT), |
| 16125 | HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 16126 | HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 16127 | { } /* end */ |
| 16128 | }; |
| 16129 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 16130 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 16131 | #define alc662_loopbacks alc880_loopbacks |
| 16132 | #endif |
| 16133 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16134 | |
| 16135 | /* pcm configuration: identiacal with ALC880 */ |
| 16136 | #define alc662_pcm_analog_playback alc880_pcm_analog_playback |
| 16137 | #define alc662_pcm_analog_capture alc880_pcm_analog_capture |
| 16138 | #define alc662_pcm_digital_playback alc880_pcm_digital_playback |
| 16139 | #define alc662_pcm_digital_capture alc880_pcm_digital_capture |
| 16140 | |
| 16141 | /* |
| 16142 | * configuration and preset |
| 16143 | */ |
| 16144 | static const char *alc662_models[ALC662_MODEL_LAST] = { |
| 16145 | [ALC662_3ST_2ch_DIG] = "3stack-dig", |
| 16146 | [ALC662_3ST_6ch_DIG] = "3stack-6ch-dig", |
| 16147 | [ALC662_3ST_6ch] = "3stack-6ch", |
| 16148 | [ALC662_5ST_DIG] = "6stack-dig", |
| 16149 | [ALC662_LENOVO_101E] = "lenovo-101e", |
Takashi Iwai | b995d76 | 2007-10-17 10:41:06 +0200 | [diff] [blame] | 16150 | [ALC662_ASUS_EEEPC_P701] = "eeepc-p701", |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 16151 | [ALC662_ASUS_EEEPC_EP20] = "eeepc-ep20", |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 16152 | [ALC662_ECS] = "ecs", |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 16153 | [ALC663_ASUS_M51VA] = "m51va", |
| 16154 | [ALC663_ASUS_G71V] = "g71v", |
| 16155 | [ALC663_ASUS_H13] = "h13", |
| 16156 | [ALC663_ASUS_G50V] = "g50v", |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 16157 | [ALC663_ASUS_MODE1] = "asus-mode1", |
| 16158 | [ALC662_ASUS_MODE2] = "asus-mode2", |
| 16159 | [ALC663_ASUS_MODE3] = "asus-mode3", |
| 16160 | [ALC663_ASUS_MODE4] = "asus-mode4", |
| 16161 | [ALC663_ASUS_MODE5] = "asus-mode5", |
| 16162 | [ALC663_ASUS_MODE6] = "asus-mode6", |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16163 | [ALC662_AUTO] = "auto", |
| 16164 | }; |
| 16165 | |
| 16166 | static struct snd_pci_quirk alc662_cfg_tbl[] = { |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 16167 | SND_PCI_QUIRK(0x1019, 0x9087, "ECS", ALC662_ECS), |
| 16168 | SND_PCI_QUIRK(0x1043, 0x1000, "ASUS N50Vm", ALC663_ASUS_MODE1), |
| 16169 | SND_PCI_QUIRK(0x1043, 0x1092, "ASUS NB", ALC663_ASUS_MODE3), |
| 16170 | SND_PCI_QUIRK(0x1043, 0x11c3, "ASUS M70V", ALC663_ASUS_MODE3), |
| 16171 | SND_PCI_QUIRK(0x1043, 0x11d3, "ASUS NB", ALC663_ASUS_MODE1), |
| 16172 | SND_PCI_QUIRK(0x1043, 0x11f3, "ASUS NB", ALC662_ASUS_MODE2), |
| 16173 | SND_PCI_QUIRK(0x1043, 0x1203, "ASUS NB", ALC663_ASUS_MODE1), |
| 16174 | SND_PCI_QUIRK(0x1043, 0x1339, "ASUS NB", ALC662_ASUS_MODE2), |
| 16175 | SND_PCI_QUIRK(0x1043, 0x16c3, "ASUS NB", ALC662_ASUS_MODE2), |
| 16176 | SND_PCI_QUIRK(0x1043, 0x1753, "ASUS NB", ALC662_ASUS_MODE2), |
| 16177 | SND_PCI_QUIRK(0x1043, 0x1763, "ASUS NB", ALC663_ASUS_MODE6), |
| 16178 | SND_PCI_QUIRK(0x1043, 0x1765, "ASUS NB", ALC663_ASUS_MODE6), |
| 16179 | SND_PCI_QUIRK(0x1043, 0x1783, "ASUS NB", ALC662_ASUS_MODE2), |
| 16180 | SND_PCI_QUIRK(0x1043, 0x1813, "ASUS NB", ALC662_ASUS_MODE2), |
| 16181 | SND_PCI_QUIRK(0x1043, 0x1823, "ASUS NB", ALC663_ASUS_MODE5), |
| 16182 | SND_PCI_QUIRK(0x1043, 0x1833, "ASUS NB", ALC663_ASUS_MODE6), |
| 16183 | SND_PCI_QUIRK(0x1043, 0x1843, "ASUS NB", ALC662_ASUS_MODE2), |
| 16184 | SND_PCI_QUIRK(0x1043, 0x1864, "ASUS NB", ALC662_ASUS_MODE2), |
| 16185 | SND_PCI_QUIRK(0x1043, 0x1876, "ASUS NB", ALC662_ASUS_MODE2), |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 16186 | SND_PCI_QUIRK(0x1043, 0x1878, "ASUS M51VA", ALC663_ASUS_M51VA), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 16187 | /*SND_PCI_QUIRK(0x1043, 0x1878, "ASUS M50Vr", ALC663_ASUS_MODE1),*/ |
| 16188 | SND_PCI_QUIRK(0x1043, 0x1893, "ASUS M50Vm", ALC663_ASUS_MODE3), |
| 16189 | SND_PCI_QUIRK(0x1043, 0x1894, "ASUS X55", ALC663_ASUS_MODE3), |
| 16190 | SND_PCI_QUIRK(0x1043, 0x1903, "ASUS F5GL", ALC663_ASUS_MODE1), |
| 16191 | SND_PCI_QUIRK(0x1043, 0x1913, "ASUS NB", ALC662_ASUS_MODE2), |
| 16192 | SND_PCI_QUIRK(0x1043, 0x1933, "ASUS F80Q", ALC662_ASUS_MODE2), |
| 16193 | SND_PCI_QUIRK(0x1043, 0x1953, "ASUS NB", ALC663_ASUS_MODE1), |
| 16194 | SND_PCI_QUIRK(0x1043, 0x1963, "ASUS X71C", ALC663_ASUS_MODE3), |
| 16195 | SND_PCI_QUIRK(0x1043, 0x1993, "ASUS N20", ALC663_ASUS_MODE1), |
Kailang Yang | 80ffe86 | 2008-10-15 11:23:27 +0200 | [diff] [blame] | 16196 | SND_PCI_QUIRK(0x1043, 0x19a3, "ASUS G50V", ALC663_ASUS_G50V), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 16197 | /*SND_PCI_QUIRK(0x1043, 0x19a3, "ASUS NB", ALC663_ASUS_MODE1),*/ |
| 16198 | SND_PCI_QUIRK(0x1043, 0x19b3, "ASUS F7Z", ALC663_ASUS_MODE1), |
| 16199 | SND_PCI_QUIRK(0x1043, 0x19c3, "ASUS F5Z/F6x", ALC662_ASUS_MODE2), |
| 16200 | SND_PCI_QUIRK(0x1043, 0x19e3, "ASUS NB", ALC663_ASUS_MODE1), |
| 16201 | SND_PCI_QUIRK(0x1043, 0x19f3, "ASUS NB", ALC663_ASUS_MODE4), |
Herton Ronaldo Krzesinski | 3da23ca | 2008-03-14 12:52:59 +0100 | [diff] [blame] | 16202 | SND_PCI_QUIRK(0x1043, 0x8290, "ASUS P5GC-MX", ALC662_3ST_6ch_DIG), |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 16203 | SND_PCI_QUIRK(0x1043, 0x82a1, "ASUS Eeepc", ALC662_ASUS_EEEPC_P701), |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 16204 | SND_PCI_QUIRK(0x1043, 0x82d1, "ASUS Eeepc EP20", ALC662_ASUS_EEEPC_EP20), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 16205 | SND_PCI_QUIRK(0x105b, 0x0cd6, "Foxconn", ALC662_ECS), |
Herton Ronaldo Krzesinski | 95fe5f2 | 2008-09-26 23:48:45 -0300 | [diff] [blame] | 16206 | SND_PCI_QUIRK(0x105b, 0x0d47, "Foxconn 45CMX/45GMX/45CMX-K", |
| 16207 | ALC662_3ST_6ch_DIG), |
Herton Ronaldo Krzesinski | cb55974 | 2008-09-26 23:47:45 -0300 | [diff] [blame] | 16208 | SND_PCI_QUIRK(0x1458, 0xa002, "Gigabyte 945GCM-S2L", |
| 16209 | ALC662_3ST_6ch_DIG), |
Vedran Miletic | 19c009a | 2008-09-29 20:29:25 +0200 | [diff] [blame] | 16210 | SND_PCI_QUIRK(0x1565, 0x820f, "Biostar TA780G M2+", ALC662_3ST_6ch_DIG), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 16211 | SND_PCI_QUIRK(0x17aa, 0x101e, "Lenovo", ALC662_LENOVO_101E), |
Takashi Iwai | 238713d | 2008-10-05 10:57:39 +0200 | [diff] [blame] | 16212 | SND_PCI_QUIRK(0x1849, 0x3662, "ASROCK K10N78FullHD-hSLI R3.0", |
Vedran Miletic | 19c009a | 2008-09-29 20:29:25 +0200 | [diff] [blame] | 16213 | ALC662_3ST_6ch_DIG), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 16214 | SND_PCI_QUIRK_MASK(0x1854, 0xf000, 0x2000, "ASUS H13-200x", |
| 16215 | ALC663_ASUS_H13), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16216 | {} |
| 16217 | }; |
| 16218 | |
| 16219 | static struct alc_config_preset alc662_presets[] = { |
| 16220 | [ALC662_3ST_2ch_DIG] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 16221 | .mixers = { alc662_3ST_2ch_mixer }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16222 | .init_verbs = { alc662_init_verbs }, |
| 16223 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 16224 | .dac_nids = alc662_dac_nids, |
| 16225 | .dig_out_nid = ALC662_DIGOUT_NID, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16226 | .dig_in_nid = ALC662_DIGIN_NID, |
| 16227 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 16228 | .channel_mode = alc662_3ST_2ch_modes, |
| 16229 | .input_mux = &alc662_capture_source, |
| 16230 | }, |
| 16231 | [ALC662_3ST_6ch_DIG] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 16232 | .mixers = { alc662_3ST_6ch_mixer, alc662_chmode_mixer }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16233 | .init_verbs = { alc662_init_verbs }, |
| 16234 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 16235 | .dac_nids = alc662_dac_nids, |
| 16236 | .dig_out_nid = ALC662_DIGOUT_NID, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16237 | .dig_in_nid = ALC662_DIGIN_NID, |
| 16238 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes), |
| 16239 | .channel_mode = alc662_3ST_6ch_modes, |
| 16240 | .need_dac_fix = 1, |
| 16241 | .input_mux = &alc662_capture_source, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 16242 | }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16243 | [ALC662_3ST_6ch] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 16244 | .mixers = { alc662_3ST_6ch_mixer, alc662_chmode_mixer }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16245 | .init_verbs = { alc662_init_verbs }, |
| 16246 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 16247 | .dac_nids = alc662_dac_nids, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16248 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes), |
| 16249 | .channel_mode = alc662_3ST_6ch_modes, |
| 16250 | .need_dac_fix = 1, |
| 16251 | .input_mux = &alc662_capture_source, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 16252 | }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16253 | [ALC662_5ST_DIG] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 16254 | .mixers = { alc662_base_mixer, alc662_chmode_mixer }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16255 | .init_verbs = { alc662_init_verbs }, |
| 16256 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 16257 | .dac_nids = alc662_dac_nids, |
| 16258 | .dig_out_nid = ALC662_DIGOUT_NID, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16259 | .dig_in_nid = ALC662_DIGIN_NID, |
| 16260 | .num_channel_mode = ARRAY_SIZE(alc662_5stack_modes), |
| 16261 | .channel_mode = alc662_5stack_modes, |
| 16262 | .input_mux = &alc662_capture_source, |
| 16263 | }, |
| 16264 | [ALC662_LENOVO_101E] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 16265 | .mixers = { alc662_lenovo_101e_mixer }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16266 | .init_verbs = { alc662_init_verbs, alc662_sue_init_verbs }, |
| 16267 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 16268 | .dac_nids = alc662_dac_nids, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16269 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 16270 | .channel_mode = alc662_3ST_2ch_modes, |
| 16271 | .input_mux = &alc662_lenovo_101e_capture_source, |
| 16272 | .unsol_event = alc662_lenovo_101e_unsol_event, |
| 16273 | .init_hook = alc662_lenovo_101e_all_automute, |
| 16274 | }, |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 16275 | [ALC662_ASUS_EEEPC_P701] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 16276 | .mixers = { alc662_eeepc_p701_mixer }, |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 16277 | .init_verbs = { alc662_init_verbs, |
| 16278 | alc662_eeepc_sue_init_verbs }, |
| 16279 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 16280 | .dac_nids = alc662_dac_nids, |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 16281 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 16282 | .channel_mode = alc662_3ST_2ch_modes, |
| 16283 | .input_mux = &alc662_eeepc_capture_source, |
| 16284 | .unsol_event = alc662_eeepc_unsol_event, |
| 16285 | .init_hook = alc662_eeepc_inithook, |
| 16286 | }, |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 16287 | [ALC662_ASUS_EEEPC_EP20] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 16288 | .mixers = { alc662_eeepc_ep20_mixer, |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 16289 | alc662_chmode_mixer }, |
| 16290 | .init_verbs = { alc662_init_verbs, |
| 16291 | alc662_eeepc_ep20_sue_init_verbs }, |
| 16292 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 16293 | .dac_nids = alc662_dac_nids, |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 16294 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes), |
| 16295 | .channel_mode = alc662_3ST_6ch_modes, |
| 16296 | .input_mux = &alc662_lenovo_101e_capture_source, |
| 16297 | .unsol_event = alc662_eeepc_ep20_unsol_event, |
| 16298 | .init_hook = alc662_eeepc_ep20_inithook, |
| 16299 | }, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 16300 | [ALC662_ECS] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 16301 | .mixers = { alc662_ecs_mixer }, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 16302 | .init_verbs = { alc662_init_verbs, |
| 16303 | alc662_ecs_init_verbs }, |
| 16304 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 16305 | .dac_nids = alc662_dac_nids, |
| 16306 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 16307 | .channel_mode = alc662_3ST_2ch_modes, |
| 16308 | .input_mux = &alc662_eeepc_capture_source, |
| 16309 | .unsol_event = alc662_eeepc_unsol_event, |
| 16310 | .init_hook = alc662_eeepc_inithook, |
| 16311 | }, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 16312 | [ALC663_ASUS_M51VA] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 16313 | .mixers = { alc663_m51va_mixer }, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 16314 | .init_verbs = { alc662_init_verbs, alc663_m51va_init_verbs }, |
| 16315 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 16316 | .dac_nids = alc662_dac_nids, |
| 16317 | .dig_out_nid = ALC662_DIGOUT_NID, |
| 16318 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 16319 | .channel_mode = alc662_3ST_2ch_modes, |
| 16320 | .input_mux = &alc663_m51va_capture_source, |
| 16321 | .unsol_event = alc663_m51va_unsol_event, |
| 16322 | .init_hook = alc663_m51va_inithook, |
| 16323 | }, |
| 16324 | [ALC663_ASUS_G71V] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 16325 | .mixers = { alc663_g71v_mixer }, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 16326 | .init_verbs = { alc662_init_verbs, alc663_g71v_init_verbs }, |
| 16327 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 16328 | .dac_nids = alc662_dac_nids, |
| 16329 | .dig_out_nid = ALC662_DIGOUT_NID, |
| 16330 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 16331 | .channel_mode = alc662_3ST_2ch_modes, |
| 16332 | .input_mux = &alc662_eeepc_capture_source, |
| 16333 | .unsol_event = alc663_g71v_unsol_event, |
| 16334 | .init_hook = alc663_g71v_inithook, |
| 16335 | }, |
| 16336 | [ALC663_ASUS_H13] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 16337 | .mixers = { alc663_m51va_mixer }, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 16338 | .init_verbs = { alc662_init_verbs, alc663_m51va_init_verbs }, |
| 16339 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 16340 | .dac_nids = alc662_dac_nids, |
| 16341 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 16342 | .channel_mode = alc662_3ST_2ch_modes, |
| 16343 | .input_mux = &alc663_m51va_capture_source, |
| 16344 | .unsol_event = alc663_m51va_unsol_event, |
| 16345 | .init_hook = alc663_m51va_inithook, |
| 16346 | }, |
| 16347 | [ALC663_ASUS_G50V] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 16348 | .mixers = { alc663_g50v_mixer }, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 16349 | .init_verbs = { alc662_init_verbs, alc663_g50v_init_verbs }, |
| 16350 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 16351 | .dac_nids = alc662_dac_nids, |
| 16352 | .dig_out_nid = ALC662_DIGOUT_NID, |
| 16353 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes), |
| 16354 | .channel_mode = alc662_3ST_6ch_modes, |
| 16355 | .input_mux = &alc663_capture_source, |
| 16356 | .unsol_event = alc663_g50v_unsol_event, |
| 16357 | .init_hook = alc663_g50v_inithook, |
| 16358 | }, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 16359 | [ALC663_ASUS_MODE1] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 16360 | .mixers = { alc663_m51va_mixer }, |
| 16361 | .cap_mixer = alc662_auto_capture_mixer, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 16362 | .init_verbs = { alc662_init_verbs, |
| 16363 | alc663_21jd_amic_init_verbs }, |
| 16364 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 16365 | .hp_nid = 0x03, |
| 16366 | .dac_nids = alc662_dac_nids, |
| 16367 | .dig_out_nid = ALC662_DIGOUT_NID, |
| 16368 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 16369 | .channel_mode = alc662_3ST_2ch_modes, |
| 16370 | .input_mux = &alc662_eeepc_capture_source, |
| 16371 | .unsol_event = alc663_mode1_unsol_event, |
| 16372 | .init_hook = alc663_mode1_inithook, |
| 16373 | }, |
| 16374 | [ALC662_ASUS_MODE2] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 16375 | .mixers = { alc662_1bjd_mixer }, |
| 16376 | .cap_mixer = alc662_auto_capture_mixer, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 16377 | .init_verbs = { alc662_init_verbs, |
| 16378 | alc662_1bjd_amic_init_verbs }, |
| 16379 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 16380 | .dac_nids = alc662_dac_nids, |
| 16381 | .dig_out_nid = ALC662_DIGOUT_NID, |
| 16382 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 16383 | .channel_mode = alc662_3ST_2ch_modes, |
| 16384 | .input_mux = &alc662_eeepc_capture_source, |
| 16385 | .unsol_event = alc662_mode2_unsol_event, |
| 16386 | .init_hook = alc662_mode2_inithook, |
| 16387 | }, |
| 16388 | [ALC663_ASUS_MODE3] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 16389 | .mixers = { alc663_two_hp_m1_mixer }, |
| 16390 | .cap_mixer = alc662_auto_capture_mixer, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 16391 | .init_verbs = { alc662_init_verbs, |
| 16392 | alc663_two_hp_amic_m1_init_verbs }, |
| 16393 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 16394 | .hp_nid = 0x03, |
| 16395 | .dac_nids = alc662_dac_nids, |
| 16396 | .dig_out_nid = ALC662_DIGOUT_NID, |
| 16397 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 16398 | .channel_mode = alc662_3ST_2ch_modes, |
| 16399 | .input_mux = &alc662_eeepc_capture_source, |
| 16400 | .unsol_event = alc663_mode3_unsol_event, |
| 16401 | .init_hook = alc663_mode3_inithook, |
| 16402 | }, |
| 16403 | [ALC663_ASUS_MODE4] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 16404 | .mixers = { alc663_asus_21jd_clfe_mixer }, |
| 16405 | .cap_mixer = alc662_auto_capture_mixer, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 16406 | .init_verbs = { alc662_init_verbs, |
| 16407 | alc663_21jd_amic_init_verbs}, |
| 16408 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 16409 | .hp_nid = 0x03, |
| 16410 | .dac_nids = alc662_dac_nids, |
| 16411 | .dig_out_nid = ALC662_DIGOUT_NID, |
| 16412 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 16413 | .channel_mode = alc662_3ST_2ch_modes, |
| 16414 | .input_mux = &alc662_eeepc_capture_source, |
| 16415 | .unsol_event = alc663_mode4_unsol_event, |
| 16416 | .init_hook = alc663_mode4_inithook, |
| 16417 | }, |
| 16418 | [ALC663_ASUS_MODE5] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 16419 | .mixers = { alc663_asus_15jd_clfe_mixer }, |
| 16420 | .cap_mixer = alc662_auto_capture_mixer, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 16421 | .init_verbs = { alc662_init_verbs, |
| 16422 | alc663_15jd_amic_init_verbs }, |
| 16423 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 16424 | .hp_nid = 0x03, |
| 16425 | .dac_nids = alc662_dac_nids, |
| 16426 | .dig_out_nid = ALC662_DIGOUT_NID, |
| 16427 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 16428 | .channel_mode = alc662_3ST_2ch_modes, |
| 16429 | .input_mux = &alc662_eeepc_capture_source, |
| 16430 | .unsol_event = alc663_mode5_unsol_event, |
| 16431 | .init_hook = alc663_mode5_inithook, |
| 16432 | }, |
| 16433 | [ALC663_ASUS_MODE6] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 16434 | .mixers = { alc663_two_hp_m2_mixer }, |
| 16435 | .cap_mixer = alc662_auto_capture_mixer, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 16436 | .init_verbs = { alc662_init_verbs, |
| 16437 | alc663_two_hp_amic_m2_init_verbs }, |
| 16438 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 16439 | .hp_nid = 0x03, |
| 16440 | .dac_nids = alc662_dac_nids, |
| 16441 | .dig_out_nid = ALC662_DIGOUT_NID, |
| 16442 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 16443 | .channel_mode = alc662_3ST_2ch_modes, |
| 16444 | .input_mux = &alc662_eeepc_capture_source, |
| 16445 | .unsol_event = alc663_mode6_unsol_event, |
| 16446 | .init_hook = alc663_mode6_inithook, |
| 16447 | }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16448 | }; |
| 16449 | |
| 16450 | |
| 16451 | /* |
| 16452 | * BIOS auto configuration |
| 16453 | */ |
| 16454 | |
| 16455 | /* add playback controls from the parsed DAC table */ |
| 16456 | static int alc662_auto_create_multi_out_ctls(struct alc_spec *spec, |
| 16457 | const struct auto_pin_cfg *cfg) |
| 16458 | { |
| 16459 | char name[32]; |
| 16460 | static const char *chname[4] = { |
| 16461 | "Front", "Surround", NULL /*CLFE*/, "Side" |
| 16462 | }; |
| 16463 | hda_nid_t nid; |
| 16464 | int i, err; |
| 16465 | |
| 16466 | for (i = 0; i < cfg->line_outs; i++) { |
| 16467 | if (!spec->multiout.dac_nids[i]) |
| 16468 | continue; |
Kailang Yang | b60dd39 | 2007-09-20 12:50:29 +0200 | [diff] [blame] | 16469 | nid = alc880_idx_to_dac(i); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16470 | if (i == 2) { |
| 16471 | /* Center/LFE */ |
| 16472 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 16473 | "Center Playback Volume", |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 16474 | HDA_COMPOSE_AMP_VAL(nid, 1, 0, |
| 16475 | HDA_OUTPUT)); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16476 | if (err < 0) |
| 16477 | return err; |
| 16478 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 16479 | "LFE Playback Volume", |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 16480 | HDA_COMPOSE_AMP_VAL(nid, 2, 0, |
| 16481 | HDA_OUTPUT)); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16482 | if (err < 0) |
| 16483 | return err; |
Herton Ronaldo Krzesinski | b69ce01 | 2008-09-18 16:41:49 -0300 | [diff] [blame] | 16484 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16485 | "Center Playback Switch", |
Herton Ronaldo Krzesinski | b69ce01 | 2008-09-18 16:41:49 -0300 | [diff] [blame] | 16486 | HDA_COMPOSE_AMP_VAL(0x0e, 1, 0, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 16487 | HDA_INPUT)); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16488 | if (err < 0) |
| 16489 | return err; |
Herton Ronaldo Krzesinski | b69ce01 | 2008-09-18 16:41:49 -0300 | [diff] [blame] | 16490 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16491 | "LFE Playback Switch", |
Herton Ronaldo Krzesinski | b69ce01 | 2008-09-18 16:41:49 -0300 | [diff] [blame] | 16492 | HDA_COMPOSE_AMP_VAL(0x0e, 2, 0, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 16493 | HDA_INPUT)); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16494 | if (err < 0) |
| 16495 | return err; |
| 16496 | } else { |
| 16497 | sprintf(name, "%s Playback Volume", chname[i]); |
| 16498 | err = add_control(spec, ALC_CTL_WIDGET_VOL, name, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 16499 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, |
| 16500 | HDA_OUTPUT)); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16501 | if (err < 0) |
| 16502 | return err; |
| 16503 | sprintf(name, "%s Playback Switch", chname[i]); |
Herton Ronaldo Krzesinski | b69ce01 | 2008-09-18 16:41:49 -0300 | [diff] [blame] | 16504 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, name, |
| 16505 | HDA_COMPOSE_AMP_VAL(alc880_idx_to_mixer(i), |
| 16506 | 3, 0, HDA_INPUT)); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16507 | if (err < 0) |
| 16508 | return err; |
| 16509 | } |
| 16510 | } |
| 16511 | return 0; |
| 16512 | } |
| 16513 | |
| 16514 | /* add playback controls for speaker and HP outputs */ |
| 16515 | static int alc662_auto_create_extra_out(struct alc_spec *spec, hda_nid_t pin, |
| 16516 | const char *pfx) |
| 16517 | { |
| 16518 | hda_nid_t nid; |
| 16519 | int err; |
| 16520 | char name[32]; |
| 16521 | |
| 16522 | if (!pin) |
| 16523 | return 0; |
| 16524 | |
Takashi Iwai | 24fb917 | 2008-09-02 14:48:20 +0200 | [diff] [blame] | 16525 | if (pin == 0x17) { |
| 16526 | /* ALC663 has a mono output pin on 0x17 */ |
| 16527 | sprintf(name, "%s Playback Switch", pfx); |
| 16528 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, name, |
| 16529 | HDA_COMPOSE_AMP_VAL(pin, 2, 0, HDA_OUTPUT)); |
| 16530 | return err; |
| 16531 | } |
| 16532 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16533 | if (alc880_is_fixed_pin(pin)) { |
| 16534 | nid = alc880_idx_to_dac(alc880_fixed_pin_idx(pin)); |
Takashi Iwai | 939778a | 2009-02-05 15:57:55 +0100 | [diff] [blame] | 16535 | /* printk(KERN_DEBUG "DAC nid=%x\n",nid); */ |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16536 | /* specify the DAC as the extra output */ |
| 16537 | if (!spec->multiout.hp_nid) |
| 16538 | spec->multiout.hp_nid = nid; |
| 16539 | else |
| 16540 | spec->multiout.extra_out_nid[0] = nid; |
| 16541 | /* control HP volume/switch on the output mixer amp */ |
| 16542 | nid = alc880_idx_to_dac(alc880_fixed_pin_idx(pin)); |
| 16543 | sprintf(name, "%s Playback Volume", pfx); |
| 16544 | err = add_control(spec, ALC_CTL_WIDGET_VOL, name, |
| 16545 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT)); |
| 16546 | if (err < 0) |
| 16547 | return err; |
| 16548 | sprintf(name, "%s Playback Switch", pfx); |
| 16549 | err = add_control(spec, ALC_CTL_BIND_MUTE, name, |
| 16550 | HDA_COMPOSE_AMP_VAL(nid, 3, 2, HDA_INPUT)); |
| 16551 | if (err < 0) |
| 16552 | return err; |
| 16553 | } else if (alc880_is_multi_pin(pin)) { |
| 16554 | /* set manual connection */ |
| 16555 | /* we have only a switch on HP-out PIN */ |
| 16556 | sprintf(name, "%s Playback Switch", pfx); |
| 16557 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, name, |
| 16558 | HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT)); |
| 16559 | if (err < 0) |
| 16560 | return err; |
| 16561 | } |
| 16562 | return 0; |
| 16563 | } |
| 16564 | |
| 16565 | /* create playback/capture controls for input pins */ |
| 16566 | static int alc662_auto_create_analog_input_ctls(struct alc_spec *spec, |
| 16567 | const struct auto_pin_cfg *cfg) |
| 16568 | { |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 16569 | struct hda_input_mux *imux = &spec->private_imux[0]; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16570 | int i, err, idx; |
| 16571 | |
| 16572 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
| 16573 | if (alc880_is_input_pin(cfg->input_pins[i])) { |
| 16574 | idx = alc880_input_pin_idx(cfg->input_pins[i]); |
| 16575 | err = new_analog_input(spec, cfg->input_pins[i], |
| 16576 | auto_pin_cfg_labels[i], |
| 16577 | idx, 0x0b); |
| 16578 | if (err < 0) |
| 16579 | return err; |
| 16580 | imux->items[imux->num_items].label = |
| 16581 | auto_pin_cfg_labels[i]; |
| 16582 | imux->items[imux->num_items].index = |
| 16583 | alc880_input_pin_idx(cfg->input_pins[i]); |
| 16584 | imux->num_items++; |
| 16585 | } |
| 16586 | } |
| 16587 | return 0; |
| 16588 | } |
| 16589 | |
| 16590 | static void alc662_auto_set_output_and_unmute(struct hda_codec *codec, |
| 16591 | hda_nid_t nid, int pin_type, |
| 16592 | int dac_idx) |
| 16593 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 16594 | alc_set_pin_output(codec, nid, pin_type); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16595 | /* need the manual connection? */ |
| 16596 | if (alc880_is_multi_pin(nid)) { |
| 16597 | struct alc_spec *spec = codec->spec; |
| 16598 | int idx = alc880_multi_pin_idx(nid); |
| 16599 | snd_hda_codec_write(codec, alc880_idx_to_selector(idx), 0, |
| 16600 | AC_VERB_SET_CONNECT_SEL, |
| 16601 | alc880_dac_to_idx(spec->multiout.dac_nids[dac_idx])); |
| 16602 | } |
| 16603 | } |
| 16604 | |
| 16605 | static void alc662_auto_init_multi_out(struct hda_codec *codec) |
| 16606 | { |
| 16607 | struct alc_spec *spec = codec->spec; |
| 16608 | int i; |
| 16609 | |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 16610 | alc_subsystem_id(codec, 0x15, 0x1b, 0x14); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16611 | for (i = 0; i <= HDA_SIDE; i++) { |
| 16612 | hda_nid_t nid = spec->autocfg.line_out_pins[i]; |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 16613 | int pin_type = get_pin_type(spec->autocfg.line_out_type); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16614 | if (nid) |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 16615 | alc662_auto_set_output_and_unmute(codec, nid, pin_type, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16616 | i); |
| 16617 | } |
| 16618 | } |
| 16619 | |
| 16620 | static void alc662_auto_init_hp_out(struct hda_codec *codec) |
| 16621 | { |
| 16622 | struct alc_spec *spec = codec->spec; |
| 16623 | hda_nid_t pin; |
| 16624 | |
| 16625 | pin = spec->autocfg.hp_pins[0]; |
| 16626 | if (pin) /* connect to front */ |
| 16627 | /* use dac 0 */ |
| 16628 | alc662_auto_set_output_and_unmute(codec, pin, PIN_HP, 0); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 16629 | pin = spec->autocfg.speaker_pins[0]; |
| 16630 | if (pin) |
| 16631 | alc662_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16632 | } |
| 16633 | |
| 16634 | #define alc662_is_input_pin(nid) alc880_is_input_pin(nid) |
| 16635 | #define ALC662_PIN_CD_NID ALC880_PIN_CD_NID |
| 16636 | |
| 16637 | static void alc662_auto_init_analog_input(struct hda_codec *codec) |
| 16638 | { |
| 16639 | struct alc_spec *spec = codec->spec; |
| 16640 | int i; |
| 16641 | |
| 16642 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
| 16643 | hda_nid_t nid = spec->autocfg.input_pins[i]; |
| 16644 | if (alc662_is_input_pin(nid)) { |
| 16645 | snd_hda_codec_write(codec, nid, 0, |
| 16646 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 16647 | (i <= AUTO_PIN_FRONT_MIC ? |
| 16648 | PIN_VREF80 : PIN_IN)); |
| 16649 | if (nid != ALC662_PIN_CD_NID) |
| 16650 | snd_hda_codec_write(codec, nid, 0, |
| 16651 | AC_VERB_SET_AMP_GAIN_MUTE, |
| 16652 | AMP_OUT_MUTE); |
| 16653 | } |
| 16654 | } |
| 16655 | } |
| 16656 | |
Takashi Iwai | f511b01 | 2008-08-15 16:46:42 +0200 | [diff] [blame] | 16657 | #define alc662_auto_init_input_src alc882_auto_init_input_src |
| 16658 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16659 | static int alc662_parse_auto_config(struct hda_codec *codec) |
| 16660 | { |
| 16661 | struct alc_spec *spec = codec->spec; |
| 16662 | int err; |
| 16663 | static hda_nid_t alc662_ignore[] = { 0x1d, 0 }; |
| 16664 | |
| 16665 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 16666 | alc662_ignore); |
| 16667 | if (err < 0) |
| 16668 | return err; |
| 16669 | if (!spec->autocfg.line_outs) |
| 16670 | return 0; /* can't find valid BIOS pin config */ |
| 16671 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 16672 | err = alc880_auto_fill_dac_nids(spec, &spec->autocfg); |
| 16673 | if (err < 0) |
| 16674 | return err; |
| 16675 | err = alc662_auto_create_multi_out_ctls(spec, &spec->autocfg); |
| 16676 | if (err < 0) |
| 16677 | return err; |
| 16678 | err = alc662_auto_create_extra_out(spec, |
| 16679 | spec->autocfg.speaker_pins[0], |
| 16680 | "Speaker"); |
| 16681 | if (err < 0) |
| 16682 | return err; |
| 16683 | err = alc662_auto_create_extra_out(spec, spec->autocfg.hp_pins[0], |
| 16684 | "Headphone"); |
| 16685 | if (err < 0) |
| 16686 | return err; |
| 16687 | err = alc662_auto_create_analog_input_ctls(spec, &spec->autocfg); |
| 16688 | if (err < 0) |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16689 | return err; |
| 16690 | |
| 16691 | spec->multiout.max_channels = spec->multiout.num_dacs * 2; |
| 16692 | |
Takashi Iwai | 0852d7a | 2009-02-11 11:35:15 +0100 | [diff] [blame] | 16693 | if (spec->autocfg.dig_outs) |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16694 | spec->multiout.dig_out_nid = ALC880_DIGOUT_NID; |
| 16695 | |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 16696 | if (spec->kctls.list) |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 16697 | add_mixer(spec, spec->kctls.list); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16698 | |
| 16699 | spec->num_mux_defs = 1; |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 16700 | spec->input_mux = &spec->private_imux[0]; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 16701 | |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 16702 | add_verb(spec, alc662_auto_init_verbs); |
Takashi Iwai | 24fb917 | 2008-09-02 14:48:20 +0200 | [diff] [blame] | 16703 | if (codec->vendor_id == 0x10ec0663) |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 16704 | add_verb(spec, alc663_auto_init_verbs); |
Takashi Iwai | ee979a14 | 2008-09-02 15:42:20 +0200 | [diff] [blame] | 16705 | |
| 16706 | err = alc_auto_add_mic_boost(codec); |
| 16707 | if (err < 0) |
| 16708 | return err; |
| 16709 | |
Takashi Iwai | e044c39 | 2008-10-27 16:56:24 +0100 | [diff] [blame] | 16710 | store_pin_configs(codec); |
Takashi Iwai | 8c87286f | 2007-06-19 12:11:16 +0200 | [diff] [blame] | 16711 | return 1; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16712 | } |
| 16713 | |
| 16714 | /* additional initialization for auto-configuration model */ |
| 16715 | static void alc662_auto_init(struct hda_codec *codec) |
| 16716 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 16717 | struct alc_spec *spec = codec->spec; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16718 | alc662_auto_init_multi_out(codec); |
| 16719 | alc662_auto_init_hp_out(codec); |
| 16720 | alc662_auto_init_analog_input(codec); |
Takashi Iwai | f511b01 | 2008-08-15 16:46:42 +0200 | [diff] [blame] | 16721 | alc662_auto_init_input_src(codec); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 16722 | if (spec->unsol_event) |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 16723 | alc_inithook(codec); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16724 | } |
| 16725 | |
| 16726 | static int patch_alc662(struct hda_codec *codec) |
| 16727 | { |
| 16728 | struct alc_spec *spec; |
| 16729 | int err, board_config; |
| 16730 | |
| 16731 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
| 16732 | if (!spec) |
| 16733 | return -ENOMEM; |
| 16734 | |
| 16735 | codec->spec = spec; |
| 16736 | |
Takashi Iwai | 2c3bf9a | 2008-06-04 12:39:38 +0200 | [diff] [blame] | 16737 | alc_fix_pll_init(codec, 0x20, 0x04, 15); |
| 16738 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16739 | board_config = snd_hda_check_board_config(codec, ALC662_MODEL_LAST, |
| 16740 | alc662_models, |
| 16741 | alc662_cfg_tbl); |
| 16742 | if (board_config < 0) { |
| 16743 | printk(KERN_INFO "hda_codec: Unknown model for ALC662, " |
| 16744 | "trying auto-probe from BIOS...\n"); |
| 16745 | board_config = ALC662_AUTO; |
| 16746 | } |
| 16747 | |
| 16748 | if (board_config == ALC662_AUTO) { |
| 16749 | /* automatic parse from the BIOS config */ |
| 16750 | err = alc662_parse_auto_config(codec); |
| 16751 | if (err < 0) { |
| 16752 | alc_free(codec); |
| 16753 | return err; |
Takashi Iwai | 8c87286f | 2007-06-19 12:11:16 +0200 | [diff] [blame] | 16754 | } else if (!err) { |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16755 | printk(KERN_INFO |
| 16756 | "hda_codec: Cannot set up configuration " |
| 16757 | "from BIOS. Using base mode...\n"); |
| 16758 | board_config = ALC662_3ST_2ch_DIG; |
| 16759 | } |
| 16760 | } |
| 16761 | |
Kusanagi Kouichi | 680cd53 | 2009-02-05 00:00:58 +0900 | [diff] [blame] | 16762 | err = snd_hda_attach_beep_device(codec, 0x1); |
| 16763 | if (err < 0) { |
| 16764 | alc_free(codec); |
| 16765 | return err; |
| 16766 | } |
| 16767 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16768 | if (board_config != ALC662_AUTO) |
| 16769 | setup_preset(spec, &alc662_presets[board_config]); |
| 16770 | |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 16771 | if (codec->vendor_id == 0x10ec0663) { |
| 16772 | spec->stream_name_analog = "ALC663 Analog"; |
| 16773 | spec->stream_name_digital = "ALC663 Digital"; |
Kailang Yang | 01afd41 | 2008-10-15 11:22:09 +0200 | [diff] [blame] | 16774 | } else if (codec->vendor_id == 0x10ec0272) { |
| 16775 | spec->stream_name_analog = "ALC272 Analog"; |
| 16776 | spec->stream_name_digital = "ALC272 Digital"; |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 16777 | } else { |
| 16778 | spec->stream_name_analog = "ALC662 Analog"; |
| 16779 | spec->stream_name_digital = "ALC662 Digital"; |
| 16780 | } |
| 16781 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16782 | spec->stream_analog_playback = &alc662_pcm_analog_playback; |
| 16783 | spec->stream_analog_capture = &alc662_pcm_analog_capture; |
| 16784 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16785 | spec->stream_digital_playback = &alc662_pcm_digital_playback; |
| 16786 | spec->stream_digital_capture = &alc662_pcm_digital_capture; |
| 16787 | |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 16788 | spec->adc_nids = alc662_adc_nids; |
| 16789 | spec->num_adc_nids = ARRAY_SIZE(alc662_adc_nids); |
| 16790 | spec->capsrc_nids = alc662_capsrc_nids; |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 16791 | spec->capture_style = CAPT_MIX; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16792 | |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 16793 | if (!spec->cap_mixer) |
| 16794 | set_capture_mixer(spec); |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 16795 | set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT); |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 16796 | |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 16797 | spec->vmaster_nid = 0x02; |
| 16798 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16799 | codec->patch_ops = alc_patch_ops; |
| 16800 | if (board_config == ALC662_AUTO) |
| 16801 | spec->init_hook = alc662_auto_init; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 16802 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 16803 | if (!spec->loopback.amplist) |
| 16804 | spec->loopback.amplist = alc662_loopbacks; |
| 16805 | #endif |
Takashi Iwai | daead53 | 2008-11-28 12:55:36 +0100 | [diff] [blame] | 16806 | codec->proc_widget_hook = print_realtek_coef; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16807 | |
| 16808 | return 0; |
| 16809 | } |
| 16810 | |
| 16811 | /* |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 16812 | * patch entries |
| 16813 | */ |
Takashi Iwai | 1289e9e | 2008-11-27 15:47:11 +0100 | [diff] [blame] | 16814 | static struct hda_codec_preset snd_hda_preset_realtek[] = { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 16815 | { .id = 0x10ec0260, .name = "ALC260", .patch = patch_alc260 }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16816 | { .id = 0x10ec0262, .name = "ALC262", .patch = patch_alc262 }, |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 16817 | { .id = 0x10ec0267, .name = "ALC267", .patch = patch_alc268 }, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 16818 | { .id = 0x10ec0268, .name = "ALC268", .patch = patch_alc268 }, |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 16819 | { .id = 0x10ec0269, .name = "ALC269", .patch = patch_alc269 }, |
Kailang Yang | 01afd41 | 2008-10-15 11:22:09 +0200 | [diff] [blame] | 16820 | { .id = 0x10ec0272, .name = "ALC272", .patch = patch_alc662 }, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16821 | { .id = 0x10ec0861, .rev = 0x100340, .name = "ALC660", |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16822 | .patch = patch_alc861 }, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16823 | { .id = 0x10ec0660, .name = "ALC660-VD", .patch = patch_alc861vd }, |
| 16824 | { .id = 0x10ec0861, .name = "ALC861", .patch = patch_alc861 }, |
| 16825 | { .id = 0x10ec0862, .name = "ALC861-VD", .patch = patch_alc861vd }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16826 | { .id = 0x10ec0662, .rev = 0x100002, .name = "ALC662 rev2", |
| 16827 | .patch = patch_alc883 }, |
| 16828 | { .id = 0x10ec0662, .rev = 0x100101, .name = "ALC662 rev1", |
| 16829 | .patch = patch_alc662 }, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 16830 | { .id = 0x10ec0663, .name = "ALC663", .patch = patch_alc662 }, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16831 | { .id = 0x10ec0880, .name = "ALC880", .patch = patch_alc880 }, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 16832 | { .id = 0x10ec0882, .name = "ALC882", .patch = patch_alc882 }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 16833 | { .id = 0x10ec0883, .name = "ALC883", .patch = patch_alc883 }, |
Clive Messer | 669faba | 2008-09-30 15:49:13 +0200 | [diff] [blame] | 16834 | { .id = 0x10ec0885, .rev = 0x100101, .name = "ALC889A", |
| 16835 | .patch = patch_alc882 }, /* should be patch_alc883() in future */ |
Takashi Iwai | cb308f9 | 2008-04-16 14:13:29 +0200 | [diff] [blame] | 16836 | { .id = 0x10ec0885, .rev = 0x100103, .name = "ALC889A", |
Takashi Iwai | 7943a8a | 2008-04-16 17:29:09 +0200 | [diff] [blame] | 16837 | .patch = patch_alc882 }, /* should be patch_alc883() in future */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16838 | { .id = 0x10ec0885, .name = "ALC885", .patch = patch_alc882 }, |
Kailang Yang | a385a52 | 2008-10-15 11:20:21 +0200 | [diff] [blame] | 16839 | { .id = 0x10ec0887, .name = "ALC887", .patch = patch_alc883 }, |
Kailang Yang | 4442608 | 2008-10-15 11:18:05 +0200 | [diff] [blame] | 16840 | { .id = 0x10ec0888, .rev = 0x100101, .name = "ALC1200", |
| 16841 | .patch = patch_alc883 }, |
Wu Fengguang | 3fea2cb | 2008-12-26 12:20:43 +0800 | [diff] [blame] | 16842 | { .id = 0x10ec0888, .name = "ALC888", .patch = patch_alc883 }, |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 16843 | { .id = 0x10ec0889, .name = "ALC889", .patch = patch_alc883 }, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 16844 | {} /* terminator */ |
| 16845 | }; |
Takashi Iwai | 1289e9e | 2008-11-27 15:47:11 +0100 | [diff] [blame] | 16846 | |
| 16847 | MODULE_ALIAS("snd-hda-codec-id:10ec*"); |
| 16848 | |
| 16849 | MODULE_LICENSE("GPL"); |
| 16850 | MODULE_DESCRIPTION("Realtek HD-audio codec"); |
| 16851 | |
| 16852 | static struct hda_codec_preset_list realtek_list = { |
| 16853 | .preset = snd_hda_preset_realtek, |
| 16854 | .owner = THIS_MODULE, |
| 16855 | }; |
| 16856 | |
| 16857 | static int __init patch_realtek_init(void) |
| 16858 | { |
| 16859 | return snd_hda_add_codec_preset(&realtek_list); |
| 16860 | } |
| 16861 | |
| 16862 | static void __exit patch_realtek_exit(void) |
| 16863 | { |
| 16864 | snd_hda_delete_codec_preset(&realtek_list); |
| 16865 | } |
| 16866 | |
| 16867 | module_init(patch_realtek_init) |
| 16868 | module_exit(patch_realtek_exit) |