Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1 | /* |
| 2 | * Universal Interface for Intel High Definition Audio Codec |
| 3 | * |
| 4 | * HD audio interface patch for ALC 260/880/882 codecs |
| 5 | * |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6 | * Copyright (c) 2004 Kailang Yang <kailang@realtek.com.tw> |
| 7 | * PeiSen Hou <pshou@realtek.com.tw> |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 8 | * Takashi Iwai <tiwai@suse.de> |
Jonathan Woithe | 7cf51e4 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 9 | * Jonathan Woithe <jwoithe@physics.adelaide.edu.au> |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 10 | * |
| 11 | * This driver is free software; you can redistribute it and/or modify |
| 12 | * it under the terms of the GNU General Public License as published by |
| 13 | * the Free Software Foundation; either version 2 of the License, or |
| 14 | * (at your option) any later version. |
| 15 | * |
| 16 | * This driver is distributed in the hope that it will be useful, |
| 17 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 18 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 19 | * GNU General Public License for more details. |
| 20 | * |
| 21 | * You should have received a copy of the GNU General Public License |
| 22 | * along with this program; if not, write to the Free Software |
| 23 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
| 24 | */ |
| 25 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 26 | #include <linux/init.h> |
| 27 | #include <linux/delay.h> |
| 28 | #include <linux/slab.h> |
| 29 | #include <linux/pci.h> |
| 30 | #include <sound/core.h> |
| 31 | #include "hda_codec.h" |
| 32 | #include "hda_local.h" |
Kusanagi Kouichi | 680cd53 | 2009-02-05 00:00:58 +0900 | [diff] [blame] | 33 | #include "hda_beep.h" |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 34 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 35 | #define ALC880_FRONT_EVENT 0x01 |
| 36 | #define ALC880_DCVOL_EVENT 0x02 |
| 37 | #define ALC880_HP_EVENT 0x04 |
| 38 | #define ALC880_MIC_EVENT 0x08 |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 39 | |
| 40 | /* ALC880 board config type */ |
| 41 | enum { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 42 | ALC880_3ST, |
| 43 | ALC880_3ST_DIG, |
| 44 | ALC880_5ST, |
| 45 | ALC880_5ST_DIG, |
| 46 | ALC880_W810, |
Takashi Iwai | dfc0ff6 | 2005-05-12 14:31:49 +0200 | [diff] [blame] | 47 | ALC880_Z71V, |
Takashi Iwai | b6482d4 | 2005-06-27 15:32:43 +0200 | [diff] [blame] | 48 | ALC880_6ST, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 49 | ALC880_6ST_DIG, |
| 50 | ALC880_F1734, |
| 51 | ALC880_ASUS, |
| 52 | ALC880_ASUS_DIG, |
| 53 | ALC880_ASUS_W1V, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 54 | ALC880_ASUS_DIG2, |
Tobin Davis | 2cf9f0f | 2007-02-07 16:04:25 +0100 | [diff] [blame] | 55 | ALC880_FUJITSU, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 56 | ALC880_UNIWILL_DIG, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 57 | ALC880_UNIWILL, |
| 58 | ALC880_UNIWILL_P53, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 59 | ALC880_CLEVO, |
| 60 | ALC880_TCL_S700, |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 61 | ALC880_LG, |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 62 | ALC880_LG_LW, |
Takashi Iwai | df99cd3 | 2008-04-25 15:25:04 +0200 | [diff] [blame] | 63 | ALC880_MEDION_RIM, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 64 | #ifdef CONFIG_SND_DEBUG |
| 65 | ALC880_TEST, |
| 66 | #endif |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 67 | ALC880_AUTO, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 68 | ALC880_MODEL_LAST /* last tag */ |
| 69 | }; |
| 70 | |
| 71 | /* ALC260 models */ |
| 72 | enum { |
| 73 | ALC260_BASIC, |
| 74 | ALC260_HP, |
Kailang Yang | 3f87830 | 2008-08-26 13:02:23 +0200 | [diff] [blame] | 75 | ALC260_HP_DC7600, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 76 | ALC260_HP_3013, |
| 77 | ALC260_FUJITSU_S702X, |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 78 | ALC260_ACER, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 79 | ALC260_WILL, |
| 80 | ALC260_REPLACER_672V, |
Jonathan Woithe | 7cf51e4 | 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 | bab282b | 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 | 6a05ac4 | 2009-02-13 11:19:09 +0100 | [diff] [blame^] | 282 | hda_nid_t slave_dig_outs[3]; /* optional - for auto-parsing */ |
Takashi Iwai | 8c44198 | 2009-01-20 18:30:20 +0100 | [diff] [blame] | 283 | int dig_out_type; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 284 | |
| 285 | /* capture */ |
| 286 | unsigned int num_adc_nids; |
| 287 | hda_nid_t *adc_nids; |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 288 | hda_nid_t *capsrc_nids; |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 289 | hda_nid_t dig_in_nid; /* digital-in NID; optional */ |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 290 | int capture_style; /* capture style (CAPT_*) */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 291 | |
| 292 | /* capture source */ |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 293 | unsigned int num_mux_defs; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 294 | const struct hda_input_mux *input_mux; |
| 295 | unsigned int cur_mux[3]; |
| 296 | |
| 297 | /* channel model */ |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 298 | const struct hda_channel_mode *channel_mode; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 299 | int num_channel_mode; |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 300 | int need_dac_fix; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 301 | |
| 302 | /* PCM information */ |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 303 | struct hda_pcm pcm_rec[3]; /* used in alc_build_pcms() */ |
Takashi Iwai | 41e41f1 | 2005-06-08 14:48:49 +0200 | [diff] [blame] | 304 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 305 | /* dynamic controls, init_verbs and input_mux */ |
| 306 | struct auto_pin_cfg autocfg; |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 307 | struct snd_array kctls; |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 308 | struct hda_input_mux private_imux[3]; |
Takashi Iwai | 41923e4 | 2007-10-22 17:20:10 +0200 | [diff] [blame] | 309 | hda_nid_t private_dac_nids[AUTO_CFG_MAX_OUTS]; |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 310 | |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 311 | /* hooks */ |
| 312 | void (*init_hook)(struct hda_codec *codec); |
| 313 | void (*unsol_event)(struct hda_codec *codec, unsigned int res); |
| 314 | |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 315 | /* for pin sensing */ |
| 316 | unsigned int sense_updated: 1; |
| 317 | unsigned int jack_present: 1; |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 318 | unsigned int master_sw: 1; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 319 | |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 320 | /* other flags */ |
| 321 | unsigned int no_analog :1; /* digital I/O only */ |
| 322 | |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 323 | /* for virtual master */ |
| 324 | hda_nid_t vmaster_nid; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 325 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 326 | struct hda_loopback_check loopback; |
| 327 | #endif |
Takashi Iwai | 2c3bf9a | 2008-06-04 12:39:38 +0200 | [diff] [blame] | 328 | |
| 329 | /* for PLL fix */ |
| 330 | hda_nid_t pll_nid; |
| 331 | unsigned int pll_coef_idx, pll_coef_bit; |
Takashi Iwai | e044c39 | 2008-10-27 16:56:24 +0100 | [diff] [blame] | 332 | |
| 333 | #ifdef SND_HDA_NEEDS_RESUME |
| 334 | #define ALC_MAX_PINS 16 |
| 335 | unsigned int num_pins; |
| 336 | hda_nid_t pin_nids[ALC_MAX_PINS]; |
| 337 | unsigned int pin_cfgs[ALC_MAX_PINS]; |
| 338 | #endif |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 339 | }; |
| 340 | |
| 341 | /* |
| 342 | * configuration template - to be copied to the spec instance |
| 343 | */ |
| 344 | struct alc_config_preset { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 345 | struct snd_kcontrol_new *mixers[5]; /* should be identical size |
| 346 | * with spec |
| 347 | */ |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 348 | struct snd_kcontrol_new *cap_mixer; /* capture mixer */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 349 | const struct hda_verb *init_verbs[5]; |
| 350 | unsigned int num_dacs; |
| 351 | hda_nid_t *dac_nids; |
| 352 | hda_nid_t dig_out_nid; /* optional */ |
| 353 | hda_nid_t hp_nid; /* optional */ |
Wu Fengguang | b25c9da | 2009-02-06 15:02:27 +0800 | [diff] [blame] | 354 | hda_nid_t *slave_dig_outs; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 355 | unsigned int num_adc_nids; |
| 356 | hda_nid_t *adc_nids; |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 357 | hda_nid_t *capsrc_nids; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 358 | hda_nid_t dig_in_nid; |
| 359 | unsigned int num_channel_mode; |
| 360 | const struct hda_channel_mode *channel_mode; |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 361 | int need_dac_fix; |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 362 | unsigned int num_mux_defs; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 363 | const struct hda_input_mux *input_mux; |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 364 | void (*unsol_event)(struct hda_codec *, unsigned int); |
| 365 | void (*init_hook)(struct hda_codec *); |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 366 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 367 | struct hda_amp_list *loopbacks; |
| 368 | #endif |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 369 | }; |
| 370 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 371 | |
| 372 | /* |
| 373 | * input MUX handling |
| 374 | */ |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 375 | static int alc_mux_enum_info(struct snd_kcontrol *kcontrol, |
| 376 | struct snd_ctl_elem_info *uinfo) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 377 | { |
| 378 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 379 | struct alc_spec *spec = codec->spec; |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 380 | unsigned int mux_idx = snd_ctl_get_ioffidx(kcontrol, &uinfo->id); |
| 381 | if (mux_idx >= spec->num_mux_defs) |
| 382 | mux_idx = 0; |
| 383 | return snd_hda_input_mux_info(&spec->input_mux[mux_idx], uinfo); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 384 | } |
| 385 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 386 | static int alc_mux_enum_get(struct snd_kcontrol *kcontrol, |
| 387 | struct snd_ctl_elem_value *ucontrol) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 388 | { |
| 389 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 390 | struct alc_spec *spec = codec->spec; |
| 391 | unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id); |
| 392 | |
| 393 | ucontrol->value.enumerated.item[0] = spec->cur_mux[adc_idx]; |
| 394 | return 0; |
| 395 | } |
| 396 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 397 | static int alc_mux_enum_put(struct snd_kcontrol *kcontrol, |
| 398 | struct snd_ctl_elem_value *ucontrol) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 399 | { |
| 400 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 401 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | cd896c3 | 2008-11-18 12:36:33 +0100 | [diff] [blame] | 402 | const struct hda_input_mux *imux; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 403 | unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id); |
Takashi Iwai | cd896c3 | 2008-11-18 12:36:33 +0100 | [diff] [blame] | 404 | unsigned int mux_idx; |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 405 | hda_nid_t nid = spec->capsrc_nids ? |
| 406 | spec->capsrc_nids[adc_idx] : spec->adc_nids[adc_idx]; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 407 | |
Takashi Iwai | cd896c3 | 2008-11-18 12:36:33 +0100 | [diff] [blame] | 408 | mux_idx = adc_idx >= spec->num_mux_defs ? 0 : adc_idx; |
| 409 | imux = &spec->input_mux[mux_idx]; |
| 410 | |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 411 | if (spec->capture_style && |
| 412 | !(spec->capture_style == CAPT_1MUX_MIX && !adc_idx)) { |
Takashi Iwai | 54cbc9a | 2008-10-31 15:24:04 +0100 | [diff] [blame] | 413 | /* Matrix-mixer style (e.g. ALC882) */ |
| 414 | unsigned int *cur_val = &spec->cur_mux[adc_idx]; |
| 415 | unsigned int i, idx; |
| 416 | |
| 417 | idx = ucontrol->value.enumerated.item[0]; |
| 418 | if (idx >= imux->num_items) |
| 419 | idx = imux->num_items - 1; |
| 420 | if (*cur_val == idx) |
| 421 | return 0; |
| 422 | for (i = 0; i < imux->num_items; i++) { |
| 423 | unsigned int v = (i == idx) ? 0 : HDA_AMP_MUTE; |
| 424 | snd_hda_codec_amp_stereo(codec, nid, HDA_INPUT, |
| 425 | imux->items[i].index, |
| 426 | HDA_AMP_MUTE, v); |
| 427 | } |
| 428 | *cur_val = idx; |
| 429 | return 1; |
| 430 | } else { |
| 431 | /* MUX style (e.g. ALC880) */ |
Takashi Iwai | cd896c3 | 2008-11-18 12:36:33 +0100 | [diff] [blame] | 432 | return snd_hda_input_mux_put(codec, imux, ucontrol, nid, |
Takashi Iwai | 54cbc9a | 2008-10-31 15:24:04 +0100 | [diff] [blame] | 433 | &spec->cur_mux[adc_idx]); |
| 434 | } |
| 435 | } |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 436 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 437 | /* |
| 438 | * channel mode setting |
| 439 | */ |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 440 | static int alc_ch_mode_info(struct snd_kcontrol *kcontrol, |
| 441 | struct snd_ctl_elem_info *uinfo) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 442 | { |
| 443 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 444 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 445 | return snd_hda_ch_mode_info(codec, uinfo, spec->channel_mode, |
| 446 | spec->num_channel_mode); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 447 | } |
| 448 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 449 | static int alc_ch_mode_get(struct snd_kcontrol *kcontrol, |
| 450 | struct snd_ctl_elem_value *ucontrol) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 451 | { |
| 452 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 453 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 454 | return snd_hda_ch_mode_get(codec, ucontrol, spec->channel_mode, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 455 | spec->num_channel_mode, |
| 456 | spec->multiout.max_channels); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 457 | } |
| 458 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 459 | static int alc_ch_mode_put(struct snd_kcontrol *kcontrol, |
| 460 | struct snd_ctl_elem_value *ucontrol) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 461 | { |
| 462 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 463 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 464 | int err = snd_hda_ch_mode_put(codec, ucontrol, spec->channel_mode, |
| 465 | spec->num_channel_mode, |
| 466 | &spec->multiout.max_channels); |
Takashi Iwai | bd2033f | 2006-10-10 19:49:31 +0200 | [diff] [blame] | 467 | if (err >= 0 && spec->need_dac_fix) |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 468 | spec->multiout.num_dacs = spec->multiout.max_channels / 2; |
| 469 | return err; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 470 | } |
| 471 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 472 | /* |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 473 | * 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] | 474 | * instead of "%" to avoid consequences of accidently treating the % as |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 475 | * being part of a format specifier. Maximum allowed length of a value is |
| 476 | * 63 characters plus NULL terminator. |
Jonathan Woithe | 7cf51e4 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 477 | * |
| 478 | * Note: some retasking pin complexes seem to ignore requests for input |
| 479 | * states other than HiZ (eg: PIN_VREFxx) and revert to HiZ if any of these |
| 480 | * are requested. Therefore order this list so that this behaviour will not |
| 481 | * cause problems when mixer clients move through the enum sequentially. |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 482 | * NIDs 0x0f and 0x10 have been observed to have this behaviour as of |
| 483 | * March 2006. |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 484 | */ |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 485 | static char *alc_pin_mode_names[] = { |
Jonathan Woithe | 7cf51e4 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 486 | "Mic 50pc bias", "Mic 80pc bias", |
| 487 | "Line in", "Line out", "Headphone out", |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 488 | }; |
| 489 | static unsigned char alc_pin_mode_values[] = { |
Jonathan Woithe | 7cf51e4 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 490 | PIN_VREF50, PIN_VREF80, PIN_IN, PIN_OUT, PIN_HP, |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 491 | }; |
| 492 | /* 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] | 493 | * in the pin being assumed to be exclusively an input or an output pin. In |
| 494 | * addition, "input" pins may or may not process the mic bias option |
| 495 | * depending on actual widget capability (NIDs 0x0f and 0x10 don't seem to |
| 496 | * accept requests for bias as of chip versions up to March 2006) and/or |
| 497 | * wiring in the computer. |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 498 | */ |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 499 | #define ALC_PIN_DIR_IN 0x00 |
| 500 | #define ALC_PIN_DIR_OUT 0x01 |
| 501 | #define ALC_PIN_DIR_INOUT 0x02 |
| 502 | #define ALC_PIN_DIR_IN_NOMICBIAS 0x03 |
| 503 | #define ALC_PIN_DIR_INOUT_NOMICBIAS 0x04 |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 504 | |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 505 | /* Info about the pin modes supported by the different pin direction modes. |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 506 | * For each direction the minimum and maximum values are given. |
| 507 | */ |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 508 | static signed char alc_pin_mode_dir_info[5][2] = { |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 509 | { 0, 2 }, /* ALC_PIN_DIR_IN */ |
| 510 | { 3, 4 }, /* ALC_PIN_DIR_OUT */ |
| 511 | { 0, 4 }, /* ALC_PIN_DIR_INOUT */ |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 512 | { 2, 2 }, /* ALC_PIN_DIR_IN_NOMICBIAS */ |
| 513 | { 2, 4 }, /* ALC_PIN_DIR_INOUT_NOMICBIAS */ |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 514 | }; |
| 515 | #define alc_pin_mode_min(_dir) (alc_pin_mode_dir_info[_dir][0]) |
| 516 | #define alc_pin_mode_max(_dir) (alc_pin_mode_dir_info[_dir][1]) |
| 517 | #define alc_pin_mode_n_items(_dir) \ |
| 518 | (alc_pin_mode_max(_dir)-alc_pin_mode_min(_dir)+1) |
| 519 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 520 | static int alc_pin_mode_info(struct snd_kcontrol *kcontrol, |
| 521 | struct snd_ctl_elem_info *uinfo) |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 522 | { |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 523 | unsigned int item_num = uinfo->value.enumerated.item; |
| 524 | unsigned char dir = (kcontrol->private_value >> 16) & 0xff; |
| 525 | |
| 526 | uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED; |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 527 | uinfo->count = 1; |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 528 | uinfo->value.enumerated.items = alc_pin_mode_n_items(dir); |
| 529 | |
| 530 | if (item_num<alc_pin_mode_min(dir) || item_num>alc_pin_mode_max(dir)) |
| 531 | item_num = alc_pin_mode_min(dir); |
| 532 | strcpy(uinfo->value.enumerated.name, alc_pin_mode_names[item_num]); |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 533 | return 0; |
| 534 | } |
| 535 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 536 | static int alc_pin_mode_get(struct snd_kcontrol *kcontrol, |
| 537 | struct snd_ctl_elem_value *ucontrol) |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 538 | { |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 539 | unsigned int i; |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 540 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 541 | hda_nid_t nid = kcontrol->private_value & 0xffff; |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 542 | unsigned char dir = (kcontrol->private_value >> 16) & 0xff; |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 543 | long *valp = ucontrol->value.integer.value; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 544 | unsigned int pinctl = snd_hda_codec_read(codec, nid, 0, |
| 545 | AC_VERB_GET_PIN_WIDGET_CONTROL, |
| 546 | 0x00); |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 547 | |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 548 | /* Find enumerated value for current pinctl setting */ |
| 549 | i = alc_pin_mode_min(dir); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 550 | 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] | 551 | i++; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 552 | *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] | 553 | return 0; |
| 554 | } |
| 555 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 556 | static int alc_pin_mode_put(struct snd_kcontrol *kcontrol, |
| 557 | struct snd_ctl_elem_value *ucontrol) |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 558 | { |
| 559 | signed int change; |
| 560 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 561 | hda_nid_t nid = kcontrol->private_value & 0xffff; |
| 562 | unsigned char dir = (kcontrol->private_value >> 16) & 0xff; |
| 563 | long val = *ucontrol->value.integer.value; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 564 | unsigned int pinctl = snd_hda_codec_read(codec, nid, 0, |
| 565 | AC_VERB_GET_PIN_WIDGET_CONTROL, |
| 566 | 0x00); |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 567 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 568 | 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] | 569 | val = alc_pin_mode_min(dir); |
| 570 | |
| 571 | change = pinctl != alc_pin_mode_values[val]; |
Jonathan Woithe | cdcd926 | 2006-02-28 11:36:42 +0100 | [diff] [blame] | 572 | if (change) { |
| 573 | /* Set pin mode to that requested */ |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 574 | snd_hda_codec_write_cache(codec, nid, 0, |
| 575 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 576 | alc_pin_mode_values[val]); |
Jonathan Woithe | cdcd926 | 2006-02-28 11:36:42 +0100 | [diff] [blame] | 577 | |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 578 | /* Also enable the retasking pin's input/output as required |
Jonathan Woithe | cdcd926 | 2006-02-28 11:36:42 +0100 | [diff] [blame] | 579 | * for the requested pin mode. Enum values of 2 or less are |
| 580 | * input modes. |
| 581 | * |
| 582 | * Dynamically switching the input/output buffers probably |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 583 | * reduces noise slightly (particularly on input) so we'll |
| 584 | * do it. However, having both input and output buffers |
| 585 | * enabled simultaneously doesn't seem to be problematic if |
| 586 | * this turns out to be necessary in the future. |
Jonathan Woithe | cdcd926 | 2006-02-28 11:36:42 +0100 | [diff] [blame] | 587 | */ |
| 588 | if (val <= 2) { |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 589 | snd_hda_codec_amp_stereo(codec, nid, HDA_OUTPUT, 0, |
| 590 | HDA_AMP_MUTE, HDA_AMP_MUTE); |
| 591 | snd_hda_codec_amp_stereo(codec, nid, HDA_INPUT, 0, |
| 592 | HDA_AMP_MUTE, 0); |
Jonathan Woithe | cdcd926 | 2006-02-28 11:36:42 +0100 | [diff] [blame] | 593 | } else { |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 594 | snd_hda_codec_amp_stereo(codec, nid, HDA_INPUT, 0, |
| 595 | HDA_AMP_MUTE, HDA_AMP_MUTE); |
| 596 | snd_hda_codec_amp_stereo(codec, nid, HDA_OUTPUT, 0, |
| 597 | HDA_AMP_MUTE, 0); |
Jonathan Woithe | cdcd926 | 2006-02-28 11:36:42 +0100 | [diff] [blame] | 598 | } |
| 599 | } |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 600 | return change; |
| 601 | } |
| 602 | |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 603 | #define ALC_PIN_MODE(xname, nid, dir) \ |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 604 | { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \ |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 605 | .info = alc_pin_mode_info, \ |
| 606 | .get = alc_pin_mode_get, \ |
| 607 | .put = alc_pin_mode_put, \ |
| 608 | .private_value = nid | (dir<<16) } |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 609 | |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 610 | /* A switch control for ALC260 GPIO pins. Multiple GPIOs can be ganged |
| 611 | * together using a mask with more than one bit set. This control is |
| 612 | * currently used only by the ALC260 test model. At this stage they are not |
| 613 | * needed for any "production" models. |
| 614 | */ |
| 615 | #ifdef CONFIG_SND_DEBUG |
Takashi Iwai | a5ce889 | 2007-07-23 15:42:26 +0200 | [diff] [blame] | 616 | #define alc_gpio_data_info snd_ctl_boolean_mono_info |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 617 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 618 | static int alc_gpio_data_get(struct snd_kcontrol *kcontrol, |
| 619 | struct snd_ctl_elem_value *ucontrol) |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 620 | { |
| 621 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 622 | hda_nid_t nid = kcontrol->private_value & 0xffff; |
| 623 | unsigned char mask = (kcontrol->private_value >> 16) & 0xff; |
| 624 | long *valp = ucontrol->value.integer.value; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 625 | unsigned int val = snd_hda_codec_read(codec, nid, 0, |
| 626 | AC_VERB_GET_GPIO_DATA, 0x00); |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 627 | |
| 628 | *valp = (val & mask) != 0; |
| 629 | return 0; |
| 630 | } |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 631 | static int alc_gpio_data_put(struct snd_kcontrol *kcontrol, |
| 632 | struct snd_ctl_elem_value *ucontrol) |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 633 | { |
| 634 | signed int change; |
| 635 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 636 | hda_nid_t nid = kcontrol->private_value & 0xffff; |
| 637 | unsigned char mask = (kcontrol->private_value >> 16) & 0xff; |
| 638 | long val = *ucontrol->value.integer.value; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 639 | unsigned int gpio_data = snd_hda_codec_read(codec, nid, 0, |
| 640 | AC_VERB_GET_GPIO_DATA, |
| 641 | 0x00); |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 642 | |
| 643 | /* Set/unset the masked GPIO bit(s) as needed */ |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 644 | change = (val == 0 ? 0 : mask) != (gpio_data & mask); |
| 645 | if (val == 0) |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 646 | gpio_data &= ~mask; |
| 647 | else |
| 648 | gpio_data |= mask; |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 649 | snd_hda_codec_write_cache(codec, nid, 0, |
| 650 | AC_VERB_SET_GPIO_DATA, gpio_data); |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 651 | |
| 652 | return change; |
| 653 | } |
| 654 | #define ALC_GPIO_DATA_SWITCH(xname, nid, mask) \ |
| 655 | { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \ |
| 656 | .info = alc_gpio_data_info, \ |
| 657 | .get = alc_gpio_data_get, \ |
| 658 | .put = alc_gpio_data_put, \ |
| 659 | .private_value = nid | (mask<<16) } |
| 660 | #endif /* CONFIG_SND_DEBUG */ |
| 661 | |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 662 | /* A switch control to allow the enabling of the digital IO pins on the |
| 663 | * ALC260. This is incredibly simplistic; the intention of this control is |
| 664 | * to provide something in the test model allowing digital outputs to be |
| 665 | * identified if present. If models are found which can utilise these |
| 666 | * outputs a more complete mixer control can be devised for those models if |
| 667 | * necessary. |
| 668 | */ |
| 669 | #ifdef CONFIG_SND_DEBUG |
Takashi Iwai | a5ce889 | 2007-07-23 15:42:26 +0200 | [diff] [blame] | 670 | #define alc_spdif_ctrl_info snd_ctl_boolean_mono_info |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 671 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 672 | static int alc_spdif_ctrl_get(struct snd_kcontrol *kcontrol, |
| 673 | struct snd_ctl_elem_value *ucontrol) |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 674 | { |
| 675 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 676 | hda_nid_t nid = kcontrol->private_value & 0xffff; |
| 677 | unsigned char mask = (kcontrol->private_value >> 16) & 0xff; |
| 678 | long *valp = ucontrol->value.integer.value; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 679 | unsigned int val = snd_hda_codec_read(codec, nid, 0, |
Andrew Paprocki | 3982d17 | 2007-12-19 12:13:44 +0100 | [diff] [blame] | 680 | AC_VERB_GET_DIGI_CONVERT_1, 0x00); |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 681 | |
| 682 | *valp = (val & mask) != 0; |
| 683 | return 0; |
| 684 | } |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 685 | static int alc_spdif_ctrl_put(struct snd_kcontrol *kcontrol, |
| 686 | struct snd_ctl_elem_value *ucontrol) |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 687 | { |
| 688 | signed int change; |
| 689 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 690 | hda_nid_t nid = kcontrol->private_value & 0xffff; |
| 691 | unsigned char mask = (kcontrol->private_value >> 16) & 0xff; |
| 692 | long val = *ucontrol->value.integer.value; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 693 | unsigned int ctrl_data = snd_hda_codec_read(codec, nid, 0, |
Andrew Paprocki | 3982d17 | 2007-12-19 12:13:44 +0100 | [diff] [blame] | 694 | AC_VERB_GET_DIGI_CONVERT_1, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 695 | 0x00); |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 696 | |
| 697 | /* Set/unset the masked control bit(s) as needed */ |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 698 | change = (val == 0 ? 0 : mask) != (ctrl_data & mask); |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 699 | if (val==0) |
| 700 | ctrl_data &= ~mask; |
| 701 | else |
| 702 | ctrl_data |= mask; |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 703 | snd_hda_codec_write_cache(codec, nid, 0, AC_VERB_SET_DIGI_CONVERT_1, |
| 704 | ctrl_data); |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 705 | |
| 706 | return change; |
| 707 | } |
| 708 | #define ALC_SPDIF_CTRL_SWITCH(xname, nid, mask) \ |
| 709 | { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \ |
| 710 | .info = alc_spdif_ctrl_info, \ |
| 711 | .get = alc_spdif_ctrl_get, \ |
| 712 | .put = alc_spdif_ctrl_put, \ |
| 713 | .private_value = nid | (mask<<16) } |
| 714 | #endif /* CONFIG_SND_DEBUG */ |
| 715 | |
Jonathan Woithe | f8225f6 | 2008-01-08 12:16:54 +0100 | [diff] [blame] | 716 | /* A switch control to allow the enabling EAPD digital outputs on the ALC26x. |
| 717 | * Again, this is only used in the ALC26x test models to help identify when |
| 718 | * the EAPD line must be asserted for features to work. |
| 719 | */ |
| 720 | #ifdef CONFIG_SND_DEBUG |
| 721 | #define alc_eapd_ctrl_info snd_ctl_boolean_mono_info |
| 722 | |
| 723 | static int alc_eapd_ctrl_get(struct snd_kcontrol *kcontrol, |
| 724 | struct snd_ctl_elem_value *ucontrol) |
| 725 | { |
| 726 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 727 | hda_nid_t nid = kcontrol->private_value & 0xffff; |
| 728 | unsigned char mask = (kcontrol->private_value >> 16) & 0xff; |
| 729 | long *valp = ucontrol->value.integer.value; |
| 730 | unsigned int val = snd_hda_codec_read(codec, nid, 0, |
| 731 | AC_VERB_GET_EAPD_BTLENABLE, 0x00); |
| 732 | |
| 733 | *valp = (val & mask) != 0; |
| 734 | return 0; |
| 735 | } |
| 736 | |
| 737 | static int alc_eapd_ctrl_put(struct snd_kcontrol *kcontrol, |
| 738 | struct snd_ctl_elem_value *ucontrol) |
| 739 | { |
| 740 | int change; |
| 741 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 742 | hda_nid_t nid = kcontrol->private_value & 0xffff; |
| 743 | unsigned char mask = (kcontrol->private_value >> 16) & 0xff; |
| 744 | long val = *ucontrol->value.integer.value; |
| 745 | unsigned int ctrl_data = snd_hda_codec_read(codec, nid, 0, |
| 746 | AC_VERB_GET_EAPD_BTLENABLE, |
| 747 | 0x00); |
| 748 | |
| 749 | /* Set/unset the masked control bit(s) as needed */ |
| 750 | change = (!val ? 0 : mask) != (ctrl_data & mask); |
| 751 | if (!val) |
| 752 | ctrl_data &= ~mask; |
| 753 | else |
| 754 | ctrl_data |= mask; |
| 755 | snd_hda_codec_write_cache(codec, nid, 0, AC_VERB_SET_EAPD_BTLENABLE, |
| 756 | ctrl_data); |
| 757 | |
| 758 | return change; |
| 759 | } |
| 760 | |
| 761 | #define ALC_EAPD_CTRL_SWITCH(xname, nid, mask) \ |
| 762 | { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \ |
| 763 | .info = alc_eapd_ctrl_info, \ |
| 764 | .get = alc_eapd_ctrl_get, \ |
| 765 | .put = alc_eapd_ctrl_put, \ |
| 766 | .private_value = nid | (mask<<16) } |
| 767 | #endif /* CONFIG_SND_DEBUG */ |
| 768 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 769 | /* |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 770 | */ |
| 771 | static void add_mixer(struct alc_spec *spec, struct snd_kcontrol_new *mix) |
| 772 | { |
| 773 | if (snd_BUG_ON(spec->num_mixers >= ARRAY_SIZE(spec->mixers))) |
| 774 | return; |
| 775 | spec->mixers[spec->num_mixers++] = mix; |
| 776 | } |
| 777 | |
| 778 | static void add_verb(struct alc_spec *spec, const struct hda_verb *verb) |
| 779 | { |
| 780 | if (snd_BUG_ON(spec->num_init_verbs >= ARRAY_SIZE(spec->init_verbs))) |
| 781 | return; |
| 782 | spec->init_verbs[spec->num_init_verbs++] = verb; |
| 783 | } |
| 784 | |
Takashi Iwai | daead53 | 2008-11-28 12:55:36 +0100 | [diff] [blame] | 785 | #ifdef CONFIG_PROC_FS |
| 786 | /* |
| 787 | * hook for proc |
| 788 | */ |
| 789 | static void print_realtek_coef(struct snd_info_buffer *buffer, |
| 790 | struct hda_codec *codec, hda_nid_t nid) |
| 791 | { |
| 792 | int coeff; |
| 793 | |
| 794 | if (nid != 0x20) |
| 795 | return; |
| 796 | coeff = snd_hda_codec_read(codec, nid, 0, AC_VERB_GET_PROC_COEF, 0); |
| 797 | snd_iprintf(buffer, " Processing Coefficient: 0x%02x\n", coeff); |
| 798 | coeff = snd_hda_codec_read(codec, nid, 0, |
| 799 | AC_VERB_GET_COEF_INDEX, 0); |
| 800 | snd_iprintf(buffer, " Coefficient Index: 0x%02x\n", coeff); |
| 801 | } |
| 802 | #else |
| 803 | #define print_realtek_coef NULL |
| 804 | #endif |
| 805 | |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 806 | /* |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 807 | * set up from the preset table |
| 808 | */ |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 809 | static void setup_preset(struct alc_spec *spec, |
| 810 | const struct alc_config_preset *preset) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 811 | { |
| 812 | int i; |
| 813 | |
| 814 | for (i = 0; i < ARRAY_SIZE(preset->mixers) && preset->mixers[i]; i++) |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 815 | add_mixer(spec, preset->mixers[i]); |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 816 | spec->cap_mixer = preset->cap_mixer; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 817 | for (i = 0; i < ARRAY_SIZE(preset->init_verbs) && preset->init_verbs[i]; |
| 818 | i++) |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 819 | add_verb(spec, preset->init_verbs[i]); |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 820 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 821 | spec->channel_mode = preset->channel_mode; |
| 822 | spec->num_channel_mode = preset->num_channel_mode; |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 823 | spec->need_dac_fix = preset->need_dac_fix; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 824 | |
| 825 | spec->multiout.max_channels = spec->channel_mode[0].channels; |
| 826 | |
| 827 | spec->multiout.num_dacs = preset->num_dacs; |
| 828 | spec->multiout.dac_nids = preset->dac_nids; |
| 829 | spec->multiout.dig_out_nid = preset->dig_out_nid; |
Wu Fengguang | b25c9da | 2009-02-06 15:02:27 +0800 | [diff] [blame] | 830 | spec->multiout.slave_dig_outs = preset->slave_dig_outs; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 831 | spec->multiout.hp_nid = preset->hp_nid; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 832 | |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 833 | spec->num_mux_defs = preset->num_mux_defs; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 834 | if (!spec->num_mux_defs) |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 835 | spec->num_mux_defs = 1; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 836 | spec->input_mux = preset->input_mux; |
| 837 | |
| 838 | spec->num_adc_nids = preset->num_adc_nids; |
| 839 | spec->adc_nids = preset->adc_nids; |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 840 | spec->capsrc_nids = preset->capsrc_nids; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 841 | spec->dig_in_nid = preset->dig_in_nid; |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 842 | |
| 843 | spec->unsol_event = preset->unsol_event; |
| 844 | spec->init_hook = preset->init_hook; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 845 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 846 | spec->loopback.amplist = preset->loopbacks; |
| 847 | #endif |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 848 | } |
| 849 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 850 | /* Enable GPIO mask and set output */ |
| 851 | static struct hda_verb alc_gpio1_init_verbs[] = { |
| 852 | {0x01, AC_VERB_SET_GPIO_MASK, 0x01}, |
| 853 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01}, |
| 854 | {0x01, AC_VERB_SET_GPIO_DATA, 0x01}, |
| 855 | { } |
| 856 | }; |
| 857 | |
| 858 | static struct hda_verb alc_gpio2_init_verbs[] = { |
| 859 | {0x01, AC_VERB_SET_GPIO_MASK, 0x02}, |
| 860 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x02}, |
| 861 | {0x01, AC_VERB_SET_GPIO_DATA, 0x02}, |
| 862 | { } |
| 863 | }; |
| 864 | |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 865 | static struct hda_verb alc_gpio3_init_verbs[] = { |
| 866 | {0x01, AC_VERB_SET_GPIO_MASK, 0x03}, |
| 867 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x03}, |
| 868 | {0x01, AC_VERB_SET_GPIO_DATA, 0x03}, |
| 869 | { } |
| 870 | }; |
| 871 | |
Takashi Iwai | 2c3bf9a | 2008-06-04 12:39:38 +0200 | [diff] [blame] | 872 | /* |
| 873 | * Fix hardware PLL issue |
| 874 | * On some codecs, the analog PLL gating control must be off while |
| 875 | * the default value is 1. |
| 876 | */ |
| 877 | static void alc_fix_pll(struct hda_codec *codec) |
| 878 | { |
| 879 | struct alc_spec *spec = codec->spec; |
| 880 | unsigned int val; |
| 881 | |
| 882 | if (!spec->pll_nid) |
| 883 | return; |
| 884 | snd_hda_codec_write(codec, spec->pll_nid, 0, AC_VERB_SET_COEF_INDEX, |
| 885 | spec->pll_coef_idx); |
| 886 | val = snd_hda_codec_read(codec, spec->pll_nid, 0, |
| 887 | AC_VERB_GET_PROC_COEF, 0); |
| 888 | snd_hda_codec_write(codec, spec->pll_nid, 0, AC_VERB_SET_COEF_INDEX, |
| 889 | spec->pll_coef_idx); |
| 890 | snd_hda_codec_write(codec, spec->pll_nid, 0, AC_VERB_SET_PROC_COEF, |
| 891 | val & ~(1 << spec->pll_coef_bit)); |
| 892 | } |
| 893 | |
| 894 | static void alc_fix_pll_init(struct hda_codec *codec, hda_nid_t nid, |
| 895 | unsigned int coef_idx, unsigned int coef_bit) |
| 896 | { |
| 897 | struct alc_spec *spec = codec->spec; |
| 898 | spec->pll_nid = nid; |
| 899 | spec->pll_coef_idx = coef_idx; |
| 900 | spec->pll_coef_bit = coef_bit; |
| 901 | alc_fix_pll(codec); |
| 902 | } |
| 903 | |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 904 | static void alc_sku_automute(struct hda_codec *codec) |
| 905 | { |
| 906 | struct alc_spec *spec = codec->spec; |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 907 | unsigned int present; |
| 908 | unsigned int hp_nid = spec->autocfg.hp_pins[0]; |
| 909 | unsigned int sp_nid = spec->autocfg.speaker_pins[0]; |
| 910 | |
| 911 | /* need to execute and sync at first */ |
| 912 | snd_hda_codec_read(codec, hp_nid, 0, AC_VERB_SET_PIN_SENSE, 0); |
| 913 | present = snd_hda_codec_read(codec, hp_nid, 0, |
| 914 | AC_VERB_GET_PIN_SENSE, 0); |
| 915 | spec->jack_present = (present & 0x80000000) != 0; |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 916 | snd_hda_codec_write(codec, sp_nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 917 | spec->jack_present ? 0 : PIN_OUT); |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 918 | } |
| 919 | |
Takashi Iwai | 4605b71 | 2008-10-31 14:18:24 +0100 | [diff] [blame] | 920 | #if 0 /* it's broken in some acses -- temporarily disabled */ |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 921 | static void alc_mic_automute(struct hda_codec *codec) |
| 922 | { |
| 923 | struct alc_spec *spec = codec->spec; |
| 924 | unsigned int present; |
| 925 | unsigned int mic_nid = spec->autocfg.input_pins[AUTO_PIN_MIC]; |
| 926 | unsigned int fmic_nid = spec->autocfg.input_pins[AUTO_PIN_FRONT_MIC]; |
| 927 | unsigned int mix_nid = spec->capsrc_nids[0]; |
| 928 | unsigned int capsrc_idx_mic, capsrc_idx_fmic; |
| 929 | |
| 930 | capsrc_idx_mic = mic_nid - 0x18; |
| 931 | capsrc_idx_fmic = fmic_nid - 0x18; |
| 932 | present = snd_hda_codec_read(codec, mic_nid, 0, |
| 933 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 934 | snd_hda_codec_write(codec, mix_nid, 0, AC_VERB_SET_AMP_GAIN_MUTE, |
| 935 | 0x7000 | (capsrc_idx_mic << 8) | (present ? 0 : 0x80)); |
| 936 | snd_hda_codec_write(codec, mix_nid, 0, AC_VERB_SET_AMP_GAIN_MUTE, |
| 937 | 0x7000 | (capsrc_idx_fmic << 8) | (present ? 0x80 : 0)); |
| 938 | snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, capsrc_idx_fmic, |
| 939 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
| 940 | } |
Takashi Iwai | 4605b71 | 2008-10-31 14:18:24 +0100 | [diff] [blame] | 941 | #else |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 942 | #define alc_mic_automute(codec) do {} while(0) /* NOP */ |
Takashi Iwai | 4605b71 | 2008-10-31 14:18:24 +0100 | [diff] [blame] | 943 | #endif /* disabled */ |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 944 | |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 945 | /* unsolicited event for HP jack sensing */ |
| 946 | static void alc_sku_unsol_event(struct hda_codec *codec, unsigned int res) |
| 947 | { |
| 948 | if (codec->vendor_id == 0x10ec0880) |
| 949 | res >>= 28; |
| 950 | else |
| 951 | res >>= 26; |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 952 | if (res == ALC880_HP_EVENT) |
| 953 | alc_sku_automute(codec); |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 954 | |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 955 | if (res == ALC880_MIC_EVENT) |
| 956 | alc_mic_automute(codec); |
| 957 | } |
| 958 | |
| 959 | static void alc_inithook(struct hda_codec *codec) |
| 960 | { |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 961 | alc_sku_automute(codec); |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 962 | alc_mic_automute(codec); |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 963 | } |
| 964 | |
Kailang Yang | f9423e7 | 2008-05-27 12:32:25 +0200 | [diff] [blame] | 965 | /* additional initialization for ALC888 variants */ |
| 966 | static void alc888_coef_init(struct hda_codec *codec) |
| 967 | { |
| 968 | unsigned int tmp; |
| 969 | |
| 970 | snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_COEF_INDEX, 0); |
| 971 | tmp = snd_hda_codec_read(codec, 0x20, 0, AC_VERB_GET_PROC_COEF, 0); |
| 972 | snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_COEF_INDEX, 7); |
| 973 | if ((tmp & 0xf0) == 2) |
| 974 | /* alc888S-VC */ |
| 975 | snd_hda_codec_read(codec, 0x20, 0, |
| 976 | AC_VERB_SET_PROC_COEF, 0x830); |
| 977 | else |
| 978 | /* alc888-VB */ |
| 979 | snd_hda_codec_read(codec, 0x20, 0, |
| 980 | AC_VERB_SET_PROC_COEF, 0x3030); |
| 981 | } |
| 982 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 983 | /* 32-bit subsystem ID for BIOS loading in HD Audio codec. |
| 984 | * 31 ~ 16 : Manufacture ID |
| 985 | * 15 ~ 8 : SKU ID |
| 986 | * 7 ~ 0 : Assembly ID |
| 987 | * port-A --> pin 39/41, port-E --> pin 14/15, port-D --> pin 35/36 |
| 988 | */ |
| 989 | static void alc_subsystem_id(struct hda_codec *codec, |
| 990 | unsigned int porta, unsigned int porte, |
| 991 | unsigned int portd) |
| 992 | { |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 993 | unsigned int ass, tmp, i; |
| 994 | unsigned nid; |
| 995 | struct alc_spec *spec = codec->spec; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 996 | |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 997 | ass = codec->subsystem_id & 0xffff; |
| 998 | if ((ass != codec->bus->pci->subsystem_device) && (ass & 1)) |
| 999 | goto do_sku; |
| 1000 | |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 1001 | /* |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1002 | * 31~30 : port conetcivity |
| 1003 | * 29~21 : reserve |
| 1004 | * 20 : PCBEEP input |
| 1005 | * 19~16 : Check sum (15:1) |
| 1006 | * 15~1 : Custom |
| 1007 | * 0 : override |
| 1008 | */ |
| 1009 | nid = 0x1d; |
| 1010 | if (codec->vendor_id == 0x10ec0260) |
| 1011 | nid = 0x17; |
| 1012 | ass = snd_hda_codec_read(codec, nid, 0, |
| 1013 | AC_VERB_GET_CONFIG_DEFAULT, 0); |
| 1014 | if (!(ass & 1) && !(ass & 0x100000)) |
| 1015 | return; |
| 1016 | if ((ass >> 30) != 1) /* no physical connection */ |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 1017 | return; |
| 1018 | |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1019 | /* check sum */ |
| 1020 | tmp = 0; |
| 1021 | for (i = 1; i < 16; i++) { |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 1022 | if ((ass >> i) & 1) |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1023 | tmp++; |
| 1024 | } |
| 1025 | if (((ass >> 16) & 0xf) != tmp) |
| 1026 | return; |
| 1027 | do_sku: |
| 1028 | /* |
| 1029 | * 0 : override |
| 1030 | * 1 : Swap Jack |
| 1031 | * 2 : 0 --> Desktop, 1 --> Laptop |
| 1032 | * 3~5 : External Amplifier control |
| 1033 | * 7~6 : Reserved |
| 1034 | */ |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 1035 | tmp = (ass & 0x38) >> 3; /* external Amp control */ |
| 1036 | switch (tmp) { |
| 1037 | case 1: |
| 1038 | snd_hda_sequence_write(codec, alc_gpio1_init_verbs); |
| 1039 | break; |
| 1040 | case 3: |
| 1041 | snd_hda_sequence_write(codec, alc_gpio2_init_verbs); |
| 1042 | break; |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 1043 | case 7: |
| 1044 | snd_hda_sequence_write(codec, alc_gpio3_init_verbs); |
| 1045 | break; |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1046 | case 5: /* set EAPD output high */ |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 1047 | switch (codec->vendor_id) { |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1048 | case 0x10ec0260: |
| 1049 | snd_hda_codec_write(codec, 0x0f, 0, |
| 1050 | AC_VERB_SET_EAPD_BTLENABLE, 2); |
| 1051 | snd_hda_codec_write(codec, 0x10, 0, |
| 1052 | AC_VERB_SET_EAPD_BTLENABLE, 2); |
| 1053 | break; |
| 1054 | case 0x10ec0262: |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 1055 | case 0x10ec0267: |
| 1056 | case 0x10ec0268: |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1057 | case 0x10ec0269: |
Takashi Iwai | c6e8f2d | 2009-02-06 12:45:52 +0100 | [diff] [blame] | 1058 | case 0x10ec0272: |
Kailang Yang | f9423e7 | 2008-05-27 12:32:25 +0200 | [diff] [blame] | 1059 | case 0x10ec0660: |
| 1060 | case 0x10ec0662: |
| 1061 | case 0x10ec0663: |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1062 | case 0x10ec0862: |
Takashi Iwai | 20a3a05 | 2008-05-23 17:52:53 +0200 | [diff] [blame] | 1063 | case 0x10ec0889: |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 1064 | snd_hda_codec_write(codec, 0x14, 0, |
| 1065 | AC_VERB_SET_EAPD_BTLENABLE, 2); |
| 1066 | snd_hda_codec_write(codec, 0x15, 0, |
| 1067 | AC_VERB_SET_EAPD_BTLENABLE, 2); |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1068 | break; |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 1069 | } |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1070 | switch (codec->vendor_id) { |
| 1071 | case 0x10ec0260: |
| 1072 | snd_hda_codec_write(codec, 0x1a, 0, |
| 1073 | AC_VERB_SET_COEF_INDEX, 7); |
| 1074 | tmp = snd_hda_codec_read(codec, 0x1a, 0, |
| 1075 | AC_VERB_GET_PROC_COEF, 0); |
| 1076 | snd_hda_codec_write(codec, 0x1a, 0, |
| 1077 | AC_VERB_SET_COEF_INDEX, 7); |
| 1078 | snd_hda_codec_write(codec, 0x1a, 0, |
| 1079 | AC_VERB_SET_PROC_COEF, |
| 1080 | tmp | 0x2010); |
| 1081 | break; |
| 1082 | case 0x10ec0262: |
| 1083 | case 0x10ec0880: |
| 1084 | case 0x10ec0882: |
| 1085 | case 0x10ec0883: |
| 1086 | case 0x10ec0885: |
Takashi Iwai | 4a5a4c5 | 2009-02-06 12:46:59 +0100 | [diff] [blame] | 1087 | case 0x10ec0887: |
Takashi Iwai | 20a3a05 | 2008-05-23 17:52:53 +0200 | [diff] [blame] | 1088 | case 0x10ec0889: |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1089 | snd_hda_codec_write(codec, 0x20, 0, |
| 1090 | AC_VERB_SET_COEF_INDEX, 7); |
| 1091 | tmp = snd_hda_codec_read(codec, 0x20, 0, |
| 1092 | AC_VERB_GET_PROC_COEF, 0); |
| 1093 | snd_hda_codec_write(codec, 0x20, 0, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 1094 | AC_VERB_SET_COEF_INDEX, 7); |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1095 | snd_hda_codec_write(codec, 0x20, 0, |
| 1096 | AC_VERB_SET_PROC_COEF, |
| 1097 | tmp | 0x2010); |
| 1098 | break; |
Kailang Yang | f9423e7 | 2008-05-27 12:32:25 +0200 | [diff] [blame] | 1099 | case 0x10ec0888: |
Takashi Iwai | 1082c74 | 2008-08-22 15:24:22 +0200 | [diff] [blame] | 1100 | /*alc888_coef_init(codec);*/ /* called in alc_init() */ |
Kailang Yang | f9423e7 | 2008-05-27 12:32:25 +0200 | [diff] [blame] | 1101 | break; |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1102 | case 0x10ec0267: |
| 1103 | case 0x10ec0268: |
| 1104 | snd_hda_codec_write(codec, 0x20, 0, |
| 1105 | AC_VERB_SET_COEF_INDEX, 7); |
| 1106 | tmp = snd_hda_codec_read(codec, 0x20, 0, |
| 1107 | AC_VERB_GET_PROC_COEF, 0); |
| 1108 | snd_hda_codec_write(codec, 0x20, 0, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 1109 | AC_VERB_SET_COEF_INDEX, 7); |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1110 | snd_hda_codec_write(codec, 0x20, 0, |
| 1111 | AC_VERB_SET_PROC_COEF, |
| 1112 | tmp | 0x3000); |
| 1113 | break; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 1114 | } |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1115 | default: |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 1116 | break; |
| 1117 | } |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 1118 | |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 1119 | /* is laptop or Desktop and enable the function "Mute internal speaker |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1120 | * when the external headphone out jack is plugged" |
| 1121 | */ |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 1122 | if (!(ass & 0x8000)) |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1123 | return; |
| 1124 | /* |
| 1125 | * 10~8 : Jack location |
| 1126 | * 12~11: Headphone out -> 00: PortA, 01: PortE, 02: PortD, 03: Resvered |
| 1127 | * 14~13: Resvered |
| 1128 | * 15 : 1 --> enable the function "Mute internal speaker |
| 1129 | * when the external headphone out jack is plugged" |
| 1130 | */ |
| 1131 | if (!spec->autocfg.speaker_pins[0]) { |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 1132 | if (spec->autocfg.line_out_pins[0]) |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1133 | spec->autocfg.speaker_pins[0] = |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 1134 | spec->autocfg.line_out_pins[0]; |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1135 | else |
| 1136 | return; |
| 1137 | } |
| 1138 | |
| 1139 | if (!spec->autocfg.hp_pins[0]) { |
| 1140 | tmp = (ass >> 11) & 0x3; /* HP to chassis */ |
| 1141 | if (tmp == 0) |
| 1142 | spec->autocfg.hp_pins[0] = porta; |
| 1143 | else if (tmp == 1) |
| 1144 | spec->autocfg.hp_pins[0] = porte; |
| 1145 | else if (tmp == 2) |
| 1146 | spec->autocfg.hp_pins[0] = portd; |
| 1147 | else |
| 1148 | return; |
| 1149 | } |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 1150 | if (spec->autocfg.hp_pins[0]) |
| 1151 | snd_hda_codec_write(codec, spec->autocfg.hp_pins[0], 0, |
| 1152 | AC_VERB_SET_UNSOLICITED_ENABLE, |
| 1153 | AC_USRSP_EN | ALC880_HP_EVENT); |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1154 | |
Takashi Iwai | 4605b71 | 2008-10-31 14:18:24 +0100 | [diff] [blame] | 1155 | #if 0 /* it's broken in some acses -- temporarily disabled */ |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 1156 | if (spec->autocfg.input_pins[AUTO_PIN_MIC] && |
| 1157 | spec->autocfg.input_pins[AUTO_PIN_FRONT_MIC]) |
| 1158 | snd_hda_codec_write(codec, |
| 1159 | spec->autocfg.input_pins[AUTO_PIN_MIC], 0, |
| 1160 | AC_VERB_SET_UNSOLICITED_ENABLE, |
| 1161 | AC_USRSP_EN | ALC880_MIC_EVENT); |
Takashi Iwai | 4605b71 | 2008-10-31 14:18:24 +0100 | [diff] [blame] | 1162 | #endif /* disabled */ |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 1163 | |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1164 | spec->unsol_event = alc_sku_unsol_event; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 1165 | } |
| 1166 | |
Takashi Iwai | 41e41f1 | 2005-06-08 14:48:49 +0200 | [diff] [blame] | 1167 | /* |
Takashi Iwai | f95474e | 2007-07-10 00:47:43 +0200 | [diff] [blame] | 1168 | * Fix-up pin default configurations |
| 1169 | */ |
| 1170 | |
| 1171 | struct alc_pincfg { |
| 1172 | hda_nid_t nid; |
| 1173 | u32 val; |
| 1174 | }; |
| 1175 | |
| 1176 | static void alc_fix_pincfg(struct hda_codec *codec, |
| 1177 | const struct snd_pci_quirk *quirk, |
| 1178 | const struct alc_pincfg **pinfix) |
| 1179 | { |
| 1180 | const struct alc_pincfg *cfg; |
| 1181 | |
| 1182 | quirk = snd_pci_quirk_lookup(codec->bus->pci, quirk); |
| 1183 | if (!quirk) |
| 1184 | return; |
| 1185 | |
| 1186 | cfg = pinfix[quirk->value]; |
| 1187 | for (; cfg->nid; cfg++) { |
| 1188 | int i; |
| 1189 | u32 val = cfg->val; |
| 1190 | for (i = 0; i < 4; i++) { |
| 1191 | snd_hda_codec_write(codec, cfg->nid, 0, |
| 1192 | AC_VERB_SET_CONFIG_DEFAULT_BYTES_0 + i, |
| 1193 | val & 0xff); |
| 1194 | val >>= 8; |
| 1195 | } |
| 1196 | } |
| 1197 | } |
| 1198 | |
| 1199 | /* |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 1200 | * ALC888 |
| 1201 | */ |
| 1202 | |
| 1203 | /* |
| 1204 | * 2ch mode |
| 1205 | */ |
| 1206 | static struct hda_verb alc888_4ST_ch2_intel_init[] = { |
| 1207 | /* Mic-in jack as mic in */ |
| 1208 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 1209 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 1210 | /* Line-in jack as Line in */ |
| 1211 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 1212 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 1213 | /* Line-Out as Front */ |
| 1214 | { 0x17, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 1215 | { } /* end */ |
| 1216 | }; |
| 1217 | |
| 1218 | /* |
| 1219 | * 4ch mode |
| 1220 | */ |
| 1221 | static struct hda_verb alc888_4ST_ch4_intel_init[] = { |
| 1222 | /* Mic-in jack as mic in */ |
| 1223 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 1224 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 1225 | /* Line-in jack as Surround */ |
| 1226 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 1227 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 1228 | /* Line-Out as Front */ |
| 1229 | { 0x17, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 1230 | { } /* end */ |
| 1231 | }; |
| 1232 | |
| 1233 | /* |
| 1234 | * 6ch mode |
| 1235 | */ |
| 1236 | static struct hda_verb alc888_4ST_ch6_intel_init[] = { |
| 1237 | /* Mic-in jack as CLFE */ |
| 1238 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 1239 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 1240 | /* Line-in jack as Surround */ |
| 1241 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 1242 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 1243 | /* Line-Out as CLFE (workaround because Mic-in is not loud enough) */ |
| 1244 | { 0x17, AC_VERB_SET_CONNECT_SEL, 0x03}, |
| 1245 | { } /* end */ |
| 1246 | }; |
| 1247 | |
| 1248 | /* |
| 1249 | * 8ch mode |
| 1250 | */ |
| 1251 | static struct hda_verb alc888_4ST_ch8_intel_init[] = { |
| 1252 | /* Mic-in jack as CLFE */ |
| 1253 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 1254 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 1255 | /* Line-in jack as Surround */ |
| 1256 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 1257 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 1258 | /* Line-Out as Side */ |
| 1259 | { 0x17, AC_VERB_SET_CONNECT_SEL, 0x03}, |
| 1260 | { } /* end */ |
| 1261 | }; |
| 1262 | |
| 1263 | static struct hda_channel_mode alc888_4ST_8ch_intel_modes[4] = { |
| 1264 | { 2, alc888_4ST_ch2_intel_init }, |
| 1265 | { 4, alc888_4ST_ch4_intel_init }, |
| 1266 | { 6, alc888_4ST_ch6_intel_init }, |
| 1267 | { 8, alc888_4ST_ch8_intel_init }, |
| 1268 | }; |
| 1269 | |
| 1270 | /* |
| 1271 | * ALC888 Fujitsu Siemens Amillo xa3530 |
| 1272 | */ |
| 1273 | |
| 1274 | static struct hda_verb alc888_fujitsu_xa3530_verbs[] = { |
| 1275 | /* Front Mic: set to PIN_IN (empty by default) */ |
| 1276 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 1277 | /* Connect Internal HP to Front */ |
| 1278 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1279 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1280 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 1281 | /* Connect Bass HP to Front */ |
| 1282 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1283 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1284 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 1285 | /* Connect Line-Out side jack (SPDIF) to Side */ |
| 1286 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1287 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1288 | {0x17, AC_VERB_SET_CONNECT_SEL, 0x03}, |
| 1289 | /* Connect Mic jack to CLFE */ |
| 1290 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1291 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1292 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 1293 | /* Connect Line-in jack to Surround */ |
| 1294 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1295 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1296 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 1297 | /* Connect HP out jack to Front */ |
| 1298 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1299 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1300 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 1301 | /* Enable unsolicited event for HP jack and Line-out jack */ |
| 1302 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 1303 | {0x17, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 1304 | {} |
| 1305 | }; |
| 1306 | |
| 1307 | static void alc888_fujitsu_xa3530_automute(struct hda_codec *codec) |
| 1308 | { |
| 1309 | unsigned int present; |
| 1310 | unsigned int bits; |
| 1311 | /* Line out presence */ |
| 1312 | present = snd_hda_codec_read(codec, 0x17, 0, |
| 1313 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 1314 | /* HP out presence */ |
| 1315 | present = present || snd_hda_codec_read(codec, 0x1b, 0, |
| 1316 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 1317 | bits = present ? HDA_AMP_MUTE : 0; |
| 1318 | /* Toggle internal speakers muting */ |
| 1319 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 1320 | HDA_AMP_MUTE, bits); |
| 1321 | /* Toggle internal bass muting */ |
| 1322 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 1323 | HDA_AMP_MUTE, bits); |
| 1324 | } |
| 1325 | |
| 1326 | static void alc888_fujitsu_xa3530_unsol_event(struct hda_codec *codec, |
| 1327 | unsigned int res) |
| 1328 | { |
| 1329 | if (res >> 26 == ALC880_HP_EVENT) |
| 1330 | alc888_fujitsu_xa3530_automute(codec); |
| 1331 | } |
| 1332 | |
| 1333 | |
| 1334 | /* |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 1335 | * ALC888 Acer Aspire 4930G model |
| 1336 | */ |
| 1337 | |
| 1338 | static struct hda_verb alc888_acer_aspire_4930g_verbs[] = { |
| 1339 | /* Front Mic: set to PIN_IN (empty by default) */ |
| 1340 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 1341 | /* Unselect Front Mic by default in input mixer 3 */ |
| 1342 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0xb)}, |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 1343 | /* Enable unsolicited event for HP jack */ |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 1344 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 1345 | /* Connect Internal HP to front */ |
| 1346 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1347 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1348 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 1349 | /* Connect HP out to front */ |
| 1350 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1351 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1352 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 1353 | { } |
| 1354 | }; |
| 1355 | |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 1356 | static struct hda_input_mux alc888_2_capture_sources[2] = { |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 1357 | /* Front mic only available on one ADC */ |
| 1358 | { |
| 1359 | .num_items = 4, |
| 1360 | .items = { |
| 1361 | { "Mic", 0x0 }, |
| 1362 | { "Line", 0x2 }, |
| 1363 | { "CD", 0x4 }, |
| 1364 | { "Front Mic", 0xb }, |
| 1365 | }, |
| 1366 | }, |
| 1367 | { |
| 1368 | .num_items = 3, |
| 1369 | .items = { |
| 1370 | { "Mic", 0x0 }, |
| 1371 | { "Line", 0x2 }, |
| 1372 | { "CD", 0x4 }, |
| 1373 | }, |
| 1374 | } |
| 1375 | }; |
| 1376 | |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 1377 | static struct snd_kcontrol_new alc888_base_mixer[] = { |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 1378 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 1379 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 1380 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 1381 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
| 1382 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, |
| 1383 | HDA_OUTPUT), |
| 1384 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 1385 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 1386 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 1387 | HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
| 1388 | HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT), |
| 1389 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 1390 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 1391 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 1392 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 1393 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 1394 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 1395 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 1396 | { } /* end */ |
| 1397 | }; |
| 1398 | |
| 1399 | static void alc888_acer_aspire_4930g_automute(struct hda_codec *codec) |
| 1400 | { |
| 1401 | unsigned int present; |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 1402 | unsigned int bits; |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 1403 | present = snd_hda_codec_read(codec, 0x15, 0, |
| 1404 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 1405 | bits = present ? HDA_AMP_MUTE : 0; |
| 1406 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 1407 | HDA_AMP_MUTE, bits); |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 1408 | } |
| 1409 | |
| 1410 | static void alc888_acer_aspire_4930g_unsol_event(struct hda_codec *codec, |
| 1411 | unsigned int res) |
| 1412 | { |
| 1413 | if (res >> 26 == ALC880_HP_EVENT) |
| 1414 | alc888_acer_aspire_4930g_automute(codec); |
| 1415 | } |
| 1416 | |
| 1417 | /* |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1418 | * ALC880 3-stack model |
| 1419 | * |
| 1420 | * DAC: Front = 0x02 (0x0c), Surr = 0x05 (0x0f), CLFE = 0x04 (0x0e) |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 1421 | * Pin assignment: Front = 0x14, Line-In/Surr = 0x1a, Mic/CLFE = 0x18, |
| 1422 | * F-Mic = 0x1b, HP = 0x19 |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1423 | */ |
| 1424 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1425 | static hda_nid_t alc880_dac_nids[4] = { |
| 1426 | /* front, rear, clfe, rear_surr */ |
| 1427 | 0x02, 0x05, 0x04, 0x03 |
| 1428 | }; |
| 1429 | |
| 1430 | static hda_nid_t alc880_adc_nids[3] = { |
| 1431 | /* ADC0-2 */ |
| 1432 | 0x07, 0x08, 0x09, |
| 1433 | }; |
| 1434 | |
| 1435 | /* The datasheet says the node 0x07 is connected from inputs, |
| 1436 | * but it shows zero connection in the real implementation on some devices. |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 1437 | * Note: this is a 915GAV bug, fixed on 915GLV |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1438 | */ |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1439 | static hda_nid_t alc880_adc_nids_alt[2] = { |
| 1440 | /* ADC1-2 */ |
| 1441 | 0x08, 0x09, |
| 1442 | }; |
| 1443 | |
| 1444 | #define ALC880_DIGOUT_NID 0x06 |
| 1445 | #define ALC880_DIGIN_NID 0x0a |
| 1446 | |
| 1447 | static struct hda_input_mux alc880_capture_source = { |
| 1448 | .num_items = 4, |
| 1449 | .items = { |
| 1450 | { "Mic", 0x0 }, |
| 1451 | { "Front Mic", 0x3 }, |
| 1452 | { "Line", 0x2 }, |
| 1453 | { "CD", 0x4 }, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1454 | }, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1455 | }; |
| 1456 | |
| 1457 | /* channel source setting (2/6 channel selection for 3-stack) */ |
| 1458 | /* 2ch mode */ |
| 1459 | static struct hda_verb alc880_threestack_ch2_init[] = { |
| 1460 | /* set line-in to input, mute it */ |
| 1461 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 1462 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 1463 | /* set mic-in to input vref 80%, mute it */ |
| 1464 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 1465 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1466 | { } /* end */ |
| 1467 | }; |
| 1468 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1469 | /* 6ch mode */ |
| 1470 | static struct hda_verb alc880_threestack_ch6_init[] = { |
| 1471 | /* set line-in to output, unmute it */ |
| 1472 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 1473 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 1474 | /* set mic-in to output, unmute it */ |
| 1475 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 1476 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 1477 | { } /* end */ |
| 1478 | }; |
| 1479 | |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 1480 | static struct hda_channel_mode alc880_threestack_modes[2] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1481 | { 2, alc880_threestack_ch2_init }, |
| 1482 | { 6, alc880_threestack_ch6_init }, |
| 1483 | }; |
| 1484 | |
Takashi Iwai | c8b6bf9b | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 1485 | static struct snd_kcontrol_new alc880_three_stack_mixer[] = { |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 1486 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 1487 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 1488 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 1489 | HDA_BIND_MUTE("Surround Playback Switch", 0x0f, 2, HDA_INPUT), |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 1490 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 1491 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 1492 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 1493 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1494 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 1495 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 1496 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 1497 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 1498 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 1499 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 1500 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x3, HDA_INPUT), |
| 1501 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x3, HDA_INPUT), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1502 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x19, 0x0, HDA_OUTPUT), |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1503 | { |
| 1504 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 1505 | .name = "Channel Mode", |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 1506 | .info = alc_ch_mode_info, |
| 1507 | .get = alc_ch_mode_get, |
| 1508 | .put = alc_ch_mode_put, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1509 | }, |
| 1510 | { } /* end */ |
| 1511 | }; |
| 1512 | |
| 1513 | /* capture mixer elements */ |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 1514 | static int alc_cap_vol_info(struct snd_kcontrol *kcontrol, |
| 1515 | struct snd_ctl_elem_info *uinfo) |
| 1516 | { |
| 1517 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 1518 | struct alc_spec *spec = codec->spec; |
| 1519 | int err; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1520 | |
Wu Fengguang | 5a9e02e | 2009-01-09 16:45:24 +0800 | [diff] [blame] | 1521 | mutex_lock(&codec->control_mutex); |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 1522 | kcontrol->private_value = HDA_COMPOSE_AMP_VAL(spec->adc_nids[0], 3, 0, |
| 1523 | HDA_INPUT); |
| 1524 | err = snd_hda_mixer_amp_volume_info(kcontrol, uinfo); |
Wu Fengguang | 5a9e02e | 2009-01-09 16:45:24 +0800 | [diff] [blame] | 1525 | mutex_unlock(&codec->control_mutex); |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 1526 | return err; |
| 1527 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1528 | |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 1529 | static int alc_cap_vol_tlv(struct snd_kcontrol *kcontrol, int op_flag, |
| 1530 | unsigned int size, unsigned int __user *tlv) |
| 1531 | { |
| 1532 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 1533 | struct alc_spec *spec = codec->spec; |
| 1534 | int err; |
| 1535 | |
Wu Fengguang | 5a9e02e | 2009-01-09 16:45:24 +0800 | [diff] [blame] | 1536 | mutex_lock(&codec->control_mutex); |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 1537 | kcontrol->private_value = HDA_COMPOSE_AMP_VAL(spec->adc_nids[0], 3, 0, |
| 1538 | HDA_INPUT); |
| 1539 | err = snd_hda_mixer_amp_tlv(kcontrol, op_flag, size, tlv); |
Wu Fengguang | 5a9e02e | 2009-01-09 16:45:24 +0800 | [diff] [blame] | 1540 | mutex_unlock(&codec->control_mutex); |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 1541 | return err; |
| 1542 | } |
| 1543 | |
| 1544 | typedef int (*getput_call_t)(struct snd_kcontrol *kcontrol, |
| 1545 | struct snd_ctl_elem_value *ucontrol); |
| 1546 | |
| 1547 | static int alc_cap_getput_caller(struct snd_kcontrol *kcontrol, |
| 1548 | struct snd_ctl_elem_value *ucontrol, |
| 1549 | getput_call_t func) |
| 1550 | { |
| 1551 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 1552 | struct alc_spec *spec = codec->spec; |
| 1553 | unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id); |
| 1554 | int err; |
| 1555 | |
Wu Fengguang | 5a9e02e | 2009-01-09 16:45:24 +0800 | [diff] [blame] | 1556 | mutex_lock(&codec->control_mutex); |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 1557 | kcontrol->private_value = HDA_COMPOSE_AMP_VAL(spec->adc_nids[adc_idx], |
| 1558 | 3, 0, HDA_INPUT); |
| 1559 | err = func(kcontrol, ucontrol); |
Wu Fengguang | 5a9e02e | 2009-01-09 16:45:24 +0800 | [diff] [blame] | 1560 | mutex_unlock(&codec->control_mutex); |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 1561 | return err; |
| 1562 | } |
| 1563 | |
| 1564 | static int alc_cap_vol_get(struct snd_kcontrol *kcontrol, |
| 1565 | struct snd_ctl_elem_value *ucontrol) |
| 1566 | { |
| 1567 | return alc_cap_getput_caller(kcontrol, ucontrol, |
| 1568 | snd_hda_mixer_amp_volume_get); |
| 1569 | } |
| 1570 | |
| 1571 | static int alc_cap_vol_put(struct snd_kcontrol *kcontrol, |
| 1572 | struct snd_ctl_elem_value *ucontrol) |
| 1573 | { |
| 1574 | return alc_cap_getput_caller(kcontrol, ucontrol, |
| 1575 | snd_hda_mixer_amp_volume_put); |
| 1576 | } |
| 1577 | |
| 1578 | /* capture mixer elements */ |
| 1579 | #define alc_cap_sw_info snd_ctl_boolean_stereo_info |
| 1580 | |
| 1581 | static int alc_cap_sw_get(struct snd_kcontrol *kcontrol, |
| 1582 | struct snd_ctl_elem_value *ucontrol) |
| 1583 | { |
| 1584 | return alc_cap_getput_caller(kcontrol, ucontrol, |
| 1585 | snd_hda_mixer_amp_switch_get); |
| 1586 | } |
| 1587 | |
| 1588 | static int alc_cap_sw_put(struct snd_kcontrol *kcontrol, |
| 1589 | struct snd_ctl_elem_value *ucontrol) |
| 1590 | { |
| 1591 | return alc_cap_getput_caller(kcontrol, ucontrol, |
| 1592 | snd_hda_mixer_amp_switch_put); |
| 1593 | } |
| 1594 | |
| 1595 | #define DEFINE_CAPMIX(num) \ |
| 1596 | static struct snd_kcontrol_new alc_capture_mixer ## num[] = { \ |
| 1597 | { \ |
| 1598 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \ |
| 1599 | .name = "Capture Switch", \ |
| 1600 | .access = SNDRV_CTL_ELEM_ACCESS_READWRITE, \ |
| 1601 | .count = num, \ |
| 1602 | .info = alc_cap_sw_info, \ |
| 1603 | .get = alc_cap_sw_get, \ |
| 1604 | .put = alc_cap_sw_put, \ |
| 1605 | }, \ |
| 1606 | { \ |
| 1607 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \ |
| 1608 | .name = "Capture Volume", \ |
| 1609 | .access = (SNDRV_CTL_ELEM_ACCESS_READWRITE | \ |
| 1610 | SNDRV_CTL_ELEM_ACCESS_TLV_READ | \ |
| 1611 | SNDRV_CTL_ELEM_ACCESS_TLV_CALLBACK), \ |
| 1612 | .count = num, \ |
| 1613 | .info = alc_cap_vol_info, \ |
| 1614 | .get = alc_cap_vol_get, \ |
| 1615 | .put = alc_cap_vol_put, \ |
| 1616 | .tlv = { .c = alc_cap_vol_tlv }, \ |
| 1617 | }, \ |
Takashi Iwai | 3c3e989 | 2008-10-31 17:48:56 +0100 | [diff] [blame] | 1618 | { \ |
| 1619 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \ |
| 1620 | /* .name = "Capture Source", */ \ |
| 1621 | .name = "Input Source", \ |
| 1622 | .count = num, \ |
| 1623 | .info = alc_mux_enum_info, \ |
| 1624 | .get = alc_mux_enum_get, \ |
| 1625 | .put = alc_mux_enum_put, \ |
| 1626 | }, \ |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 1627 | { } /* end */ \ |
| 1628 | } |
| 1629 | |
| 1630 | /* up to three ADCs */ |
| 1631 | DEFINE_CAPMIX(1); |
| 1632 | DEFINE_CAPMIX(2); |
| 1633 | DEFINE_CAPMIX(3); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1634 | |
| 1635 | |
| 1636 | /* |
| 1637 | * ALC880 5-stack model |
| 1638 | * |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 1639 | * DAC: Front = 0x02 (0x0c), Surr = 0x05 (0x0f), CLFE = 0x04 (0x0d), |
| 1640 | * Side = 0x02 (0xd) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1641 | * Pin assignment: Front = 0x14, Surr = 0x17, CLFE = 0x16 |
| 1642 | * Line-In/Side = 0x1a, Mic = 0x18, F-Mic = 0x1b, HP = 0x19 |
| 1643 | */ |
| 1644 | |
| 1645 | /* additional mixers to alc880_three_stack_mixer */ |
Takashi Iwai | c8b6bf9b | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 1646 | static struct snd_kcontrol_new alc880_five_stack_mixer[] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1647 | HDA_CODEC_VOLUME("Side Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 1648 | HDA_BIND_MUTE("Side Playback Switch", 0x0d, 2, HDA_INPUT), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1649 | { } /* end */ |
| 1650 | }; |
| 1651 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1652 | /* channel source setting (6/8 channel selection for 5-stack) */ |
| 1653 | /* 6ch mode */ |
| 1654 | static struct hda_verb alc880_fivestack_ch6_init[] = { |
| 1655 | /* set line-in to input, mute it */ |
| 1656 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 1657 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
Takashi Iwai | dfc0ff6 | 2005-05-12 14:31:49 +0200 | [diff] [blame] | 1658 | { } /* end */ |
| 1659 | }; |
| 1660 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1661 | /* 8ch mode */ |
| 1662 | static struct hda_verb alc880_fivestack_ch8_init[] = { |
| 1663 | /* set line-in to output, unmute it */ |
| 1664 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 1665 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 1666 | { } /* end */ |
| 1667 | }; |
| 1668 | |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 1669 | static struct hda_channel_mode alc880_fivestack_modes[2] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1670 | { 6, alc880_fivestack_ch6_init }, |
| 1671 | { 8, alc880_fivestack_ch8_init }, |
| 1672 | }; |
| 1673 | |
| 1674 | |
| 1675 | /* |
| 1676 | * ALC880 6-stack model |
| 1677 | * |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 1678 | * DAC: Front = 0x02 (0x0c), Surr = 0x03 (0x0d), CLFE = 0x04 (0x0e), |
| 1679 | * Side = 0x05 (0x0f) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1680 | * Pin assignment: Front = 0x14, Surr = 0x15, CLFE = 0x16, Side = 0x17, |
| 1681 | * Mic = 0x18, F-Mic = 0x19, Line = 0x1a, HP = 0x1b |
| 1682 | */ |
| 1683 | |
| 1684 | static hda_nid_t alc880_6st_dac_nids[4] = { |
| 1685 | /* front, rear, clfe, rear_surr */ |
| 1686 | 0x02, 0x03, 0x04, 0x05 |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 1687 | }; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1688 | |
| 1689 | static struct hda_input_mux alc880_6stack_capture_source = { |
| 1690 | .num_items = 4, |
| 1691 | .items = { |
| 1692 | { "Mic", 0x0 }, |
| 1693 | { "Front Mic", 0x1 }, |
| 1694 | { "Line", 0x2 }, |
| 1695 | { "CD", 0x4 }, |
| 1696 | }, |
| 1697 | }; |
| 1698 | |
| 1699 | /* fixed 8-channels */ |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 1700 | static struct hda_channel_mode alc880_sixstack_modes[1] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1701 | { 8, NULL }, |
| 1702 | }; |
| 1703 | |
Takashi Iwai | c8b6bf9b | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 1704 | static struct snd_kcontrol_new alc880_six_stack_mixer[] = { |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1705 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 1706 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1707 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 1708 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1709 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 1710 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 1711 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 1712 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1713 | HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 1714 | HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1715 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 1716 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 1717 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 1718 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 1719 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 1720 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 1721 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 1722 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1723 | { |
| 1724 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 1725 | .name = "Channel Mode", |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 1726 | .info = alc_ch_mode_info, |
| 1727 | .get = alc_ch_mode_get, |
| 1728 | .put = alc_ch_mode_put, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1729 | }, |
| 1730 | { } /* end */ |
| 1731 | }; |
| 1732 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1733 | |
| 1734 | /* |
| 1735 | * ALC880 W810 model |
| 1736 | * |
| 1737 | * W810 has rear IO for: |
| 1738 | * Front (DAC 02) |
| 1739 | * Surround (DAC 03) |
| 1740 | * Center/LFE (DAC 04) |
| 1741 | * Digital out (06) |
| 1742 | * |
| 1743 | * The system also has a pair of internal speakers, and a headphone jack. |
| 1744 | * 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] | 1745 | * |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1746 | * There is a variable resistor to control the speaker or headphone |
| 1747 | * volume. This is a hardware-only device without a software API. |
| 1748 | * |
| 1749 | * Plugging headphones in will disable the internal speakers. This is |
| 1750 | * implemented in hardware, not via the driver using jack sense. In |
| 1751 | * a similar fashion, plugging into the rear socket marked "front" will |
| 1752 | * disable both the speakers and headphones. |
| 1753 | * |
| 1754 | * For input, there's a microphone jack, and an "audio in" jack. |
| 1755 | * These may not do anything useful with this driver yet, because I |
| 1756 | * haven't setup any initialization verbs for these yet... |
| 1757 | */ |
| 1758 | |
| 1759 | static hda_nid_t alc880_w810_dac_nids[3] = { |
| 1760 | /* front, rear/surround, clfe */ |
| 1761 | 0x02, 0x03, 0x04 |
| 1762 | }; |
| 1763 | |
| 1764 | /* fixed 6 channels */ |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 1765 | static struct hda_channel_mode alc880_w810_modes[1] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1766 | { 6, NULL } |
| 1767 | }; |
| 1768 | |
| 1769 | /* Pin assignment: Front = 0x14, Surr = 0x15, CLFE = 0x16, HP = 0x1b */ |
Takashi Iwai | c8b6bf9b | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 1770 | static struct snd_kcontrol_new alc880_w810_base_mixer[] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1771 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 1772 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1773 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 1774 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1775 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 1776 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 1777 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 1778 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1779 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 1780 | { } /* end */ |
| 1781 | }; |
| 1782 | |
| 1783 | |
| 1784 | /* |
| 1785 | * Z710V model |
| 1786 | * |
| 1787 | * DAC: Front = 0x02 (0x0c), HP = 0x03 (0x0d) |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 1788 | * Pin assignment: Front = 0x14, HP = 0x15, Mic = 0x18, Mic2 = 0x19(?), |
| 1789 | * Line = 0x1a |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1790 | */ |
| 1791 | |
| 1792 | static hda_nid_t alc880_z71v_dac_nids[1] = { |
| 1793 | 0x02 |
| 1794 | }; |
| 1795 | #define ALC880_Z71V_HP_DAC 0x03 |
| 1796 | |
| 1797 | /* fixed 2 channels */ |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 1798 | static struct hda_channel_mode alc880_2_jack_modes[1] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1799 | { 2, NULL } |
| 1800 | }; |
| 1801 | |
Takashi Iwai | c8b6bf9b | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 1802 | static struct snd_kcontrol_new alc880_z71v_mixer[] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1803 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 1804 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1805 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 1806 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT), |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1807 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 1808 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 1809 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 1810 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 1811 | { } /* end */ |
| 1812 | }; |
| 1813 | |
| 1814 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1815 | /* |
| 1816 | * ALC880 F1734 model |
| 1817 | * |
| 1818 | * DAC: HP = 0x02 (0x0c), Front = 0x03 (0x0d) |
| 1819 | * Pin assignment: HP = 0x14, Front = 0x15, Mic = 0x18 |
| 1820 | */ |
| 1821 | |
| 1822 | static hda_nid_t alc880_f1734_dac_nids[1] = { |
| 1823 | 0x03 |
| 1824 | }; |
| 1825 | #define ALC880_F1734_HP_DAC 0x02 |
| 1826 | |
Takashi Iwai | c8b6bf9b | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 1827 | static struct snd_kcontrol_new alc880_f1734_mixer[] = { |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1828 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 1829 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT), |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 1830 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 1831 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1832 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 1833 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
Takashi Iwai | 937b416 | 2008-02-11 14:52:36 +0100 | [diff] [blame] | 1834 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 1835 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1836 | { } /* end */ |
| 1837 | }; |
| 1838 | |
Takashi Iwai | 937b416 | 2008-02-11 14:52:36 +0100 | [diff] [blame] | 1839 | static struct hda_input_mux alc880_f1734_capture_source = { |
| 1840 | .num_items = 2, |
| 1841 | .items = { |
| 1842 | { "Mic", 0x1 }, |
| 1843 | { "CD", 0x4 }, |
| 1844 | }, |
| 1845 | }; |
| 1846 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1847 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1848 | /* |
| 1849 | * ALC880 ASUS model |
| 1850 | * |
| 1851 | * DAC: HP/Front = 0x02 (0x0c), Surr = 0x03 (0x0d), CLFE = 0x04 (0x0e) |
| 1852 | * Pin assignment: HP/Front = 0x14, Surr = 0x15, CLFE = 0x16, |
| 1853 | * Mic = 0x18, Line = 0x1a |
| 1854 | */ |
| 1855 | |
| 1856 | #define alc880_asus_dac_nids alc880_w810_dac_nids /* identical with w810 */ |
| 1857 | #define alc880_asus_modes alc880_threestack_modes /* 2/6 channel mode */ |
| 1858 | |
Takashi Iwai | c8b6bf9b | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 1859 | static struct snd_kcontrol_new alc880_asus_mixer[] = { |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1860 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 1861 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1862 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 1863 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1864 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 1865 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 1866 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 1867 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1868 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 1869 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 1870 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 1871 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 1872 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 1873 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1874 | { |
| 1875 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 1876 | .name = "Channel Mode", |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 1877 | .info = alc_ch_mode_info, |
| 1878 | .get = alc_ch_mode_get, |
| 1879 | .put = alc_ch_mode_put, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1880 | }, |
| 1881 | { } /* end */ |
| 1882 | }; |
| 1883 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1884 | /* |
| 1885 | * ALC880 ASUS W1V model |
| 1886 | * |
| 1887 | * DAC: HP/Front = 0x02 (0x0c), Surr = 0x03 (0x0d), CLFE = 0x04 (0x0e) |
| 1888 | * Pin assignment: HP/Front = 0x14, Surr = 0x15, CLFE = 0x16, |
| 1889 | * Mic = 0x18, Line = 0x1a, Line2 = 0x1b |
| 1890 | */ |
| 1891 | |
| 1892 | /* additional mixers to alc880_asus_mixer */ |
Takashi Iwai | c8b6bf9b | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 1893 | static struct snd_kcontrol_new alc880_asus_w1v_mixer[] = { |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1894 | HDA_CODEC_VOLUME("Line2 Playback Volume", 0x0b, 0x03, HDA_INPUT), |
| 1895 | HDA_CODEC_MUTE("Line2 Playback Switch", 0x0b, 0x03, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1896 | { } /* end */ |
| 1897 | }; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1898 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 1899 | /* TCL S700 */ |
| 1900 | static struct snd_kcontrol_new alc880_tcl_s700_mixer[] = { |
| 1901 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 1902 | HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 1903 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 1904 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0B, 0x04, HDA_INPUT), |
| 1905 | HDA_CODEC_MUTE("CD Playback Switch", 0x0B, 0x04, HDA_INPUT), |
| 1906 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0B, 0x0, HDA_INPUT), |
| 1907 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0B, 0x0, HDA_INPUT), |
| 1908 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 1909 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 1910 | { } /* end */ |
| 1911 | }; |
| 1912 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 1913 | /* Uniwill */ |
| 1914 | static struct snd_kcontrol_new alc880_uniwill_mixer[] = { |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 1915 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 1916 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT), |
| 1917 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 1918 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 1919 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 1920 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 1921 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 1922 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 1923 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 1924 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 1925 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 1926 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 1927 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 1928 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 1929 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 1930 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 1931 | { |
| 1932 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 1933 | .name = "Channel Mode", |
| 1934 | .info = alc_ch_mode_info, |
| 1935 | .get = alc_ch_mode_get, |
| 1936 | .put = alc_ch_mode_put, |
| 1937 | }, |
| 1938 | { } /* end */ |
| 1939 | }; |
| 1940 | |
Tobin Davis | 2cf9f0f | 2007-02-07 16:04:25 +0100 | [diff] [blame] | 1941 | static struct snd_kcontrol_new alc880_fujitsu_mixer[] = { |
| 1942 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 1943 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT), |
| 1944 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 1945 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT), |
| 1946 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 1947 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 1948 | HDA_CODEC_VOLUME("Ext Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 1949 | HDA_CODEC_MUTE("Ext Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 1950 | HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 1951 | HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 1952 | { } /* end */ |
| 1953 | }; |
| 1954 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 1955 | static struct snd_kcontrol_new alc880_uniwill_p53_mixer[] = { |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 1956 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 1957 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT), |
| 1958 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 1959 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 1960 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 1961 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 1962 | { } /* end */ |
| 1963 | }; |
| 1964 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1965 | /* |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 1966 | * virtual master controls |
| 1967 | */ |
| 1968 | |
| 1969 | /* |
| 1970 | * slave controls for virtual master |
| 1971 | */ |
| 1972 | static const char *alc_slave_vols[] = { |
| 1973 | "Front Playback Volume", |
| 1974 | "Surround Playback Volume", |
| 1975 | "Center Playback Volume", |
| 1976 | "LFE Playback Volume", |
| 1977 | "Side Playback Volume", |
| 1978 | "Headphone Playback Volume", |
| 1979 | "Speaker Playback Volume", |
| 1980 | "Mono Playback Volume", |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 1981 | "Line-Out Playback Volume", |
Takashi Iwai | 26f5df2 | 2008-11-03 17:39:46 +0100 | [diff] [blame] | 1982 | "PCM Playback Volume", |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 1983 | NULL, |
| 1984 | }; |
| 1985 | |
| 1986 | static const char *alc_slave_sws[] = { |
| 1987 | "Front Playback Switch", |
| 1988 | "Surround Playback Switch", |
| 1989 | "Center Playback Switch", |
| 1990 | "LFE Playback Switch", |
| 1991 | "Side Playback Switch", |
| 1992 | "Headphone Playback Switch", |
| 1993 | "Speaker Playback Switch", |
| 1994 | "Mono Playback Switch", |
Takashi Iwai | edb54a5 | 2008-01-29 12:47:02 +0100 | [diff] [blame] | 1995 | "IEC958 Playback Switch", |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 1996 | NULL, |
| 1997 | }; |
| 1998 | |
| 1999 | /* |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2000 | * build control elements |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2001 | */ |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 2002 | |
| 2003 | static void alc_free_kctls(struct hda_codec *codec); |
| 2004 | |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 2005 | /* additional beep mixers; the actual parameters are overwritten at build */ |
| 2006 | static struct snd_kcontrol_new alc_beep_mixer[] = { |
| 2007 | HDA_CODEC_VOLUME("Beep Playback Volume", 0, 0, HDA_INPUT), |
| 2008 | HDA_CODEC_MUTE("Beep Playback Switch", 0, 0, HDA_INPUT), |
| 2009 | { } /* end */ |
| 2010 | }; |
| 2011 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2012 | static int alc_build_controls(struct hda_codec *codec) |
| 2013 | { |
| 2014 | struct alc_spec *spec = codec->spec; |
| 2015 | int err; |
| 2016 | int i; |
| 2017 | |
| 2018 | for (i = 0; i < spec->num_mixers; i++) { |
| 2019 | err = snd_hda_add_new_ctls(codec, spec->mixers[i]); |
| 2020 | if (err < 0) |
| 2021 | return err; |
| 2022 | } |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 2023 | if (spec->cap_mixer) { |
| 2024 | err = snd_hda_add_new_ctls(codec, spec->cap_mixer); |
| 2025 | if (err < 0) |
| 2026 | return err; |
| 2027 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2028 | if (spec->multiout.dig_out_nid) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 2029 | err = snd_hda_create_spdif_out_ctls(codec, |
| 2030 | spec->multiout.dig_out_nid); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2031 | if (err < 0) |
| 2032 | return err; |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 2033 | if (!spec->no_analog) { |
| 2034 | err = snd_hda_create_spdif_share_sw(codec, |
| 2035 | &spec->multiout); |
| 2036 | if (err < 0) |
| 2037 | return err; |
| 2038 | spec->multiout.share_spdif = 1; |
| 2039 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2040 | } |
| 2041 | if (spec->dig_in_nid) { |
| 2042 | err = snd_hda_create_spdif_in_ctls(codec, spec->dig_in_nid); |
| 2043 | if (err < 0) |
| 2044 | return err; |
| 2045 | } |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 2046 | |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 2047 | /* create beep controls if needed */ |
| 2048 | if (spec->beep_amp) { |
| 2049 | struct snd_kcontrol_new *knew; |
| 2050 | for (knew = alc_beep_mixer; knew->name; knew++) { |
| 2051 | struct snd_kcontrol *kctl; |
| 2052 | kctl = snd_ctl_new1(knew, codec); |
| 2053 | if (!kctl) |
| 2054 | return -ENOMEM; |
| 2055 | kctl->private_value = spec->beep_amp; |
| 2056 | err = snd_hda_ctl_add(codec, kctl); |
| 2057 | if (err < 0) |
| 2058 | return err; |
| 2059 | } |
| 2060 | } |
| 2061 | |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 2062 | /* if we have no master control, let's create it */ |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 2063 | if (!spec->no_analog && |
| 2064 | !snd_hda_find_mixer_ctl(codec, "Master Playback Volume")) { |
Takashi Iwai | 1c82ed1 | 2008-02-18 13:05:50 +0100 | [diff] [blame] | 2065 | unsigned int vmaster_tlv[4]; |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 2066 | snd_hda_set_vmaster_tlv(codec, spec->vmaster_nid, |
Takashi Iwai | 1c82ed1 | 2008-02-18 13:05:50 +0100 | [diff] [blame] | 2067 | HDA_OUTPUT, vmaster_tlv); |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 2068 | err = snd_hda_add_vmaster(codec, "Master Playback Volume", |
Takashi Iwai | 1c82ed1 | 2008-02-18 13:05:50 +0100 | [diff] [blame] | 2069 | vmaster_tlv, alc_slave_vols); |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 2070 | if (err < 0) |
| 2071 | return err; |
| 2072 | } |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 2073 | if (!spec->no_analog && |
| 2074 | !snd_hda_find_mixer_ctl(codec, "Master Playback Switch")) { |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 2075 | err = snd_hda_add_vmaster(codec, "Master Playback Switch", |
| 2076 | NULL, alc_slave_sws); |
| 2077 | if (err < 0) |
| 2078 | return err; |
| 2079 | } |
| 2080 | |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 2081 | alc_free_kctls(codec); /* no longer needed */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2082 | return 0; |
| 2083 | } |
| 2084 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2085 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2086 | /* |
| 2087 | * initialize the codec volumes, etc |
| 2088 | */ |
| 2089 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2090 | /* |
| 2091 | * generic initialization of ADC, input mixers and output mixers |
| 2092 | */ |
| 2093 | static struct hda_verb alc880_volume_init_verbs[] = { |
| 2094 | /* |
| 2095 | * Unmute ADC0-2 and set the default input to mic-in |
| 2096 | */ |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 2097 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2098 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 2099 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2100 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 2101 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2102 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2103 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2104 | /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback |
| 2105 | * mixer widget |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 2106 | * Note: PASD motherboards uses the Line In 2 as the input for front |
| 2107 | * panel mic (mic 2) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2108 | */ |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2109 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 2110 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 2111 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 2112 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 2113 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 2114 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 2115 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, |
| 2116 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2117 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2118 | /* |
| 2119 | * Set up output mixers (0x0c - 0x0f) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2120 | */ |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2121 | /* set vol=0 to output mixers */ |
| 2122 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 2123 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 2124 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 2125 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 2126 | /* set up input amps for analog loopback */ |
| 2127 | /* Amp Indices: DAC = 0, mixer = 1 */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 2128 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 2129 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 2130 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 2131 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 2132 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 2133 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 2134 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 2135 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2136 | |
| 2137 | { } |
| 2138 | }; |
| 2139 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2140 | /* |
| 2141 | * 3-stack pin configuration: |
| 2142 | * front = 0x14, mic/clfe = 0x18, HP = 0x19, line/surr = 0x1a, f-mic = 0x1b |
| 2143 | */ |
| 2144 | static struct hda_verb alc880_pin_3stack_init_verbs[] = { |
| 2145 | /* |
| 2146 | * preset connection lists of input pins |
| 2147 | * 0 = front, 1 = rear_surr, 2 = CLFE, 3 = surround |
| 2148 | */ |
| 2149 | {0x10, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */ |
| 2150 | {0x11, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 2151 | {0x12, AC_VERB_SET_CONNECT_SEL, 0x03}, /* line/surround */ |
| 2152 | |
| 2153 | /* |
| 2154 | * Set pin mode and muting |
| 2155 | */ |
| 2156 | /* set front pin widgets 0x14 for output */ |
| 2157 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2158 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2159 | /* Mic1 (rear panel) pin widget for input and vref at 80% */ |
| 2160 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 2161 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 2162 | /* Mic2 (as headphone out) for HP output */ |
| 2163 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 2164 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2165 | /* Line In pin widget for input */ |
| 2166 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 2167 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 2168 | /* Line2 (as front mic) pin widget for input and vref at 80% */ |
| 2169 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 2170 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 2171 | /* CD pin widget for input */ |
| 2172 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 2173 | |
| 2174 | { } |
| 2175 | }; |
| 2176 | |
| 2177 | /* |
| 2178 | * 5-stack pin configuration: |
| 2179 | * front = 0x14, surround = 0x17, clfe = 0x16, mic = 0x18, HP = 0x19, |
| 2180 | * line-in/side = 0x1a, f-mic = 0x1b |
| 2181 | */ |
| 2182 | static struct hda_verb alc880_pin_5stack_init_verbs[] = { |
| 2183 | /* |
| 2184 | * preset connection lists of input pins |
| 2185 | * 0 = front, 1 = rear_surr, 2 = CLFE, 3 = surround |
| 2186 | */ |
| 2187 | {0x11, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 2188 | {0x12, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/side */ |
| 2189 | |
| 2190 | /* |
| 2191 | * Set pin mode and muting |
| 2192 | */ |
| 2193 | /* set pin widgets 0x14-0x17 for output */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 2194 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2195 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2196 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2197 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2198 | /* unmute pins for output (no gain on this amp) */ |
| 2199 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2200 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2201 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2202 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2203 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2204 | /* Mic1 (rear panel) pin widget for input and vref at 80% */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2205 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2206 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 2207 | /* Mic2 (as headphone out) for HP output */ |
| 2208 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 2209 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2210 | /* Line In pin widget for input */ |
| 2211 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 2212 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 2213 | /* Line2 (as front mic) pin widget for input and vref at 80% */ |
| 2214 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 2215 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 2216 | /* CD pin widget for input */ |
| 2217 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2218 | |
| 2219 | { } |
| 2220 | }; |
| 2221 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2222 | /* |
| 2223 | * W810 pin configuration: |
| 2224 | * front = 0x14, surround = 0x15, clfe = 0x16, HP = 0x1b |
| 2225 | */ |
| 2226 | static struct hda_verb alc880_pin_w810_init_verbs[] = { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2227 | /* hphone/speaker input selector: front DAC */ |
| 2228 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x0}, |
| 2229 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2230 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2231 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2232 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2233 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2234 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2235 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2236 | |
| 2237 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 2238 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2239 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2240 | { } |
| 2241 | }; |
| 2242 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2243 | /* |
| 2244 | * Z71V pin configuration: |
| 2245 | * Speaker-out = 0x14, HP = 0x15, Mic = 0x18, Line-in = 0x1a, Mic2 = 0x1b (?) |
| 2246 | */ |
| 2247 | static struct hda_verb alc880_pin_z71v_init_verbs[] = { |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 2248 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2249 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 2250 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2251 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | dfc0ff6 | 2005-05-12 14:31:49 +0200 | [diff] [blame] | 2252 | |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2253 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2254 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2255 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2256 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Takashi Iwai | dfc0ff6 | 2005-05-12 14:31:49 +0200 | [diff] [blame] | 2257 | |
| 2258 | { } |
| 2259 | }; |
| 2260 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2261 | /* |
| 2262 | * 6-stack pin configuration: |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 2263 | * front = 0x14, surr = 0x15, clfe = 0x16, side = 0x17, mic = 0x18, |
| 2264 | * f-mic = 0x19, line = 0x1a, HP = 0x1b |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2265 | */ |
| 2266 | static struct hda_verb alc880_pin_6stack_init_verbs[] = { |
| 2267 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 2268 | |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2269 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2270 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2271 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2272 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2273 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2274 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2275 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2276 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2277 | |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2278 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2279 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2280 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2281 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2282 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2283 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2284 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2285 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2286 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 2287 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2288 | { } |
| 2289 | }; |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2290 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 2291 | /* |
| 2292 | * Uniwill pin configuration: |
| 2293 | * HP = 0x14, InternalSpeaker = 0x15, mic = 0x18, internal mic = 0x19, |
| 2294 | * line = 0x1a |
| 2295 | */ |
| 2296 | static struct hda_verb alc880_uniwill_init_verbs[] = { |
| 2297 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 2298 | |
| 2299 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 2300 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2301 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 2302 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2303 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 2304 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2305 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2306 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2307 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 2308 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 2309 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 2310 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 2311 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 2312 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 2313 | |
| 2314 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 2315 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 2316 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 2317 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 2318 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 2319 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 2320 | /* {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, */ |
| 2321 | /* {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, */ |
| 2322 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 2323 | |
| 2324 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 2325 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 2326 | |
| 2327 | { } |
| 2328 | }; |
| 2329 | |
| 2330 | /* |
| 2331 | * Uniwill P53 |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 2332 | * HP = 0x14, InternalSpeaker = 0x15, mic = 0x19, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 2333 | */ |
| 2334 | static struct hda_verb alc880_uniwill_p53_init_verbs[] = { |
| 2335 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 2336 | |
| 2337 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 2338 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2339 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 2340 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2341 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 2342 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2343 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 2344 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 2345 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 2346 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 2347 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 2348 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 2349 | |
| 2350 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 2351 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 2352 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 2353 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 2354 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 2355 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 2356 | |
| 2357 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 2358 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_DCVOL_EVENT}, |
| 2359 | |
| 2360 | { } |
| 2361 | }; |
| 2362 | |
Tobin Davis | 2cf9f0f | 2007-02-07 16:04:25 +0100 | [diff] [blame] | 2363 | static struct hda_verb alc880_beep_init_verbs[] = { |
| 2364 | { 0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(5) }, |
| 2365 | { } |
| 2366 | }; |
| 2367 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 2368 | /* toggle speaker-output according to the hp-jack state */ |
Takashi Iwai | 458a4fa | 2007-05-05 12:18:40 +0200 | [diff] [blame] | 2369 | static void alc880_uniwill_hp_automute(struct hda_codec *codec) |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 2370 | { |
| 2371 | unsigned int present; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 2372 | unsigned char bits; |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 2373 | |
| 2374 | present = snd_hda_codec_read(codec, 0x14, 0, |
| 2375 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 2376 | bits = present ? HDA_AMP_MUTE : 0; |
| 2377 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 2378 | HDA_AMP_MUTE, bits); |
| 2379 | snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0, |
| 2380 | HDA_AMP_MUTE, bits); |
Takashi Iwai | 458a4fa | 2007-05-05 12:18:40 +0200 | [diff] [blame] | 2381 | } |
| 2382 | |
| 2383 | /* auto-toggle front mic */ |
| 2384 | static void alc880_uniwill_mic_automute(struct hda_codec *codec) |
| 2385 | { |
| 2386 | unsigned int present; |
| 2387 | unsigned char bits; |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 2388 | |
| 2389 | present = snd_hda_codec_read(codec, 0x18, 0, |
| 2390 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 2391 | bits = present ? HDA_AMP_MUTE : 0; |
| 2392 | 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] | 2393 | } |
| 2394 | |
| 2395 | static void alc880_uniwill_automute(struct hda_codec *codec) |
| 2396 | { |
| 2397 | alc880_uniwill_hp_automute(codec); |
| 2398 | alc880_uniwill_mic_automute(codec); |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 2399 | } |
| 2400 | |
| 2401 | static void alc880_uniwill_unsol_event(struct hda_codec *codec, |
| 2402 | unsigned int res) |
| 2403 | { |
| 2404 | /* Looks like the unsol event is incompatible with the standard |
| 2405 | * definition. 4bit tag is placed at 28 bit! |
| 2406 | */ |
Takashi Iwai | 458a4fa | 2007-05-05 12:18:40 +0200 | [diff] [blame] | 2407 | switch (res >> 28) { |
| 2408 | case ALC880_HP_EVENT: |
| 2409 | alc880_uniwill_hp_automute(codec); |
| 2410 | break; |
| 2411 | case ALC880_MIC_EVENT: |
| 2412 | alc880_uniwill_mic_automute(codec); |
| 2413 | break; |
| 2414 | } |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 2415 | } |
| 2416 | |
| 2417 | static void alc880_uniwill_p53_hp_automute(struct hda_codec *codec) |
| 2418 | { |
| 2419 | unsigned int present; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 2420 | unsigned char bits; |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 2421 | |
| 2422 | present = snd_hda_codec_read(codec, 0x14, 0, |
| 2423 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 2424 | bits = present ? HDA_AMP_MUTE : 0; |
Jiang zhe | 64654c2 | 2008-04-14 13:26:21 +0200 | [diff] [blame] | 2425 | 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] | 2426 | } |
| 2427 | |
| 2428 | static void alc880_uniwill_p53_dcvol_automute(struct hda_codec *codec) |
| 2429 | { |
| 2430 | unsigned int present; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 2431 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 2432 | present = snd_hda_codec_read(codec, 0x21, 0, |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 2433 | AC_VERB_GET_VOLUME_KNOB_CONTROL, 0); |
| 2434 | present &= HDA_AMP_VOLMASK; |
| 2435 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_OUTPUT, 0, |
| 2436 | HDA_AMP_VOLMASK, present); |
| 2437 | snd_hda_codec_amp_stereo(codec, 0x0d, HDA_OUTPUT, 0, |
| 2438 | HDA_AMP_VOLMASK, present); |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 2439 | } |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 2440 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 2441 | static void alc880_uniwill_p53_unsol_event(struct hda_codec *codec, |
| 2442 | unsigned int res) |
| 2443 | { |
| 2444 | /* Looks like the unsol event is incompatible with the standard |
| 2445 | * definition. 4bit tag is placed at 28 bit! |
| 2446 | */ |
| 2447 | if ((res >> 28) == ALC880_HP_EVENT) |
| 2448 | alc880_uniwill_p53_hp_automute(codec); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 2449 | if ((res >> 28) == ALC880_DCVOL_EVENT) |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 2450 | alc880_uniwill_p53_dcvol_automute(codec); |
| 2451 | } |
| 2452 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2453 | /* |
| 2454 | * F1734 pin configuration: |
| 2455 | * HP = 0x14, speaker-out = 0x15, mic = 0x18 |
| 2456 | */ |
| 2457 | static struct hda_verb alc880_pin_f1734_init_verbs[] = { |
Michael Gruber | ee7a9c7 | 2008-03-10 11:30:59 +0100 | [diff] [blame] | 2458 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x01}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2459 | {0x10, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 2460 | {0x11, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 2461 | {0x12, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 2462 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 2463 | |
| 2464 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 2465 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2466 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2467 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2468 | |
| 2469 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 2470 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Michael Gruber | ee7a9c7 | 2008-03-10 11:30:59 +0100 | [diff] [blame] | 2471 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2472 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 2473 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2474 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2475 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2476 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2477 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2478 | |
Takashi Iwai | 937b416 | 2008-02-11 14:52:36 +0100 | [diff] [blame] | 2479 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_HP_EVENT}, |
| 2480 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_DCVOL_EVENT}, |
| 2481 | |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2482 | { } |
| 2483 | }; |
| 2484 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2485 | /* |
| 2486 | * ASUS pin configuration: |
| 2487 | * HP/front = 0x14, surr = 0x15, clfe = 0x16, mic = 0x18, line = 0x1a |
| 2488 | */ |
| 2489 | static struct hda_verb alc880_pin_asus_init_verbs[] = { |
| 2490 | {0x10, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 2491 | {0x11, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 2492 | {0x12, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 2493 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 2494 | |
| 2495 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 2496 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2497 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2498 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2499 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2500 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2501 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2502 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2503 | |
| 2504 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 2505 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 2506 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 2507 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 2508 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 2509 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 2510 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2511 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2512 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 2513 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2514 | { } |
| 2515 | }; |
| 2516 | |
| 2517 | /* Enable GPIO mask and set output */ |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 2518 | #define alc880_gpio1_init_verbs alc_gpio1_init_verbs |
| 2519 | #define alc880_gpio2_init_verbs alc_gpio2_init_verbs |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2520 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 2521 | /* Clevo m520g init */ |
| 2522 | static struct hda_verb alc880_pin_clevo_init_verbs[] = { |
| 2523 | /* headphone output */ |
| 2524 | {0x11, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 2525 | /* line-out */ |
| 2526 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2527 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2528 | /* Line-in */ |
| 2529 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 2530 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2531 | /* CD */ |
| 2532 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 2533 | {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2534 | /* Mic1 (rear panel) */ |
| 2535 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 2536 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2537 | /* Mic2 (front panel) */ |
| 2538 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 2539 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2540 | /* headphone */ |
| 2541 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 2542 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2543 | /* change to EAPD mode */ |
| 2544 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 2545 | {0x20, AC_VERB_SET_PROC_COEF, 0x3060}, |
| 2546 | |
| 2547 | { } |
| 2548 | }; |
| 2549 | |
| 2550 | static struct hda_verb alc880_pin_tcl_S700_init_verbs[] = { |
Takashi Iwai | 4b146cb | 2006-07-28 14:42:36 +0200 | [diff] [blame] | 2551 | /* change to EAPD mode */ |
| 2552 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 2553 | {0x20, AC_VERB_SET_PROC_COEF, 0x3060}, |
| 2554 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 2555 | /* Headphone output */ |
| 2556 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 2557 | /* Front output*/ |
| 2558 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2559 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 2560 | |
| 2561 | /* Line In pin widget for input */ |
| 2562 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 2563 | /* CD pin widget for input */ |
| 2564 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 2565 | /* Mic1 (rear panel) pin widget for input and vref at 80% */ |
| 2566 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 2567 | |
| 2568 | /* change to EAPD mode */ |
| 2569 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 2570 | {0x20, AC_VERB_SET_PROC_COEF, 0x3070}, |
| 2571 | |
| 2572 | { } |
| 2573 | }; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2574 | |
| 2575 | /* |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 2576 | * LG m1 express dual |
| 2577 | * |
| 2578 | * Pin assignment: |
| 2579 | * Rear Line-In/Out (blue): 0x14 |
| 2580 | * Build-in Mic-In: 0x15 |
| 2581 | * Speaker-out: 0x17 |
| 2582 | * HP-Out (green): 0x1b |
| 2583 | * Mic-In/Out (red): 0x19 |
| 2584 | * SPDIF-Out: 0x1e |
| 2585 | */ |
| 2586 | |
| 2587 | /* To make 5.1 output working (green=Front, blue=Surr, red=CLFE) */ |
| 2588 | static hda_nid_t alc880_lg_dac_nids[3] = { |
| 2589 | 0x05, 0x02, 0x03 |
| 2590 | }; |
| 2591 | |
| 2592 | /* seems analog CD is not working */ |
| 2593 | static struct hda_input_mux alc880_lg_capture_source = { |
| 2594 | .num_items = 3, |
| 2595 | .items = { |
| 2596 | { "Mic", 0x1 }, |
| 2597 | { "Line", 0x5 }, |
| 2598 | { "Internal Mic", 0x6 }, |
| 2599 | }, |
| 2600 | }; |
| 2601 | |
| 2602 | /* 2,4,6 channel modes */ |
| 2603 | static struct hda_verb alc880_lg_ch2_init[] = { |
| 2604 | /* set line-in and mic-in to input */ |
| 2605 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 2606 | { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 2607 | { } |
| 2608 | }; |
| 2609 | |
| 2610 | static struct hda_verb alc880_lg_ch4_init[] = { |
| 2611 | /* set line-in to out and mic-in to input */ |
| 2612 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, |
| 2613 | { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 2614 | { } |
| 2615 | }; |
| 2616 | |
| 2617 | static struct hda_verb alc880_lg_ch6_init[] = { |
| 2618 | /* set line-in and mic-in to output */ |
| 2619 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, |
| 2620 | { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, |
| 2621 | { } |
| 2622 | }; |
| 2623 | |
| 2624 | static struct hda_channel_mode alc880_lg_ch_modes[3] = { |
| 2625 | { 2, alc880_lg_ch2_init }, |
| 2626 | { 4, alc880_lg_ch4_init }, |
| 2627 | { 6, alc880_lg_ch6_init }, |
| 2628 | }; |
| 2629 | |
| 2630 | static struct snd_kcontrol_new alc880_lg_mixer[] = { |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 2631 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
| 2632 | HDA_BIND_MUTE("Front Playback Switch", 0x0f, 2, HDA_INPUT), |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 2633 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 2634 | HDA_BIND_MUTE("Surround Playback Switch", 0x0c, 2, HDA_INPUT), |
| 2635 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0d, 1, 0x0, HDA_OUTPUT), |
| 2636 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0d, 2, 0x0, HDA_OUTPUT), |
| 2637 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0d, 1, 2, HDA_INPUT), |
| 2638 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0d, 2, 2, HDA_INPUT), |
| 2639 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 2640 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 2641 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x06, HDA_INPUT), |
| 2642 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x06, HDA_INPUT), |
| 2643 | HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x07, HDA_INPUT), |
| 2644 | HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x07, HDA_INPUT), |
| 2645 | { |
| 2646 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 2647 | .name = "Channel Mode", |
| 2648 | .info = alc_ch_mode_info, |
| 2649 | .get = alc_ch_mode_get, |
| 2650 | .put = alc_ch_mode_put, |
| 2651 | }, |
| 2652 | { } /* end */ |
| 2653 | }; |
| 2654 | |
| 2655 | static struct hda_verb alc880_lg_init_verbs[] = { |
| 2656 | /* set capture source to mic-in */ |
| 2657 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 2658 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 2659 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 2660 | /* mute all amp mixer inputs */ |
| 2661 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(5)}, |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 2662 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, |
| 2663 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 2664 | /* line-in to input */ |
| 2665 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 2666 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2667 | /* built-in mic */ |
| 2668 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 2669 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2670 | /* speaker-out */ |
| 2671 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 2672 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2673 | /* mic-in to input */ |
| 2674 | {0x11, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 2675 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 2676 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2677 | /* HP-out */ |
| 2678 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x03}, |
| 2679 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 2680 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2681 | /* jack sense */ |
| 2682 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | 0x1}, |
| 2683 | { } |
| 2684 | }; |
| 2685 | |
| 2686 | /* toggle speaker-output according to the hp-jack state */ |
| 2687 | static void alc880_lg_automute(struct hda_codec *codec) |
| 2688 | { |
| 2689 | unsigned int present; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 2690 | unsigned char bits; |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 2691 | |
| 2692 | present = snd_hda_codec_read(codec, 0x1b, 0, |
| 2693 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 2694 | bits = present ? HDA_AMP_MUTE : 0; |
| 2695 | snd_hda_codec_amp_stereo(codec, 0x17, HDA_OUTPUT, 0, |
| 2696 | HDA_AMP_MUTE, bits); |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 2697 | } |
| 2698 | |
| 2699 | static void alc880_lg_unsol_event(struct hda_codec *codec, unsigned int res) |
| 2700 | { |
| 2701 | /* Looks like the unsol event is incompatible with the standard |
| 2702 | * definition. 4bit tag is placed at 28 bit! |
| 2703 | */ |
| 2704 | if ((res >> 28) == 0x01) |
| 2705 | alc880_lg_automute(codec); |
| 2706 | } |
| 2707 | |
| 2708 | /* |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 2709 | * LG LW20 |
| 2710 | * |
| 2711 | * Pin assignment: |
| 2712 | * Speaker-out: 0x14 |
| 2713 | * Mic-In: 0x18 |
Claudio Matsuoka | e4f41da | 2007-07-13 11:51:06 +0200 | [diff] [blame] | 2714 | * Built-in Mic-In: 0x19 |
| 2715 | * Line-In: 0x1b |
| 2716 | * HP-Out: 0x1a |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 2717 | * SPDIF-Out: 0x1e |
| 2718 | */ |
| 2719 | |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 2720 | static struct hda_input_mux alc880_lg_lw_capture_source = { |
Claudio Matsuoka | e4f41da | 2007-07-13 11:51:06 +0200 | [diff] [blame] | 2721 | .num_items = 3, |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 2722 | .items = { |
| 2723 | { "Mic", 0x0 }, |
| 2724 | { "Internal Mic", 0x1 }, |
Claudio Matsuoka | e4f41da | 2007-07-13 11:51:06 +0200 | [diff] [blame] | 2725 | { "Line In", 0x2 }, |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 2726 | }, |
| 2727 | }; |
| 2728 | |
Claudio Matsuoka | 0a8c5da | 2007-07-04 15:17:38 +0200 | [diff] [blame] | 2729 | #define alc880_lg_lw_modes alc880_threestack_modes |
| 2730 | |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 2731 | static struct snd_kcontrol_new alc880_lg_lw_mixer[] = { |
Claudio Matsuoka | 0a8c5da | 2007-07-04 15:17:38 +0200 | [diff] [blame] | 2732 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 2733 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 2734 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
| 2735 | HDA_BIND_MUTE("Surround Playback Switch", 0x0f, 2, HDA_INPUT), |
| 2736 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 2737 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 2738 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 2739 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 2740 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 2741 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 2742 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 2743 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 2744 | HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 2745 | HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
Claudio Matsuoka | 0a8c5da | 2007-07-04 15:17:38 +0200 | [diff] [blame] | 2746 | { |
| 2747 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 2748 | .name = "Channel Mode", |
| 2749 | .info = alc_ch_mode_info, |
| 2750 | .get = alc_ch_mode_get, |
| 2751 | .put = alc_ch_mode_put, |
| 2752 | }, |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 2753 | { } /* end */ |
| 2754 | }; |
| 2755 | |
| 2756 | static struct hda_verb alc880_lg_lw_init_verbs[] = { |
Claudio Matsuoka | 0a8c5da | 2007-07-04 15:17:38 +0200 | [diff] [blame] | 2757 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 2758 | {0x10, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */ |
| 2759 | {0x12, AC_VERB_SET_CONNECT_SEL, 0x03}, /* line/surround */ |
| 2760 | |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 2761 | /* set capture source to mic-in */ |
| 2762 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 2763 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 2764 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 2765 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 2766 | /* speaker-out */ |
| 2767 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 2768 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2769 | /* HP-out */ |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 2770 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 2771 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2772 | /* mic-in to input */ |
| 2773 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 2774 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2775 | /* built-in mic */ |
| 2776 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 2777 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2778 | /* jack sense */ |
| 2779 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | 0x1}, |
| 2780 | { } |
| 2781 | }; |
| 2782 | |
| 2783 | /* toggle speaker-output according to the hp-jack state */ |
| 2784 | static void alc880_lg_lw_automute(struct hda_codec *codec) |
| 2785 | { |
| 2786 | unsigned int present; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 2787 | unsigned char bits; |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 2788 | |
| 2789 | present = snd_hda_codec_read(codec, 0x1b, 0, |
| 2790 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 2791 | bits = present ? HDA_AMP_MUTE : 0; |
| 2792 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 2793 | HDA_AMP_MUTE, bits); |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 2794 | } |
| 2795 | |
| 2796 | static void alc880_lg_lw_unsol_event(struct hda_codec *codec, unsigned int res) |
| 2797 | { |
| 2798 | /* Looks like the unsol event is incompatible with the standard |
| 2799 | * definition. 4bit tag is placed at 28 bit! |
| 2800 | */ |
| 2801 | if ((res >> 28) == 0x01) |
| 2802 | alc880_lg_lw_automute(codec); |
| 2803 | } |
| 2804 | |
Takashi Iwai | df99cd3 | 2008-04-25 15:25:04 +0200 | [diff] [blame] | 2805 | static struct snd_kcontrol_new alc880_medion_rim_mixer[] = { |
| 2806 | HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 2807 | HDA_BIND_MUTE("Master Playback Switch", 0x0c, 2, HDA_INPUT), |
| 2808 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 2809 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 2810 | HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 2811 | HDA_CODEC_MUTE("Internal Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 2812 | { } /* end */ |
| 2813 | }; |
| 2814 | |
| 2815 | static struct hda_input_mux alc880_medion_rim_capture_source = { |
| 2816 | .num_items = 2, |
| 2817 | .items = { |
| 2818 | { "Mic", 0x0 }, |
| 2819 | { "Internal Mic", 0x1 }, |
| 2820 | }, |
| 2821 | }; |
| 2822 | |
| 2823 | static struct hda_verb alc880_medion_rim_init_verbs[] = { |
| 2824 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 2825 | |
| 2826 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 2827 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2828 | |
| 2829 | /* Mic1 (rear panel) pin widget for input and vref at 80% */ |
| 2830 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 2831 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 2832 | /* Mic2 (as headphone out) for HP output */ |
| 2833 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 2834 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 2835 | /* Internal Speaker */ |
| 2836 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2837 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2838 | |
| 2839 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 2840 | {0x20, AC_VERB_SET_PROC_COEF, 0x3060}, |
| 2841 | |
| 2842 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 2843 | { } |
| 2844 | }; |
| 2845 | |
| 2846 | /* toggle speaker-output according to the hp-jack state */ |
| 2847 | static void alc880_medion_rim_automute(struct hda_codec *codec) |
| 2848 | { |
| 2849 | unsigned int present; |
| 2850 | unsigned char bits; |
| 2851 | |
| 2852 | present = snd_hda_codec_read(codec, 0x14, 0, |
| 2853 | AC_VERB_GET_PIN_SENSE, 0) |
| 2854 | & AC_PINSENSE_PRESENCE; |
| 2855 | bits = present ? HDA_AMP_MUTE : 0; |
| 2856 | snd_hda_codec_amp_stereo(codec, 0x1b, HDA_OUTPUT, 0, |
| 2857 | HDA_AMP_MUTE, bits); |
| 2858 | if (present) |
| 2859 | snd_hda_codec_write(codec, 0x01, 0, AC_VERB_SET_GPIO_DATA, 0); |
| 2860 | else |
| 2861 | snd_hda_codec_write(codec, 0x01, 0, AC_VERB_SET_GPIO_DATA, 2); |
| 2862 | } |
| 2863 | |
| 2864 | static void alc880_medion_rim_unsol_event(struct hda_codec *codec, |
| 2865 | unsigned int res) |
| 2866 | { |
| 2867 | /* Looks like the unsol event is incompatible with the standard |
| 2868 | * definition. 4bit tag is placed at 28 bit! |
| 2869 | */ |
| 2870 | if ((res >> 28) == ALC880_HP_EVENT) |
| 2871 | alc880_medion_rim_automute(codec); |
| 2872 | } |
| 2873 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 2874 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 2875 | static struct hda_amp_list alc880_loopbacks[] = { |
| 2876 | { 0x0b, HDA_INPUT, 0 }, |
| 2877 | { 0x0b, HDA_INPUT, 1 }, |
| 2878 | { 0x0b, HDA_INPUT, 2 }, |
| 2879 | { 0x0b, HDA_INPUT, 3 }, |
| 2880 | { 0x0b, HDA_INPUT, 4 }, |
| 2881 | { } /* end */ |
| 2882 | }; |
| 2883 | |
| 2884 | static struct hda_amp_list alc880_lg_loopbacks[] = { |
| 2885 | { 0x0b, HDA_INPUT, 1 }, |
| 2886 | { 0x0b, HDA_INPUT, 6 }, |
| 2887 | { 0x0b, HDA_INPUT, 7 }, |
| 2888 | { } /* end */ |
| 2889 | }; |
| 2890 | #endif |
| 2891 | |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 2892 | /* |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 2893 | * Common callbacks |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2894 | */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2895 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2896 | static int alc_init(struct hda_codec *codec) |
| 2897 | { |
| 2898 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2899 | unsigned int i; |
| 2900 | |
Takashi Iwai | 2c3bf9a | 2008-06-04 12:39:38 +0200 | [diff] [blame] | 2901 | alc_fix_pll(codec); |
Takashi Iwai | 1082c74 | 2008-08-22 15:24:22 +0200 | [diff] [blame] | 2902 | if (codec->vendor_id == 0x10ec0888) |
| 2903 | alc888_coef_init(codec); |
Takashi Iwai | 2c3bf9a | 2008-06-04 12:39:38 +0200 | [diff] [blame] | 2904 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2905 | for (i = 0; i < spec->num_init_verbs; i++) |
| 2906 | snd_hda_sequence_write(codec, spec->init_verbs[i]); |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 2907 | |
| 2908 | if (spec->init_hook) |
| 2909 | spec->init_hook(codec); |
| 2910 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2911 | return 0; |
| 2912 | } |
| 2913 | |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 2914 | static void alc_unsol_event(struct hda_codec *codec, unsigned int res) |
| 2915 | { |
| 2916 | struct alc_spec *spec = codec->spec; |
| 2917 | |
| 2918 | if (spec->unsol_event) |
| 2919 | spec->unsol_event(codec, res); |
| 2920 | } |
| 2921 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 2922 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 2923 | static int alc_check_power_status(struct hda_codec *codec, hda_nid_t nid) |
| 2924 | { |
| 2925 | struct alc_spec *spec = codec->spec; |
| 2926 | return snd_hda_check_amp_list_power(codec, &spec->loopback, nid); |
| 2927 | } |
| 2928 | #endif |
| 2929 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2930 | /* |
| 2931 | * Analog playback callbacks |
| 2932 | */ |
| 2933 | static int alc880_playback_pcm_open(struct hda_pcm_stream *hinfo, |
| 2934 | struct hda_codec *codec, |
Takashi Iwai | c8b6bf9b | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 2935 | struct snd_pcm_substream *substream) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2936 | { |
| 2937 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 9a08160 | 2008-02-12 18:37:26 +0100 | [diff] [blame] | 2938 | return snd_hda_multi_out_analog_open(codec, &spec->multiout, substream, |
| 2939 | hinfo); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2940 | } |
| 2941 | |
| 2942 | static int alc880_playback_pcm_prepare(struct hda_pcm_stream *hinfo, |
| 2943 | struct hda_codec *codec, |
| 2944 | unsigned int stream_tag, |
| 2945 | unsigned int format, |
Takashi Iwai | c8b6bf9b | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 2946 | struct snd_pcm_substream *substream) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2947 | { |
| 2948 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 2949 | return snd_hda_multi_out_analog_prepare(codec, &spec->multiout, |
| 2950 | stream_tag, format, substream); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2951 | } |
| 2952 | |
| 2953 | static int alc880_playback_pcm_cleanup(struct hda_pcm_stream *hinfo, |
| 2954 | struct hda_codec *codec, |
Takashi Iwai | c8b6bf9b | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 2955 | struct snd_pcm_substream *substream) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2956 | { |
| 2957 | struct alc_spec *spec = codec->spec; |
| 2958 | return snd_hda_multi_out_analog_cleanup(codec, &spec->multiout); |
| 2959 | } |
| 2960 | |
| 2961 | /* |
| 2962 | * Digital out |
| 2963 | */ |
| 2964 | static int alc880_dig_playback_pcm_open(struct hda_pcm_stream *hinfo, |
| 2965 | struct hda_codec *codec, |
Takashi Iwai | c8b6bf9b | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 2966 | struct snd_pcm_substream *substream) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2967 | { |
| 2968 | struct alc_spec *spec = codec->spec; |
| 2969 | return snd_hda_multi_out_dig_open(codec, &spec->multiout); |
| 2970 | } |
| 2971 | |
Takashi Iwai | 6b97eb4 | 2007-04-05 14:51:48 +0200 | [diff] [blame] | 2972 | static int alc880_dig_playback_pcm_prepare(struct hda_pcm_stream *hinfo, |
| 2973 | struct hda_codec *codec, |
| 2974 | unsigned int stream_tag, |
| 2975 | unsigned int format, |
| 2976 | struct snd_pcm_substream *substream) |
| 2977 | { |
| 2978 | struct alc_spec *spec = codec->spec; |
| 2979 | return snd_hda_multi_out_dig_prepare(codec, &spec->multiout, |
| 2980 | stream_tag, format, substream); |
| 2981 | } |
| 2982 | |
Takashi Iwai | 9b5f12e | 2009-02-13 11:47:37 +0100 | [diff] [blame] | 2983 | static int alc880_dig_playback_pcm_cleanup(struct hda_pcm_stream *hinfo, |
| 2984 | struct hda_codec *codec, |
| 2985 | struct snd_pcm_substream *substream) |
| 2986 | { |
| 2987 | struct alc_spec *spec = codec->spec; |
| 2988 | return snd_hda_multi_out_dig_cleanup(codec, &spec->multiout); |
| 2989 | } |
| 2990 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2991 | static int alc880_dig_playback_pcm_close(struct hda_pcm_stream *hinfo, |
| 2992 | struct hda_codec *codec, |
Takashi Iwai | c8b6bf9b | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 2993 | struct snd_pcm_substream *substream) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2994 | { |
| 2995 | struct alc_spec *spec = codec->spec; |
| 2996 | return snd_hda_multi_out_dig_close(codec, &spec->multiout); |
| 2997 | } |
| 2998 | |
| 2999 | /* |
| 3000 | * Analog capture |
| 3001 | */ |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 3002 | static int alc880_alt_capture_pcm_prepare(struct hda_pcm_stream *hinfo, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3003 | struct hda_codec *codec, |
| 3004 | unsigned int stream_tag, |
| 3005 | unsigned int format, |
Takashi Iwai | c8b6bf9b | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 3006 | struct snd_pcm_substream *substream) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3007 | { |
| 3008 | struct alc_spec *spec = codec->spec; |
| 3009 | |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 3010 | snd_hda_codec_setup_stream(codec, spec->adc_nids[substream->number + 1], |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3011 | stream_tag, 0, format); |
| 3012 | return 0; |
| 3013 | } |
| 3014 | |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 3015 | static int alc880_alt_capture_pcm_cleanup(struct hda_pcm_stream *hinfo, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3016 | struct hda_codec *codec, |
Takashi Iwai | c8b6bf9b | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 3017 | struct snd_pcm_substream *substream) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3018 | { |
| 3019 | struct alc_spec *spec = codec->spec; |
| 3020 | |
Takashi Iwai | 888afa1 | 2008-03-18 09:57:50 +0100 | [diff] [blame] | 3021 | snd_hda_codec_cleanup_stream(codec, |
| 3022 | spec->adc_nids[substream->number + 1]); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3023 | return 0; |
| 3024 | } |
| 3025 | |
| 3026 | |
| 3027 | /* |
| 3028 | */ |
| 3029 | static struct hda_pcm_stream alc880_pcm_analog_playback = { |
| 3030 | .substreams = 1, |
| 3031 | .channels_min = 2, |
| 3032 | .channels_max = 8, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3033 | /* NID is set in alc_build_pcms */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3034 | .ops = { |
| 3035 | .open = alc880_playback_pcm_open, |
| 3036 | .prepare = alc880_playback_pcm_prepare, |
| 3037 | .cleanup = alc880_playback_pcm_cleanup |
| 3038 | }, |
| 3039 | }; |
| 3040 | |
| 3041 | static struct hda_pcm_stream alc880_pcm_analog_capture = { |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 3042 | .substreams = 1, |
| 3043 | .channels_min = 2, |
| 3044 | .channels_max = 2, |
| 3045 | /* NID is set in alc_build_pcms */ |
| 3046 | }; |
| 3047 | |
| 3048 | static struct hda_pcm_stream alc880_pcm_analog_alt_playback = { |
| 3049 | .substreams = 1, |
| 3050 | .channels_min = 2, |
| 3051 | .channels_max = 2, |
| 3052 | /* NID is set in alc_build_pcms */ |
| 3053 | }; |
| 3054 | |
| 3055 | static struct hda_pcm_stream alc880_pcm_analog_alt_capture = { |
| 3056 | .substreams = 2, /* can be overridden */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3057 | .channels_min = 2, |
| 3058 | .channels_max = 2, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3059 | /* NID is set in alc_build_pcms */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3060 | .ops = { |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 3061 | .prepare = alc880_alt_capture_pcm_prepare, |
| 3062 | .cleanup = alc880_alt_capture_pcm_cleanup |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3063 | }, |
| 3064 | }; |
| 3065 | |
| 3066 | static struct hda_pcm_stream alc880_pcm_digital_playback = { |
| 3067 | .substreams = 1, |
| 3068 | .channels_min = 2, |
| 3069 | .channels_max = 2, |
| 3070 | /* NID is set in alc_build_pcms */ |
| 3071 | .ops = { |
| 3072 | .open = alc880_dig_playback_pcm_open, |
Takashi Iwai | 6b97eb4 | 2007-04-05 14:51:48 +0200 | [diff] [blame] | 3073 | .close = alc880_dig_playback_pcm_close, |
Takashi Iwai | 9b5f12e | 2009-02-13 11:47:37 +0100 | [diff] [blame] | 3074 | .prepare = alc880_dig_playback_pcm_prepare, |
| 3075 | .cleanup = alc880_dig_playback_pcm_cleanup |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3076 | }, |
| 3077 | }; |
| 3078 | |
| 3079 | static struct hda_pcm_stream alc880_pcm_digital_capture = { |
| 3080 | .substreams = 1, |
| 3081 | .channels_min = 2, |
| 3082 | .channels_max = 2, |
| 3083 | /* NID is set in alc_build_pcms */ |
| 3084 | }; |
| 3085 | |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 3086 | /* 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] | 3087 | static struct hda_pcm_stream alc_pcm_null_stream = { |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 3088 | .substreams = 0, |
| 3089 | .channels_min = 0, |
| 3090 | .channels_max = 0, |
| 3091 | }; |
| 3092 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3093 | static int alc_build_pcms(struct hda_codec *codec) |
| 3094 | { |
| 3095 | struct alc_spec *spec = codec->spec; |
| 3096 | struct hda_pcm *info = spec->pcm_rec; |
| 3097 | int i; |
| 3098 | |
| 3099 | codec->num_pcms = 1; |
| 3100 | codec->pcm_info = info; |
| 3101 | |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 3102 | if (spec->no_analog) |
| 3103 | goto skip_analog; |
| 3104 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3105 | info->name = spec->stream_name_analog; |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 3106 | if (spec->stream_analog_playback) { |
Takashi Iwai | da3cec3 | 2008-08-08 17:12:14 +0200 | [diff] [blame] | 3107 | if (snd_BUG_ON(!spec->multiout.dac_nids)) |
| 3108 | return -EINVAL; |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 3109 | info->stream[SNDRV_PCM_STREAM_PLAYBACK] = *(spec->stream_analog_playback); |
| 3110 | info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = spec->multiout.dac_nids[0]; |
| 3111 | } |
| 3112 | if (spec->stream_analog_capture) { |
Takashi Iwai | da3cec3 | 2008-08-08 17:12:14 +0200 | [diff] [blame] | 3113 | if (snd_BUG_ON(!spec->adc_nids)) |
| 3114 | return -EINVAL; |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 3115 | info->stream[SNDRV_PCM_STREAM_CAPTURE] = *(spec->stream_analog_capture); |
| 3116 | info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = spec->adc_nids[0]; |
| 3117 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3118 | |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 3119 | if (spec->channel_mode) { |
| 3120 | info->stream[SNDRV_PCM_STREAM_PLAYBACK].channels_max = 0; |
| 3121 | for (i = 0; i < spec->num_channel_mode; i++) { |
| 3122 | if (spec->channel_mode[i].channels > info->stream[SNDRV_PCM_STREAM_PLAYBACK].channels_max) { |
| 3123 | info->stream[SNDRV_PCM_STREAM_PLAYBACK].channels_max = spec->channel_mode[i].channels; |
| 3124 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3125 | } |
| 3126 | } |
| 3127 | |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 3128 | skip_analog: |
Takashi Iwai | e08a007 | 2006-09-07 17:52:14 +0200 | [diff] [blame] | 3129 | /* SPDIF for stream index #1 */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3130 | if (spec->multiout.dig_out_nid || spec->dig_in_nid) { |
Takashi Iwai | e08a007 | 2006-09-07 17:52:14 +0200 | [diff] [blame] | 3131 | codec->num_pcms = 2; |
Wu Fengguang | b25c9da | 2009-02-06 15:02:27 +0800 | [diff] [blame] | 3132 | codec->slave_dig_outs = spec->multiout.slave_dig_outs; |
Takashi Iwai | c06134d | 2006-10-11 18:49:13 +0200 | [diff] [blame] | 3133 | info = spec->pcm_rec + 1; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3134 | info->name = spec->stream_name_digital; |
Takashi Iwai | 8c44198 | 2009-01-20 18:30:20 +0100 | [diff] [blame] | 3135 | if (spec->dig_out_type) |
| 3136 | info->pcm_type = spec->dig_out_type; |
| 3137 | else |
| 3138 | info->pcm_type = HDA_PCM_TYPE_SPDIF; |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 3139 | if (spec->multiout.dig_out_nid && |
| 3140 | spec->stream_digital_playback) { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3141 | info->stream[SNDRV_PCM_STREAM_PLAYBACK] = *(spec->stream_digital_playback); |
| 3142 | info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = spec->multiout.dig_out_nid; |
| 3143 | } |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 3144 | if (spec->dig_in_nid && |
| 3145 | spec->stream_digital_capture) { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3146 | info->stream[SNDRV_PCM_STREAM_CAPTURE] = *(spec->stream_digital_capture); |
| 3147 | info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = spec->dig_in_nid; |
| 3148 | } |
Takashi Iwai | 963f803 | 2008-08-11 10:04:40 +0200 | [diff] [blame] | 3149 | /* FIXME: do we need this for all Realtek codec models? */ |
| 3150 | codec->spdif_status_reset = 1; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3151 | } |
| 3152 | |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 3153 | if (spec->no_analog) |
| 3154 | return 0; |
| 3155 | |
Takashi Iwai | e08a007 | 2006-09-07 17:52:14 +0200 | [diff] [blame] | 3156 | /* If the use of more than one ADC is requested for the current |
| 3157 | * model, configure a second analog capture-only PCM. |
| 3158 | */ |
| 3159 | /* Additional Analaog capture for index #2 */ |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 3160 | if ((spec->alt_dac_nid && spec->stream_analog_alt_playback) || |
| 3161 | (spec->num_adc_nids > 1 && spec->stream_analog_alt_capture)) { |
Takashi Iwai | e08a007 | 2006-09-07 17:52:14 +0200 | [diff] [blame] | 3162 | codec->num_pcms = 3; |
Takashi Iwai | c06134d | 2006-10-11 18:49:13 +0200 | [diff] [blame] | 3163 | info = spec->pcm_rec + 2; |
Takashi Iwai | e08a007 | 2006-09-07 17:52:14 +0200 | [diff] [blame] | 3164 | info->name = spec->stream_name_analog; |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 3165 | if (spec->alt_dac_nid) { |
| 3166 | info->stream[SNDRV_PCM_STREAM_PLAYBACK] = |
| 3167 | *spec->stream_analog_alt_playback; |
| 3168 | info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = |
| 3169 | spec->alt_dac_nid; |
| 3170 | } else { |
| 3171 | info->stream[SNDRV_PCM_STREAM_PLAYBACK] = |
| 3172 | alc_pcm_null_stream; |
| 3173 | info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = 0; |
| 3174 | } |
| 3175 | if (spec->num_adc_nids > 1) { |
| 3176 | info->stream[SNDRV_PCM_STREAM_CAPTURE] = |
| 3177 | *spec->stream_analog_alt_capture; |
| 3178 | info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = |
| 3179 | spec->adc_nids[1]; |
| 3180 | info->stream[SNDRV_PCM_STREAM_CAPTURE].substreams = |
| 3181 | spec->num_adc_nids - 1; |
| 3182 | } else { |
| 3183 | info->stream[SNDRV_PCM_STREAM_CAPTURE] = |
| 3184 | alc_pcm_null_stream; |
| 3185 | info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = 0; |
Takashi Iwai | e08a007 | 2006-09-07 17:52:14 +0200 | [diff] [blame] | 3186 | } |
| 3187 | } |
| 3188 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3189 | return 0; |
| 3190 | } |
| 3191 | |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 3192 | static void alc_free_kctls(struct hda_codec *codec) |
| 3193 | { |
| 3194 | struct alc_spec *spec = codec->spec; |
| 3195 | |
| 3196 | if (spec->kctls.list) { |
| 3197 | struct snd_kcontrol_new *kctl = spec->kctls.list; |
| 3198 | int i; |
| 3199 | for (i = 0; i < spec->kctls.used; i++) |
| 3200 | kfree(kctl[i].name); |
| 3201 | } |
| 3202 | snd_array_free(&spec->kctls); |
| 3203 | } |
| 3204 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3205 | static void alc_free(struct hda_codec *codec) |
| 3206 | { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3207 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3208 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3209 | if (!spec) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3210 | return; |
| 3211 | |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 3212 | alc_free_kctls(codec); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3213 | kfree(spec); |
Kusanagi Kouichi | 680cd53 | 2009-02-05 00:00:58 +0900 | [diff] [blame] | 3214 | snd_hda_detach_beep_device(codec); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3215 | } |
| 3216 | |
Takashi Iwai | e044c39 | 2008-10-27 16:56:24 +0100 | [diff] [blame] | 3217 | #ifdef SND_HDA_NEEDS_RESUME |
| 3218 | static void store_pin_configs(struct hda_codec *codec) |
| 3219 | { |
| 3220 | struct alc_spec *spec = codec->spec; |
| 3221 | hda_nid_t nid, end_nid; |
| 3222 | |
| 3223 | end_nid = codec->start_nid + codec->num_nodes; |
| 3224 | for (nid = codec->start_nid; nid < end_nid; nid++) { |
| 3225 | unsigned int wid_caps = get_wcaps(codec, nid); |
| 3226 | unsigned int wid_type = |
| 3227 | (wid_caps & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT; |
| 3228 | if (wid_type != AC_WID_PIN) |
| 3229 | continue; |
| 3230 | if (spec->num_pins >= ARRAY_SIZE(spec->pin_nids)) |
| 3231 | break; |
| 3232 | spec->pin_nids[spec->num_pins] = nid; |
| 3233 | spec->pin_cfgs[spec->num_pins] = |
| 3234 | snd_hda_codec_read(codec, nid, 0, |
| 3235 | AC_VERB_GET_CONFIG_DEFAULT, 0); |
| 3236 | spec->num_pins++; |
| 3237 | } |
| 3238 | } |
| 3239 | |
| 3240 | static void resume_pin_configs(struct hda_codec *codec) |
| 3241 | { |
| 3242 | struct alc_spec *spec = codec->spec; |
| 3243 | int i; |
| 3244 | |
| 3245 | for (i = 0; i < spec->num_pins; i++) { |
| 3246 | hda_nid_t pin_nid = spec->pin_nids[i]; |
| 3247 | unsigned int pin_config = spec->pin_cfgs[i]; |
| 3248 | snd_hda_codec_write(codec, pin_nid, 0, |
| 3249 | AC_VERB_SET_CONFIG_DEFAULT_BYTES_0, |
| 3250 | pin_config & 0x000000ff); |
| 3251 | snd_hda_codec_write(codec, pin_nid, 0, |
| 3252 | AC_VERB_SET_CONFIG_DEFAULT_BYTES_1, |
| 3253 | (pin_config & 0x0000ff00) >> 8); |
| 3254 | snd_hda_codec_write(codec, pin_nid, 0, |
| 3255 | AC_VERB_SET_CONFIG_DEFAULT_BYTES_2, |
| 3256 | (pin_config & 0x00ff0000) >> 16); |
| 3257 | snd_hda_codec_write(codec, pin_nid, 0, |
| 3258 | AC_VERB_SET_CONFIG_DEFAULT_BYTES_3, |
| 3259 | pin_config >> 24); |
| 3260 | } |
| 3261 | } |
| 3262 | |
| 3263 | static int alc_resume(struct hda_codec *codec) |
| 3264 | { |
| 3265 | resume_pin_configs(codec); |
| 3266 | codec->patch_ops.init(codec); |
| 3267 | snd_hda_codec_resume_amp(codec); |
| 3268 | snd_hda_codec_resume_cache(codec); |
| 3269 | return 0; |
| 3270 | } |
| 3271 | #else |
| 3272 | #define store_pin_configs(codec) |
| 3273 | #endif |
| 3274 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3275 | /* |
| 3276 | */ |
| 3277 | static struct hda_codec_ops alc_patch_ops = { |
| 3278 | .build_controls = alc_build_controls, |
| 3279 | .build_pcms = alc_build_pcms, |
| 3280 | .init = alc_init, |
| 3281 | .free = alc_free, |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 3282 | .unsol_event = alc_unsol_event, |
Takashi Iwai | e044c39 | 2008-10-27 16:56:24 +0100 | [diff] [blame] | 3283 | #ifdef SND_HDA_NEEDS_RESUME |
| 3284 | .resume = alc_resume, |
| 3285 | #endif |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 3286 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 3287 | .check_power_status = alc_check_power_status, |
| 3288 | #endif |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3289 | }; |
| 3290 | |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3291 | |
| 3292 | /* |
| 3293 | * Test configuration for debugging |
| 3294 | * |
| 3295 | * Almost all inputs/outputs are enabled. I/O pins can be configured via |
| 3296 | * enum controls. |
| 3297 | */ |
| 3298 | #ifdef CONFIG_SND_DEBUG |
| 3299 | static hda_nid_t alc880_test_dac_nids[4] = { |
| 3300 | 0x02, 0x03, 0x04, 0x05 |
| 3301 | }; |
| 3302 | |
| 3303 | static struct hda_input_mux alc880_test_capture_source = { |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 3304 | .num_items = 7, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3305 | .items = { |
| 3306 | { "In-1", 0x0 }, |
| 3307 | { "In-2", 0x1 }, |
| 3308 | { "In-3", 0x2 }, |
| 3309 | { "In-4", 0x3 }, |
| 3310 | { "CD", 0x4 }, |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 3311 | { "Front", 0x5 }, |
| 3312 | { "Surround", 0x6 }, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3313 | }, |
| 3314 | }; |
| 3315 | |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 3316 | static struct hda_channel_mode alc880_test_modes[4] = { |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3317 | { 2, NULL }, |
Takashi Iwai | fd2c326 | 2005-05-13 17:18:42 +0200 | [diff] [blame] | 3318 | { 4, NULL }, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3319 | { 6, NULL }, |
Takashi Iwai | fd2c326 | 2005-05-13 17:18:42 +0200 | [diff] [blame] | 3320 | { 8, NULL }, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3321 | }; |
| 3322 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 3323 | static int alc_test_pin_ctl_info(struct snd_kcontrol *kcontrol, |
| 3324 | struct snd_ctl_elem_info *uinfo) |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3325 | { |
| 3326 | static char *texts[] = { |
| 3327 | "N/A", "Line Out", "HP Out", |
| 3328 | "In Hi-Z", "In 50%", "In Grd", "In 80%", "In 100%" |
| 3329 | }; |
| 3330 | uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED; |
| 3331 | uinfo->count = 1; |
| 3332 | uinfo->value.enumerated.items = 8; |
| 3333 | if (uinfo->value.enumerated.item >= 8) |
| 3334 | uinfo->value.enumerated.item = 7; |
| 3335 | strcpy(uinfo->value.enumerated.name, texts[uinfo->value.enumerated.item]); |
| 3336 | return 0; |
| 3337 | } |
| 3338 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 3339 | static int alc_test_pin_ctl_get(struct snd_kcontrol *kcontrol, |
| 3340 | struct snd_ctl_elem_value *ucontrol) |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3341 | { |
| 3342 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 3343 | hda_nid_t nid = (hda_nid_t)kcontrol->private_value; |
| 3344 | unsigned int pin_ctl, item = 0; |
| 3345 | |
| 3346 | pin_ctl = snd_hda_codec_read(codec, nid, 0, |
| 3347 | AC_VERB_GET_PIN_WIDGET_CONTROL, 0); |
| 3348 | if (pin_ctl & AC_PINCTL_OUT_EN) { |
| 3349 | if (pin_ctl & AC_PINCTL_HP_EN) |
| 3350 | item = 2; |
| 3351 | else |
| 3352 | item = 1; |
| 3353 | } else if (pin_ctl & AC_PINCTL_IN_EN) { |
| 3354 | switch (pin_ctl & AC_PINCTL_VREFEN) { |
| 3355 | case AC_PINCTL_VREF_HIZ: item = 3; break; |
| 3356 | case AC_PINCTL_VREF_50: item = 4; break; |
| 3357 | case AC_PINCTL_VREF_GRD: item = 5; break; |
| 3358 | case AC_PINCTL_VREF_80: item = 6; break; |
| 3359 | case AC_PINCTL_VREF_100: item = 7; break; |
| 3360 | } |
| 3361 | } |
| 3362 | ucontrol->value.enumerated.item[0] = item; |
| 3363 | return 0; |
| 3364 | } |
| 3365 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 3366 | static int alc_test_pin_ctl_put(struct snd_kcontrol *kcontrol, |
| 3367 | struct snd_ctl_elem_value *ucontrol) |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3368 | { |
| 3369 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 3370 | hda_nid_t nid = (hda_nid_t)kcontrol->private_value; |
| 3371 | static unsigned int ctls[] = { |
| 3372 | 0, AC_PINCTL_OUT_EN, AC_PINCTL_OUT_EN | AC_PINCTL_HP_EN, |
| 3373 | AC_PINCTL_IN_EN | AC_PINCTL_VREF_HIZ, |
| 3374 | AC_PINCTL_IN_EN | AC_PINCTL_VREF_50, |
| 3375 | AC_PINCTL_IN_EN | AC_PINCTL_VREF_GRD, |
| 3376 | AC_PINCTL_IN_EN | AC_PINCTL_VREF_80, |
| 3377 | AC_PINCTL_IN_EN | AC_PINCTL_VREF_100, |
| 3378 | }; |
| 3379 | unsigned int old_ctl, new_ctl; |
| 3380 | |
| 3381 | old_ctl = snd_hda_codec_read(codec, nid, 0, |
| 3382 | AC_VERB_GET_PIN_WIDGET_CONTROL, 0); |
| 3383 | new_ctl = ctls[ucontrol->value.enumerated.item[0]]; |
| 3384 | if (old_ctl != new_ctl) { |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 3385 | int val; |
| 3386 | snd_hda_codec_write_cache(codec, nid, 0, |
| 3387 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 3388 | new_ctl); |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 3389 | val = ucontrol->value.enumerated.item[0] >= 3 ? |
| 3390 | HDA_AMP_MUTE : 0; |
| 3391 | snd_hda_codec_amp_stereo(codec, nid, HDA_OUTPUT, 0, |
| 3392 | HDA_AMP_MUTE, val); |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3393 | return 1; |
| 3394 | } |
| 3395 | return 0; |
| 3396 | } |
| 3397 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 3398 | static int alc_test_pin_src_info(struct snd_kcontrol *kcontrol, |
| 3399 | struct snd_ctl_elem_info *uinfo) |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3400 | { |
| 3401 | static char *texts[] = { |
| 3402 | "Front", "Surround", "CLFE", "Side" |
| 3403 | }; |
| 3404 | uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED; |
| 3405 | uinfo->count = 1; |
| 3406 | uinfo->value.enumerated.items = 4; |
| 3407 | if (uinfo->value.enumerated.item >= 4) |
| 3408 | uinfo->value.enumerated.item = 3; |
| 3409 | strcpy(uinfo->value.enumerated.name, texts[uinfo->value.enumerated.item]); |
| 3410 | return 0; |
| 3411 | } |
| 3412 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 3413 | static int alc_test_pin_src_get(struct snd_kcontrol *kcontrol, |
| 3414 | struct snd_ctl_elem_value *ucontrol) |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3415 | { |
| 3416 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 3417 | hda_nid_t nid = (hda_nid_t)kcontrol->private_value; |
| 3418 | unsigned int sel; |
| 3419 | |
| 3420 | sel = snd_hda_codec_read(codec, nid, 0, AC_VERB_GET_CONNECT_SEL, 0); |
| 3421 | ucontrol->value.enumerated.item[0] = sel & 3; |
| 3422 | return 0; |
| 3423 | } |
| 3424 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 3425 | static int alc_test_pin_src_put(struct snd_kcontrol *kcontrol, |
| 3426 | struct snd_ctl_elem_value *ucontrol) |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3427 | { |
| 3428 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 3429 | hda_nid_t nid = (hda_nid_t)kcontrol->private_value; |
| 3430 | unsigned int sel; |
| 3431 | |
| 3432 | sel = snd_hda_codec_read(codec, nid, 0, AC_VERB_GET_CONNECT_SEL, 0) & 3; |
| 3433 | if (ucontrol->value.enumerated.item[0] != sel) { |
| 3434 | sel = ucontrol->value.enumerated.item[0] & 3; |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 3435 | snd_hda_codec_write_cache(codec, nid, 0, |
| 3436 | AC_VERB_SET_CONNECT_SEL, sel); |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3437 | return 1; |
| 3438 | } |
| 3439 | return 0; |
| 3440 | } |
| 3441 | |
| 3442 | #define PIN_CTL_TEST(xname,nid) { \ |
| 3443 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \ |
| 3444 | .name = xname, \ |
| 3445 | .info = alc_test_pin_ctl_info, \ |
| 3446 | .get = alc_test_pin_ctl_get, \ |
| 3447 | .put = alc_test_pin_ctl_put, \ |
| 3448 | .private_value = nid \ |
| 3449 | } |
| 3450 | |
| 3451 | #define PIN_SRC_TEST(xname,nid) { \ |
| 3452 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \ |
| 3453 | .name = xname, \ |
| 3454 | .info = alc_test_pin_src_info, \ |
| 3455 | .get = alc_test_pin_src_get, \ |
| 3456 | .put = alc_test_pin_src_put, \ |
| 3457 | .private_value = nid \ |
| 3458 | } |
| 3459 | |
Takashi Iwai | c8b6bf9b | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 3460 | static struct snd_kcontrol_new alc880_test_mixer[] = { |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 3461 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 3462 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 3463 | HDA_CODEC_VOLUME("CLFE Playback Volume", 0x0e, 0x0, HDA_OUTPUT), |
| 3464 | HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 3465 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 3466 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
| 3467 | HDA_BIND_MUTE("CLFE Playback Switch", 0x0e, 2, HDA_INPUT), |
| 3468 | HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT), |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3469 | PIN_CTL_TEST("Front Pin Mode", 0x14), |
| 3470 | PIN_CTL_TEST("Surround Pin Mode", 0x15), |
| 3471 | PIN_CTL_TEST("CLFE Pin Mode", 0x16), |
| 3472 | PIN_CTL_TEST("Side Pin Mode", 0x17), |
| 3473 | PIN_CTL_TEST("In-1 Pin Mode", 0x18), |
| 3474 | PIN_CTL_TEST("In-2 Pin Mode", 0x19), |
| 3475 | PIN_CTL_TEST("In-3 Pin Mode", 0x1a), |
| 3476 | PIN_CTL_TEST("In-4 Pin Mode", 0x1b), |
| 3477 | PIN_SRC_TEST("In-1 Pin Source", 0x18), |
| 3478 | PIN_SRC_TEST("In-2 Pin Source", 0x19), |
| 3479 | PIN_SRC_TEST("In-3 Pin Source", 0x1a), |
| 3480 | PIN_SRC_TEST("In-4 Pin Source", 0x1b), |
| 3481 | HDA_CODEC_VOLUME("In-1 Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 3482 | HDA_CODEC_MUTE("In-1 Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 3483 | HDA_CODEC_VOLUME("In-2 Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 3484 | HDA_CODEC_MUTE("In-2 Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 3485 | HDA_CODEC_VOLUME("In-3 Playback Volume", 0x0b, 0x2, HDA_INPUT), |
| 3486 | HDA_CODEC_MUTE("In-3 Playback Switch", 0x0b, 0x2, HDA_INPUT), |
| 3487 | HDA_CODEC_VOLUME("In-4 Playback Volume", 0x0b, 0x3, HDA_INPUT), |
| 3488 | HDA_CODEC_MUTE("In-4 Playback Switch", 0x0b, 0x3, HDA_INPUT), |
| 3489 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x4, HDA_INPUT), |
| 3490 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x4, HDA_INPUT), |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3491 | { |
| 3492 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 3493 | .name = "Channel Mode", |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3494 | .info = alc_ch_mode_info, |
| 3495 | .get = alc_ch_mode_get, |
| 3496 | .put = alc_ch_mode_put, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3497 | }, |
| 3498 | { } /* end */ |
| 3499 | }; |
| 3500 | |
| 3501 | static struct hda_verb alc880_test_init_verbs[] = { |
| 3502 | /* Unmute inputs of 0x0c - 0x0f */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 3503 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 3504 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 3505 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 3506 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 3507 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 3508 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 3509 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 3510 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3511 | /* Vol output for 0x0c-0x0f */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 3512 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 3513 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 3514 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 3515 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3516 | /* Set output pins 0x14-0x17 */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 3517 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 3518 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 3519 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 3520 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3521 | /* Unmute output pins 0x14-0x17 */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 3522 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3523 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3524 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3525 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3526 | /* Set input pins 0x18-0x1c */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3527 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 3528 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 3529 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 3530 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 3531 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3532 | /* Mute input pins 0x18-0x1b */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 3533 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 3534 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 3535 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 3536 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 3537 | /* ADC set up */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 3538 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 3539 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 3540 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 3541 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 3542 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 3543 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 3544 | /* Analog input/passthru */ |
| 3545 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 3546 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 3547 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 3548 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 3549 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3550 | { } |
| 3551 | }; |
| 3552 | #endif |
| 3553 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3554 | /* |
| 3555 | */ |
| 3556 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3557 | static const char *alc880_models[ALC880_MODEL_LAST] = { |
| 3558 | [ALC880_3ST] = "3stack", |
| 3559 | [ALC880_TCL_S700] = "tcl", |
| 3560 | [ALC880_3ST_DIG] = "3stack-digout", |
| 3561 | [ALC880_CLEVO] = "clevo", |
| 3562 | [ALC880_5ST] = "5stack", |
| 3563 | [ALC880_5ST_DIG] = "5stack-digout", |
| 3564 | [ALC880_W810] = "w810", |
| 3565 | [ALC880_Z71V] = "z71v", |
| 3566 | [ALC880_6ST] = "6stack", |
| 3567 | [ALC880_6ST_DIG] = "6stack-digout", |
| 3568 | [ALC880_ASUS] = "asus", |
| 3569 | [ALC880_ASUS_W1V] = "asus-w1v", |
| 3570 | [ALC880_ASUS_DIG] = "asus-dig", |
| 3571 | [ALC880_ASUS_DIG2] = "asus-dig2", |
| 3572 | [ALC880_UNIWILL_DIG] = "uniwill", |
Tobin Davis | 2cf9f0f | 2007-02-07 16:04:25 +0100 | [diff] [blame] | 3573 | [ALC880_UNIWILL_P53] = "uniwill-p53", |
| 3574 | [ALC880_FUJITSU] = "fujitsu", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3575 | [ALC880_F1734] = "F1734", |
| 3576 | [ALC880_LG] = "lg", |
| 3577 | [ALC880_LG_LW] = "lg-lw", |
Takashi Iwai | df99cd3 | 2008-04-25 15:25:04 +0200 | [diff] [blame] | 3578 | [ALC880_MEDION_RIM] = "medion", |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3579 | #ifdef CONFIG_SND_DEBUG |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3580 | [ALC880_TEST] = "test", |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3581 | #endif |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3582 | [ALC880_AUTO] = "auto", |
| 3583 | }; |
| 3584 | |
| 3585 | static struct snd_pci_quirk alc880_cfg_tbl[] = { |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 3586 | SND_PCI_QUIRK(0x1019, 0x0f69, "Coeus G610P", ALC880_W810), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3587 | SND_PCI_QUIRK(0x1019, 0xa880, "ECS", ALC880_5ST_DIG), |
| 3588 | SND_PCI_QUIRK(0x1019, 0xa884, "Acer APFV", ALC880_6ST), |
| 3589 | SND_PCI_QUIRK(0x1025, 0x0070, "ULI", ALC880_3ST_DIG), |
| 3590 | SND_PCI_QUIRK(0x1025, 0x0077, "ULI", ALC880_6ST_DIG), |
| 3591 | SND_PCI_QUIRK(0x1025, 0x0078, "ULI", ALC880_6ST_DIG), |
| 3592 | SND_PCI_QUIRK(0x1025, 0x0087, "ULI", ALC880_6ST_DIG), |
| 3593 | SND_PCI_QUIRK(0x1025, 0xe309, "ULI", ALC880_3ST_DIG), |
| 3594 | SND_PCI_QUIRK(0x1025, 0xe310, "ULI", ALC880_3ST), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3595 | SND_PCI_QUIRK(0x1039, 0x1234, NULL, ALC880_6ST_DIG), |
| 3596 | SND_PCI_QUIRK(0x103c, 0x2a09, "HP", ALC880_5ST), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3597 | SND_PCI_QUIRK(0x1043, 0x10b3, "ASUS W1V", ALC880_ASUS_W1V), |
| 3598 | SND_PCI_QUIRK(0x1043, 0x10c2, "ASUS W6A", ALC880_ASUS_DIG), |
| 3599 | SND_PCI_QUIRK(0x1043, 0x10c3, "ASUS Wxx", ALC880_ASUS_DIG), |
| 3600 | SND_PCI_QUIRK(0x1043, 0x1113, "ASUS", ALC880_ASUS_DIG), |
| 3601 | SND_PCI_QUIRK(0x1043, 0x1123, "ASUS", ALC880_ASUS_DIG), |
| 3602 | SND_PCI_QUIRK(0x1043, 0x1173, "ASUS", ALC880_ASUS_DIG), |
| 3603 | SND_PCI_QUIRK(0x1043, 0x1964, "ASUS Z71V", ALC880_Z71V), |
| 3604 | /* SND_PCI_QUIRK(0x1043, 0x1964, "ASUS", ALC880_ASUS_DIG), */ |
| 3605 | SND_PCI_QUIRK(0x1043, 0x1973, "ASUS", ALC880_ASUS_DIG), |
| 3606 | SND_PCI_QUIRK(0x1043, 0x19b3, "ASUS", ALC880_ASUS_DIG), |
Travis Place | 186c311 | 2008-05-20 11:54:41 +0200 | [diff] [blame] | 3607 | SND_PCI_QUIRK(0x1043, 0x814e, "ASUS P5GD1 w/SPDIF", ALC880_6ST_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3608 | SND_PCI_QUIRK(0x1043, 0x8181, "ASUS P4GPL", ALC880_ASUS_DIG), |
| 3609 | SND_PCI_QUIRK(0x1043, 0x8196, "ASUS P5GD1", ALC880_6ST), |
| 3610 | SND_PCI_QUIRK(0x1043, 0x81b4, "ASUS", ALC880_6ST), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 3611 | SND_PCI_QUIRK_VENDOR(0x1043, "ASUS", ALC880_ASUS), /* default ASUS */ |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3612 | SND_PCI_QUIRK(0x104d, 0x81a0, "Sony", ALC880_3ST), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 3613 | SND_PCI_QUIRK(0x104d, 0x81d6, "Sony", ALC880_3ST), |
| 3614 | SND_PCI_QUIRK(0x107b, 0x3032, "Gateway", ALC880_5ST), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3615 | SND_PCI_QUIRK(0x107b, 0x3033, "Gateway", ALC880_5ST), |
| 3616 | SND_PCI_QUIRK(0x107b, 0x4039, "Gateway", ALC880_5ST), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3617 | SND_PCI_QUIRK(0x1297, 0xc790, "Shuttle ST20G5", ALC880_6ST_DIG), |
| 3618 | SND_PCI_QUIRK(0x1458, 0xa102, "Gigabyte K8", ALC880_6ST_DIG), |
| 3619 | SND_PCI_QUIRK(0x1462, 0x1150, "MSI", ALC880_6ST_DIG), |
| 3620 | SND_PCI_QUIRK(0x1509, 0x925d, "FIC P4M", ALC880_6ST_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 3621 | SND_PCI_QUIRK(0x1558, 0x0520, "Clevo m520G", ALC880_CLEVO), |
| 3622 | SND_PCI_QUIRK(0x1558, 0x0660, "Clevo m655n", ALC880_CLEVO), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3623 | SND_PCI_QUIRK(0x1558, 0x5401, "ASUS", ALC880_ASUS_DIG2), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 3624 | SND_PCI_QUIRK(0x1565, 0x8202, "Biostar", ALC880_5ST_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3625 | SND_PCI_QUIRK(0x1584, 0x9050, "Uniwill", ALC880_UNIWILL_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 3626 | SND_PCI_QUIRK(0x1584, 0x9054, "Uniwlll", ALC880_F1734), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3627 | SND_PCI_QUIRK(0x1584, 0x9070, "Uniwill", ALC880_UNIWILL), |
| 3628 | SND_PCI_QUIRK(0x1584, 0x9077, "Uniwill P53", ALC880_UNIWILL_P53), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 3629 | SND_PCI_QUIRK(0x161f, 0x203d, "W810", ALC880_W810), |
Takashi Iwai | df99cd3 | 2008-04-25 15:25:04 +0200 | [diff] [blame] | 3630 | SND_PCI_QUIRK(0x161f, 0x205d, "Medion Rim 2150", ALC880_MEDION_RIM), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 3631 | SND_PCI_QUIRK(0x1695, 0x400d, "EPoX", ALC880_5ST_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3632 | SND_PCI_QUIRK(0x1695, 0x4012, "EPox EP-5LDA", ALC880_5ST_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3633 | SND_PCI_QUIRK(0x1734, 0x107c, "FSC F1734", ALC880_F1734), |
Travis Place | 1d11604 | 2008-06-23 11:42:30 +0200 | [diff] [blame] | 3634 | SND_PCI_QUIRK(0x1734, 0x1094, "FSC Amilo M1451G", ALC880_FUJITSU), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 3635 | SND_PCI_QUIRK(0x1734, 0x10ac, "FSC", ALC880_UNIWILL), |
Tobin Davis | 2cf9f0f | 2007-02-07 16:04:25 +0100 | [diff] [blame] | 3636 | SND_PCI_QUIRK(0x1734, 0x10b0, "Fujitsu", ALC880_FUJITSU), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 3637 | SND_PCI_QUIRK(0x1854, 0x0018, "LG LW20", ALC880_LG_LW), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3638 | SND_PCI_QUIRK(0x1854, 0x003b, "LG", ALC880_LG), |
| 3639 | SND_PCI_QUIRK(0x1854, 0x0068, "LG w1", ALC880_LG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3640 | SND_PCI_QUIRK(0x1854, 0x0077, "LG LW25", ALC880_LG_LW), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 3641 | SND_PCI_QUIRK(0x19db, 0x4188, "TCL S700", ALC880_TCL_S700), |
| 3642 | SND_PCI_QUIRK(0x2668, 0x8086, NULL, ALC880_6ST_DIG), /* broken BIOS */ |
| 3643 | SND_PCI_QUIRK(0x8086, 0x2668, NULL, ALC880_6ST_DIG), |
| 3644 | SND_PCI_QUIRK(0x8086, 0xa100, "Intel mobo", ALC880_5ST_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3645 | SND_PCI_QUIRK(0x8086, 0xd400, "Intel mobo", ALC880_5ST_DIG), |
| 3646 | SND_PCI_QUIRK(0x8086, 0xd401, "Intel mobo", ALC880_5ST_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 3647 | SND_PCI_QUIRK(0x8086, 0xd402, "Intel mobo", ALC880_3ST_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3648 | SND_PCI_QUIRK(0x8086, 0xe224, "Intel mobo", ALC880_5ST_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 3649 | SND_PCI_QUIRK(0x8086, 0xe305, "Intel mobo", ALC880_3ST_DIG), |
| 3650 | SND_PCI_QUIRK(0x8086, 0xe308, "Intel mobo", ALC880_3ST_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3651 | SND_PCI_QUIRK(0x8086, 0xe400, "Intel mobo", ALC880_5ST_DIG), |
| 3652 | SND_PCI_QUIRK(0x8086, 0xe401, "Intel mobo", ALC880_5ST_DIG), |
| 3653 | SND_PCI_QUIRK(0x8086, 0xe402, "Intel mobo", ALC880_5ST_DIG), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 3654 | /* default Intel */ |
| 3655 | SND_PCI_QUIRK_VENDOR(0x8086, "Intel mobo", ALC880_3ST), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 3656 | SND_PCI_QUIRK(0xa0a0, 0x0560, "AOpen i915GMm-HFS", ALC880_5ST_DIG), |
| 3657 | SND_PCI_QUIRK(0xe803, 0x1019, NULL, ALC880_6ST_DIG), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3658 | {} |
| 3659 | }; |
| 3660 | |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3661 | /* |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3662 | * ALC880 codec presets |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3663 | */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3664 | static struct alc_config_preset alc880_presets[] = { |
| 3665 | [ALC880_3ST] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3666 | .mixers = { alc880_three_stack_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3667 | .init_verbs = { alc880_volume_init_verbs, |
| 3668 | alc880_pin_3stack_init_verbs }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3669 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3670 | .dac_nids = alc880_dac_nids, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3671 | .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes), |
| 3672 | .channel_mode = alc880_threestack_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 3673 | .need_dac_fix = 1, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3674 | .input_mux = &alc880_capture_source, |
| 3675 | }, |
| 3676 | [ALC880_3ST_DIG] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3677 | .mixers = { alc880_three_stack_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3678 | .init_verbs = { alc880_volume_init_verbs, |
| 3679 | alc880_pin_3stack_init_verbs }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3680 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3681 | .dac_nids = alc880_dac_nids, |
| 3682 | .dig_out_nid = ALC880_DIGOUT_NID, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3683 | .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes), |
| 3684 | .channel_mode = alc880_threestack_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 3685 | .need_dac_fix = 1, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3686 | .input_mux = &alc880_capture_source, |
| 3687 | }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3688 | [ALC880_TCL_S700] = { |
| 3689 | .mixers = { alc880_tcl_s700_mixer }, |
| 3690 | .init_verbs = { alc880_volume_init_verbs, |
| 3691 | alc880_pin_tcl_S700_init_verbs, |
| 3692 | alc880_gpio2_init_verbs }, |
| 3693 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
| 3694 | .dac_nids = alc880_dac_nids, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 3695 | .adc_nids = alc880_adc_nids_alt, /* FIXME: correct? */ |
| 3696 | .num_adc_nids = 1, /* single ADC */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3697 | .hp_nid = 0x03, |
| 3698 | .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes), |
| 3699 | .channel_mode = alc880_2_jack_modes, |
| 3700 | .input_mux = &alc880_capture_source, |
| 3701 | }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3702 | [ALC880_5ST] = { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3703 | .mixers = { alc880_three_stack_mixer, |
| 3704 | alc880_five_stack_mixer}, |
| 3705 | .init_verbs = { alc880_volume_init_verbs, |
| 3706 | alc880_pin_5stack_init_verbs }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3707 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
| 3708 | .dac_nids = alc880_dac_nids, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3709 | .num_channel_mode = ARRAY_SIZE(alc880_fivestack_modes), |
| 3710 | .channel_mode = alc880_fivestack_modes, |
| 3711 | .input_mux = &alc880_capture_source, |
| 3712 | }, |
| 3713 | [ALC880_5ST_DIG] = { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3714 | .mixers = { alc880_three_stack_mixer, |
| 3715 | alc880_five_stack_mixer }, |
| 3716 | .init_verbs = { alc880_volume_init_verbs, |
| 3717 | alc880_pin_5stack_init_verbs }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3718 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
| 3719 | .dac_nids = alc880_dac_nids, |
| 3720 | .dig_out_nid = ALC880_DIGOUT_NID, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3721 | .num_channel_mode = ARRAY_SIZE(alc880_fivestack_modes), |
| 3722 | .channel_mode = alc880_fivestack_modes, |
| 3723 | .input_mux = &alc880_capture_source, |
| 3724 | }, |
Takashi Iwai | b6482d4 | 2005-06-27 15:32:43 +0200 | [diff] [blame] | 3725 | [ALC880_6ST] = { |
| 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 | b6482d4 | 2005-06-27 15:32:43 +0200 | [diff] [blame] | 3729 | .num_dacs = ARRAY_SIZE(alc880_6st_dac_nids), |
| 3730 | .dac_nids = alc880_6st_dac_nids, |
| 3731 | .num_channel_mode = ARRAY_SIZE(alc880_sixstack_modes), |
| 3732 | .channel_mode = alc880_sixstack_modes, |
| 3733 | .input_mux = &alc880_6stack_capture_source, |
| 3734 | }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3735 | [ALC880_6ST_DIG] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3736 | .mixers = { alc880_six_stack_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3737 | .init_verbs = { alc880_volume_init_verbs, |
| 3738 | alc880_pin_6stack_init_verbs }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3739 | .num_dacs = ARRAY_SIZE(alc880_6st_dac_nids), |
| 3740 | .dac_nids = alc880_6st_dac_nids, |
| 3741 | .dig_out_nid = ALC880_DIGOUT_NID, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3742 | .num_channel_mode = ARRAY_SIZE(alc880_sixstack_modes), |
| 3743 | .channel_mode = alc880_sixstack_modes, |
| 3744 | .input_mux = &alc880_6stack_capture_source, |
| 3745 | }, |
| 3746 | [ALC880_W810] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3747 | .mixers = { alc880_w810_base_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3748 | .init_verbs = { alc880_volume_init_verbs, |
| 3749 | alc880_pin_w810_init_verbs, |
Takashi Iwai | b0af0de | 2005-06-21 14:49:19 +0200 | [diff] [blame] | 3750 | alc880_gpio2_init_verbs }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3751 | .num_dacs = ARRAY_SIZE(alc880_w810_dac_nids), |
| 3752 | .dac_nids = alc880_w810_dac_nids, |
| 3753 | .dig_out_nid = ALC880_DIGOUT_NID, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3754 | .num_channel_mode = ARRAY_SIZE(alc880_w810_modes), |
| 3755 | .channel_mode = alc880_w810_modes, |
| 3756 | .input_mux = &alc880_capture_source, |
| 3757 | }, |
| 3758 | [ALC880_Z71V] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3759 | .mixers = { alc880_z71v_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3760 | .init_verbs = { alc880_volume_init_verbs, |
| 3761 | alc880_pin_z71v_init_verbs }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3762 | .num_dacs = ARRAY_SIZE(alc880_z71v_dac_nids), |
| 3763 | .dac_nids = alc880_z71v_dac_nids, |
| 3764 | .dig_out_nid = ALC880_DIGOUT_NID, |
| 3765 | .hp_nid = 0x03, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3766 | .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes), |
| 3767 | .channel_mode = alc880_2_jack_modes, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3768 | .input_mux = &alc880_capture_source, |
| 3769 | }, |
| 3770 | [ALC880_F1734] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3771 | .mixers = { alc880_f1734_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3772 | .init_verbs = { alc880_volume_init_verbs, |
| 3773 | alc880_pin_f1734_init_verbs }, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3774 | .num_dacs = ARRAY_SIZE(alc880_f1734_dac_nids), |
| 3775 | .dac_nids = alc880_f1734_dac_nids, |
| 3776 | .hp_nid = 0x02, |
| 3777 | .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes), |
| 3778 | .channel_mode = alc880_2_jack_modes, |
Takashi Iwai | 937b416 | 2008-02-11 14:52:36 +0100 | [diff] [blame] | 3779 | .input_mux = &alc880_f1734_capture_source, |
| 3780 | .unsol_event = alc880_uniwill_p53_unsol_event, |
| 3781 | .init_hook = alc880_uniwill_p53_hp_automute, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3782 | }, |
| 3783 | [ALC880_ASUS] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3784 | .mixers = { alc880_asus_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3785 | .init_verbs = { alc880_volume_init_verbs, |
| 3786 | alc880_pin_asus_init_verbs, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3787 | alc880_gpio1_init_verbs }, |
| 3788 | .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids), |
| 3789 | .dac_nids = alc880_asus_dac_nids, |
| 3790 | .num_channel_mode = ARRAY_SIZE(alc880_asus_modes), |
| 3791 | .channel_mode = alc880_asus_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 3792 | .need_dac_fix = 1, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3793 | .input_mux = &alc880_capture_source, |
| 3794 | }, |
| 3795 | [ALC880_ASUS_DIG] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3796 | .mixers = { alc880_asus_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3797 | .init_verbs = { alc880_volume_init_verbs, |
| 3798 | alc880_pin_asus_init_verbs, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3799 | alc880_gpio1_init_verbs }, |
| 3800 | .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids), |
| 3801 | .dac_nids = alc880_asus_dac_nids, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3802 | .dig_out_nid = ALC880_DIGOUT_NID, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3803 | .num_channel_mode = ARRAY_SIZE(alc880_asus_modes), |
| 3804 | .channel_mode = alc880_asus_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 3805 | .need_dac_fix = 1, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3806 | .input_mux = &alc880_capture_source, |
| 3807 | }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3808 | [ALC880_ASUS_DIG2] = { |
| 3809 | .mixers = { alc880_asus_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3810 | .init_verbs = { alc880_volume_init_verbs, |
| 3811 | alc880_pin_asus_init_verbs, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3812 | alc880_gpio2_init_verbs }, /* use GPIO2 */ |
| 3813 | .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids), |
| 3814 | .dac_nids = alc880_asus_dac_nids, |
| 3815 | .dig_out_nid = ALC880_DIGOUT_NID, |
| 3816 | .num_channel_mode = ARRAY_SIZE(alc880_asus_modes), |
| 3817 | .channel_mode = alc880_asus_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 3818 | .need_dac_fix = 1, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3819 | .input_mux = &alc880_capture_source, |
| 3820 | }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3821 | [ALC880_ASUS_W1V] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3822 | .mixers = { alc880_asus_mixer, alc880_asus_w1v_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3823 | .init_verbs = { alc880_volume_init_verbs, |
| 3824 | alc880_pin_asus_init_verbs, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3825 | alc880_gpio1_init_verbs }, |
| 3826 | .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids), |
| 3827 | .dac_nids = alc880_asus_dac_nids, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3828 | .dig_out_nid = ALC880_DIGOUT_NID, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3829 | .num_channel_mode = ARRAY_SIZE(alc880_asus_modes), |
| 3830 | .channel_mode = alc880_asus_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 3831 | .need_dac_fix = 1, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3832 | .input_mux = &alc880_capture_source, |
| 3833 | }, |
| 3834 | [ALC880_UNIWILL_DIG] = { |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 3835 | .mixers = { alc880_asus_mixer }, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 3836 | .init_verbs = { alc880_volume_init_verbs, |
| 3837 | alc880_pin_asus_init_verbs }, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3838 | .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids), |
| 3839 | .dac_nids = alc880_asus_dac_nids, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3840 | .dig_out_nid = ALC880_DIGOUT_NID, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3841 | .num_channel_mode = ARRAY_SIZE(alc880_asus_modes), |
| 3842 | .channel_mode = alc880_asus_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 3843 | .need_dac_fix = 1, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3844 | .input_mux = &alc880_capture_source, |
| 3845 | }, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 3846 | [ALC880_UNIWILL] = { |
| 3847 | .mixers = { alc880_uniwill_mixer }, |
| 3848 | .init_verbs = { alc880_volume_init_verbs, |
| 3849 | alc880_uniwill_init_verbs }, |
| 3850 | .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids), |
| 3851 | .dac_nids = alc880_asus_dac_nids, |
| 3852 | .dig_out_nid = ALC880_DIGOUT_NID, |
| 3853 | .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes), |
| 3854 | .channel_mode = alc880_threestack_modes, |
| 3855 | .need_dac_fix = 1, |
| 3856 | .input_mux = &alc880_capture_source, |
| 3857 | .unsol_event = alc880_uniwill_unsol_event, |
| 3858 | .init_hook = alc880_uniwill_automute, |
| 3859 | }, |
| 3860 | [ALC880_UNIWILL_P53] = { |
| 3861 | .mixers = { alc880_uniwill_p53_mixer }, |
| 3862 | .init_verbs = { alc880_volume_init_verbs, |
| 3863 | alc880_uniwill_p53_init_verbs }, |
| 3864 | .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids), |
| 3865 | .dac_nids = alc880_asus_dac_nids, |
| 3866 | .num_channel_mode = ARRAY_SIZE(alc880_w810_modes), |
Tobin Davis | 2cf9f0f | 2007-02-07 16:04:25 +0100 | [diff] [blame] | 3867 | .channel_mode = alc880_threestack_modes, |
| 3868 | .input_mux = &alc880_capture_source, |
| 3869 | .unsol_event = alc880_uniwill_p53_unsol_event, |
| 3870 | .init_hook = alc880_uniwill_p53_hp_automute, |
| 3871 | }, |
| 3872 | [ALC880_FUJITSU] = { |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 3873 | .mixers = { alc880_fujitsu_mixer }, |
Tobin Davis | 2cf9f0f | 2007-02-07 16:04:25 +0100 | [diff] [blame] | 3874 | .init_verbs = { alc880_volume_init_verbs, |
| 3875 | alc880_uniwill_p53_init_verbs, |
| 3876 | alc880_beep_init_verbs }, |
| 3877 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
| 3878 | .dac_nids = alc880_dac_nids, |
Takashi Iwai | d53d7d9 | 2007-08-20 15:20:02 +0200 | [diff] [blame] | 3879 | .dig_out_nid = ALC880_DIGOUT_NID, |
Tobin Davis | 2cf9f0f | 2007-02-07 16:04:25 +0100 | [diff] [blame] | 3880 | .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes), |
| 3881 | .channel_mode = alc880_2_jack_modes, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 3882 | .input_mux = &alc880_capture_source, |
| 3883 | .unsol_event = alc880_uniwill_p53_unsol_event, |
| 3884 | .init_hook = alc880_uniwill_p53_hp_automute, |
| 3885 | }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3886 | [ALC880_CLEVO] = { |
| 3887 | .mixers = { alc880_three_stack_mixer }, |
| 3888 | .init_verbs = { alc880_volume_init_verbs, |
| 3889 | alc880_pin_clevo_init_verbs }, |
| 3890 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
| 3891 | .dac_nids = alc880_dac_nids, |
| 3892 | .hp_nid = 0x03, |
| 3893 | .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes), |
| 3894 | .channel_mode = alc880_threestack_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 3895 | .need_dac_fix = 1, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3896 | .input_mux = &alc880_capture_source, |
| 3897 | }, |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 3898 | [ALC880_LG] = { |
| 3899 | .mixers = { alc880_lg_mixer }, |
| 3900 | .init_verbs = { alc880_volume_init_verbs, |
| 3901 | alc880_lg_init_verbs }, |
| 3902 | .num_dacs = ARRAY_SIZE(alc880_lg_dac_nids), |
| 3903 | .dac_nids = alc880_lg_dac_nids, |
| 3904 | .dig_out_nid = ALC880_DIGOUT_NID, |
| 3905 | .num_channel_mode = ARRAY_SIZE(alc880_lg_ch_modes), |
| 3906 | .channel_mode = alc880_lg_ch_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 3907 | .need_dac_fix = 1, |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 3908 | .input_mux = &alc880_lg_capture_source, |
| 3909 | .unsol_event = alc880_lg_unsol_event, |
| 3910 | .init_hook = alc880_lg_automute, |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 3911 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 3912 | .loopbacks = alc880_lg_loopbacks, |
| 3913 | #endif |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 3914 | }, |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 3915 | [ALC880_LG_LW] = { |
| 3916 | .mixers = { alc880_lg_lw_mixer }, |
| 3917 | .init_verbs = { alc880_volume_init_verbs, |
| 3918 | alc880_lg_lw_init_verbs }, |
Claudio Matsuoka | 0a8c5da | 2007-07-04 15:17:38 +0200 | [diff] [blame] | 3919 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 3920 | .dac_nids = alc880_dac_nids, |
| 3921 | .dig_out_nid = ALC880_DIGOUT_NID, |
Claudio Matsuoka | 0a8c5da | 2007-07-04 15:17:38 +0200 | [diff] [blame] | 3922 | .num_channel_mode = ARRAY_SIZE(alc880_lg_lw_modes), |
| 3923 | .channel_mode = alc880_lg_lw_modes, |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 3924 | .input_mux = &alc880_lg_lw_capture_source, |
| 3925 | .unsol_event = alc880_lg_lw_unsol_event, |
| 3926 | .init_hook = alc880_lg_lw_automute, |
| 3927 | }, |
Takashi Iwai | df99cd3 | 2008-04-25 15:25:04 +0200 | [diff] [blame] | 3928 | [ALC880_MEDION_RIM] = { |
| 3929 | .mixers = { alc880_medion_rim_mixer }, |
| 3930 | .init_verbs = { alc880_volume_init_verbs, |
| 3931 | alc880_medion_rim_init_verbs, |
| 3932 | alc_gpio2_init_verbs }, |
| 3933 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
| 3934 | .dac_nids = alc880_dac_nids, |
| 3935 | .dig_out_nid = ALC880_DIGOUT_NID, |
| 3936 | .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes), |
| 3937 | .channel_mode = alc880_2_jack_modes, |
| 3938 | .input_mux = &alc880_medion_rim_capture_source, |
| 3939 | .unsol_event = alc880_medion_rim_unsol_event, |
| 3940 | .init_hook = alc880_medion_rim_automute, |
| 3941 | }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3942 | #ifdef CONFIG_SND_DEBUG |
| 3943 | [ALC880_TEST] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3944 | .mixers = { alc880_test_mixer }, |
| 3945 | .init_verbs = { alc880_test_init_verbs }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3946 | .num_dacs = ARRAY_SIZE(alc880_test_dac_nids), |
| 3947 | .dac_nids = alc880_test_dac_nids, |
| 3948 | .dig_out_nid = ALC880_DIGOUT_NID, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3949 | .num_channel_mode = ARRAY_SIZE(alc880_test_modes), |
| 3950 | .channel_mode = alc880_test_modes, |
| 3951 | .input_mux = &alc880_test_capture_source, |
| 3952 | }, |
| 3953 | #endif |
| 3954 | }; |
| 3955 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3956 | /* |
| 3957 | * Automatic parse of I/O pins from the BIOS configuration |
| 3958 | */ |
| 3959 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3960 | enum { |
| 3961 | ALC_CTL_WIDGET_VOL, |
| 3962 | ALC_CTL_WIDGET_MUTE, |
| 3963 | ALC_CTL_BIND_MUTE, |
| 3964 | }; |
Takashi Iwai | c8b6bf9b | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 3965 | static struct snd_kcontrol_new alc880_control_templates[] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3966 | HDA_CODEC_VOLUME(NULL, 0, 0, 0), |
| 3967 | HDA_CODEC_MUTE(NULL, 0, 0, 0), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 3968 | HDA_BIND_MUTE(NULL, 0, 0, 0), |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3969 | }; |
| 3970 | |
| 3971 | /* add dynamic controls */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3972 | static int add_control(struct alc_spec *spec, int type, const char *name, |
| 3973 | unsigned long val) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3974 | { |
Takashi Iwai | c8b6bf9b | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 3975 | struct snd_kcontrol_new *knew; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3976 | |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 3977 | snd_array_init(&spec->kctls, sizeof(*knew), 32); |
| 3978 | knew = snd_array_new(&spec->kctls); |
| 3979 | if (!knew) |
| 3980 | return -ENOMEM; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3981 | *knew = alc880_control_templates[type]; |
Paulo Marques | 543537b | 2005-06-23 00:09:02 -0700 | [diff] [blame] | 3982 | knew->name = kstrdup(name, GFP_KERNEL); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3983 | if (!knew->name) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3984 | return -ENOMEM; |
| 3985 | knew->private_value = val; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3986 | return 0; |
| 3987 | } |
| 3988 | |
| 3989 | #define alc880_is_fixed_pin(nid) ((nid) >= 0x14 && (nid) <= 0x17) |
| 3990 | #define alc880_fixed_pin_idx(nid) ((nid) - 0x14) |
| 3991 | #define alc880_is_multi_pin(nid) ((nid) >= 0x18) |
| 3992 | #define alc880_multi_pin_idx(nid) ((nid) - 0x18) |
| 3993 | #define alc880_is_input_pin(nid) ((nid) >= 0x18) |
| 3994 | #define alc880_input_pin_idx(nid) ((nid) - 0x18) |
| 3995 | #define alc880_idx_to_dac(nid) ((nid) + 0x02) |
| 3996 | #define alc880_dac_to_idx(nid) ((nid) - 0x02) |
| 3997 | #define alc880_idx_to_mixer(nid) ((nid) + 0x0c) |
| 3998 | #define alc880_idx_to_selector(nid) ((nid) + 0x10) |
| 3999 | #define ALC880_PIN_CD_NID 0x1c |
| 4000 | |
| 4001 | /* fill in the dac_nids table from the parsed pin configuration */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4002 | static int alc880_auto_fill_dac_nids(struct alc_spec *spec, |
| 4003 | const struct auto_pin_cfg *cfg) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4004 | { |
| 4005 | hda_nid_t nid; |
| 4006 | int assigned[4]; |
| 4007 | int i, j; |
| 4008 | |
| 4009 | memset(assigned, 0, sizeof(assigned)); |
Takashi Iwai | b0af0de | 2005-06-21 14:49:19 +0200 | [diff] [blame] | 4010 | spec->multiout.dac_nids = spec->private_dac_nids; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4011 | |
| 4012 | /* check the pins hardwired to audio widget */ |
| 4013 | for (i = 0; i < cfg->line_outs; i++) { |
| 4014 | nid = cfg->line_out_pins[i]; |
| 4015 | if (alc880_is_fixed_pin(nid)) { |
| 4016 | int idx = alc880_fixed_pin_idx(nid); |
Libin Yang | 5014f19 | 2005-11-23 15:48:36 +0100 | [diff] [blame] | 4017 | spec->multiout.dac_nids[i] = alc880_idx_to_dac(idx); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4018 | assigned[idx] = 1; |
| 4019 | } |
| 4020 | } |
| 4021 | /* left pins can be connect to any audio widget */ |
| 4022 | for (i = 0; i < cfg->line_outs; i++) { |
| 4023 | nid = cfg->line_out_pins[i]; |
| 4024 | if (alc880_is_fixed_pin(nid)) |
| 4025 | continue; |
| 4026 | /* search for an empty channel */ |
| 4027 | for (j = 0; j < cfg->line_outs; j++) { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4028 | if (!assigned[j]) { |
| 4029 | spec->multiout.dac_nids[i] = |
| 4030 | alc880_idx_to_dac(j); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4031 | assigned[j] = 1; |
| 4032 | break; |
| 4033 | } |
| 4034 | } |
| 4035 | } |
| 4036 | spec->multiout.num_dacs = cfg->line_outs; |
| 4037 | return 0; |
| 4038 | } |
| 4039 | |
| 4040 | /* add playback controls from the parsed DAC table */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4041 | static int alc880_auto_create_multi_out_ctls(struct alc_spec *spec, |
| 4042 | const struct auto_pin_cfg *cfg) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4043 | { |
| 4044 | char name[32]; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4045 | static const char *chname[4] = { |
| 4046 | "Front", "Surround", NULL /*CLFE*/, "Side" |
| 4047 | }; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4048 | hda_nid_t nid; |
| 4049 | int i, err; |
| 4050 | |
| 4051 | for (i = 0; i < cfg->line_outs; i++) { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4052 | if (!spec->multiout.dac_nids[i]) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4053 | continue; |
| 4054 | nid = alc880_idx_to_mixer(alc880_dac_to_idx(spec->multiout.dac_nids[i])); |
| 4055 | if (i == 2) { |
| 4056 | /* Center/LFE */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4057 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 4058 | "Center Playback Volume", |
| 4059 | HDA_COMPOSE_AMP_VAL(nid, 1, 0, |
| 4060 | HDA_OUTPUT)); |
| 4061 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4062 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4063 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 4064 | "LFE Playback Volume", |
| 4065 | HDA_COMPOSE_AMP_VAL(nid, 2, 0, |
| 4066 | HDA_OUTPUT)); |
| 4067 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4068 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4069 | err = add_control(spec, ALC_CTL_BIND_MUTE, |
| 4070 | "Center Playback Switch", |
| 4071 | HDA_COMPOSE_AMP_VAL(nid, 1, 2, |
| 4072 | HDA_INPUT)); |
| 4073 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4074 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4075 | err = add_control(spec, ALC_CTL_BIND_MUTE, |
| 4076 | "LFE Playback Switch", |
| 4077 | HDA_COMPOSE_AMP_VAL(nid, 2, 2, |
| 4078 | HDA_INPUT)); |
| 4079 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4080 | return err; |
| 4081 | } else { |
| 4082 | sprintf(name, "%s Playback Volume", chname[i]); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4083 | err = add_control(spec, ALC_CTL_WIDGET_VOL, name, |
| 4084 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, |
| 4085 | HDA_OUTPUT)); |
| 4086 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4087 | return err; |
| 4088 | sprintf(name, "%s Playback Switch", chname[i]); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4089 | err = add_control(spec, ALC_CTL_BIND_MUTE, name, |
| 4090 | HDA_COMPOSE_AMP_VAL(nid, 3, 2, |
| 4091 | HDA_INPUT)); |
| 4092 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4093 | return err; |
| 4094 | } |
| 4095 | } |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4096 | return 0; |
| 4097 | } |
| 4098 | |
Takashi Iwai | 8d88bc3 | 2005-11-17 11:09:23 +0100 | [diff] [blame] | 4099 | /* add playback controls for speaker and HP outputs */ |
| 4100 | static int alc880_auto_create_extra_out(struct alc_spec *spec, hda_nid_t pin, |
| 4101 | const char *pfx) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4102 | { |
| 4103 | hda_nid_t nid; |
| 4104 | int err; |
Takashi Iwai | 8d88bc3 | 2005-11-17 11:09:23 +0100 | [diff] [blame] | 4105 | char name[32]; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4106 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4107 | if (!pin) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4108 | return 0; |
| 4109 | |
| 4110 | if (alc880_is_fixed_pin(pin)) { |
| 4111 | nid = alc880_idx_to_dac(alc880_fixed_pin_idx(pin)); |
Takashi Iwai | 82bc955 | 2006-03-21 11:24:42 +0100 | [diff] [blame] | 4112 | /* specify the DAC as the extra output */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4113 | if (!spec->multiout.hp_nid) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4114 | spec->multiout.hp_nid = nid; |
Takashi Iwai | 82bc955 | 2006-03-21 11:24:42 +0100 | [diff] [blame] | 4115 | else |
| 4116 | spec->multiout.extra_out_nid[0] = nid; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4117 | /* control HP volume/switch on the output mixer amp */ |
| 4118 | nid = alc880_idx_to_mixer(alc880_fixed_pin_idx(pin)); |
Takashi Iwai | 8d88bc3 | 2005-11-17 11:09:23 +0100 | [diff] [blame] | 4119 | sprintf(name, "%s Playback Volume", pfx); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4120 | err = add_control(spec, ALC_CTL_WIDGET_VOL, name, |
| 4121 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT)); |
| 4122 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4123 | return err; |
Takashi Iwai | 8d88bc3 | 2005-11-17 11:09:23 +0100 | [diff] [blame] | 4124 | sprintf(name, "%s Playback Switch", pfx); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4125 | err = add_control(spec, ALC_CTL_BIND_MUTE, name, |
| 4126 | HDA_COMPOSE_AMP_VAL(nid, 3, 2, HDA_INPUT)); |
| 4127 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4128 | return err; |
| 4129 | } else if (alc880_is_multi_pin(pin)) { |
| 4130 | /* set manual connection */ |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4131 | /* we have only a switch on HP-out PIN */ |
Takashi Iwai | 8d88bc3 | 2005-11-17 11:09:23 +0100 | [diff] [blame] | 4132 | sprintf(name, "%s Playback Switch", pfx); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4133 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, name, |
| 4134 | HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT)); |
| 4135 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4136 | return err; |
| 4137 | } |
| 4138 | return 0; |
| 4139 | } |
| 4140 | |
| 4141 | /* create input playback/capture controls for the given pin */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4142 | static int new_analog_input(struct alc_spec *spec, hda_nid_t pin, |
| 4143 | const char *ctlname, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4144 | int idx, hda_nid_t mix_nid) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4145 | { |
| 4146 | char name[32]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4147 | int err; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4148 | |
| 4149 | sprintf(name, "%s Playback Volume", ctlname); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4150 | err = add_control(spec, ALC_CTL_WIDGET_VOL, name, |
| 4151 | HDA_COMPOSE_AMP_VAL(mix_nid, 3, idx, HDA_INPUT)); |
| 4152 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4153 | return err; |
| 4154 | sprintf(name, "%s Playback Switch", ctlname); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4155 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, name, |
| 4156 | HDA_COMPOSE_AMP_VAL(mix_nid, 3, idx, HDA_INPUT)); |
| 4157 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4158 | return err; |
| 4159 | return 0; |
| 4160 | } |
| 4161 | |
| 4162 | /* create playback/capture controls for input pins */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4163 | static int alc880_auto_create_analog_input_ctls(struct alc_spec *spec, |
| 4164 | const struct auto_pin_cfg *cfg) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4165 | { |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 4166 | struct hda_input_mux *imux = &spec->private_imux[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4167 | int i, err, idx; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4168 | |
| 4169 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
| 4170 | if (alc880_is_input_pin(cfg->input_pins[i])) { |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4171 | idx = alc880_input_pin_idx(cfg->input_pins[i]); |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 4172 | err = new_analog_input(spec, cfg->input_pins[i], |
| 4173 | auto_pin_cfg_labels[i], |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4174 | idx, 0x0b); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4175 | if (err < 0) |
| 4176 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4177 | imux->items[imux->num_items].label = |
| 4178 | auto_pin_cfg_labels[i]; |
| 4179 | imux->items[imux->num_items].index = |
| 4180 | alc880_input_pin_idx(cfg->input_pins[i]); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4181 | imux->num_items++; |
| 4182 | } |
| 4183 | } |
| 4184 | return 0; |
| 4185 | } |
| 4186 | |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 4187 | static void alc_set_pin_output(struct hda_codec *codec, hda_nid_t nid, |
| 4188 | unsigned int pin_type) |
| 4189 | { |
| 4190 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 4191 | pin_type); |
| 4192 | /* unmute pin */ |
Takashi Iwai | d260cdf | 2008-02-13 17:19:35 +0100 | [diff] [blame] | 4193 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_AMP_GAIN_MUTE, |
| 4194 | AMP_OUT_UNMUTE); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 4195 | } |
| 4196 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4197 | static void alc880_auto_set_output_and_unmute(struct hda_codec *codec, |
| 4198 | hda_nid_t nid, int pin_type, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4199 | int dac_idx) |
| 4200 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 4201 | alc_set_pin_output(codec, nid, pin_type); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4202 | /* need the manual connection? */ |
| 4203 | if (alc880_is_multi_pin(nid)) { |
| 4204 | struct alc_spec *spec = codec->spec; |
| 4205 | int idx = alc880_multi_pin_idx(nid); |
| 4206 | snd_hda_codec_write(codec, alc880_idx_to_selector(idx), 0, |
| 4207 | AC_VERB_SET_CONNECT_SEL, |
| 4208 | alc880_dac_to_idx(spec->multiout.dac_nids[dac_idx])); |
| 4209 | } |
| 4210 | } |
| 4211 | |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 4212 | static int get_pin_type(int line_out_type) |
| 4213 | { |
| 4214 | if (line_out_type == AUTO_PIN_HP_OUT) |
| 4215 | return PIN_HP; |
| 4216 | else |
| 4217 | return PIN_OUT; |
| 4218 | } |
| 4219 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4220 | static void alc880_auto_init_multi_out(struct hda_codec *codec) |
| 4221 | { |
| 4222 | struct alc_spec *spec = codec->spec; |
| 4223 | int i; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 4224 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 4225 | alc_subsystem_id(codec, 0x15, 0x1b, 0x14); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4226 | for (i = 0; i < spec->autocfg.line_outs; i++) { |
| 4227 | hda_nid_t nid = spec->autocfg.line_out_pins[i]; |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 4228 | int pin_type = get_pin_type(spec->autocfg.line_out_type); |
| 4229 | alc880_auto_set_output_and_unmute(codec, nid, pin_type, i); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4230 | } |
| 4231 | } |
| 4232 | |
Takashi Iwai | 8d88bc3 | 2005-11-17 11:09:23 +0100 | [diff] [blame] | 4233 | static void alc880_auto_init_extra_out(struct hda_codec *codec) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4234 | { |
| 4235 | struct alc_spec *spec = codec->spec; |
| 4236 | hda_nid_t pin; |
| 4237 | |
Takashi Iwai | 82bc955 | 2006-03-21 11:24:42 +0100 | [diff] [blame] | 4238 | pin = spec->autocfg.speaker_pins[0]; |
Takashi Iwai | 8d88bc3 | 2005-11-17 11:09:23 +0100 | [diff] [blame] | 4239 | if (pin) /* connect to front */ |
| 4240 | alc880_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0); |
Takashi Iwai | eb06ed8 | 2006-09-20 17:10:27 +0200 | [diff] [blame] | 4241 | pin = spec->autocfg.hp_pins[0]; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4242 | if (pin) /* connect to front */ |
| 4243 | alc880_auto_set_output_and_unmute(codec, pin, PIN_HP, 0); |
| 4244 | } |
| 4245 | |
| 4246 | static void alc880_auto_init_analog_input(struct hda_codec *codec) |
| 4247 | { |
| 4248 | struct alc_spec *spec = codec->spec; |
| 4249 | int i; |
| 4250 | |
| 4251 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
| 4252 | hda_nid_t nid = spec->autocfg.input_pins[i]; |
| 4253 | if (alc880_is_input_pin(nid)) { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4254 | snd_hda_codec_write(codec, nid, 0, |
| 4255 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 4256 | i <= AUTO_PIN_FRONT_MIC ? |
| 4257 | PIN_VREF80 : PIN_IN); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4258 | if (nid != ALC880_PIN_CD_NID) |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4259 | snd_hda_codec_write(codec, nid, 0, |
| 4260 | AC_VERB_SET_AMP_GAIN_MUTE, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4261 | AMP_OUT_MUTE); |
| 4262 | } |
| 4263 | } |
| 4264 | } |
| 4265 | |
| 4266 | /* parse the BIOS configuration and set up the alc_spec */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4267 | /* return 1 if successful, 0 if the proper config is not found, |
| 4268 | * or a negative error code |
| 4269 | */ |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4270 | static int alc880_parse_auto_config(struct hda_codec *codec) |
| 4271 | { |
| 4272 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 6a05ac4 | 2009-02-13 11:19:09 +0100 | [diff] [blame^] | 4273 | int i, err; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4274 | static hda_nid_t alc880_ignore[] = { 0x1d, 0 }; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4275 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4276 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 4277 | alc880_ignore); |
| 4278 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4279 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4280 | if (!spec->autocfg.line_outs) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4281 | return 0; /* can't find valid BIOS pin config */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4282 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4283 | err = alc880_auto_fill_dac_nids(spec, &spec->autocfg); |
| 4284 | if (err < 0) |
| 4285 | return err; |
| 4286 | err = alc880_auto_create_multi_out_ctls(spec, &spec->autocfg); |
| 4287 | if (err < 0) |
| 4288 | return err; |
| 4289 | err = alc880_auto_create_extra_out(spec, |
| 4290 | spec->autocfg.speaker_pins[0], |
| 4291 | "Speaker"); |
| 4292 | if (err < 0) |
| 4293 | return err; |
| 4294 | err = alc880_auto_create_extra_out(spec, spec->autocfg.hp_pins[0], |
| 4295 | "Headphone"); |
| 4296 | if (err < 0) |
| 4297 | return err; |
| 4298 | err = alc880_auto_create_analog_input_ctls(spec, &spec->autocfg); |
| 4299 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4300 | return err; |
| 4301 | |
| 4302 | spec->multiout.max_channels = spec->multiout.num_dacs * 2; |
| 4303 | |
Takashi Iwai | 6a05ac4 | 2009-02-13 11:19:09 +0100 | [diff] [blame^] | 4304 | /* check multiple SPDIF-out (for recent codecs) */ |
| 4305 | for (i = 0; i < spec->autocfg.dig_outs; i++) { |
| 4306 | hda_nid_t dig_nid; |
| 4307 | err = snd_hda_get_connections(codec, |
| 4308 | spec->autocfg.dig_out_pins[i], |
| 4309 | &dig_nid, 1); |
| 4310 | if (err < 0) |
| 4311 | continue; |
| 4312 | if (!i) |
| 4313 | spec->multiout.dig_out_nid = dig_nid; |
| 4314 | else { |
| 4315 | spec->multiout.slave_dig_outs = spec->slave_dig_outs; |
| 4316 | spec->slave_dig_outs[i - 1] = dig_nid; |
| 4317 | if (i == ARRAY_SIZE(spec->slave_dig_outs) - 1) |
| 4318 | break; |
| 4319 | } |
| 4320 | } |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4321 | if (spec->autocfg.dig_in_pin) |
| 4322 | spec->dig_in_nid = ALC880_DIGIN_NID; |
| 4323 | |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 4324 | if (spec->kctls.list) |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 4325 | add_mixer(spec, spec->kctls.list); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4326 | |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 4327 | add_verb(spec, alc880_volume_init_verbs); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4328 | |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 4329 | spec->num_mux_defs = 1; |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 4330 | spec->input_mux = &spec->private_imux[0]; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4331 | |
Takashi Iwai | e044c39 | 2008-10-27 16:56:24 +0100 | [diff] [blame] | 4332 | store_pin_configs(codec); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4333 | return 1; |
| 4334 | } |
| 4335 | |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 4336 | /* additional initialization for auto-configuration model */ |
| 4337 | static void alc880_auto_init(struct hda_codec *codec) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4338 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 4339 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4340 | alc880_auto_init_multi_out(codec); |
Takashi Iwai | 8d88bc3 | 2005-11-17 11:09:23 +0100 | [diff] [blame] | 4341 | alc880_auto_init_extra_out(codec); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4342 | alc880_auto_init_analog_input(codec); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 4343 | if (spec->unsol_event) |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 4344 | alc_inithook(codec); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4345 | } |
| 4346 | |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 4347 | static void set_capture_mixer(struct alc_spec *spec) |
| 4348 | { |
| 4349 | static struct snd_kcontrol_new *caps[3] = { |
| 4350 | alc_capture_mixer1, |
| 4351 | alc_capture_mixer2, |
| 4352 | alc_capture_mixer3, |
| 4353 | }; |
Takashi Iwai | 30d72e9 | 2008-11-27 15:25:34 +0100 | [diff] [blame] | 4354 | if (spec->num_adc_nids > 0 && spec->num_adc_nids <= 3) |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 4355 | spec->cap_mixer = caps[spec->num_adc_nids - 1]; |
| 4356 | } |
| 4357 | |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 4358 | #define set_beep_amp(spec, nid, idx, dir) \ |
| 4359 | ((spec)->beep_amp = HDA_COMPOSE_AMP_VAL(nid, 3, idx, dir)) |
| 4360 | |
| 4361 | /* |
| 4362 | * OK, here we have finally the patch for ALC880 |
| 4363 | */ |
| 4364 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4365 | static int patch_alc880(struct hda_codec *codec) |
| 4366 | { |
| 4367 | struct alc_spec *spec; |
| 4368 | int board_config; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4369 | int err; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4370 | |
Takashi Iwai | e560d8d | 2005-09-09 14:21:46 +0200 | [diff] [blame] | 4371 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4372 | if (spec == NULL) |
| 4373 | return -ENOMEM; |
| 4374 | |
| 4375 | codec->spec = spec; |
| 4376 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 4377 | board_config = snd_hda_check_board_config(codec, ALC880_MODEL_LAST, |
| 4378 | alc880_models, |
| 4379 | alc880_cfg_tbl); |
| 4380 | if (board_config < 0) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 4381 | printk(KERN_INFO "hda_codec: Unknown model for ALC880, " |
| 4382 | "trying auto-probe from BIOS...\n"); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4383 | board_config = ALC880_AUTO; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4384 | } |
| 4385 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4386 | if (board_config == ALC880_AUTO) { |
| 4387 | /* automatic parse from the BIOS config */ |
| 4388 | err = alc880_parse_auto_config(codec); |
| 4389 | if (err < 0) { |
| 4390 | alc_free(codec); |
| 4391 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4392 | } else if (!err) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 4393 | printk(KERN_INFO |
| 4394 | "hda_codec: Cannot set up configuration " |
| 4395 | "from BIOS. Using 3-stack mode...\n"); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4396 | board_config = ALC880_3ST; |
| 4397 | } |
| 4398 | } |
| 4399 | |
Kusanagi Kouichi | 680cd53 | 2009-02-05 00:00:58 +0900 | [diff] [blame] | 4400 | err = snd_hda_attach_beep_device(codec, 0x1); |
| 4401 | if (err < 0) { |
| 4402 | alc_free(codec); |
| 4403 | return err; |
| 4404 | } |
| 4405 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4406 | if (board_config != ALC880_AUTO) |
| 4407 | setup_preset(spec, &alc880_presets[board_config]); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4408 | |
| 4409 | spec->stream_name_analog = "ALC880 Analog"; |
| 4410 | spec->stream_analog_playback = &alc880_pcm_analog_playback; |
| 4411 | spec->stream_analog_capture = &alc880_pcm_analog_capture; |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 4412 | spec->stream_analog_alt_capture = &alc880_pcm_analog_alt_capture; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4413 | |
| 4414 | spec->stream_name_digital = "ALC880 Digital"; |
| 4415 | spec->stream_digital_playback = &alc880_pcm_digital_playback; |
| 4416 | spec->stream_digital_capture = &alc880_pcm_digital_capture; |
| 4417 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4418 | if (!spec->adc_nids && spec->input_mux) { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4419 | /* check whether NID 0x07 is valid */ |
Takashi Iwai | 54d1740 | 2005-11-21 16:33:22 +0100 | [diff] [blame] | 4420 | unsigned int wcap = get_wcaps(codec, alc880_adc_nids[0]); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4421 | /* get type */ |
| 4422 | wcap = (wcap & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4423 | if (wcap != AC_WID_AUD_IN) { |
| 4424 | spec->adc_nids = alc880_adc_nids_alt; |
| 4425 | spec->num_adc_nids = ARRAY_SIZE(alc880_adc_nids_alt); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4426 | } else { |
| 4427 | spec->adc_nids = alc880_adc_nids; |
| 4428 | spec->num_adc_nids = ARRAY_SIZE(alc880_adc_nids); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4429 | } |
| 4430 | } |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 4431 | set_capture_mixer(spec); |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 4432 | set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4433 | |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 4434 | spec->vmaster_nid = 0x0c; |
| 4435 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4436 | codec->patch_ops = alc_patch_ops; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4437 | if (board_config == ALC880_AUTO) |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 4438 | spec->init_hook = alc880_auto_init; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 4439 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 4440 | if (!spec->loopback.amplist) |
| 4441 | spec->loopback.amplist = alc880_loopbacks; |
| 4442 | #endif |
Takashi Iwai | daead53 | 2008-11-28 12:55:36 +0100 | [diff] [blame] | 4443 | codec->proc_widget_hook = print_realtek_coef; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4444 | |
| 4445 | return 0; |
| 4446 | } |
| 4447 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4448 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4449 | /* |
| 4450 | * ALC260 support |
| 4451 | */ |
| 4452 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4453 | static hda_nid_t alc260_dac_nids[1] = { |
| 4454 | /* front */ |
| 4455 | 0x02, |
| 4456 | }; |
| 4457 | |
| 4458 | static hda_nid_t alc260_adc_nids[1] = { |
| 4459 | /* ADC0 */ |
| 4460 | 0x04, |
| 4461 | }; |
| 4462 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4463 | static hda_nid_t alc260_adc_nids_alt[1] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4464 | /* ADC1 */ |
| 4465 | 0x05, |
| 4466 | }; |
| 4467 | |
Jonathan Woithe | d57fdac | 2006-02-28 11:38:35 +0100 | [diff] [blame] | 4468 | /* NIDs used when simultaneous access to both ADCs makes sense. Note that |
| 4469 | * alc260_capture_mixer assumes ADC0 (nid 0x04) is the first ADC. |
| 4470 | */ |
| 4471 | static hda_nid_t alc260_dual_adc_nids[2] = { |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 4472 | /* ADC0, ADC1 */ |
| 4473 | 0x04, 0x05 |
| 4474 | }; |
| 4475 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4476 | #define ALC260_DIGOUT_NID 0x03 |
| 4477 | #define ALC260_DIGIN_NID 0x06 |
| 4478 | |
| 4479 | static struct hda_input_mux alc260_capture_source = { |
| 4480 | .num_items = 4, |
| 4481 | .items = { |
| 4482 | { "Mic", 0x0 }, |
| 4483 | { "Front Mic", 0x1 }, |
| 4484 | { "Line", 0x2 }, |
| 4485 | { "CD", 0x4 }, |
| 4486 | }, |
| 4487 | }; |
| 4488 | |
Jonathan Woithe | 17e7aec | 2006-02-28 11:35:18 +0100 | [diff] [blame] | 4489 | /* On Fujitsu S702x laptops capture only makes sense from Mic/LineIn jack, |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 4490 | * headphone jack and the internal CD lines since these are the only pins at |
| 4491 | * which audio can appear. For flexibility, also allow the option of |
| 4492 | * recording the mixer output on the second ADC (ADC0 doesn't have a |
| 4493 | * connection to the mixer output). |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 4494 | */ |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 4495 | static struct hda_input_mux alc260_fujitsu_capture_sources[2] = { |
| 4496 | { |
| 4497 | .num_items = 3, |
| 4498 | .items = { |
| 4499 | { "Mic/Line", 0x0 }, |
| 4500 | { "CD", 0x4 }, |
| 4501 | { "Headphone", 0x2 }, |
| 4502 | }, |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 4503 | }, |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 4504 | { |
| 4505 | .num_items = 4, |
| 4506 | .items = { |
| 4507 | { "Mic/Line", 0x0 }, |
| 4508 | { "CD", 0x4 }, |
| 4509 | { "Headphone", 0x2 }, |
| 4510 | { "Mixer", 0x5 }, |
| 4511 | }, |
| 4512 | }, |
| 4513 | |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 4514 | }; |
| 4515 | |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 4516 | /* Acer TravelMate(/Extensa/Aspire) notebooks have similar configuration to |
| 4517 | * the Fujitsu S702x, but jacks are marked differently. |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 4518 | */ |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 4519 | static struct hda_input_mux alc260_acer_capture_sources[2] = { |
| 4520 | { |
| 4521 | .num_items = 4, |
| 4522 | .items = { |
| 4523 | { "Mic", 0x0 }, |
| 4524 | { "Line", 0x2 }, |
| 4525 | { "CD", 0x4 }, |
| 4526 | { "Headphone", 0x5 }, |
| 4527 | }, |
| 4528 | }, |
| 4529 | { |
| 4530 | .num_items = 5, |
| 4531 | .items = { |
| 4532 | { "Mic", 0x0 }, |
| 4533 | { "Line", 0x2 }, |
| 4534 | { "CD", 0x4 }, |
| 4535 | { "Headphone", 0x6 }, |
| 4536 | { "Mixer", 0x5 }, |
| 4537 | }, |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 4538 | }, |
| 4539 | }; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4540 | /* |
| 4541 | * This is just place-holder, so there's something for alc_build_pcms to look |
| 4542 | * at when it calculates the maximum number of channels. ALC260 has no mixer |
| 4543 | * element which allows changing the channel mode, so the verb list is |
| 4544 | * never used. |
| 4545 | */ |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 4546 | static struct hda_channel_mode alc260_modes[1] = { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4547 | { 2, NULL }, |
| 4548 | }; |
| 4549 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4550 | |
| 4551 | /* Mixer combinations |
| 4552 | * |
| 4553 | * basic: base_output + input + pc_beep + capture |
| 4554 | * HP: base_output + input + capture_alt |
| 4555 | * HP_3013: hp_3013 + input + capture |
| 4556 | * fujitsu: fujitsu + capture |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 4557 | * acer: acer + capture |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4558 | */ |
| 4559 | |
| 4560 | static struct snd_kcontrol_new alc260_base_output_mixer[] = { |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 4561 | HDA_CODEC_VOLUME("Front Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 4562 | HDA_BIND_MUTE("Front Playback Switch", 0x08, 2, HDA_INPUT), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4563 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x09, 0x0, HDA_OUTPUT), |
| 4564 | HDA_BIND_MUTE("Headphone Playback Switch", 0x09, 2, HDA_INPUT), |
| 4565 | HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT), |
| 4566 | HDA_BIND_MUTE_MONO("Mono Playback Switch", 0x0a, 1, 2, HDA_INPUT), |
| 4567 | { } /* end */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4568 | }; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4569 | |
| 4570 | static struct snd_kcontrol_new alc260_input_mixer[] = { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4571 | HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT), |
| 4572 | HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT), |
| 4573 | HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT), |
| 4574 | HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT), |
| 4575 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT), |
| 4576 | HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT), |
| 4577 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x07, 0x01, HDA_INPUT), |
| 4578 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x07, 0x01, HDA_INPUT), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4579 | { } /* end */ |
| 4580 | }; |
| 4581 | |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 4582 | /* update HP, line and mono out pins according to the master switch */ |
| 4583 | static void alc260_hp_master_update(struct hda_codec *codec, |
| 4584 | hda_nid_t hp, hda_nid_t line, |
| 4585 | hda_nid_t mono) |
| 4586 | { |
| 4587 | struct alc_spec *spec = codec->spec; |
| 4588 | unsigned int val = spec->master_sw ? PIN_HP : 0; |
| 4589 | /* change HP and line-out pins */ |
Takashi Iwai | 30cde0a | 2008-11-07 14:49:28 +0100 | [diff] [blame] | 4590 | 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] | 4591 | val); |
Takashi Iwai | 30cde0a | 2008-11-07 14:49:28 +0100 | [diff] [blame] | 4592 | 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] | 4593 | val); |
| 4594 | /* mono (speaker) depending on the HP jack sense */ |
| 4595 | val = (val && !spec->jack_present) ? PIN_OUT : 0; |
Takashi Iwai | 30cde0a | 2008-11-07 14:49:28 +0100 | [diff] [blame] | 4596 | 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] | 4597 | val); |
| 4598 | } |
| 4599 | |
| 4600 | static int alc260_hp_master_sw_get(struct snd_kcontrol *kcontrol, |
| 4601 | struct snd_ctl_elem_value *ucontrol) |
| 4602 | { |
| 4603 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 4604 | struct alc_spec *spec = codec->spec; |
| 4605 | *ucontrol->value.integer.value = spec->master_sw; |
| 4606 | return 0; |
| 4607 | } |
| 4608 | |
| 4609 | static int alc260_hp_master_sw_put(struct snd_kcontrol *kcontrol, |
| 4610 | struct snd_ctl_elem_value *ucontrol) |
| 4611 | { |
| 4612 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 4613 | struct alc_spec *spec = codec->spec; |
| 4614 | int val = !!*ucontrol->value.integer.value; |
| 4615 | hda_nid_t hp, line, mono; |
| 4616 | |
| 4617 | if (val == spec->master_sw) |
| 4618 | return 0; |
| 4619 | spec->master_sw = val; |
| 4620 | hp = (kcontrol->private_value >> 16) & 0xff; |
| 4621 | line = (kcontrol->private_value >> 8) & 0xff; |
| 4622 | mono = kcontrol->private_value & 0xff; |
| 4623 | alc260_hp_master_update(codec, hp, line, mono); |
| 4624 | return 1; |
| 4625 | } |
| 4626 | |
| 4627 | static struct snd_kcontrol_new alc260_hp_output_mixer[] = { |
| 4628 | { |
| 4629 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 4630 | .name = "Master Playback Switch", |
| 4631 | .info = snd_ctl_boolean_mono_info, |
| 4632 | .get = alc260_hp_master_sw_get, |
| 4633 | .put = alc260_hp_master_sw_put, |
| 4634 | .private_value = (0x0f << 16) | (0x10 << 8) | 0x11 |
| 4635 | }, |
| 4636 | HDA_CODEC_VOLUME("Front Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
| 4637 | HDA_BIND_MUTE("Front Playback Switch", 0x08, 2, HDA_INPUT), |
| 4638 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x09, 0x0, HDA_OUTPUT), |
| 4639 | HDA_BIND_MUTE("Headphone Playback Switch", 0x09, 2, HDA_INPUT), |
| 4640 | HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0a, 1, 0x0, |
| 4641 | HDA_OUTPUT), |
| 4642 | HDA_BIND_MUTE_MONO("Speaker Playback Switch", 0x0a, 1, 2, HDA_INPUT), |
| 4643 | { } /* end */ |
| 4644 | }; |
| 4645 | |
| 4646 | static struct hda_verb alc260_hp_unsol_verbs[] = { |
| 4647 | {0x10, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 4648 | {}, |
| 4649 | }; |
| 4650 | |
| 4651 | static void alc260_hp_automute(struct hda_codec *codec) |
| 4652 | { |
| 4653 | struct alc_spec *spec = codec->spec; |
| 4654 | unsigned int present; |
| 4655 | |
| 4656 | present = snd_hda_codec_read(codec, 0x10, 0, |
| 4657 | AC_VERB_GET_PIN_SENSE, 0); |
| 4658 | spec->jack_present = (present & AC_PINSENSE_PRESENCE) != 0; |
| 4659 | alc260_hp_master_update(codec, 0x0f, 0x10, 0x11); |
| 4660 | } |
| 4661 | |
| 4662 | static void alc260_hp_unsol_event(struct hda_codec *codec, unsigned int res) |
| 4663 | { |
| 4664 | if ((res >> 26) == ALC880_HP_EVENT) |
| 4665 | alc260_hp_automute(codec); |
| 4666 | } |
| 4667 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4668 | static struct snd_kcontrol_new alc260_hp_3013_mixer[] = { |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 4669 | { |
| 4670 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 4671 | .name = "Master Playback Switch", |
| 4672 | .info = snd_ctl_boolean_mono_info, |
| 4673 | .get = alc260_hp_master_sw_get, |
| 4674 | .put = alc260_hp_master_sw_put, |
Takashi Iwai | 30cde0a | 2008-11-07 14:49:28 +0100 | [diff] [blame] | 4675 | .private_value = (0x15 << 16) | (0x10 << 8) | 0x11 |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 4676 | }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4677 | HDA_CODEC_VOLUME("Front Playback Volume", 0x09, 0x0, HDA_OUTPUT), |
| 4678 | HDA_CODEC_MUTE("Front Playback Switch", 0x10, 0x0, HDA_OUTPUT), |
| 4679 | HDA_CODEC_VOLUME("Aux-In Playback Volume", 0x07, 0x06, HDA_INPUT), |
| 4680 | HDA_CODEC_MUTE("Aux-In Playback Switch", 0x07, 0x06, HDA_INPUT), |
| 4681 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
| 4682 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
Takashi Iwai | 86cd929 | 2008-01-28 18:09:56 +0100 | [diff] [blame] | 4683 | HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT), |
| 4684 | HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x11, 1, 0x0, HDA_OUTPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4685 | { } /* end */ |
| 4686 | }; |
| 4687 | |
Kailang Yang | 3f87830 | 2008-08-26 13:02:23 +0200 | [diff] [blame] | 4688 | static struct hda_bind_ctls alc260_dc7600_bind_master_vol = { |
| 4689 | .ops = &snd_hda_bind_vol, |
| 4690 | .values = { |
| 4691 | HDA_COMPOSE_AMP_VAL(0x08, 3, 0, HDA_OUTPUT), |
| 4692 | HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_OUTPUT), |
| 4693 | HDA_COMPOSE_AMP_VAL(0x0a, 3, 0, HDA_OUTPUT), |
| 4694 | 0 |
| 4695 | }, |
| 4696 | }; |
| 4697 | |
| 4698 | static struct hda_bind_ctls alc260_dc7600_bind_switch = { |
| 4699 | .ops = &snd_hda_bind_sw, |
| 4700 | .values = { |
| 4701 | HDA_COMPOSE_AMP_VAL(0x11, 3, 0, HDA_OUTPUT), |
| 4702 | HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT), |
| 4703 | 0 |
| 4704 | }, |
| 4705 | }; |
| 4706 | |
| 4707 | static struct snd_kcontrol_new alc260_hp_dc7600_mixer[] = { |
| 4708 | HDA_BIND_VOL("Master Playback Volume", &alc260_dc7600_bind_master_vol), |
| 4709 | HDA_BIND_SW("LineOut Playback Switch", &alc260_dc7600_bind_switch), |
| 4710 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x0f, 0x0, HDA_OUTPUT), |
| 4711 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x10, 0x0, HDA_OUTPUT), |
| 4712 | { } /* end */ |
| 4713 | }; |
| 4714 | |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 4715 | static struct hda_verb alc260_hp_3013_unsol_verbs[] = { |
| 4716 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 4717 | {}, |
| 4718 | }; |
| 4719 | |
| 4720 | static void alc260_hp_3013_automute(struct hda_codec *codec) |
| 4721 | { |
| 4722 | struct alc_spec *spec = codec->spec; |
| 4723 | unsigned int present; |
| 4724 | |
| 4725 | present = snd_hda_codec_read(codec, 0x15, 0, |
| 4726 | AC_VERB_GET_PIN_SENSE, 0); |
| 4727 | spec->jack_present = (present & AC_PINSENSE_PRESENCE) != 0; |
Takashi Iwai | 30cde0a | 2008-11-07 14:49:28 +0100 | [diff] [blame] | 4728 | alc260_hp_master_update(codec, 0x15, 0x10, 0x11); |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 4729 | } |
| 4730 | |
| 4731 | static void alc260_hp_3013_unsol_event(struct hda_codec *codec, |
| 4732 | unsigned int res) |
| 4733 | { |
| 4734 | if ((res >> 26) == ALC880_HP_EVENT) |
| 4735 | alc260_hp_3013_automute(codec); |
| 4736 | } |
| 4737 | |
Kailang Yang | 3f87830 | 2008-08-26 13:02:23 +0200 | [diff] [blame] | 4738 | static void alc260_hp_3012_automute(struct hda_codec *codec) |
| 4739 | { |
| 4740 | unsigned int present, bits; |
| 4741 | |
| 4742 | present = snd_hda_codec_read(codec, 0x10, 0, |
| 4743 | AC_VERB_GET_PIN_SENSE, 0) & AC_PINSENSE_PRESENCE; |
| 4744 | |
| 4745 | bits = present ? 0 : PIN_OUT; |
| 4746 | snd_hda_codec_write(codec, 0x0f, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 4747 | bits); |
| 4748 | snd_hda_codec_write(codec, 0x11, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 4749 | bits); |
| 4750 | snd_hda_codec_write(codec, 0x15, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 4751 | bits); |
| 4752 | } |
| 4753 | |
| 4754 | static void alc260_hp_3012_unsol_event(struct hda_codec *codec, |
| 4755 | unsigned int res) |
| 4756 | { |
| 4757 | if ((res >> 26) == ALC880_HP_EVENT) |
| 4758 | alc260_hp_3012_automute(codec); |
| 4759 | } |
| 4760 | |
| 4761 | /* Fujitsu S702x series laptops. ALC260 pin usage: Mic/Line jack = 0x12, |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 4762 | * HP jack = 0x14, CD audio = 0x16, internal speaker = 0x10. |
| 4763 | */ |
Takashi Iwai | c8b6bf9b | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 4764 | static struct snd_kcontrol_new alc260_fujitsu_mixer[] = { |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 4765 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 4766 | HDA_BIND_MUTE("Headphone Playback Switch", 0x08, 2, HDA_INPUT), |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 4767 | ALC_PIN_MODE("Headphone Jack Mode", 0x14, ALC_PIN_DIR_INOUT), |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 4768 | HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT), |
| 4769 | HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT), |
| 4770 | HDA_CODEC_VOLUME("Mic/Line Playback Volume", 0x07, 0x0, HDA_INPUT), |
| 4771 | HDA_CODEC_MUTE("Mic/Line Playback Switch", 0x07, 0x0, HDA_INPUT), |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 4772 | ALC_PIN_MODE("Mic/Line Jack Mode", 0x12, ALC_PIN_DIR_IN), |
Takashi Iwai | 31bffaa | 2008-02-27 16:10:44 +0100 | [diff] [blame] | 4773 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x09, 0x0, HDA_OUTPUT), |
| 4774 | HDA_BIND_MUTE("Speaker Playback Switch", 0x09, 2, HDA_INPUT), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4775 | { } /* end */ |
| 4776 | }; |
| 4777 | |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 4778 | /* Mixer for Acer TravelMate(/Extensa/Aspire) notebooks. Note that current |
| 4779 | * versions of the ALC260 don't act on requests to enable mic bias from NID |
| 4780 | * 0x0f (used to drive the headphone jack in these laptops). The ALC260 |
| 4781 | * datasheet doesn't mention this restriction. At this stage it's not clear |
| 4782 | * whether this behaviour is intentional or is a hardware bug in chip |
| 4783 | * revisions available in early 2006. Therefore for now allow the |
| 4784 | * "Headphone Jack Mode" control to span all choices, but if it turns out |
| 4785 | * that the lack of mic bias for this NID is intentional we could change the |
| 4786 | * mode from ALC_PIN_DIR_INOUT to ALC_PIN_DIR_INOUT_NOMICBIAS. |
| 4787 | * |
| 4788 | * In addition, Acer TravelMate(/Extensa/Aspire) notebooks in early 2006 |
| 4789 | * don't appear to make the mic bias available from the "line" jack, even |
| 4790 | * though the NID used for this jack (0x14) can supply it. The theory is |
| 4791 | * that perhaps Acer have included blocking capacitors between the ALC260 |
| 4792 | * and the output jack. If this turns out to be the case for all such |
| 4793 | * models the "Line Jack Mode" mode could be changed from ALC_PIN_DIR_INOUT |
| 4794 | * to ALC_PIN_DIR_INOUT_NOMICBIAS. |
Jonathan Woithe | bd86948 | 2006-11-28 11:35:52 +0100 | [diff] [blame] | 4795 | * |
| 4796 | * The C20x Tablet series have a mono internal speaker which is controlled |
| 4797 | * via the chip's Mono sum widget and pin complex, so include the necessary |
| 4798 | * controls for such models. On models without a "mono speaker" the control |
| 4799 | * won't do anything. |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 4800 | */ |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 4801 | static struct snd_kcontrol_new alc260_acer_mixer[] = { |
| 4802 | HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
| 4803 | HDA_BIND_MUTE("Master Playback Switch", 0x08, 2, HDA_INPUT), |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 4804 | ALC_PIN_MODE("Headphone Jack Mode", 0x0f, ALC_PIN_DIR_INOUT), |
Takashi Iwai | 31bffaa | 2008-02-27 16:10:44 +0100 | [diff] [blame] | 4805 | HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0a, 1, 0x0, |
Jonathan Woithe | bd86948 | 2006-11-28 11:35:52 +0100 | [diff] [blame] | 4806 | HDA_OUTPUT), |
Takashi Iwai | 31bffaa | 2008-02-27 16:10:44 +0100 | [diff] [blame] | 4807 | HDA_BIND_MUTE_MONO("Speaker Playback Switch", 0x0a, 1, 2, |
Jonathan Woithe | bd86948 | 2006-11-28 11:35:52 +0100 | [diff] [blame] | 4808 | HDA_INPUT), |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 4809 | HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT), |
| 4810 | HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT), |
| 4811 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT), |
| 4812 | HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT), |
| 4813 | ALC_PIN_MODE("Mic Jack Mode", 0x12, ALC_PIN_DIR_IN), |
| 4814 | HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT), |
| 4815 | HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT), |
| 4816 | ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT), |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 4817 | { } /* end */ |
| 4818 | }; |
| 4819 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 4820 | /* Packard bell V7900 ALC260 pin usage: HP = 0x0f, Mic jack = 0x12, |
| 4821 | * Line In jack = 0x14, CD audio = 0x16, pc beep = 0x17. |
| 4822 | */ |
| 4823 | static struct snd_kcontrol_new alc260_will_mixer[] = { |
| 4824 | HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
| 4825 | HDA_BIND_MUTE("Master Playback Switch", 0x08, 0x2, HDA_INPUT), |
| 4826 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT), |
| 4827 | HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT), |
| 4828 | ALC_PIN_MODE("Mic Jack Mode", 0x12, ALC_PIN_DIR_IN), |
| 4829 | HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT), |
| 4830 | HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT), |
| 4831 | ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT), |
| 4832 | HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT), |
| 4833 | HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 4834 | { } /* end */ |
| 4835 | }; |
| 4836 | |
| 4837 | /* Replacer 672V ALC260 pin usage: Mic jack = 0x12, |
| 4838 | * Line In jack = 0x14, ATAPI Mic = 0x13, speaker = 0x0f. |
| 4839 | */ |
| 4840 | static struct snd_kcontrol_new alc260_replacer_672v_mixer[] = { |
| 4841 | HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
| 4842 | HDA_BIND_MUTE("Master Playback Switch", 0x08, 0x2, HDA_INPUT), |
| 4843 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT), |
| 4844 | HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT), |
| 4845 | ALC_PIN_MODE("Mic Jack Mode", 0x12, ALC_PIN_DIR_IN), |
| 4846 | HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x07, 0x1, HDA_INPUT), |
| 4847 | HDA_CODEC_MUTE("ATATI Mic Playback Switch", 0x07, 0x1, HDA_INPUT), |
| 4848 | HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT), |
| 4849 | HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT), |
| 4850 | ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT), |
| 4851 | { } /* end */ |
| 4852 | }; |
| 4853 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4854 | /* |
| 4855 | * initialization verbs |
| 4856 | */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4857 | static struct hda_verb alc260_init_verbs[] = { |
| 4858 | /* Line In pin widget for input */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 4859 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4860 | /* CD pin widget for input */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 4861 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4862 | /* Mic1 (rear panel) pin widget for input and vref at 80% */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4863 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4864 | /* Mic2 (front panel) pin widget for input and vref at 80% */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4865 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4866 | /* LINE-2 is used for line-out in rear */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 4867 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4868 | /* select line-out */ |
Jonathan Woithe | fd56f2d | 2006-01-24 10:35:46 +0100 | [diff] [blame] | 4869 | {0x0e, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4870 | /* LINE-OUT pin */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 4871 | {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4872 | /* enable HP */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 4873 | {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4874 | /* enable Mono */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 4875 | {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 4876 | /* mute capture amp left and right */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4877 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4878 | /* set connection select to line in (default select for this ADC) */ |
| 4879 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x02}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4880 | /* mute capture amp left and right */ |
| 4881 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 4882 | /* set connection select to line in (default select for this ADC) */ |
| 4883 | {0x05, AC_VERB_SET_CONNECT_SEL, 0x02}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 4884 | /* set vol=0 Line-Out mixer amp left and right */ |
| 4885 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 4886 | /* unmute pin widget amp left and right (no gain on this amp) */ |
| 4887 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 4888 | /* set vol=0 HP mixer amp left and right */ |
| 4889 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 4890 | /* unmute pin widget amp left and right (no gain on this amp) */ |
| 4891 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 4892 | /* set vol=0 Mono mixer amp left and right */ |
| 4893 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 4894 | /* unmute pin widget amp left and right (no gain on this amp) */ |
| 4895 | {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 4896 | /* unmute LINE-2 out pin */ |
| 4897 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4898 | /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 & |
| 4899 | * Line In 2 = 0x03 |
| 4900 | */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 4901 | /* mute analog inputs */ |
| 4902 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 4903 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 4904 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 4905 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 4906 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4907 | /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 4908 | /* mute Front out path */ |
| 4909 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 4910 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 4911 | /* mute Headphone out path */ |
| 4912 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 4913 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 4914 | /* mute Mono out path */ |
| 4915 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 4916 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4917 | { } |
| 4918 | }; |
| 4919 | |
Takashi Iwai | 474167d | 2006-05-17 17:17:43 +0200 | [diff] [blame] | 4920 | #if 0 /* should be identical with alc260_init_verbs? */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4921 | static struct hda_verb alc260_hp_init_verbs[] = { |
| 4922 | /* Headphone and output */ |
| 4923 | {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0}, |
| 4924 | /* mono output */ |
| 4925 | {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, |
| 4926 | /* Mic1 (rear panel) pin widget for input and vref at 80% */ |
| 4927 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 4928 | /* Mic2 (front panel) pin widget for input and vref at 80% */ |
| 4929 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 4930 | /* Line In pin widget for input */ |
| 4931 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 4932 | /* Line-2 pin widget for output */ |
| 4933 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, |
| 4934 | /* CD pin widget for input */ |
| 4935 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 4936 | /* unmute amp left and right */ |
| 4937 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000}, |
| 4938 | /* set connection select to line in (default select for this ADC) */ |
| 4939 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 4940 | /* unmute Line-Out mixer amp left and right (volume = 0) */ |
| 4941 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000}, |
| 4942 | /* mute pin widget amp left and right (no gain on this amp) */ |
| 4943 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
| 4944 | /* unmute HP mixer amp left and right (volume = 0) */ |
| 4945 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000}, |
| 4946 | /* mute pin widget amp left and right (no gain on this amp) */ |
| 4947 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4948 | /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 & |
| 4949 | * Line In 2 = 0x03 |
| 4950 | */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 4951 | /* mute analog inputs */ |
| 4952 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 4953 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 4954 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 4955 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 4956 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4957 | /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */ |
| 4958 | /* Unmute Front out path */ |
| 4959 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 4960 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 4961 | /* Unmute Headphone out path */ |
| 4962 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 4963 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 4964 | /* Unmute Mono out path */ |
| 4965 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 4966 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 4967 | { } |
| 4968 | }; |
Takashi Iwai | 474167d | 2006-05-17 17:17:43 +0200 | [diff] [blame] | 4969 | #endif |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4970 | |
| 4971 | static struct hda_verb alc260_hp_3013_init_verbs[] = { |
| 4972 | /* Line out and output */ |
| 4973 | {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, |
| 4974 | /* mono output */ |
| 4975 | {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, |
| 4976 | /* Mic1 (rear panel) pin widget for input and vref at 80% */ |
| 4977 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 4978 | /* Mic2 (front panel) pin widget for input and vref at 80% */ |
| 4979 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 4980 | /* Line In pin widget for input */ |
| 4981 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 4982 | /* Headphone pin widget for output */ |
| 4983 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0}, |
| 4984 | /* CD pin widget for input */ |
| 4985 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 4986 | /* unmute amp left and right */ |
| 4987 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000}, |
| 4988 | /* set connection select to line in (default select for this ADC) */ |
| 4989 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 4990 | /* unmute Line-Out mixer amp left and right (volume = 0) */ |
| 4991 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000}, |
| 4992 | /* mute pin widget amp left and right (no gain on this amp) */ |
| 4993 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
| 4994 | /* unmute HP mixer amp left and right (volume = 0) */ |
| 4995 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000}, |
| 4996 | /* mute pin widget amp left and right (no gain on this amp) */ |
| 4997 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4998 | /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 & |
| 4999 | * Line In 2 = 0x03 |
| 5000 | */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 5001 | /* mute analog inputs */ |
| 5002 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5003 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 5004 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 5005 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 5006 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5007 | /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */ |
| 5008 | /* Unmute Front out path */ |
| 5009 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 5010 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 5011 | /* Unmute Headphone out path */ |
| 5012 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 5013 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 5014 | /* Unmute Mono out path */ |
| 5015 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 5016 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 5017 | { } |
| 5018 | }; |
| 5019 | |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 5020 | /* Initialisation sequence for ALC260 as configured in Fujitsu S702x |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 5021 | * laptops. ALC260 pin usage: Mic/Line jack = 0x12, HP jack = 0x14, CD |
| 5022 | * audio = 0x16, internal speaker = 0x10. |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 5023 | */ |
| 5024 | static struct hda_verb alc260_fujitsu_init_verbs[] = { |
| 5025 | /* Disable all GPIOs */ |
| 5026 | {0x01, AC_VERB_SET_GPIO_MASK, 0}, |
| 5027 | /* Internal speaker is connected to headphone pin */ |
| 5028 | {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 5029 | /* Headphone/Line-out jack connects to Line1 pin; make it an output */ |
| 5030 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 5031 | /* Mic/Line-in jack is connected to mic1 pin, so make it an input */ |
| 5032 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 5033 | /* Ensure all other unused pins are disabled and muted. */ |
| 5034 | {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
| 5035 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 5036 | {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 5037 | {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 5038 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 5039 | {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5040 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
| 5041 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 5042 | |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 5043 | /* Disable digital (SPDIF) pins */ |
| 5044 | {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0}, |
| 5045 | {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0}, |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 5046 | |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 5047 | /* Ensure Line1 pin widget takes its input from the OUT1 sum bus |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 5048 | * when acting as an output. |
| 5049 | */ |
| 5050 | {0x0d, AC_VERB_SET_CONNECT_SEL, 0}, |
| 5051 | |
| 5052 | /* Start with output sum widgets muted and their output gains at min */ |
Takashi Iwai | 8b33a5a | 2006-02-09 11:57:01 +0100 | [diff] [blame] | 5053 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5054 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 5055 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5056 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5057 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 5058 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5059 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5060 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 5061 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 5062 | |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 5063 | /* Unmute HP pin widget amp left and right (no equiv mixer ctrl) */ |
| 5064 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 5065 | /* Unmute Line1 pin widget output buffer since it starts as an output. |
| 5066 | * If the pin mode is changed by the user the pin mode control will |
| 5067 | * take care of enabling the pin's input/output buffers as needed. |
| 5068 | * Therefore there's no need to enable the input buffer at this |
| 5069 | * stage. |
Jonathan Woithe | cdcd926 | 2006-02-28 11:36:42 +0100 | [diff] [blame] | 5070 | */ |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 5071 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 5072 | /* Unmute input buffer of pin widget used for Line-in (no equiv |
Jonathan Woithe | cdcd926 | 2006-02-28 11:36:42 +0100 | [diff] [blame] | 5073 | * mixer ctrl) |
| 5074 | */ |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 5075 | {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 5076 | |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 5077 | /* Mute capture amp left and right */ |
| 5078 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 5079 | /* Set ADC connection select to match default mixer setting - line |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 5080 | * in (on mic1 pin) |
| 5081 | */ |
| 5082 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 5083 | |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 5084 | /* Do the same for the second ADC: mute capture input amp and |
| 5085 | * set ADC connection to line in (on mic1 pin) |
| 5086 | */ |
| 5087 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5088 | {0x05, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 5089 | |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 5090 | /* Mute all inputs to mixer widget (even unconnected ones) */ |
| 5091 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */ |
| 5092 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */ |
| 5093 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */ |
| 5094 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */ |
| 5095 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */ |
| 5096 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */ |
| 5097 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */ |
| 5098 | {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] | 5099 | |
| 5100 | { } |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 5101 | }; |
| 5102 | |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 5103 | /* Initialisation sequence for ALC260 as configured in Acer TravelMate and |
| 5104 | * similar laptops (adapted from Fujitsu init verbs). |
| 5105 | */ |
| 5106 | static struct hda_verb alc260_acer_init_verbs[] = { |
| 5107 | /* On TravelMate laptops, GPIO 0 enables the internal speaker and |
| 5108 | * the headphone jack. Turn this on and rely on the standard mute |
| 5109 | * methods whenever the user wants to turn these outputs off. |
| 5110 | */ |
| 5111 | {0x01, AC_VERB_SET_GPIO_MASK, 0x01}, |
| 5112 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01}, |
| 5113 | {0x01, AC_VERB_SET_GPIO_DATA, 0x01}, |
| 5114 | /* Internal speaker/Headphone jack is connected to Line-out pin */ |
| 5115 | {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 5116 | /* Internal microphone/Mic jack is connected to Mic1 pin */ |
| 5117 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50}, |
| 5118 | /* Line In jack is connected to Line1 pin */ |
| 5119 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Jonathan Woithe | bd86948 | 2006-11-28 11:35:52 +0100 | [diff] [blame] | 5120 | /* Some Acers (eg: C20x Tablets) use Mono pin for internal speaker */ |
| 5121 | {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 5122 | /* Ensure all other unused pins are disabled and muted. */ |
| 5123 | {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
| 5124 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 5125 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
| 5126 | {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5127 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
| 5128 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5129 | /* Disable digital (SPDIF) pins */ |
| 5130 | {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0}, |
| 5131 | {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0}, |
| 5132 | |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 5133 | /* Ensure Mic1 and Line1 pin widgets take input from the OUT1 sum |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 5134 | * bus when acting as outputs. |
| 5135 | */ |
| 5136 | {0x0b, AC_VERB_SET_CONNECT_SEL, 0}, |
| 5137 | {0x0d, AC_VERB_SET_CONNECT_SEL, 0}, |
| 5138 | |
| 5139 | /* Start with output sum widgets muted and their output gains at min */ |
| 5140 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5141 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 5142 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5143 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5144 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 5145 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5146 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5147 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 5148 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5149 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5150 | /* Unmute Line-out pin widget amp left and right |
| 5151 | * (no equiv mixer ctrl) |
| 5152 | */ |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 5153 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Jonathan Woithe | bd86948 | 2006-11-28 11:35:52 +0100 | [diff] [blame] | 5154 | /* Unmute mono pin widget amp output (no equiv mixer ctrl) */ |
| 5155 | {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 5156 | /* Unmute Mic1 and Line1 pin widget input buffers since they start as |
| 5157 | * inputs. If the pin mode is changed by the user the pin mode control |
| 5158 | * will take care of enabling the pin's input/output buffers as needed. |
| 5159 | * Therefore there's no need to enable the input buffer at this |
| 5160 | * stage. |
| 5161 | */ |
| 5162 | {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5163 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5164 | |
| 5165 | /* Mute capture amp left and right */ |
| 5166 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5167 | /* Set ADC connection select to match default mixer setting - mic |
| 5168 | * (on mic1 pin) |
| 5169 | */ |
| 5170 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 5171 | |
| 5172 | /* Do similar with the second ADC: mute capture input amp and |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 5173 | * set ADC connection to mic to match ALSA's default state. |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 5174 | */ |
| 5175 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 5176 | {0x05, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 5177 | |
| 5178 | /* Mute all inputs to mixer widget (even unconnected ones) */ |
| 5179 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */ |
| 5180 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */ |
| 5181 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */ |
| 5182 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */ |
| 5183 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */ |
| 5184 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */ |
| 5185 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */ |
| 5186 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */ |
| 5187 | |
| 5188 | { } |
| 5189 | }; |
| 5190 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 5191 | static struct hda_verb alc260_will_verbs[] = { |
| 5192 | {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 5193 | {0x0b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 5194 | {0x0d, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 5195 | {0x0f, AC_VERB_SET_EAPD_BTLENABLE, 0x02}, |
| 5196 | {0x1a, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 5197 | {0x1a, AC_VERB_SET_PROC_COEF, 0x3040}, |
| 5198 | {} |
| 5199 | }; |
| 5200 | |
| 5201 | static struct hda_verb alc260_replacer_672v_verbs[] = { |
| 5202 | {0x0f, AC_VERB_SET_EAPD_BTLENABLE, 0x02}, |
| 5203 | {0x1a, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 5204 | {0x1a, AC_VERB_SET_PROC_COEF, 0x3050}, |
| 5205 | |
| 5206 | {0x01, AC_VERB_SET_GPIO_MASK, 0x01}, |
| 5207 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01}, |
| 5208 | {0x01, AC_VERB_SET_GPIO_DATA, 0x00}, |
| 5209 | |
| 5210 | {0x0f, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 5211 | {} |
| 5212 | }; |
| 5213 | |
| 5214 | /* toggle speaker-output according to the hp-jack state */ |
| 5215 | static void alc260_replacer_672v_automute(struct hda_codec *codec) |
| 5216 | { |
| 5217 | unsigned int present; |
| 5218 | |
| 5219 | /* speaker --> GPIO Data 0, hp or spdif --> GPIO data 1 */ |
| 5220 | present = snd_hda_codec_read(codec, 0x0f, 0, |
| 5221 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 5222 | if (present) { |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 5223 | snd_hda_codec_write_cache(codec, 0x01, 0, |
| 5224 | AC_VERB_SET_GPIO_DATA, 1); |
| 5225 | snd_hda_codec_write_cache(codec, 0x0f, 0, |
| 5226 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 5227 | PIN_HP); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 5228 | } else { |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 5229 | snd_hda_codec_write_cache(codec, 0x01, 0, |
| 5230 | AC_VERB_SET_GPIO_DATA, 0); |
| 5231 | snd_hda_codec_write_cache(codec, 0x0f, 0, |
| 5232 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 5233 | PIN_OUT); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 5234 | } |
| 5235 | } |
| 5236 | |
| 5237 | static void alc260_replacer_672v_unsol_event(struct hda_codec *codec, |
| 5238 | unsigned int res) |
| 5239 | { |
| 5240 | if ((res >> 26) == ALC880_HP_EVENT) |
| 5241 | alc260_replacer_672v_automute(codec); |
| 5242 | } |
| 5243 | |
Kailang Yang | 3f87830 | 2008-08-26 13:02:23 +0200 | [diff] [blame] | 5244 | static struct hda_verb alc260_hp_dc7600_verbs[] = { |
| 5245 | {0x05, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 5246 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 5247 | {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 5248 | {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 5249 | {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 5250 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 5251 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 5252 | {0x10, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 5253 | {0x11, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 5254 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 5255 | {} |
| 5256 | }; |
| 5257 | |
Jonathan Woithe | 7cf51e4 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 5258 | /* Test configuration for debugging, modelled after the ALC880 test |
| 5259 | * configuration. |
| 5260 | */ |
| 5261 | #ifdef CONFIG_SND_DEBUG |
| 5262 | static hda_nid_t alc260_test_dac_nids[1] = { |
| 5263 | 0x02, |
| 5264 | }; |
| 5265 | static hda_nid_t alc260_test_adc_nids[2] = { |
| 5266 | 0x04, 0x05, |
| 5267 | }; |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 5268 | /* For testing the ALC260, each input MUX needs its own definition since |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 5269 | * the signal assignments are different. This assumes that the first ADC |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 5270 | * is NID 0x04. |
Jonathan Woithe | 17e7aec | 2006-02-28 11:35:18 +0100 | [diff] [blame] | 5271 | */ |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 5272 | static struct hda_input_mux alc260_test_capture_sources[2] = { |
| 5273 | { |
| 5274 | .num_items = 7, |
| 5275 | .items = { |
| 5276 | { "MIC1 pin", 0x0 }, |
| 5277 | { "MIC2 pin", 0x1 }, |
| 5278 | { "LINE1 pin", 0x2 }, |
| 5279 | { "LINE2 pin", 0x3 }, |
| 5280 | { "CD pin", 0x4 }, |
| 5281 | { "LINE-OUT pin", 0x5 }, |
| 5282 | { "HP-OUT pin", 0x6 }, |
| 5283 | }, |
| 5284 | }, |
| 5285 | { |
| 5286 | .num_items = 8, |
| 5287 | .items = { |
| 5288 | { "MIC1 pin", 0x0 }, |
| 5289 | { "MIC2 pin", 0x1 }, |
| 5290 | { "LINE1 pin", 0x2 }, |
| 5291 | { "LINE2 pin", 0x3 }, |
| 5292 | { "CD pin", 0x4 }, |
| 5293 | { "Mixer", 0x5 }, |
| 5294 | { "LINE-OUT pin", 0x6 }, |
| 5295 | { "HP-OUT pin", 0x7 }, |
| 5296 | }, |
Jonathan Woithe | 7cf51e4 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 5297 | }, |
| 5298 | }; |
| 5299 | static struct snd_kcontrol_new alc260_test_mixer[] = { |
| 5300 | /* Output driver widgets */ |
| 5301 | HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT), |
| 5302 | HDA_BIND_MUTE_MONO("Mono Playback Switch", 0x0a, 1, 2, HDA_INPUT), |
| 5303 | HDA_CODEC_VOLUME("LOUT2 Playback Volume", 0x09, 0x0, HDA_OUTPUT), |
| 5304 | HDA_BIND_MUTE("LOUT2 Playback Switch", 0x09, 2, HDA_INPUT), |
| 5305 | HDA_CODEC_VOLUME("LOUT1 Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
| 5306 | HDA_BIND_MUTE("LOUT1 Playback Switch", 0x08, 2, HDA_INPUT), |
| 5307 | |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 5308 | /* Modes for retasking pin widgets |
| 5309 | * Note: the ALC260 doesn't seem to act on requests to enable mic |
| 5310 | * bias from NIDs 0x0f and 0x10. The ALC260 datasheet doesn't |
| 5311 | * mention this restriction. At this stage it's not clear whether |
| 5312 | * this behaviour is intentional or is a hardware bug in chip |
| 5313 | * revisions available at least up until early 2006. Therefore for |
| 5314 | * now allow the "HP-OUT" and "LINE-OUT" Mode controls to span all |
| 5315 | * choices, but if it turns out that the lack of mic bias for these |
| 5316 | * NIDs is intentional we could change their modes from |
| 5317 | * ALC_PIN_DIR_INOUT to ALC_PIN_DIR_INOUT_NOMICBIAS. |
| 5318 | */ |
Jonathan Woithe | 7cf51e4 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 5319 | ALC_PIN_MODE("HP-OUT pin mode", 0x10, ALC_PIN_DIR_INOUT), |
| 5320 | ALC_PIN_MODE("LINE-OUT pin mode", 0x0f, ALC_PIN_DIR_INOUT), |
| 5321 | ALC_PIN_MODE("LINE2 pin mode", 0x15, ALC_PIN_DIR_INOUT), |
| 5322 | ALC_PIN_MODE("LINE1 pin mode", 0x14, ALC_PIN_DIR_INOUT), |
| 5323 | ALC_PIN_MODE("MIC2 pin mode", 0x13, ALC_PIN_DIR_INOUT), |
| 5324 | ALC_PIN_MODE("MIC1 pin mode", 0x12, ALC_PIN_DIR_INOUT), |
| 5325 | |
| 5326 | /* Loopback mixer controls */ |
| 5327 | HDA_CODEC_VOLUME("MIC1 Playback Volume", 0x07, 0x00, HDA_INPUT), |
| 5328 | HDA_CODEC_MUTE("MIC1 Playback Switch", 0x07, 0x00, HDA_INPUT), |
| 5329 | HDA_CODEC_VOLUME("MIC2 Playback Volume", 0x07, 0x01, HDA_INPUT), |
| 5330 | HDA_CODEC_MUTE("MIC2 Playback Switch", 0x07, 0x01, HDA_INPUT), |
| 5331 | HDA_CODEC_VOLUME("LINE1 Playback Volume", 0x07, 0x02, HDA_INPUT), |
| 5332 | HDA_CODEC_MUTE("LINE1 Playback Switch", 0x07, 0x02, HDA_INPUT), |
| 5333 | HDA_CODEC_VOLUME("LINE2 Playback Volume", 0x07, 0x03, HDA_INPUT), |
| 5334 | HDA_CODEC_MUTE("LINE2 Playback Switch", 0x07, 0x03, HDA_INPUT), |
| 5335 | HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT), |
| 5336 | HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT), |
Jonathan Woithe | 7cf51e4 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 5337 | HDA_CODEC_VOLUME("LINE-OUT loopback Playback Volume", 0x07, 0x06, HDA_INPUT), |
| 5338 | HDA_CODEC_MUTE("LINE-OUT loopback Playback Switch", 0x07, 0x06, HDA_INPUT), |
| 5339 | HDA_CODEC_VOLUME("HP-OUT loopback Playback Volume", 0x07, 0x7, HDA_INPUT), |
| 5340 | HDA_CODEC_MUTE("HP-OUT loopback Playback Switch", 0x07, 0x7, HDA_INPUT), |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 5341 | |
| 5342 | /* Controls for GPIO pins, assuming they are configured as outputs */ |
| 5343 | ALC_GPIO_DATA_SWITCH("GPIO pin 0", 0x01, 0x01), |
| 5344 | ALC_GPIO_DATA_SWITCH("GPIO pin 1", 0x01, 0x02), |
| 5345 | ALC_GPIO_DATA_SWITCH("GPIO pin 2", 0x01, 0x04), |
| 5346 | ALC_GPIO_DATA_SWITCH("GPIO pin 3", 0x01, 0x08), |
| 5347 | |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 5348 | /* Switches to allow the digital IO pins to be enabled. The datasheet |
| 5349 | * is ambigious as to which NID is which; testing on laptops which |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 5350 | * make this output available should provide clarification. |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 5351 | */ |
| 5352 | ALC_SPDIF_CTRL_SWITCH("SPDIF Playback Switch", 0x03, 0x01), |
| 5353 | ALC_SPDIF_CTRL_SWITCH("SPDIF Capture Switch", 0x06, 0x01), |
| 5354 | |
Jonathan Woithe | f8225f6 | 2008-01-08 12:16:54 +0100 | [diff] [blame] | 5355 | /* A switch allowing EAPD to be enabled. Some laptops seem to use |
| 5356 | * this output to turn on an external amplifier. |
| 5357 | */ |
| 5358 | ALC_EAPD_CTRL_SWITCH("LINE-OUT EAPD Enable Switch", 0x0f, 0x02), |
| 5359 | ALC_EAPD_CTRL_SWITCH("HP-OUT EAPD Enable Switch", 0x10, 0x02), |
| 5360 | |
Jonathan Woithe | 7cf51e4 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 5361 | { } /* end */ |
| 5362 | }; |
| 5363 | static struct hda_verb alc260_test_init_verbs[] = { |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 5364 | /* Enable all GPIOs as outputs with an initial value of 0 */ |
| 5365 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x0f}, |
| 5366 | {0x01, AC_VERB_SET_GPIO_DATA, 0x00}, |
| 5367 | {0x01, AC_VERB_SET_GPIO_MASK, 0x0f}, |
| 5368 | |
Jonathan Woithe | 7cf51e4 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 5369 | /* Enable retasking pins as output, initially without power amp */ |
| 5370 | {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 5371 | {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 5372 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 5373 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 5374 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 5375 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 5376 | |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 5377 | /* Disable digital (SPDIF) pins initially, but users can enable |
| 5378 | * them via a mixer switch. In the case of SPDIF-out, this initverb |
| 5379 | * payload also sets the generation to 0, output to be in "consumer" |
| 5380 | * PCM format, copyright asserted, no pre-emphasis and no validity |
| 5381 | * control. |
| 5382 | */ |
Jonathan Woithe | 7cf51e4 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 5383 | {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0}, |
| 5384 | {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0}, |
| 5385 | |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 5386 | /* Ensure mic1, mic2, line1 and line2 pin widgets take input from the |
Jonathan Woithe | 7cf51e4 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 5387 | * OUT1 sum bus when acting as an output. |
| 5388 | */ |
| 5389 | {0x0b, AC_VERB_SET_CONNECT_SEL, 0}, |
| 5390 | {0x0c, AC_VERB_SET_CONNECT_SEL, 0}, |
| 5391 | {0x0d, AC_VERB_SET_CONNECT_SEL, 0}, |
| 5392 | {0x0e, AC_VERB_SET_CONNECT_SEL, 0}, |
| 5393 | |
| 5394 | /* Start with output sum widgets muted and their output gains at min */ |
| 5395 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5396 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 5397 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5398 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5399 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 5400 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5401 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5402 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 5403 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5404 | |
Jonathan Woithe | cdcd926 | 2006-02-28 11:36:42 +0100 | [diff] [blame] | 5405 | /* Unmute retasking pin widget output buffers since the default |
| 5406 | * state appears to be output. As the pin mode is changed by the |
| 5407 | * user the pin mode control will take care of enabling the pin's |
| 5408 | * input/output buffers as needed. |
| 5409 | */ |
Jonathan Woithe | 7cf51e4 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 5410 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 5411 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 5412 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 5413 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 5414 | {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 5415 | {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 5416 | /* Also unmute the mono-out pin widget */ |
| 5417 | {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 5418 | |
Jonathan Woithe | 7cf51e4 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 5419 | /* Mute capture amp left and right */ |
| 5420 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 5421 | /* Set ADC connection select to match default mixer setting (mic1 |
| 5422 | * pin) |
Jonathan Woithe | 7cf51e4 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 5423 | */ |
| 5424 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 5425 | |
| 5426 | /* Do the same for the second ADC: mute capture input amp and |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 5427 | * set ADC connection to mic1 pin |
Jonathan Woithe | 7cf51e4 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 5428 | */ |
| 5429 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5430 | {0x05, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 5431 | |
| 5432 | /* Mute all inputs to mixer widget (even unconnected ones) */ |
| 5433 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */ |
| 5434 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */ |
| 5435 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */ |
| 5436 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */ |
| 5437 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */ |
| 5438 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */ |
| 5439 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */ |
| 5440 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */ |
| 5441 | |
| 5442 | { } |
| 5443 | }; |
| 5444 | #endif |
| 5445 | |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 5446 | #define alc260_pcm_analog_playback alc880_pcm_analog_alt_playback |
| 5447 | #define alc260_pcm_analog_capture alc880_pcm_analog_capture |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5448 | |
Takashi Iwai | a3bcba3 | 2005-12-06 19:05:29 +0100 | [diff] [blame] | 5449 | #define alc260_pcm_digital_playback alc880_pcm_digital_playback |
| 5450 | #define alc260_pcm_digital_capture alc880_pcm_digital_capture |
| 5451 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5452 | /* |
| 5453 | * for BIOS auto-configuration |
| 5454 | */ |
| 5455 | |
| 5456 | 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] | 5457 | const char *pfx, int *vol_bits) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5458 | { |
| 5459 | hda_nid_t nid_vol; |
| 5460 | unsigned long vol_val, sw_val; |
| 5461 | char name[32]; |
| 5462 | int err; |
| 5463 | |
| 5464 | if (nid >= 0x0f && nid < 0x11) { |
| 5465 | nid_vol = nid - 0x7; |
| 5466 | vol_val = HDA_COMPOSE_AMP_VAL(nid_vol, 3, 0, HDA_OUTPUT); |
| 5467 | sw_val = HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT); |
| 5468 | } else if (nid == 0x11) { |
| 5469 | nid_vol = nid - 0x7; |
| 5470 | vol_val = HDA_COMPOSE_AMP_VAL(nid_vol, 2, 0, HDA_OUTPUT); |
| 5471 | sw_val = HDA_COMPOSE_AMP_VAL(nid, 2, 0, HDA_OUTPUT); |
| 5472 | } else if (nid >= 0x12 && nid <= 0x15) { |
| 5473 | nid_vol = 0x08; |
| 5474 | vol_val = HDA_COMPOSE_AMP_VAL(nid_vol, 3, 0, HDA_OUTPUT); |
| 5475 | sw_val = HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT); |
| 5476 | } else |
| 5477 | return 0; /* N/A */ |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 5478 | |
Takashi Iwai | 863b451 | 2008-10-21 17:01:47 +0200 | [diff] [blame] | 5479 | if (!(*vol_bits & (1 << nid_vol))) { |
| 5480 | /* first control for the volume widget */ |
| 5481 | snprintf(name, sizeof(name), "%s Playback Volume", pfx); |
| 5482 | err = add_control(spec, ALC_CTL_WIDGET_VOL, name, vol_val); |
| 5483 | if (err < 0) |
| 5484 | return err; |
| 5485 | *vol_bits |= (1 << nid_vol); |
| 5486 | } |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5487 | snprintf(name, sizeof(name), "%s Playback Switch", pfx); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5488 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, name, sw_val); |
| 5489 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5490 | return err; |
| 5491 | return 1; |
| 5492 | } |
| 5493 | |
| 5494 | /* add playback controls from the parsed DAC table */ |
| 5495 | static int alc260_auto_create_multi_out_ctls(struct alc_spec *spec, |
| 5496 | const struct auto_pin_cfg *cfg) |
| 5497 | { |
| 5498 | hda_nid_t nid; |
| 5499 | int err; |
Takashi Iwai | 863b451 | 2008-10-21 17:01:47 +0200 | [diff] [blame] | 5500 | int vols = 0; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5501 | |
| 5502 | spec->multiout.num_dacs = 1; |
| 5503 | spec->multiout.dac_nids = spec->private_dac_nids; |
| 5504 | spec->multiout.dac_nids[0] = 0x02; |
| 5505 | |
| 5506 | nid = cfg->line_out_pins[0]; |
| 5507 | if (nid) { |
Takashi Iwai | 863b451 | 2008-10-21 17:01:47 +0200 | [diff] [blame] | 5508 | err = alc260_add_playback_controls(spec, nid, "Front", &vols); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5509 | if (err < 0) |
| 5510 | return err; |
| 5511 | } |
| 5512 | |
Takashi Iwai | 82bc955 | 2006-03-21 11:24:42 +0100 | [diff] [blame] | 5513 | nid = cfg->speaker_pins[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5514 | if (nid) { |
Takashi Iwai | 863b451 | 2008-10-21 17:01:47 +0200 | [diff] [blame] | 5515 | err = alc260_add_playback_controls(spec, nid, "Speaker", &vols); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5516 | if (err < 0) |
| 5517 | return err; |
| 5518 | } |
| 5519 | |
Takashi Iwai | eb06ed8 | 2006-09-20 17:10:27 +0200 | [diff] [blame] | 5520 | nid = cfg->hp_pins[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5521 | if (nid) { |
Takashi Iwai | 863b451 | 2008-10-21 17:01:47 +0200 | [diff] [blame] | 5522 | err = alc260_add_playback_controls(spec, nid, "Headphone", |
| 5523 | &vols); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5524 | if (err < 0) |
| 5525 | return err; |
| 5526 | } |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5527 | return 0; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5528 | } |
| 5529 | |
| 5530 | /* create playback/capture controls for input pins */ |
| 5531 | static int alc260_auto_create_analog_input_ctls(struct alc_spec *spec, |
| 5532 | const struct auto_pin_cfg *cfg) |
| 5533 | { |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 5534 | struct hda_input_mux *imux = &spec->private_imux[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5535 | int i, err, idx; |
| 5536 | |
| 5537 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
| 5538 | if (cfg->input_pins[i] >= 0x12) { |
| 5539 | idx = cfg->input_pins[i] - 0x12; |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 5540 | err = new_analog_input(spec, cfg->input_pins[i], |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5541 | auto_pin_cfg_labels[i], idx, |
| 5542 | 0x07); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5543 | if (err < 0) |
| 5544 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5545 | imux->items[imux->num_items].label = |
| 5546 | auto_pin_cfg_labels[i]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5547 | imux->items[imux->num_items].index = idx; |
| 5548 | imux->num_items++; |
| 5549 | } |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5550 | if (cfg->input_pins[i] >= 0x0f && cfg->input_pins[i] <= 0x10){ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5551 | idx = cfg->input_pins[i] - 0x09; |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 5552 | err = new_analog_input(spec, cfg->input_pins[i], |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5553 | auto_pin_cfg_labels[i], idx, |
| 5554 | 0x07); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5555 | if (err < 0) |
| 5556 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5557 | imux->items[imux->num_items].label = |
| 5558 | auto_pin_cfg_labels[i]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5559 | imux->items[imux->num_items].index = idx; |
| 5560 | imux->num_items++; |
| 5561 | } |
| 5562 | } |
| 5563 | return 0; |
| 5564 | } |
| 5565 | |
| 5566 | static void alc260_auto_set_output_and_unmute(struct hda_codec *codec, |
| 5567 | hda_nid_t nid, int pin_type, |
| 5568 | int sel_idx) |
| 5569 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 5570 | alc_set_pin_output(codec, nid, pin_type); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5571 | /* need the manual connection? */ |
| 5572 | if (nid >= 0x12) { |
| 5573 | int idx = nid - 0x12; |
| 5574 | snd_hda_codec_write(codec, idx + 0x0b, 0, |
| 5575 | AC_VERB_SET_CONNECT_SEL, sel_idx); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5576 | } |
| 5577 | } |
| 5578 | |
| 5579 | static void alc260_auto_init_multi_out(struct hda_codec *codec) |
| 5580 | { |
| 5581 | struct alc_spec *spec = codec->spec; |
| 5582 | hda_nid_t nid; |
| 5583 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 5584 | alc_subsystem_id(codec, 0x10, 0x15, 0x0f); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5585 | nid = spec->autocfg.line_out_pins[0]; |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 5586 | if (nid) { |
| 5587 | int pin_type = get_pin_type(spec->autocfg.line_out_type); |
| 5588 | alc260_auto_set_output_and_unmute(codec, nid, pin_type, 0); |
| 5589 | } |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 5590 | |
Takashi Iwai | 82bc955 | 2006-03-21 11:24:42 +0100 | [diff] [blame] | 5591 | nid = spec->autocfg.speaker_pins[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5592 | if (nid) |
| 5593 | alc260_auto_set_output_and_unmute(codec, nid, PIN_OUT, 0); |
| 5594 | |
Takashi Iwai | eb06ed8 | 2006-09-20 17:10:27 +0200 | [diff] [blame] | 5595 | nid = spec->autocfg.hp_pins[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5596 | if (nid) |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 5597 | alc260_auto_set_output_and_unmute(codec, nid, PIN_HP, 0); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5598 | } |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5599 | |
| 5600 | #define ALC260_PIN_CD_NID 0x16 |
| 5601 | static void alc260_auto_init_analog_input(struct hda_codec *codec) |
| 5602 | { |
| 5603 | struct alc_spec *spec = codec->spec; |
| 5604 | int i; |
| 5605 | |
| 5606 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
| 5607 | hda_nid_t nid = spec->autocfg.input_pins[i]; |
| 5608 | if (nid >= 0x12) { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5609 | snd_hda_codec_write(codec, nid, 0, |
| 5610 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 5611 | i <= AUTO_PIN_FRONT_MIC ? |
| 5612 | PIN_VREF80 : PIN_IN); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5613 | if (nid != ALC260_PIN_CD_NID) |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5614 | snd_hda_codec_write(codec, nid, 0, |
| 5615 | AC_VERB_SET_AMP_GAIN_MUTE, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5616 | AMP_OUT_MUTE); |
| 5617 | } |
| 5618 | } |
| 5619 | } |
| 5620 | |
| 5621 | /* |
| 5622 | * generic initialization of ADC, input mixers and output mixers |
| 5623 | */ |
| 5624 | static struct hda_verb alc260_volume_init_verbs[] = { |
| 5625 | /* |
| 5626 | * Unmute ADC0-1 and set the default input to mic-in |
| 5627 | */ |
| 5628 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 5629 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5630 | {0x05, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 5631 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 5632 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5633 | /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback |
| 5634 | * mixer widget |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5635 | * Note: PASD motherboards uses the Line In 2 as the input for |
| 5636 | * front panel mic (mic 2) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5637 | */ |
| 5638 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 5639 | /* mute analog inputs */ |
| 5640 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5641 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 5642 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 5643 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 5644 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5645 | |
| 5646 | /* |
| 5647 | * Set up output mixers (0x08 - 0x0a) |
| 5648 | */ |
| 5649 | /* set vol=0 to output mixers */ |
| 5650 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5651 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5652 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5653 | /* set up input amps for analog loopback */ |
| 5654 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 5655 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5656 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 5657 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5658 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 5659 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5660 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 5661 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5662 | { } |
| 5663 | }; |
| 5664 | |
| 5665 | static int alc260_parse_auto_config(struct hda_codec *codec) |
| 5666 | { |
| 5667 | struct alc_spec *spec = codec->spec; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5668 | int err; |
| 5669 | static hda_nid_t alc260_ignore[] = { 0x17, 0 }; |
| 5670 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5671 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 5672 | alc260_ignore); |
| 5673 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5674 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5675 | err = alc260_auto_create_multi_out_ctls(spec, &spec->autocfg); |
| 5676 | if (err < 0) |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 5677 | return err; |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 5678 | if (!spec->kctls.list) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5679 | return 0; /* can't find valid BIOS pin config */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5680 | err = alc260_auto_create_analog_input_ctls(spec, &spec->autocfg); |
| 5681 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5682 | return err; |
| 5683 | |
| 5684 | spec->multiout.max_channels = 2; |
| 5685 | |
Takashi Iwai | 0852d7a | 2009-02-11 11:35:15 +0100 | [diff] [blame] | 5686 | if (spec->autocfg.dig_outs) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5687 | spec->multiout.dig_out_nid = ALC260_DIGOUT_NID; |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 5688 | if (spec->kctls.list) |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 5689 | add_mixer(spec, spec->kctls.list); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5690 | |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 5691 | add_verb(spec, alc260_volume_init_verbs); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5692 | |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 5693 | spec->num_mux_defs = 1; |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 5694 | spec->input_mux = &spec->private_imux[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5695 | |
Takashi Iwai | e044c39 | 2008-10-27 16:56:24 +0100 | [diff] [blame] | 5696 | store_pin_configs(codec); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5697 | return 1; |
| 5698 | } |
| 5699 | |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 5700 | /* additional initialization for auto-configuration model */ |
| 5701 | static void alc260_auto_init(struct hda_codec *codec) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5702 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 5703 | struct alc_spec *spec = codec->spec; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5704 | alc260_auto_init_multi_out(codec); |
| 5705 | alc260_auto_init_analog_input(codec); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 5706 | if (spec->unsol_event) |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 5707 | alc_inithook(codec); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5708 | } |
| 5709 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 5710 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 5711 | static struct hda_amp_list alc260_loopbacks[] = { |
| 5712 | { 0x07, HDA_INPUT, 0 }, |
| 5713 | { 0x07, HDA_INPUT, 1 }, |
| 5714 | { 0x07, HDA_INPUT, 2 }, |
| 5715 | { 0x07, HDA_INPUT, 3 }, |
| 5716 | { 0x07, HDA_INPUT, 4 }, |
| 5717 | { } /* end */ |
| 5718 | }; |
| 5719 | #endif |
| 5720 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5721 | /* |
| 5722 | * ALC260 configurations |
| 5723 | */ |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 5724 | static const char *alc260_models[ALC260_MODEL_LAST] = { |
| 5725 | [ALC260_BASIC] = "basic", |
| 5726 | [ALC260_HP] = "hp", |
| 5727 | [ALC260_HP_3013] = "hp-3013", |
Takashi Iwai | 2922c9a | 2008-08-27 18:12:42 +0200 | [diff] [blame] | 5728 | [ALC260_HP_DC7600] = "hp-dc7600", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 5729 | [ALC260_FUJITSU_S702X] = "fujitsu", |
| 5730 | [ALC260_ACER] = "acer", |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 5731 | [ALC260_WILL] = "will", |
| 5732 | [ALC260_REPLACER_672V] = "replacer", |
Jonathan Woithe | 7cf51e4 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 5733 | #ifdef CONFIG_SND_DEBUG |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 5734 | [ALC260_TEST] = "test", |
Jonathan Woithe | 7cf51e4 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 5735 | #endif |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 5736 | [ALC260_AUTO] = "auto", |
| 5737 | }; |
| 5738 | |
| 5739 | static struct snd_pci_quirk alc260_cfg_tbl[] = { |
Jonathan Woithe | bd86948 | 2006-11-28 11:35:52 +0100 | [diff] [blame] | 5740 | SND_PCI_QUIRK(0x1025, 0x007b, "Acer C20x", ALC260_ACER), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 5741 | SND_PCI_QUIRK(0x1025, 0x008f, "Acer", ALC260_ACER), |
Takashi Iwai | 9720b71 | 2007-03-13 21:46:23 +0100 | [diff] [blame] | 5742 | SND_PCI_QUIRK(0x103c, 0x2808, "HP d5700", ALC260_HP_3013), |
Takashi Iwai | a8a5d06 | 2007-03-15 15:10:28 +0100 | [diff] [blame] | 5743 | SND_PCI_QUIRK(0x103c, 0x280a, "HP d5750", ALC260_HP_3013), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 5744 | SND_PCI_QUIRK(0x103c, 0x3010, "HP", ALC260_HP_3013), |
Jaroslav Kysela | 34ec8a0 | 2008-07-10 14:49:19 +0200 | [diff] [blame] | 5745 | SND_PCI_QUIRK(0x103c, 0x3011, "HP", ALC260_HP_3013), |
Kailang Yang | 3f87830 | 2008-08-26 13:02:23 +0200 | [diff] [blame] | 5746 | SND_PCI_QUIRK(0x103c, 0x3012, "HP", ALC260_HP_DC7600), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 5747 | SND_PCI_QUIRK(0x103c, 0x3013, "HP", ALC260_HP_3013), |
| 5748 | SND_PCI_QUIRK(0x103c, 0x3014, "HP", ALC260_HP), |
| 5749 | SND_PCI_QUIRK(0x103c, 0x3015, "HP", ALC260_HP), |
| 5750 | SND_PCI_QUIRK(0x103c, 0x3016, "HP", ALC260_HP), |
| 5751 | SND_PCI_QUIRK(0x104d, 0x81bb, "Sony VAIO", ALC260_BASIC), |
| 5752 | SND_PCI_QUIRK(0x104d, 0x81cc, "Sony VAIO", ALC260_BASIC), |
| 5753 | SND_PCI_QUIRK(0x104d, 0x81cd, "Sony VAIO", ALC260_BASIC), |
| 5754 | SND_PCI_QUIRK(0x10cf, 0x1326, "Fujitsu S702X", ALC260_FUJITSU_S702X), |
| 5755 | SND_PCI_QUIRK(0x152d, 0x0729, "CTL U553W", ALC260_BASIC), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 5756 | SND_PCI_QUIRK(0x161f, 0x2057, "Replacer 672V", ALC260_REPLACER_672V), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 5757 | SND_PCI_QUIRK(0x1631, 0xc017, "PB V7900", ALC260_WILL), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 5758 | {} |
| 5759 | }; |
| 5760 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5761 | static struct alc_config_preset alc260_presets[] = { |
| 5762 | [ALC260_BASIC] = { |
| 5763 | .mixers = { alc260_base_output_mixer, |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 5764 | alc260_input_mixer }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5765 | .init_verbs = { alc260_init_verbs }, |
| 5766 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
| 5767 | .dac_nids = alc260_dac_nids, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 5768 | .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5769 | .adc_nids = alc260_adc_nids, |
| 5770 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 5771 | .channel_mode = alc260_modes, |
| 5772 | .input_mux = &alc260_capture_source, |
| 5773 | }, |
| 5774 | [ALC260_HP] = { |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 5775 | .mixers = { alc260_hp_output_mixer, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 5776 | alc260_input_mixer }, |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 5777 | .init_verbs = { alc260_init_verbs, |
| 5778 | alc260_hp_unsol_verbs }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5779 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
| 5780 | .dac_nids = alc260_dac_nids, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 5781 | .num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt), |
| 5782 | .adc_nids = alc260_adc_nids_alt, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5783 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 5784 | .channel_mode = alc260_modes, |
| 5785 | .input_mux = &alc260_capture_source, |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 5786 | .unsol_event = alc260_hp_unsol_event, |
| 5787 | .init_hook = alc260_hp_automute, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5788 | }, |
Kailang Yang | 3f87830 | 2008-08-26 13:02:23 +0200 | [diff] [blame] | 5789 | [ALC260_HP_DC7600] = { |
| 5790 | .mixers = { alc260_hp_dc7600_mixer, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 5791 | alc260_input_mixer }, |
Kailang Yang | 3f87830 | 2008-08-26 13:02:23 +0200 | [diff] [blame] | 5792 | .init_verbs = { alc260_init_verbs, |
| 5793 | alc260_hp_dc7600_verbs }, |
| 5794 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
| 5795 | .dac_nids = alc260_dac_nids, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 5796 | .num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt), |
| 5797 | .adc_nids = alc260_adc_nids_alt, |
Kailang Yang | 3f87830 | 2008-08-26 13:02:23 +0200 | [diff] [blame] | 5798 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 5799 | .channel_mode = alc260_modes, |
| 5800 | .input_mux = &alc260_capture_source, |
| 5801 | .unsol_event = alc260_hp_3012_unsol_event, |
| 5802 | .init_hook = alc260_hp_3012_automute, |
| 5803 | }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5804 | [ALC260_HP_3013] = { |
| 5805 | .mixers = { alc260_hp_3013_mixer, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 5806 | alc260_input_mixer }, |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 5807 | .init_verbs = { alc260_hp_3013_init_verbs, |
| 5808 | alc260_hp_3013_unsol_verbs }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5809 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
| 5810 | .dac_nids = alc260_dac_nids, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 5811 | .num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt), |
| 5812 | .adc_nids = alc260_adc_nids_alt, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5813 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 5814 | .channel_mode = alc260_modes, |
| 5815 | .input_mux = &alc260_capture_source, |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 5816 | .unsol_event = alc260_hp_3013_unsol_event, |
| 5817 | .init_hook = alc260_hp_3013_automute, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5818 | }, |
| 5819 | [ALC260_FUJITSU_S702X] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 5820 | .mixers = { alc260_fujitsu_mixer }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5821 | .init_verbs = { alc260_fujitsu_init_verbs }, |
| 5822 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
| 5823 | .dac_nids = alc260_dac_nids, |
Jonathan Woithe | d57fdac | 2006-02-28 11:38:35 +0100 | [diff] [blame] | 5824 | .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids), |
| 5825 | .adc_nids = alc260_dual_adc_nids, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5826 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 5827 | .channel_mode = alc260_modes, |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 5828 | .num_mux_defs = ARRAY_SIZE(alc260_fujitsu_capture_sources), |
| 5829 | .input_mux = alc260_fujitsu_capture_sources, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5830 | }, |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 5831 | [ALC260_ACER] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 5832 | .mixers = { alc260_acer_mixer }, |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 5833 | .init_verbs = { alc260_acer_init_verbs }, |
| 5834 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
| 5835 | .dac_nids = alc260_dac_nids, |
| 5836 | .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids), |
| 5837 | .adc_nids = alc260_dual_adc_nids, |
| 5838 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 5839 | .channel_mode = alc260_modes, |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 5840 | .num_mux_defs = ARRAY_SIZE(alc260_acer_capture_sources), |
| 5841 | .input_mux = alc260_acer_capture_sources, |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 5842 | }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 5843 | [ALC260_WILL] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 5844 | .mixers = { alc260_will_mixer }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 5845 | .init_verbs = { alc260_init_verbs, alc260_will_verbs }, |
| 5846 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
| 5847 | .dac_nids = alc260_dac_nids, |
| 5848 | .num_adc_nids = ARRAY_SIZE(alc260_adc_nids), |
| 5849 | .adc_nids = alc260_adc_nids, |
| 5850 | .dig_out_nid = ALC260_DIGOUT_NID, |
| 5851 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 5852 | .channel_mode = alc260_modes, |
| 5853 | .input_mux = &alc260_capture_source, |
| 5854 | }, |
| 5855 | [ALC260_REPLACER_672V] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 5856 | .mixers = { alc260_replacer_672v_mixer }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 5857 | .init_verbs = { alc260_init_verbs, alc260_replacer_672v_verbs }, |
| 5858 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
| 5859 | .dac_nids = alc260_dac_nids, |
| 5860 | .num_adc_nids = ARRAY_SIZE(alc260_adc_nids), |
| 5861 | .adc_nids = alc260_adc_nids, |
| 5862 | .dig_out_nid = ALC260_DIGOUT_NID, |
| 5863 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 5864 | .channel_mode = alc260_modes, |
| 5865 | .input_mux = &alc260_capture_source, |
| 5866 | .unsol_event = alc260_replacer_672v_unsol_event, |
| 5867 | .init_hook = alc260_replacer_672v_automute, |
| 5868 | }, |
Jonathan Woithe | 7cf51e4 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 5869 | #ifdef CONFIG_SND_DEBUG |
| 5870 | [ALC260_TEST] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 5871 | .mixers = { alc260_test_mixer }, |
Jonathan Woithe | 7cf51e4 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 5872 | .init_verbs = { alc260_test_init_verbs }, |
| 5873 | .num_dacs = ARRAY_SIZE(alc260_test_dac_nids), |
| 5874 | .dac_nids = alc260_test_dac_nids, |
| 5875 | .num_adc_nids = ARRAY_SIZE(alc260_test_adc_nids), |
| 5876 | .adc_nids = alc260_test_adc_nids, |
| 5877 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 5878 | .channel_mode = alc260_modes, |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 5879 | .num_mux_defs = ARRAY_SIZE(alc260_test_capture_sources), |
| 5880 | .input_mux = alc260_test_capture_sources, |
Jonathan Woithe | 7cf51e4 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 5881 | }, |
| 5882 | #endif |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5883 | }; |
| 5884 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5885 | static int patch_alc260(struct hda_codec *codec) |
| 5886 | { |
| 5887 | struct alc_spec *spec; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5888 | int err, board_config; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5889 | |
Takashi Iwai | e560d8d | 2005-09-09 14:21:46 +0200 | [diff] [blame] | 5890 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5891 | if (spec == NULL) |
| 5892 | return -ENOMEM; |
| 5893 | |
| 5894 | codec->spec = spec; |
| 5895 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 5896 | board_config = snd_hda_check_board_config(codec, ALC260_MODEL_LAST, |
| 5897 | alc260_models, |
| 5898 | alc260_cfg_tbl); |
| 5899 | if (board_config < 0) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 5900 | snd_printd(KERN_INFO "hda_codec: Unknown model for ALC260, " |
| 5901 | "trying auto-probe from BIOS...\n"); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5902 | board_config = ALC260_AUTO; |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 5903 | } |
| 5904 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5905 | if (board_config == ALC260_AUTO) { |
| 5906 | /* automatic parse from the BIOS config */ |
| 5907 | err = alc260_parse_auto_config(codec); |
| 5908 | if (err < 0) { |
| 5909 | alc_free(codec); |
| 5910 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5911 | } else if (!err) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 5912 | printk(KERN_INFO |
| 5913 | "hda_codec: Cannot set up configuration " |
| 5914 | "from BIOS. Using base mode...\n"); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5915 | board_config = ALC260_BASIC; |
| 5916 | } |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 5917 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5918 | |
Kusanagi Kouichi | 680cd53 | 2009-02-05 00:00:58 +0900 | [diff] [blame] | 5919 | err = snd_hda_attach_beep_device(codec, 0x1); |
| 5920 | if (err < 0) { |
| 5921 | alc_free(codec); |
| 5922 | return err; |
| 5923 | } |
| 5924 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5925 | if (board_config != ALC260_AUTO) |
| 5926 | setup_preset(spec, &alc260_presets[board_config]); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5927 | |
| 5928 | spec->stream_name_analog = "ALC260 Analog"; |
| 5929 | spec->stream_analog_playback = &alc260_pcm_analog_playback; |
| 5930 | spec->stream_analog_capture = &alc260_pcm_analog_capture; |
| 5931 | |
Takashi Iwai | a3bcba3 | 2005-12-06 19:05:29 +0100 | [diff] [blame] | 5932 | spec->stream_name_digital = "ALC260 Digital"; |
| 5933 | spec->stream_digital_playback = &alc260_pcm_digital_playback; |
| 5934 | spec->stream_digital_capture = &alc260_pcm_digital_capture; |
| 5935 | |
Takashi Iwai | 4ef0ef1 | 2008-11-03 17:47:49 +0100 | [diff] [blame] | 5936 | if (!spec->adc_nids && spec->input_mux) { |
| 5937 | /* check whether NID 0x04 is valid */ |
| 5938 | unsigned int wcap = get_wcaps(codec, 0x04); |
| 5939 | wcap = (wcap & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT; |
| 5940 | /* get type */ |
| 5941 | if (wcap != AC_WID_AUD_IN || spec->input_mux->num_items == 1) { |
| 5942 | spec->adc_nids = alc260_adc_nids_alt; |
| 5943 | spec->num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt); |
| 5944 | } else { |
| 5945 | spec->adc_nids = alc260_adc_nids; |
| 5946 | spec->num_adc_nids = ARRAY_SIZE(alc260_adc_nids); |
| 5947 | } |
| 5948 | } |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 5949 | set_capture_mixer(spec); |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 5950 | set_beep_amp(spec, 0x07, 0x05, HDA_INPUT); |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 5951 | |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 5952 | spec->vmaster_nid = 0x08; |
| 5953 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5954 | codec->patch_ops = alc_patch_ops; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5955 | if (board_config == ALC260_AUTO) |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 5956 | spec->init_hook = alc260_auto_init; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 5957 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 5958 | if (!spec->loopback.amplist) |
| 5959 | spec->loopback.amplist = alc260_loopbacks; |
| 5960 | #endif |
Takashi Iwai | daead53 | 2008-11-28 12:55:36 +0100 | [diff] [blame] | 5961 | codec->proc_widget_hook = print_realtek_coef; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5962 | |
| 5963 | return 0; |
| 5964 | } |
| 5965 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5966 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5967 | /* |
| 5968 | * ALC882 support |
| 5969 | * |
| 5970 | * ALC882 is almost identical with ALC880 but has cleaner and more flexible |
| 5971 | * configuration. Each pin widget can choose any input DACs and a mixer. |
| 5972 | * Each ADC is connected from a mixer of all inputs. This makes possible |
| 5973 | * 6-channel independent captures. |
| 5974 | * |
| 5975 | * In addition, an independent DAC for the multi-playback (not used in this |
| 5976 | * driver yet). |
| 5977 | */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5978 | #define ALC882_DIGOUT_NID 0x06 |
| 5979 | #define ALC882_DIGIN_NID 0x0a |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5980 | |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 5981 | static struct hda_channel_mode alc882_ch_modes[1] = { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5982 | { 8, NULL } |
| 5983 | }; |
| 5984 | |
| 5985 | static hda_nid_t alc882_dac_nids[4] = { |
| 5986 | /* front, rear, clfe, rear_surr */ |
| 5987 | 0x02, 0x03, 0x04, 0x05 |
| 5988 | }; |
| 5989 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5990 | /* identical with ALC880 */ |
| 5991 | #define alc882_adc_nids alc880_adc_nids |
| 5992 | #define alc882_adc_nids_alt alc880_adc_nids_alt |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5993 | |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 5994 | static hda_nid_t alc882_capsrc_nids[3] = { 0x24, 0x23, 0x22 }; |
| 5995 | static hda_nid_t alc882_capsrc_nids_alt[2] = { 0x23, 0x22 }; |
| 5996 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5997 | /* input MUX */ |
| 5998 | /* FIXME: should be a matrix-type input source selection */ |
| 5999 | |
| 6000 | static struct hda_input_mux alc882_capture_source = { |
| 6001 | .num_items = 4, |
| 6002 | .items = { |
| 6003 | { "Mic", 0x0 }, |
| 6004 | { "Front Mic", 0x1 }, |
| 6005 | { "Line", 0x2 }, |
| 6006 | { "CD", 0x4 }, |
| 6007 | }, |
| 6008 | }; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6009 | /* |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 6010 | * 2ch mode |
| 6011 | */ |
| 6012 | static struct hda_verb alc882_3ST_ch2_init[] = { |
| 6013 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 6014 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 6015 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 6016 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 6017 | { } /* end */ |
| 6018 | }; |
| 6019 | |
| 6020 | /* |
| 6021 | * 6ch mode |
| 6022 | */ |
| 6023 | static struct hda_verb alc882_3ST_ch6_init[] = { |
| 6024 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6025 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 6026 | { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 }, |
| 6027 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6028 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 6029 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 6030 | { } /* end */ |
| 6031 | }; |
| 6032 | |
| 6033 | static struct hda_channel_mode alc882_3ST_6ch_modes[2] = { |
| 6034 | { 2, alc882_3ST_ch2_init }, |
| 6035 | { 6, alc882_3ST_ch6_init }, |
| 6036 | }; |
| 6037 | |
| 6038 | /* |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6039 | * 6ch mode |
| 6040 | */ |
| 6041 | static struct hda_verb alc882_sixstack_ch6_init[] = { |
| 6042 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 6043 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6044 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6045 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6046 | { } /* end */ |
| 6047 | }; |
| 6048 | |
| 6049 | /* |
| 6050 | * 8ch mode |
| 6051 | */ |
| 6052 | static struct hda_verb alc882_sixstack_ch8_init[] = { |
| 6053 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6054 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6055 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6056 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6057 | { } /* end */ |
| 6058 | }; |
| 6059 | |
| 6060 | static struct hda_channel_mode alc882_sixstack_modes[2] = { |
| 6061 | { 6, alc882_sixstack_ch6_init }, |
| 6062 | { 8, alc882_sixstack_ch8_init }, |
| 6063 | }; |
| 6064 | |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 6065 | /* |
| 6066 | * macbook pro ALC885 can switch LineIn to LineOut without loosing Mic |
| 6067 | */ |
| 6068 | |
| 6069 | /* |
| 6070 | * 2ch mode |
| 6071 | */ |
| 6072 | static struct hda_verb alc885_mbp_ch2_init[] = { |
| 6073 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 6074 | { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6075 | { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 6076 | { } /* end */ |
| 6077 | }; |
| 6078 | |
| 6079 | /* |
| 6080 | * 6ch mode |
| 6081 | */ |
| 6082 | static struct hda_verb alc885_mbp_ch6_init[] = { |
| 6083 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6084 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 6085 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 6086 | { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6087 | { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 6088 | { } /* end */ |
| 6089 | }; |
| 6090 | |
| 6091 | static struct hda_channel_mode alc885_mbp_6ch_modes[2] = { |
| 6092 | { 2, alc885_mbp_ch2_init }, |
| 6093 | { 6, alc885_mbp_ch6_init }, |
| 6094 | }; |
| 6095 | |
| 6096 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6097 | /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17 |
| 6098 | * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b |
| 6099 | */ |
Takashi Iwai | c8b6bf9b | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 6100 | static struct snd_kcontrol_new alc882_base_mixer[] = { |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 6101 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 6102 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 6103 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 6104 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 6105 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 6106 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 6107 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 6108 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 6109 | HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 6110 | HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6111 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 6112 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 6113 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 6114 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 6115 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 6116 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 6117 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6118 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 6119 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 6120 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6121 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6122 | { } /* end */ |
| 6123 | }; |
| 6124 | |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 6125 | static struct snd_kcontrol_new alc885_mbp3_mixer[] = { |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 6126 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x00, HDA_OUTPUT), |
| 6127 | HDA_BIND_MUTE ("Front Playback Switch", 0x0c, 0x02, HDA_INPUT), |
| 6128 | HDA_CODEC_MUTE ("Speaker Playback Switch", 0x14, 0x00, HDA_OUTPUT), |
| 6129 | HDA_CODEC_VOLUME("Line-Out Playback Volume", 0x0d, 0x00, HDA_OUTPUT), |
| 6130 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 6131 | HDA_CODEC_MUTE ("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 6132 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x00, HDA_INPUT), |
| 6133 | HDA_CODEC_MUTE ("Mic Playback Switch", 0x0b, 0x00, HDA_INPUT), |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 6134 | HDA_CODEC_VOLUME("Line Boost", 0x1a, 0x00, HDA_INPUT), |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 6135 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0x00, HDA_INPUT), |
| 6136 | { } /* end */ |
| 6137 | }; |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 6138 | static struct snd_kcontrol_new alc882_w2jc_mixer[] = { |
| 6139 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 6140 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 6141 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 6142 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 6143 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 6144 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 6145 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 6146 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 6147 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 6148 | { } /* end */ |
| 6149 | }; |
| 6150 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 6151 | static struct snd_kcontrol_new alc882_targa_mixer[] = { |
| 6152 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 6153 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 6154 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 6155 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 6156 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 6157 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 6158 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 6159 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 6160 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Takashi Iwai | 96fe7cc | 2007-09-07 10:57:44 +0200 | [diff] [blame] | 6161 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 6162 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 6163 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Takashi Iwai | 96fe7cc | 2007-09-07 10:57:44 +0200 | [diff] [blame] | 6164 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 6165 | { } /* end */ |
| 6166 | }; |
| 6167 | |
| 6168 | /* Pin assignment: Front=0x14, HP = 0x15, Front = 0x16, ??? |
| 6169 | * Front Mic=0x18, Line In = 0x1a, Line In = 0x1b, CD = 0x1c |
| 6170 | */ |
| 6171 | static struct snd_kcontrol_new alc882_asus_a7j_mixer[] = { |
| 6172 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 6173 | HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 6174 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 6175 | HDA_CODEC_MUTE("Mobile Front Playback Switch", 0x16, 0x0, HDA_OUTPUT), |
| 6176 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 6177 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 6178 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 6179 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 6180 | HDA_CODEC_VOLUME("Mobile Line Playback Volume", 0x0b, 0x03, HDA_INPUT), |
| 6181 | HDA_CODEC_MUTE("Mobile Line Playback Switch", 0x0b, 0x03, HDA_INPUT), |
| 6182 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 6183 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Takashi Iwai | 96fe7cc | 2007-09-07 10:57:44 +0200 | [diff] [blame] | 6184 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 6185 | { } /* end */ |
| 6186 | }; |
| 6187 | |
Takashi Iwai | 914759b | 2007-09-06 14:52:04 +0200 | [diff] [blame] | 6188 | static struct snd_kcontrol_new alc882_asus_a7m_mixer[] = { |
| 6189 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 6190 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 6191 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 6192 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 6193 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 6194 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 6195 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 6196 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 6197 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 6198 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Takashi Iwai | 914759b | 2007-09-06 14:52:04 +0200 | [diff] [blame] | 6199 | { } /* end */ |
| 6200 | }; |
| 6201 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6202 | static struct snd_kcontrol_new alc882_chmode_mixer[] = { |
| 6203 | { |
| 6204 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 6205 | .name = "Channel Mode", |
| 6206 | .info = alc_ch_mode_info, |
| 6207 | .get = alc_ch_mode_get, |
| 6208 | .put = alc_ch_mode_put, |
| 6209 | }, |
| 6210 | { } /* end */ |
| 6211 | }; |
| 6212 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6213 | static struct hda_verb alc882_init_verbs[] = { |
| 6214 | /* Front mixer: unmute input/output amp left and right (volume = 0) */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 6215 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 6216 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6217 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6218 | /* Rear mixer */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 6219 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 6220 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6221 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6222 | /* CLFE mixer */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 6223 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 6224 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6225 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6226 | /* Side mixer */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 6227 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 6228 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6229 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6230 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 6231 | /* Front Pin: output 0 (0x0c) */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 6232 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 6233 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6234 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 6235 | /* Rear Pin: output 1 (0x0d) */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 6236 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 6237 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6238 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 6239 | /* CLFE Pin: output 2 (0x0e) */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 6240 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 6241 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6242 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x02}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 6243 | /* Side Pin: output 3 (0x0f) */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 6244 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 6245 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6246 | {0x17, AC_VERB_SET_CONNECT_SEL, 0x03}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 6247 | /* Mic (rear) pin: input vref at 80% */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 6248 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 6249 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 6250 | /* Front Mic pin: input vref at 80% */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 6251 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 6252 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 6253 | /* Line In pin: input */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 6254 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 6255 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 6256 | /* Line-2 In: Headphone output (output 0 - 0x0c) */ |
| 6257 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 6258 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 6259 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6260 | /* CD pin widget for input */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 6261 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6262 | |
| 6263 | /* FIXME: use matrix-type input source selection */ |
| 6264 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 6265 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 6266 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6267 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 6268 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 6269 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6270 | /* Input mixer2 */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 6271 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6272 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 6273 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 6274 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6275 | /* Input mixer3 */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 6276 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6277 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 6278 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 6279 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 6280 | /* ADC1: mute amp left and right */ |
| 6281 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 6282 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 6283 | /* ADC2: mute amp left and right */ |
| 6284 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 6285 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 6286 | /* ADC3: mute amp left and right */ |
| 6287 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 6288 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6289 | |
| 6290 | { } |
| 6291 | }; |
| 6292 | |
Takashi Iwai | 4b146cb | 2006-07-28 14:42:36 +0200 | [diff] [blame] | 6293 | static struct hda_verb alc882_eapd_verbs[] = { |
| 6294 | /* change to EAPD mode */ |
| 6295 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
Andrew L. Neporada | b373bde | 2006-11-07 11:37:08 +0100 | [diff] [blame] | 6296 | {0x20, AC_VERB_SET_PROC_COEF, 0x3060}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6297 | { } |
Takashi Iwai | 4b146cb | 2006-07-28 14:42:36 +0200 | [diff] [blame] | 6298 | }; |
| 6299 | |
Tobin Davis | 9102cd1 | 2006-12-15 10:02:12 +0100 | [diff] [blame] | 6300 | /* Mac Pro test */ |
| 6301 | static struct snd_kcontrol_new alc882_macpro_mixer[] = { |
| 6302 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 6303 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 6304 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x18, 0x0, HDA_OUTPUT), |
| 6305 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 6306 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT), |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 6307 | /* FIXME: this looks suspicious... |
Tobin Davis | 9102cd1 | 2006-12-15 10:02:12 +0100 | [diff] [blame] | 6308 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 6309 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x02, HDA_INPUT), |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 6310 | */ |
Tobin Davis | 9102cd1 | 2006-12-15 10:02:12 +0100 | [diff] [blame] | 6311 | { } /* end */ |
| 6312 | }; |
| 6313 | |
| 6314 | static struct hda_verb alc882_macpro_init_verbs[] = { |
| 6315 | /* Front mixer: unmute input/output amp left and right (volume = 0) */ |
| 6316 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 6317 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6318 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 6319 | /* Front Pin: output 0 (0x0c) */ |
| 6320 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 6321 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 6322 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 6323 | /* Front Mic pin: input vref at 80% */ |
| 6324 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 6325 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 6326 | /* Speaker: output */ |
| 6327 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 6328 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 6329 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x04}, |
| 6330 | /* Headphone output (output 0 - 0x0c) */ |
| 6331 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 6332 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 6333 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 6334 | |
| 6335 | /* FIXME: use matrix-type input source selection */ |
| 6336 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 6337 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ |
| 6338 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6339 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 6340 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 6341 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 6342 | /* Input mixer2 */ |
| 6343 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6344 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 6345 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 6346 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 6347 | /* Input mixer3 */ |
| 6348 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6349 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 6350 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 6351 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 6352 | /* ADC1: mute amp left and right */ |
| 6353 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6354 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 6355 | /* ADC2: mute amp left and right */ |
| 6356 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6357 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 6358 | /* ADC3: mute amp left and right */ |
| 6359 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6360 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 6361 | |
| 6362 | { } |
| 6363 | }; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6364 | |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 6365 | /* Macbook Pro rev3 */ |
| 6366 | static struct hda_verb alc885_mbp3_init_verbs[] = { |
| 6367 | /* Front mixer: unmute input/output amp left and right (volume = 0) */ |
| 6368 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 6369 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6370 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 6371 | /* Rear mixer */ |
| 6372 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 6373 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6374 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 6375 | /* Front Pin: output 0 (0x0c) */ |
| 6376 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 6377 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 6378 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 6379 | /* HP Pin: output 0 (0x0d) */ |
| 6380 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc4}, |
| 6381 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 6382 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 6383 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 6384 | /* Mic (rear) pin: input vref at 80% */ |
| 6385 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 6386 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 6387 | /* Front Mic pin: input vref at 80% */ |
| 6388 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 6389 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 6390 | /* Line In pin: use output 1 when in LineOut mode */ |
| 6391 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 6392 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 6393 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 6394 | |
| 6395 | /* FIXME: use matrix-type input source selection */ |
| 6396 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 6397 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ |
| 6398 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6399 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 6400 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 6401 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 6402 | /* Input mixer2 */ |
| 6403 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6404 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 6405 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 6406 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 6407 | /* Input mixer3 */ |
| 6408 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6409 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 6410 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 6411 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 6412 | /* ADC1: mute amp left and right */ |
| 6413 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6414 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 6415 | /* ADC2: mute amp left and right */ |
| 6416 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6417 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 6418 | /* ADC3: mute amp left and right */ |
| 6419 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6420 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 6421 | |
| 6422 | { } |
| 6423 | }; |
| 6424 | |
Nicola Fagnani | c54728d | 2007-07-19 23:28:52 +0200 | [diff] [blame] | 6425 | /* iMac 24 mixer. */ |
| 6426 | static struct snd_kcontrol_new alc885_imac24_mixer[] = { |
| 6427 | HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x00, HDA_OUTPUT), |
| 6428 | HDA_CODEC_MUTE("Master Playback Switch", 0x0c, 0x00, HDA_INPUT), |
| 6429 | { } /* end */ |
| 6430 | }; |
| 6431 | |
| 6432 | /* iMac 24 init verbs. */ |
| 6433 | static struct hda_verb alc885_imac24_init_verbs[] = { |
| 6434 | /* Internal speakers: output 0 (0x0c) */ |
| 6435 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 6436 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 6437 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 6438 | /* Internal speakers: output 0 (0x0c) */ |
| 6439 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 6440 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 6441 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 6442 | /* Headphone: output 0 (0x0c) */ |
| 6443 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 6444 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 6445 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 6446 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 6447 | /* Front Mic: input vref at 80% */ |
| 6448 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 6449 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 6450 | { } |
| 6451 | }; |
| 6452 | |
| 6453 | /* Toggle speaker-output according to the hp-jack state */ |
| 6454 | static void alc885_imac24_automute(struct hda_codec *codec) |
| 6455 | { |
| 6456 | unsigned int present; |
| 6457 | |
| 6458 | present = snd_hda_codec_read(codec, 0x14, 0, |
| 6459 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 6460 | snd_hda_codec_amp_stereo(codec, 0x18, HDA_OUTPUT, 0, |
| 6461 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
| 6462 | snd_hda_codec_amp_stereo(codec, 0x1a, HDA_OUTPUT, 0, |
| 6463 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
Nicola Fagnani | c54728d | 2007-07-19 23:28:52 +0200 | [diff] [blame] | 6464 | } |
| 6465 | |
| 6466 | /* Processes unsolicited events. */ |
| 6467 | static void alc885_imac24_unsol_event(struct hda_codec *codec, |
| 6468 | unsigned int res) |
| 6469 | { |
| 6470 | /* Headphone insertion or removal. */ |
| 6471 | if ((res >> 26) == ALC880_HP_EVENT) |
| 6472 | alc885_imac24_automute(codec); |
| 6473 | } |
| 6474 | |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 6475 | static void alc885_mbp3_automute(struct hda_codec *codec) |
| 6476 | { |
| 6477 | unsigned int present; |
| 6478 | |
| 6479 | present = snd_hda_codec_read(codec, 0x15, 0, |
| 6480 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 6481 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 6482 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
| 6483 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 6484 | HDA_AMP_MUTE, present ? 0 : HDA_AMP_MUTE); |
| 6485 | |
| 6486 | } |
| 6487 | static void alc885_mbp3_unsol_event(struct hda_codec *codec, |
| 6488 | unsigned int res) |
| 6489 | { |
| 6490 | /* Headphone insertion or removal. */ |
| 6491 | if ((res >> 26) == ALC880_HP_EVENT) |
| 6492 | alc885_mbp3_automute(codec); |
| 6493 | } |
| 6494 | |
| 6495 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 6496 | static struct hda_verb alc882_targa_verbs[] = { |
| 6497 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6498 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 6499 | |
| 6500 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 6501 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 6502 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 6503 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */ |
| 6504 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */ |
| 6505 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 6506 | |
| 6507 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 6508 | {0x01, AC_VERB_SET_GPIO_MASK, 0x03}, |
| 6509 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x03}, |
| 6510 | {0x01, AC_VERB_SET_GPIO_DATA, 0x03}, |
| 6511 | { } /* end */ |
| 6512 | }; |
| 6513 | |
| 6514 | /* toggle speaker-output according to the hp-jack state */ |
| 6515 | static void alc882_targa_automute(struct hda_codec *codec) |
| 6516 | { |
| 6517 | unsigned int present; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 6518 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 6519 | present = snd_hda_codec_read(codec, 0x14, 0, |
| 6520 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 6521 | snd_hda_codec_amp_stereo(codec, 0x1b, HDA_OUTPUT, 0, |
| 6522 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 6523 | snd_hda_codec_write_cache(codec, 1, 0, AC_VERB_SET_GPIO_DATA, |
| 6524 | present ? 1 : 3); |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 6525 | } |
| 6526 | |
| 6527 | static void alc882_targa_unsol_event(struct hda_codec *codec, unsigned int res) |
| 6528 | { |
| 6529 | /* Looks like the unsol event is incompatible with the standard |
| 6530 | * definition. 4bit tag is placed at 26 bit! |
| 6531 | */ |
| 6532 | if (((res >> 26) == ALC880_HP_EVENT)) { |
| 6533 | alc882_targa_automute(codec); |
| 6534 | } |
| 6535 | } |
| 6536 | |
| 6537 | static struct hda_verb alc882_asus_a7j_verbs[] = { |
| 6538 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6539 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 6540 | |
| 6541 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 6542 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 6543 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 6544 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 6545 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */ |
| 6546 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 6547 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */ |
| 6548 | |
| 6549 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */ |
| 6550 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */ |
| 6551 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 6552 | { } /* end */ |
| 6553 | }; |
| 6554 | |
Takashi Iwai | 914759b | 2007-09-06 14:52:04 +0200 | [diff] [blame] | 6555 | static struct hda_verb alc882_asus_a7m_verbs[] = { |
| 6556 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6557 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 6558 | |
| 6559 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 6560 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 6561 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 6562 | |
Takashi Iwai | 914759b | 2007-09-06 14:52:04 +0200 | [diff] [blame] | 6563 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */ |
| 6564 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 6565 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */ |
| 6566 | |
| 6567 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */ |
| 6568 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */ |
| 6569 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 6570 | { } /* end */ |
| 6571 | }; |
| 6572 | |
Tobin Davis | 9102cd1 | 2006-12-15 10:02:12 +0100 | [diff] [blame] | 6573 | static void alc882_gpio_mute(struct hda_codec *codec, int pin, int muted) |
| 6574 | { |
| 6575 | unsigned int gpiostate, gpiomask, gpiodir; |
| 6576 | |
| 6577 | gpiostate = snd_hda_codec_read(codec, codec->afg, 0, |
| 6578 | AC_VERB_GET_GPIO_DATA, 0); |
| 6579 | |
| 6580 | if (!muted) |
| 6581 | gpiostate |= (1 << pin); |
| 6582 | else |
| 6583 | gpiostate &= ~(1 << pin); |
| 6584 | |
| 6585 | gpiomask = snd_hda_codec_read(codec, codec->afg, 0, |
| 6586 | AC_VERB_GET_GPIO_MASK, 0); |
| 6587 | gpiomask |= (1 << pin); |
| 6588 | |
| 6589 | gpiodir = snd_hda_codec_read(codec, codec->afg, 0, |
| 6590 | AC_VERB_GET_GPIO_DIRECTION, 0); |
| 6591 | gpiodir |= (1 << pin); |
| 6592 | |
| 6593 | |
| 6594 | snd_hda_codec_write(codec, codec->afg, 0, |
| 6595 | AC_VERB_SET_GPIO_MASK, gpiomask); |
| 6596 | snd_hda_codec_write(codec, codec->afg, 0, |
| 6597 | AC_VERB_SET_GPIO_DIRECTION, gpiodir); |
| 6598 | |
| 6599 | msleep(1); |
| 6600 | |
| 6601 | snd_hda_codec_write(codec, codec->afg, 0, |
| 6602 | AC_VERB_SET_GPIO_DATA, gpiostate); |
| 6603 | } |
| 6604 | |
Takashi Iwai | 7debbe5 | 2007-08-16 15:01:03 +0200 | [diff] [blame] | 6605 | /* set up GPIO at initialization */ |
| 6606 | static void alc885_macpro_init_hook(struct hda_codec *codec) |
| 6607 | { |
| 6608 | alc882_gpio_mute(codec, 0, 0); |
| 6609 | alc882_gpio_mute(codec, 1, 0); |
| 6610 | } |
| 6611 | |
| 6612 | /* set up GPIO and update auto-muting at initialization */ |
| 6613 | static void alc885_imac24_init_hook(struct hda_codec *codec) |
| 6614 | { |
| 6615 | alc885_macpro_init_hook(codec); |
| 6616 | alc885_imac24_automute(codec); |
| 6617 | } |
| 6618 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6619 | /* |
| 6620 | * generic initialization of ADC, input mixers and output mixers |
| 6621 | */ |
| 6622 | static struct hda_verb alc882_auto_init_verbs[] = { |
| 6623 | /* |
| 6624 | * Unmute ADC0-2 and set the default input to mic-in |
| 6625 | */ |
| 6626 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 6627 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6628 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 6629 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6630 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 6631 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6632 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 6633 | /* 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] | 6634 | * mixer widget |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6635 | * Note: PASD motherboards uses the Line In 2 as the input for |
| 6636 | * front panel mic (mic 2) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6637 | */ |
| 6638 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 6639 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6640 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 6641 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 6642 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 6643 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6644 | |
| 6645 | /* |
| 6646 | * Set up output mixers (0x0c - 0x0f) |
| 6647 | */ |
| 6648 | /* set vol=0 to output mixers */ |
| 6649 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 6650 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 6651 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 6652 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 6653 | /* set up input amps for analog loopback */ |
| 6654 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 6655 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6656 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 6657 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6658 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 6659 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6660 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 6661 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6662 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 6663 | {0x26, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6664 | {0x26, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 6665 | |
| 6666 | /* FIXME: use matrix-type input source selection */ |
| 6667 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 6668 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ |
| 6669 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 6670 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 6671 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 6672 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 6673 | /* Input mixer2 */ |
| 6674 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 6675 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 6676 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 6677 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 6678 | /* Input mixer3 */ |
| 6679 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 6680 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 6681 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 6682 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 6683 | |
| 6684 | { } |
| 6685 | }; |
| 6686 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 6687 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 6688 | #define alc882_loopbacks alc880_loopbacks |
| 6689 | #endif |
| 6690 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6691 | /* pcm configuration: identiacal with ALC880 */ |
| 6692 | #define alc882_pcm_analog_playback alc880_pcm_analog_playback |
| 6693 | #define alc882_pcm_analog_capture alc880_pcm_analog_capture |
| 6694 | #define alc882_pcm_digital_playback alc880_pcm_digital_playback |
| 6695 | #define alc882_pcm_digital_capture alc880_pcm_digital_capture |
| 6696 | |
| 6697 | /* |
| 6698 | * configuration and preset |
| 6699 | */ |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 6700 | static const char *alc882_models[ALC882_MODEL_LAST] = { |
| 6701 | [ALC882_3ST_DIG] = "3stack-dig", |
| 6702 | [ALC882_6ST_DIG] = "6stack-dig", |
| 6703 | [ALC882_ARIMA] = "arima", |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 6704 | [ALC882_W2JC] = "w2jc", |
Takashi Iwai | 0438a00 | 2007-09-06 14:54:11 +0200 | [diff] [blame] | 6705 | [ALC882_TARGA] = "targa", |
| 6706 | [ALC882_ASUS_A7J] = "asus-a7j", |
| 6707 | [ALC882_ASUS_A7M] = "asus-a7m", |
Tobin Davis | 9102cd1 | 2006-12-15 10:02:12 +0100 | [diff] [blame] | 6708 | [ALC885_MACPRO] = "macpro", |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 6709 | [ALC885_MBP3] = "mbp3", |
Nicola Fagnani | c54728d | 2007-07-19 23:28:52 +0200 | [diff] [blame] | 6710 | [ALC885_IMAC24] = "imac24", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 6711 | [ALC882_AUTO] = "auto", |
| 6712 | }; |
| 6713 | |
| 6714 | static struct snd_pci_quirk alc882_cfg_tbl[] = { |
| 6715 | SND_PCI_QUIRK(0x1019, 0x6668, "ECS", ALC882_6ST_DIG), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 6716 | SND_PCI_QUIRK(0x1043, 0x060d, "Asus A7J", ALC882_ASUS_A7J), |
Kailang Yang | ac8842a | 2007-09-20 12:51:39 +0200 | [diff] [blame] | 6717 | SND_PCI_QUIRK(0x1043, 0x1243, "Asus A7J", ALC882_ASUS_A7J), |
Takashi Iwai | 914759b | 2007-09-06 14:52:04 +0200 | [diff] [blame] | 6718 | SND_PCI_QUIRK(0x1043, 0x13c2, "Asus A7M", ALC882_ASUS_A7M), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 6719 | SND_PCI_QUIRK(0x1043, 0x1971, "Asus W2JC", ALC882_W2JC), |
Claudio Matsuoka | c5d9f1c | 2007-07-19 23:18:32 +0200 | [diff] [blame] | 6720 | SND_PCI_QUIRK(0x1043, 0x817f, "Asus P5LD2", ALC882_6ST_DIG), |
Tobin Davis | 7b9470d | 2006-12-28 13:56:48 +0100 | [diff] [blame] | 6721 | SND_PCI_QUIRK(0x1043, 0x81d8, "Asus P5WD", ALC882_6ST_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 6722 | SND_PCI_QUIRK(0x105b, 0x6668, "Foxconn", ALC882_6ST_DIG), |
Jiang zhe | 4444704 | 2008-01-28 12:28:24 +0100 | [diff] [blame] | 6723 | SND_PCI_QUIRK(0x1458, 0xa002, "Gigabyte P35 DS3R", ALC882_6ST_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 6724 | SND_PCI_QUIRK(0x1462, 0x28fb, "Targa T8", ALC882_TARGA), /* MSI-1049 T8 */ |
| 6725 | SND_PCI_QUIRK(0x1462, 0x6668, "MSI", ALC882_6ST_DIG), |
| 6726 | SND_PCI_QUIRK(0x161f, 0x2054, "Arima W820", ALC882_ARIMA), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6727 | {} |
| 6728 | }; |
| 6729 | |
| 6730 | static struct alc_config_preset alc882_presets[] = { |
| 6731 | [ALC882_3ST_DIG] = { |
| 6732 | .mixers = { alc882_base_mixer }, |
| 6733 | .init_verbs = { alc882_init_verbs }, |
| 6734 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 6735 | .dac_nids = alc882_dac_nids, |
| 6736 | .dig_out_nid = ALC882_DIGOUT_NID, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6737 | .dig_in_nid = ALC882_DIGIN_NID, |
| 6738 | .num_channel_mode = ARRAY_SIZE(alc882_ch_modes), |
| 6739 | .channel_mode = alc882_ch_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 6740 | .need_dac_fix = 1, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6741 | .input_mux = &alc882_capture_source, |
| 6742 | }, |
| 6743 | [ALC882_6ST_DIG] = { |
| 6744 | .mixers = { alc882_base_mixer, alc882_chmode_mixer }, |
| 6745 | .init_verbs = { alc882_init_verbs }, |
| 6746 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 6747 | .dac_nids = alc882_dac_nids, |
| 6748 | .dig_out_nid = ALC882_DIGOUT_NID, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6749 | .dig_in_nid = ALC882_DIGIN_NID, |
| 6750 | .num_channel_mode = ARRAY_SIZE(alc882_sixstack_modes), |
| 6751 | .channel_mode = alc882_sixstack_modes, |
| 6752 | .input_mux = &alc882_capture_source, |
| 6753 | }, |
Takashi Iwai | 4b146cb | 2006-07-28 14:42:36 +0200 | [diff] [blame] | 6754 | [ALC882_ARIMA] = { |
| 6755 | .mixers = { alc882_base_mixer, alc882_chmode_mixer }, |
| 6756 | .init_verbs = { alc882_init_verbs, alc882_eapd_verbs }, |
| 6757 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 6758 | .dac_nids = alc882_dac_nids, |
| 6759 | .num_channel_mode = ARRAY_SIZE(alc882_sixstack_modes), |
| 6760 | .channel_mode = alc882_sixstack_modes, |
| 6761 | .input_mux = &alc882_capture_source, |
| 6762 | }, |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 6763 | [ALC882_W2JC] = { |
| 6764 | .mixers = { alc882_w2jc_mixer, alc882_chmode_mixer }, |
| 6765 | .init_verbs = { alc882_init_verbs, alc882_eapd_verbs, |
| 6766 | alc880_gpio1_init_verbs }, |
| 6767 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 6768 | .dac_nids = alc882_dac_nids, |
| 6769 | .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes), |
| 6770 | .channel_mode = alc880_threestack_modes, |
| 6771 | .need_dac_fix = 1, |
| 6772 | .input_mux = &alc882_capture_source, |
| 6773 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 6774 | }, |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 6775 | [ALC885_MBP3] = { |
| 6776 | .mixers = { alc885_mbp3_mixer, alc882_chmode_mixer }, |
| 6777 | .init_verbs = { alc885_mbp3_init_verbs, |
| 6778 | alc880_gpio1_init_verbs }, |
| 6779 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 6780 | .dac_nids = alc882_dac_nids, |
| 6781 | .channel_mode = alc885_mbp_6ch_modes, |
| 6782 | .num_channel_mode = ARRAY_SIZE(alc885_mbp_6ch_modes), |
| 6783 | .input_mux = &alc882_capture_source, |
| 6784 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 6785 | .dig_in_nid = ALC882_DIGIN_NID, |
| 6786 | .unsol_event = alc885_mbp3_unsol_event, |
| 6787 | .init_hook = alc885_mbp3_automute, |
| 6788 | }, |
Tobin Davis | 9102cd1 | 2006-12-15 10:02:12 +0100 | [diff] [blame] | 6789 | [ALC885_MACPRO] = { |
| 6790 | .mixers = { alc882_macpro_mixer }, |
| 6791 | .init_verbs = { alc882_macpro_init_verbs }, |
| 6792 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 6793 | .dac_nids = alc882_dac_nids, |
| 6794 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 6795 | .dig_in_nid = ALC882_DIGIN_NID, |
| 6796 | .num_channel_mode = ARRAY_SIZE(alc882_ch_modes), |
| 6797 | .channel_mode = alc882_ch_modes, |
| 6798 | .input_mux = &alc882_capture_source, |
Takashi Iwai | 7debbe5 | 2007-08-16 15:01:03 +0200 | [diff] [blame] | 6799 | .init_hook = alc885_macpro_init_hook, |
Tobin Davis | 9102cd1 | 2006-12-15 10:02:12 +0100 | [diff] [blame] | 6800 | }, |
Nicola Fagnani | c54728d | 2007-07-19 23:28:52 +0200 | [diff] [blame] | 6801 | [ALC885_IMAC24] = { |
| 6802 | .mixers = { alc885_imac24_mixer }, |
| 6803 | .init_verbs = { alc885_imac24_init_verbs }, |
| 6804 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 6805 | .dac_nids = alc882_dac_nids, |
| 6806 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 6807 | .dig_in_nid = ALC882_DIGIN_NID, |
| 6808 | .num_channel_mode = ARRAY_SIZE(alc882_ch_modes), |
| 6809 | .channel_mode = alc882_ch_modes, |
| 6810 | .input_mux = &alc882_capture_source, |
| 6811 | .unsol_event = alc885_imac24_unsol_event, |
Takashi Iwai | 7debbe5 | 2007-08-16 15:01:03 +0200 | [diff] [blame] | 6812 | .init_hook = alc885_imac24_init_hook, |
Nicola Fagnani | c54728d | 2007-07-19 23:28:52 +0200 | [diff] [blame] | 6813 | }, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 6814 | [ALC882_TARGA] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 6815 | .mixers = { alc882_targa_mixer, alc882_chmode_mixer }, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 6816 | .init_verbs = { alc882_init_verbs, alc882_targa_verbs}, |
| 6817 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 6818 | .dac_nids = alc882_dac_nids, |
| 6819 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 6820 | .num_adc_nids = ARRAY_SIZE(alc882_adc_nids), |
| 6821 | .adc_nids = alc882_adc_nids, |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 6822 | .capsrc_nids = alc882_capsrc_nids, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 6823 | .num_channel_mode = ARRAY_SIZE(alc882_3ST_6ch_modes), |
| 6824 | .channel_mode = alc882_3ST_6ch_modes, |
| 6825 | .need_dac_fix = 1, |
| 6826 | .input_mux = &alc882_capture_source, |
| 6827 | .unsol_event = alc882_targa_unsol_event, |
| 6828 | .init_hook = alc882_targa_automute, |
| 6829 | }, |
| 6830 | [ALC882_ASUS_A7J] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 6831 | .mixers = { alc882_asus_a7j_mixer, alc882_chmode_mixer }, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 6832 | .init_verbs = { alc882_init_verbs, alc882_asus_a7j_verbs}, |
| 6833 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 6834 | .dac_nids = alc882_dac_nids, |
| 6835 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 6836 | .num_adc_nids = ARRAY_SIZE(alc882_adc_nids), |
| 6837 | .adc_nids = alc882_adc_nids, |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 6838 | .capsrc_nids = alc882_capsrc_nids, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 6839 | .num_channel_mode = ARRAY_SIZE(alc882_3ST_6ch_modes), |
| 6840 | .channel_mode = alc882_3ST_6ch_modes, |
| 6841 | .need_dac_fix = 1, |
| 6842 | .input_mux = &alc882_capture_source, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 6843 | }, |
Takashi Iwai | 914759b | 2007-09-06 14:52:04 +0200 | [diff] [blame] | 6844 | [ALC882_ASUS_A7M] = { |
| 6845 | .mixers = { alc882_asus_a7m_mixer, alc882_chmode_mixer }, |
| 6846 | .init_verbs = { alc882_init_verbs, alc882_eapd_verbs, |
| 6847 | alc880_gpio1_init_verbs, |
| 6848 | alc882_asus_a7m_verbs }, |
| 6849 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 6850 | .dac_nids = alc882_dac_nids, |
| 6851 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 6852 | .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes), |
| 6853 | .channel_mode = alc880_threestack_modes, |
| 6854 | .need_dac_fix = 1, |
| 6855 | .input_mux = &alc882_capture_source, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 6856 | }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6857 | }; |
| 6858 | |
| 6859 | |
| 6860 | /* |
Takashi Iwai | f95474e | 2007-07-10 00:47:43 +0200 | [diff] [blame] | 6861 | * Pin config fixes |
| 6862 | */ |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 6863 | enum { |
Takashi Iwai | f95474e | 2007-07-10 00:47:43 +0200 | [diff] [blame] | 6864 | PINFIX_ABIT_AW9D_MAX |
| 6865 | }; |
| 6866 | |
| 6867 | static struct alc_pincfg alc882_abit_aw9d_pinfix[] = { |
| 6868 | { 0x15, 0x01080104 }, /* side */ |
| 6869 | { 0x16, 0x01011012 }, /* rear */ |
| 6870 | { 0x17, 0x01016011 }, /* clfe */ |
| 6871 | { } |
| 6872 | }; |
| 6873 | |
| 6874 | static const struct alc_pincfg *alc882_pin_fixes[] = { |
| 6875 | [PINFIX_ABIT_AW9D_MAX] = alc882_abit_aw9d_pinfix, |
| 6876 | }; |
| 6877 | |
| 6878 | static struct snd_pci_quirk alc882_pinfix_tbl[] = { |
| 6879 | SND_PCI_QUIRK(0x147b, 0x107a, "Abit AW9D-MAX", PINFIX_ABIT_AW9D_MAX), |
| 6880 | {} |
| 6881 | }; |
| 6882 | |
| 6883 | /* |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6884 | * BIOS auto configuration |
| 6885 | */ |
| 6886 | static void alc882_auto_set_output_and_unmute(struct hda_codec *codec, |
| 6887 | hda_nid_t nid, int pin_type, |
| 6888 | int dac_idx) |
| 6889 | { |
| 6890 | /* set as output */ |
| 6891 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6892 | int idx; |
| 6893 | |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 6894 | alc_set_pin_output(codec, nid, pin_type); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6895 | if (spec->multiout.dac_nids[dac_idx] == 0x25) |
| 6896 | idx = 4; |
| 6897 | else |
| 6898 | idx = spec->multiout.dac_nids[dac_idx] - 2; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6899 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_CONNECT_SEL, idx); |
| 6900 | |
| 6901 | } |
| 6902 | |
| 6903 | static void alc882_auto_init_multi_out(struct hda_codec *codec) |
| 6904 | { |
| 6905 | struct alc_spec *spec = codec->spec; |
| 6906 | int i; |
| 6907 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 6908 | alc_subsystem_id(codec, 0x15, 0x1b, 0x14); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6909 | for (i = 0; i <= HDA_SIDE; i++) { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6910 | hda_nid_t nid = spec->autocfg.line_out_pins[i]; |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 6911 | int pin_type = get_pin_type(spec->autocfg.line_out_type); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6912 | if (nid) |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 6913 | alc882_auto_set_output_and_unmute(codec, nid, pin_type, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6914 | i); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6915 | } |
| 6916 | } |
| 6917 | |
| 6918 | static void alc882_auto_init_hp_out(struct hda_codec *codec) |
| 6919 | { |
| 6920 | struct alc_spec *spec = codec->spec; |
| 6921 | hda_nid_t pin; |
| 6922 | |
Takashi Iwai | eb06ed8 | 2006-09-20 17:10:27 +0200 | [diff] [blame] | 6923 | pin = spec->autocfg.hp_pins[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6924 | if (pin) /* connect to front */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6925 | /* use dac 0 */ |
| 6926 | alc882_auto_set_output_and_unmute(codec, pin, PIN_HP, 0); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 6927 | pin = spec->autocfg.speaker_pins[0]; |
| 6928 | if (pin) |
| 6929 | alc882_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6930 | } |
| 6931 | |
| 6932 | #define alc882_is_input_pin(nid) alc880_is_input_pin(nid) |
| 6933 | #define ALC882_PIN_CD_NID ALC880_PIN_CD_NID |
| 6934 | |
| 6935 | static void alc882_auto_init_analog_input(struct hda_codec *codec) |
| 6936 | { |
| 6937 | struct alc_spec *spec = codec->spec; |
| 6938 | int i; |
| 6939 | |
| 6940 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
| 6941 | hda_nid_t nid = spec->autocfg.input_pins[i]; |
Takashi Iwai | 7194cae | 2008-03-06 16:58:17 +0100 | [diff] [blame] | 6942 | unsigned int vref; |
| 6943 | if (!nid) |
| 6944 | continue; |
| 6945 | vref = PIN_IN; |
| 6946 | if (1 /*i <= AUTO_PIN_FRONT_MIC*/) { |
Kailang Yang | 531240f | 2008-05-27 12:10:25 +0200 | [diff] [blame] | 6947 | unsigned int pincap; |
| 6948 | pincap = snd_hda_param_read(codec, nid, AC_PAR_PIN_CAP); |
| 6949 | if ((pincap >> AC_PINCAP_VREF_SHIFT) & |
Takashi Iwai | 7194cae | 2008-03-06 16:58:17 +0100 | [diff] [blame] | 6950 | AC_PINCAP_VREF_80) |
| 6951 | vref = PIN_VREF80; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6952 | } |
Takashi Iwai | 7194cae | 2008-03-06 16:58:17 +0100 | [diff] [blame] | 6953 | snd_hda_codec_write(codec, nid, 0, |
| 6954 | AC_VERB_SET_PIN_WIDGET_CONTROL, vref); |
| 6955 | if (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP) |
| 6956 | snd_hda_codec_write(codec, nid, 0, |
| 6957 | AC_VERB_SET_AMP_GAIN_MUTE, |
| 6958 | AMP_OUT_MUTE); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6959 | } |
| 6960 | } |
| 6961 | |
Takashi Iwai | f511b01 | 2008-08-15 16:46:42 +0200 | [diff] [blame] | 6962 | static void alc882_auto_init_input_src(struct hda_codec *codec) |
| 6963 | { |
| 6964 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | f511b01 | 2008-08-15 16:46:42 +0200 | [diff] [blame] | 6965 | int c; |
| 6966 | |
| 6967 | for (c = 0; c < spec->num_adc_nids; c++) { |
| 6968 | hda_nid_t conn_list[HDA_MAX_NUM_INPUTS]; |
| 6969 | hda_nid_t nid = spec->capsrc_nids[c]; |
Herton Ronaldo Krzesinski | b98b7b3 | 2009-01-29 13:18:31 -0200 | [diff] [blame] | 6970 | unsigned int mux_idx; |
| 6971 | const struct hda_input_mux *imux; |
Takashi Iwai | f511b01 | 2008-08-15 16:46:42 +0200 | [diff] [blame] | 6972 | int conns, mute, idx, item; |
| 6973 | |
| 6974 | conns = snd_hda_get_connections(codec, nid, conn_list, |
| 6975 | ARRAY_SIZE(conn_list)); |
| 6976 | if (conns < 0) |
| 6977 | continue; |
Herton Ronaldo Krzesinski | b98b7b3 | 2009-01-29 13:18:31 -0200 | [diff] [blame] | 6978 | mux_idx = c >= spec->num_mux_defs ? 0 : c; |
| 6979 | imux = &spec->input_mux[mux_idx]; |
Takashi Iwai | f511b01 | 2008-08-15 16:46:42 +0200 | [diff] [blame] | 6980 | for (idx = 0; idx < conns; idx++) { |
| 6981 | /* if the current connection is the selected one, |
| 6982 | * unmute it as default - otherwise mute it |
| 6983 | */ |
| 6984 | mute = AMP_IN_MUTE(idx); |
| 6985 | for (item = 0; item < imux->num_items; item++) { |
| 6986 | if (imux->items[item].index == idx) { |
| 6987 | if (spec->cur_mux[c] == item) |
| 6988 | mute = AMP_IN_UNMUTE(idx); |
| 6989 | break; |
| 6990 | } |
| 6991 | } |
Herton Ronaldo Krzesinski | b98b7b3 | 2009-01-29 13:18:31 -0200 | [diff] [blame] | 6992 | /* check if we have a selector or mixer |
| 6993 | * we could check for the widget type instead, but |
| 6994 | * just check for Amp-In presence (in case of mixer |
| 6995 | * without amp-in there is something wrong, this |
| 6996 | * function shouldn't be used or capsrc nid is wrong) |
| 6997 | */ |
| 6998 | if (get_wcaps(codec, nid) & AC_WCAP_IN_AMP) |
| 6999 | snd_hda_codec_write(codec, nid, 0, |
| 7000 | AC_VERB_SET_AMP_GAIN_MUTE, |
| 7001 | mute); |
| 7002 | else if (mute != AMP_IN_MUTE(idx)) |
| 7003 | snd_hda_codec_write(codec, nid, 0, |
| 7004 | AC_VERB_SET_CONNECT_SEL, |
| 7005 | idx); |
Takashi Iwai | f511b01 | 2008-08-15 16:46:42 +0200 | [diff] [blame] | 7006 | } |
| 7007 | } |
| 7008 | } |
| 7009 | |
Takashi Iwai | 776e184 | 2007-08-29 15:07:11 +0200 | [diff] [blame] | 7010 | /* add mic boosts if needed */ |
| 7011 | static int alc_auto_add_mic_boost(struct hda_codec *codec) |
| 7012 | { |
| 7013 | struct alc_spec *spec = codec->spec; |
| 7014 | int err; |
| 7015 | hda_nid_t nid; |
| 7016 | |
| 7017 | nid = spec->autocfg.input_pins[AUTO_PIN_MIC]; |
Takashi Iwai | ce22e03 | 2008-01-11 17:38:35 +0100 | [diff] [blame] | 7018 | if (nid && (get_wcaps(codec, nid) & AC_WCAP_IN_AMP)) { |
Takashi Iwai | 776e184 | 2007-08-29 15:07:11 +0200 | [diff] [blame] | 7019 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 7020 | "Mic Boost", |
| 7021 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_INPUT)); |
| 7022 | if (err < 0) |
| 7023 | return err; |
| 7024 | } |
| 7025 | nid = spec->autocfg.input_pins[AUTO_PIN_FRONT_MIC]; |
Takashi Iwai | ce22e03 | 2008-01-11 17:38:35 +0100 | [diff] [blame] | 7026 | if (nid && (get_wcaps(codec, nid) & AC_WCAP_IN_AMP)) { |
Takashi Iwai | 776e184 | 2007-08-29 15:07:11 +0200 | [diff] [blame] | 7027 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 7028 | "Front Mic Boost", |
| 7029 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_INPUT)); |
| 7030 | if (err < 0) |
| 7031 | return err; |
| 7032 | } |
| 7033 | return 0; |
| 7034 | } |
| 7035 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7036 | /* almost identical with ALC880 parser... */ |
| 7037 | static int alc882_parse_auto_config(struct hda_codec *codec) |
| 7038 | { |
| 7039 | struct alc_spec *spec = codec->spec; |
| 7040 | int err = alc880_parse_auto_config(codec); |
| 7041 | |
| 7042 | if (err < 0) |
| 7043 | return err; |
Takashi Iwai | 776e184 | 2007-08-29 15:07:11 +0200 | [diff] [blame] | 7044 | else if (!err) |
| 7045 | return 0; /* no config found */ |
| 7046 | |
| 7047 | err = alc_auto_add_mic_boost(codec); |
| 7048 | if (err < 0) |
| 7049 | return err; |
| 7050 | |
| 7051 | /* hack - override the init verbs */ |
| 7052 | spec->init_verbs[0] = alc882_auto_init_verbs; |
| 7053 | |
| 7054 | return 1; /* config found */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7055 | } |
| 7056 | |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 7057 | /* additional initialization for auto-configuration model */ |
| 7058 | static void alc882_auto_init(struct hda_codec *codec) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7059 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 7060 | struct alc_spec *spec = codec->spec; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7061 | alc882_auto_init_multi_out(codec); |
| 7062 | alc882_auto_init_hp_out(codec); |
| 7063 | alc882_auto_init_analog_input(codec); |
Takashi Iwai | f511b01 | 2008-08-15 16:46:42 +0200 | [diff] [blame] | 7064 | alc882_auto_init_input_src(codec); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 7065 | if (spec->unsol_event) |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 7066 | alc_inithook(codec); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7067 | } |
| 7068 | |
Takashi Iwai | 7943a8a | 2008-04-16 17:29:09 +0200 | [diff] [blame] | 7069 | static int patch_alc883(struct hda_codec *codec); /* called in patch_alc882() */ |
| 7070 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7071 | static int patch_alc882(struct hda_codec *codec) |
| 7072 | { |
| 7073 | struct alc_spec *spec; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7074 | int err, board_config; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7075 | |
Takashi Iwai | e560d8d | 2005-09-09 14:21:46 +0200 | [diff] [blame] | 7076 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7077 | if (spec == NULL) |
| 7078 | return -ENOMEM; |
| 7079 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7080 | codec->spec = spec; |
| 7081 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 7082 | board_config = snd_hda_check_board_config(codec, ALC882_MODEL_LAST, |
| 7083 | alc882_models, |
| 7084 | alc882_cfg_tbl); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7085 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7086 | if (board_config < 0 || board_config >= ALC882_MODEL_LAST) { |
Tobin Davis | 081d17c | 2007-02-15 17:46:18 +0100 | [diff] [blame] | 7087 | /* Pick up systems that don't supply PCI SSID */ |
| 7088 | switch (codec->subsystem_id) { |
| 7089 | case 0x106b0c00: /* Mac Pro */ |
| 7090 | board_config = ALC885_MACPRO; |
| 7091 | break; |
Nicola Fagnani | c54728d | 2007-07-19 23:28:52 +0200 | [diff] [blame] | 7092 | case 0x106b1000: /* iMac 24 */ |
Peter Korsgaard | f3911c5 | 2008-09-27 09:13:45 +0200 | [diff] [blame] | 7093 | case 0x106b2800: /* AppleTV */ |
Mark Eggleston | 3077e44 | 2009-01-31 17:57:54 +0100 | [diff] [blame] | 7094 | case 0x106b3e00: /* iMac 24 Aluminium */ |
Nicola Fagnani | c54728d | 2007-07-19 23:28:52 +0200 | [diff] [blame] | 7095 | board_config = ALC885_IMAC24; |
| 7096 | break; |
Takashi Iwai | c7e0757 | 2008-06-26 14:42:51 +0200 | [diff] [blame] | 7097 | case 0x106b00a1: /* Macbook (might be wrong - PCI SSID?) */ |
David Woodhouse | 9c95c43 | 2008-09-18 13:37:13 -0700 | [diff] [blame] | 7098 | case 0x106b00a4: /* MacbookPro4,1 */ |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 7099 | case 0x106b2c00: /* Macbook Pro rev3 */ |
Takashi Iwai | c7e0757 | 2008-06-26 14:42:51 +0200 | [diff] [blame] | 7100 | case 0x106b3600: /* Macbook 3.1 */ |
Luke Yelavich | 2a88464 | 2009-01-28 15:58:38 +1100 | [diff] [blame] | 7101 | case 0x106b3800: /* MacbookPro4,1 - latter revision */ |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 7102 | board_config = ALC885_MBP3; |
| 7103 | break; |
Tobin Davis | 081d17c | 2007-02-15 17:46:18 +0100 | [diff] [blame] | 7104 | default: |
Takashi Iwai | 7943a8a | 2008-04-16 17:29:09 +0200 | [diff] [blame] | 7105 | /* ALC889A is handled better as ALC888-compatible */ |
Clive Messer | 669faba | 2008-09-30 15:49:13 +0200 | [diff] [blame] | 7106 | if (codec->revision_id == 0x100101 || |
| 7107 | codec->revision_id == 0x100103) { |
Takashi Iwai | 7943a8a | 2008-04-16 17:29:09 +0200 | [diff] [blame] | 7108 | alc_free(codec); |
| 7109 | return patch_alc883(codec); |
| 7110 | } |
Tobin Davis | 081d17c | 2007-02-15 17:46:18 +0100 | [diff] [blame] | 7111 | printk(KERN_INFO "hda_codec: Unknown model for ALC882, " |
| 7112 | "trying auto-probe from BIOS...\n"); |
| 7113 | board_config = ALC882_AUTO; |
| 7114 | } |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7115 | } |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 7116 | |
Takashi Iwai | f95474e | 2007-07-10 00:47:43 +0200 | [diff] [blame] | 7117 | alc_fix_pincfg(codec, alc882_pinfix_tbl, alc882_pin_fixes); |
| 7118 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7119 | if (board_config == ALC882_AUTO) { |
| 7120 | /* automatic parse from the BIOS config */ |
| 7121 | err = alc882_parse_auto_config(codec); |
| 7122 | if (err < 0) { |
| 7123 | alc_free(codec); |
| 7124 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 7125 | } else if (!err) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7126 | printk(KERN_INFO |
| 7127 | "hda_codec: Cannot set up configuration " |
| 7128 | "from BIOS. Using base mode...\n"); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7129 | board_config = ALC882_3ST_DIG; |
| 7130 | } |
| 7131 | } |
| 7132 | |
Kusanagi Kouichi | 680cd53 | 2009-02-05 00:00:58 +0900 | [diff] [blame] | 7133 | err = snd_hda_attach_beep_device(codec, 0x1); |
| 7134 | if (err < 0) { |
| 7135 | alc_free(codec); |
| 7136 | return err; |
| 7137 | } |
| 7138 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7139 | if (board_config != ALC882_AUTO) |
| 7140 | setup_preset(spec, &alc882_presets[board_config]); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7141 | |
Kailang Yang | 2f89328 | 2008-05-27 12:14:47 +0200 | [diff] [blame] | 7142 | if (codec->vendor_id == 0x10ec0885) { |
| 7143 | spec->stream_name_analog = "ALC885 Analog"; |
| 7144 | spec->stream_name_digital = "ALC885 Digital"; |
| 7145 | } else { |
| 7146 | spec->stream_name_analog = "ALC882 Analog"; |
| 7147 | spec->stream_name_digital = "ALC882 Digital"; |
| 7148 | } |
| 7149 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7150 | spec->stream_analog_playback = &alc882_pcm_analog_playback; |
| 7151 | spec->stream_analog_capture = &alc882_pcm_analog_capture; |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 7152 | /* FIXME: setup DAC5 */ |
| 7153 | /*spec->stream_analog_alt_playback = &alc880_pcm_analog_alt_playback;*/ |
| 7154 | spec->stream_analog_alt_capture = &alc880_pcm_analog_alt_capture; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7155 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7156 | spec->stream_digital_playback = &alc882_pcm_digital_playback; |
| 7157 | spec->stream_digital_capture = &alc882_pcm_digital_capture; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7158 | |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 7159 | spec->capture_style = CAPT_MIX; /* matrix-style capture */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 7160 | if (!spec->adc_nids && spec->input_mux) { |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7161 | /* check whether NID 0x07 is valid */ |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 7162 | unsigned int wcap = get_wcaps(codec, 0x07); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 7163 | /* get type */ |
| 7164 | wcap = (wcap & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7165 | if (wcap != AC_WID_AUD_IN) { |
| 7166 | spec->adc_nids = alc882_adc_nids_alt; |
| 7167 | spec->num_adc_nids = ARRAY_SIZE(alc882_adc_nids_alt); |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 7168 | spec->capsrc_nids = alc882_capsrc_nids_alt; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7169 | } else { |
| 7170 | spec->adc_nids = alc882_adc_nids; |
| 7171 | spec->num_adc_nids = ARRAY_SIZE(alc882_adc_nids); |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 7172 | spec->capsrc_nids = alc882_capsrc_nids; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7173 | } |
| 7174 | } |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 7175 | set_capture_mixer(spec); |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 7176 | set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7177 | |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 7178 | spec->vmaster_nid = 0x0c; |
| 7179 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7180 | codec->patch_ops = alc_patch_ops; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7181 | if (board_config == ALC882_AUTO) |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 7182 | spec->init_hook = alc882_auto_init; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 7183 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 7184 | if (!spec->loopback.amplist) |
| 7185 | spec->loopback.amplist = alc882_loopbacks; |
| 7186 | #endif |
Takashi Iwai | daead53 | 2008-11-28 12:55:36 +0100 | [diff] [blame] | 7187 | codec->proc_widget_hook = print_realtek_coef; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7188 | |
| 7189 | return 0; |
| 7190 | } |
| 7191 | |
| 7192 | /* |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7193 | * ALC883 support |
| 7194 | * |
| 7195 | * ALC883 is almost identical with ALC880 but has cleaner and more flexible |
| 7196 | * configuration. Each pin widget can choose any input DACs and a mixer. |
| 7197 | * Each ADC is connected from a mixer of all inputs. This makes possible |
| 7198 | * 6-channel independent captures. |
| 7199 | * |
| 7200 | * In addition, an independent DAC for the multi-playback (not used in this |
| 7201 | * driver yet). |
| 7202 | */ |
| 7203 | #define ALC883_DIGOUT_NID 0x06 |
| 7204 | #define ALC883_DIGIN_NID 0x0a |
| 7205 | |
Wu Fengguang | 3ab9093 | 2008-11-17 09:51:09 +0100 | [diff] [blame] | 7206 | #define ALC1200_DIGOUT_NID 0x10 |
| 7207 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7208 | static hda_nid_t alc883_dac_nids[4] = { |
| 7209 | /* front, rear, clfe, rear_surr */ |
Herton Ronaldo Krzesinski | f32a19e | 2008-03-18 09:27:08 +0100 | [diff] [blame] | 7210 | 0x02, 0x03, 0x04, 0x05 |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7211 | }; |
| 7212 | |
| 7213 | static hda_nid_t alc883_adc_nids[2] = { |
| 7214 | /* ADC1-2 */ |
| 7215 | 0x08, 0x09, |
| 7216 | }; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 7217 | |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 7218 | static hda_nid_t alc883_adc_nids_alt[1] = { |
| 7219 | /* ADC1 */ |
| 7220 | 0x08, |
| 7221 | }; |
| 7222 | |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 7223 | static hda_nid_t alc883_adc_nids_rev[2] = { |
| 7224 | /* ADC2-1 */ |
| 7225 | 0x09, 0x08 |
| 7226 | }; |
| 7227 | |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 7228 | #define alc889_adc_nids alc880_adc_nids |
| 7229 | |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 7230 | static hda_nid_t alc883_capsrc_nids[2] = { 0x23, 0x22 }; |
| 7231 | |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 7232 | static hda_nid_t alc883_capsrc_nids_rev[2] = { 0x22, 0x23 }; |
| 7233 | |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 7234 | #define alc889_capsrc_nids alc882_capsrc_nids |
| 7235 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7236 | /* input MUX */ |
| 7237 | /* FIXME: should be a matrix-type input source selection */ |
| 7238 | |
| 7239 | static struct hda_input_mux alc883_capture_source = { |
| 7240 | .num_items = 4, |
| 7241 | .items = { |
| 7242 | { "Mic", 0x0 }, |
| 7243 | { "Front Mic", 0x1 }, |
| 7244 | { "Line", 0x2 }, |
| 7245 | { "CD", 0x4 }, |
| 7246 | }, |
| 7247 | }; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 7248 | |
Jiang zhe | 17bba1b | 2008-06-04 12:11:07 +0200 | [diff] [blame] | 7249 | static struct hda_input_mux alc883_3stack_6ch_intel = { |
| 7250 | .num_items = 4, |
| 7251 | .items = { |
| 7252 | { "Mic", 0x1 }, |
| 7253 | { "Front Mic", 0x0 }, |
| 7254 | { "Line", 0x2 }, |
| 7255 | { "CD", 0x4 }, |
| 7256 | }, |
| 7257 | }; |
| 7258 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 7259 | static struct hda_input_mux alc883_lenovo_101e_capture_source = { |
| 7260 | .num_items = 2, |
| 7261 | .items = { |
| 7262 | { "Mic", 0x1 }, |
| 7263 | { "Line", 0x2 }, |
| 7264 | }, |
| 7265 | }; |
| 7266 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7267 | static struct hda_input_mux alc883_lenovo_nb0763_capture_source = { |
| 7268 | .num_items = 4, |
| 7269 | .items = { |
| 7270 | { "Mic", 0x0 }, |
| 7271 | { "iMic", 0x1 }, |
| 7272 | { "Line", 0x2 }, |
| 7273 | { "CD", 0x4 }, |
| 7274 | }, |
| 7275 | }; |
| 7276 | |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 7277 | static struct hda_input_mux alc883_fujitsu_pi2515_capture_source = { |
| 7278 | .num_items = 2, |
| 7279 | .items = { |
| 7280 | { "Mic", 0x0 }, |
| 7281 | { "Int Mic", 0x1 }, |
| 7282 | }, |
| 7283 | }; |
| 7284 | |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 7285 | static struct hda_input_mux alc883_lenovo_sky_capture_source = { |
| 7286 | .num_items = 3, |
| 7287 | .items = { |
| 7288 | { "Mic", 0x0 }, |
| 7289 | { "Front Mic", 0x1 }, |
| 7290 | { "Line", 0x4 }, |
| 7291 | }, |
| 7292 | }; |
| 7293 | |
| 7294 | static struct hda_input_mux alc883_asus_eee1601_capture_source = { |
| 7295 | .num_items = 2, |
| 7296 | .items = { |
| 7297 | { "Mic", 0x0 }, |
| 7298 | { "Line", 0x2 }, |
| 7299 | }, |
| 7300 | }; |
| 7301 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7302 | /* |
| 7303 | * 2ch mode |
| 7304 | */ |
| 7305 | static struct hda_channel_mode alc883_3ST_2ch_modes[1] = { |
| 7306 | { 2, NULL } |
| 7307 | }; |
| 7308 | |
| 7309 | /* |
| 7310 | * 2ch mode |
| 7311 | */ |
| 7312 | static struct hda_verb alc883_3ST_ch2_init[] = { |
| 7313 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 7314 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 7315 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 7316 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 7317 | { } /* end */ |
| 7318 | }; |
| 7319 | |
| 7320 | /* |
Tobin Davis | b201131 | 2007-09-17 12:45:11 +0200 | [diff] [blame] | 7321 | * 4ch mode |
| 7322 | */ |
| 7323 | static struct hda_verb alc883_3ST_ch4_init[] = { |
| 7324 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 7325 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 7326 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7327 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 7328 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 7329 | { } /* end */ |
| 7330 | }; |
| 7331 | |
| 7332 | /* |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7333 | * 6ch mode |
| 7334 | */ |
| 7335 | static struct hda_verb alc883_3ST_ch6_init[] = { |
| 7336 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7337 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 7338 | { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 }, |
| 7339 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7340 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 7341 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 7342 | { } /* end */ |
| 7343 | }; |
| 7344 | |
Tobin Davis | b201131 | 2007-09-17 12:45:11 +0200 | [diff] [blame] | 7345 | static struct hda_channel_mode alc883_3ST_6ch_modes[3] = { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7346 | { 2, alc883_3ST_ch2_init }, |
Tobin Davis | b201131 | 2007-09-17 12:45:11 +0200 | [diff] [blame] | 7347 | { 4, alc883_3ST_ch4_init }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7348 | { 6, alc883_3ST_ch6_init }, |
| 7349 | }; |
| 7350 | |
| 7351 | /* |
Jiang zhe | 17bba1b | 2008-06-04 12:11:07 +0200 | [diff] [blame] | 7352 | * 2ch mode |
| 7353 | */ |
| 7354 | static struct hda_verb alc883_3ST_ch2_intel_init[] = { |
| 7355 | { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 7356 | { 0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 7357 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 7358 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 7359 | { } /* end */ |
| 7360 | }; |
| 7361 | |
| 7362 | /* |
| 7363 | * 4ch mode |
| 7364 | */ |
| 7365 | static struct hda_verb alc883_3ST_ch4_intel_init[] = { |
| 7366 | { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 7367 | { 0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 7368 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7369 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 7370 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 7371 | { } /* end */ |
| 7372 | }; |
| 7373 | |
| 7374 | /* |
| 7375 | * 6ch mode |
| 7376 | */ |
| 7377 | static struct hda_verb alc883_3ST_ch6_intel_init[] = { |
| 7378 | { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7379 | { 0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 7380 | { 0x19, AC_VERB_SET_CONNECT_SEL, 0x02 }, |
| 7381 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7382 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 7383 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 7384 | { } /* end */ |
| 7385 | }; |
| 7386 | |
| 7387 | static struct hda_channel_mode alc883_3ST_6ch_intel_modes[3] = { |
| 7388 | { 2, alc883_3ST_ch2_intel_init }, |
| 7389 | { 4, alc883_3ST_ch4_intel_init }, |
| 7390 | { 6, alc883_3ST_ch6_intel_init }, |
| 7391 | }; |
| 7392 | |
| 7393 | /* |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7394 | * 6ch mode |
| 7395 | */ |
| 7396 | static struct hda_verb alc883_sixstack_ch6_init[] = { |
| 7397 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 7398 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7399 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7400 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7401 | { } /* end */ |
| 7402 | }; |
| 7403 | |
| 7404 | /* |
| 7405 | * 8ch mode |
| 7406 | */ |
| 7407 | static struct hda_verb alc883_sixstack_ch8_init[] = { |
| 7408 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7409 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7410 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7411 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7412 | { } /* end */ |
| 7413 | }; |
| 7414 | |
| 7415 | static struct hda_channel_mode alc883_sixstack_modes[2] = { |
| 7416 | { 6, alc883_sixstack_ch6_init }, |
| 7417 | { 8, alc883_sixstack_ch8_init }, |
| 7418 | }; |
| 7419 | |
Andrew L. Neporada | b373bde | 2006-11-07 11:37:08 +0100 | [diff] [blame] | 7420 | static struct hda_verb alc883_medion_eapd_verbs[] = { |
| 7421 | /* eanable EAPD on medion laptop */ |
| 7422 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 7423 | {0x20, AC_VERB_SET_PROC_COEF, 0x3070}, |
| 7424 | { } |
| 7425 | }; |
| 7426 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7427 | /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17 |
| 7428 | * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b |
| 7429 | */ |
| 7430 | |
| 7431 | static struct snd_kcontrol_new alc883_base_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("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 7435 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
| 7436 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 7437 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 7438 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 7439 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 7440 | HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
| 7441 | HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT), |
| 7442 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 7443 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 7444 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 7445 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 7446 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 7447 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 7448 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7449 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 7450 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 7451 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7452 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7453 | { } /* end */ |
| 7454 | }; |
| 7455 | |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 7456 | static struct snd_kcontrol_new alc883_mitac_mixer[] = { |
| 7457 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 7458 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 7459 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 7460 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 7461 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 7462 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 7463 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 7464 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 7465 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 7466 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 7467 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 7468 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
| 7469 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 7470 | { } /* end */ |
| 7471 | }; |
| 7472 | |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 7473 | static struct snd_kcontrol_new alc883_clevo_m720_mixer[] = { |
Jiang zhe | 368c7a9 | 2008-03-04 11:20:33 +0100 | [diff] [blame] | 7474 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 7475 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT), |
| 7476 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 7477 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT), |
| 7478 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 7479 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 7480 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 7481 | HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 7482 | HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT), |
| 7483 | HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Jiang zhe | 368c7a9 | 2008-03-04 11:20:33 +0100 | [diff] [blame] | 7484 | { } /* end */ |
| 7485 | }; |
| 7486 | |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 7487 | static struct snd_kcontrol_new alc883_2ch_fujitsu_pi2515_mixer[] = { |
| 7488 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 7489 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT), |
| 7490 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 7491 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT), |
| 7492 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 7493 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 7494 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 7495 | HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 7496 | HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT), |
| 7497 | HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 7498 | { } /* end */ |
| 7499 | }; |
| 7500 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7501 | static struct snd_kcontrol_new alc883_3ST_2ch_mixer[] = { |
| 7502 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 7503 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 7504 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 7505 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 7506 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 7507 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 7508 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 7509 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 7510 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7511 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 7512 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 7513 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7514 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7515 | { } /* end */ |
| 7516 | }; |
| 7517 | |
| 7518 | static struct snd_kcontrol_new alc883_3ST_6ch_mixer[] = { |
| 7519 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 7520 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 7521 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 7522 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
| 7523 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 7524 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 7525 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 7526 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 7527 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 7528 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 7529 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 7530 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 7531 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 7532 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 7533 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7534 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 7535 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 7536 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7537 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7538 | { } /* end */ |
| 7539 | }; |
| 7540 | |
Jiang zhe | 17bba1b | 2008-06-04 12:11:07 +0200 | [diff] [blame] | 7541 | static struct snd_kcontrol_new alc883_3ST_6ch_intel_mixer[] = { |
| 7542 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 7543 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 7544 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 7545 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
| 7546 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, |
| 7547 | HDA_OUTPUT), |
| 7548 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 7549 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 7550 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 7551 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 7552 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 7553 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 7554 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 7555 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 7556 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 7557 | HDA_CODEC_VOLUME("Mic Boost", 0x19, 0, HDA_INPUT), |
| 7558 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 7559 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 7560 | HDA_CODEC_VOLUME("Front Mic Boost", 0x18, 0, HDA_INPUT), |
| 7561 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Jiang zhe | 17bba1b | 2008-06-04 12:11:07 +0200 | [diff] [blame] | 7562 | { } /* end */ |
| 7563 | }; |
| 7564 | |
Takashi Iwai | d1d985f | 2006-11-23 19:27:12 +0100 | [diff] [blame] | 7565 | static struct snd_kcontrol_new alc883_fivestack_mixer[] = { |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 7566 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | 0701e06 | 2008-06-27 16:30:57 +0200 | [diff] [blame] | 7567 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 7568 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
Takashi Iwai | 0701e06 | 2008-06-27 16:30:57 +0200 | [diff] [blame] | 7569 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 7570 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 7571 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
Takashi Iwai | 0701e06 | 2008-06-27 16:30:57 +0200 | [diff] [blame] | 7572 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 7573 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 7574 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 7575 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 7576 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 7577 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 7578 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 7579 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 7580 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 7581 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 7582 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 7583 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 7584 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 7585 | { } /* end */ |
| 7586 | }; |
| 7587 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 7588 | static struct snd_kcontrol_new alc883_tagra_mixer[] = { |
| 7589 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 7590 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 7591 | HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 7592 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 7593 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
| 7594 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 7595 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 7596 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 7597 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 7598 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 7599 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 7600 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 7601 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 7602 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 7603 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 7604 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 7605 | { } /* end */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 7606 | }; |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 7607 | |
| 7608 | static struct snd_kcontrol_new alc883_tagra_2ch_mixer[] = { |
| 7609 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 7610 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 7611 | HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 7612 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 7613 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 7614 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 7615 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 7616 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Jiang zhe | 4383fae | 2008-04-14 12:58:57 +0200 | [diff] [blame] | 7617 | HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 7618 | HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT), |
| 7619 | HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 7620 | { } /* end */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 7621 | }; |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 7622 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 7623 | static struct snd_kcontrol_new alc883_lenovo_101e_2ch_mixer[] = { |
| 7624 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 7625 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Takashi Iwai | 86cd929 | 2008-01-28 18:09:56 +0100 | [diff] [blame] | 7626 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 7627 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 7628 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 7629 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 7630 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 7631 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 7632 | { } /* end */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 7633 | }; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 7634 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7635 | static struct snd_kcontrol_new alc883_lenovo_nb0763_mixer[] = { |
| 7636 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 7637 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0c, 2, HDA_INPUT), |
| 7638 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 7639 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 7640 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 7641 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 7642 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 7643 | HDA_CODEC_VOLUME("iMic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 7644 | HDA_CODEC_MUTE("iMic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7645 | { } /* end */ |
| 7646 | }; |
| 7647 | |
| 7648 | static struct snd_kcontrol_new alc883_medion_md2_mixer[] = { |
| 7649 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 7650 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 7651 | HDA_CODEC_MUTE("Front Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 7652 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 7653 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 7654 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 7655 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 7656 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 7657 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7658 | { } /* end */ |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 7659 | }; |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7660 | |
Tobin Davis | 2880a86 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 7661 | static struct snd_kcontrol_new alc883_acer_aspire_mixer[] = { |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 7662 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 7663 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Tobin Davis | 2880a86 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 7664 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
Tobin Davis | 2880a86 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 7665 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 7666 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 7667 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 7668 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 7669 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Tobin Davis | 2880a86 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 7670 | { } /* end */ |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 7671 | }; |
Tobin Davis | 2880a86 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 7672 | |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 7673 | static struct snd_kcontrol_new alc888_lenovo_sky_mixer[] = { |
| 7674 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 7675 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 7676 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0e, 0x0, HDA_OUTPUT), |
| 7677 | HDA_BIND_MUTE("Surround Playback Switch", 0x0e, 2, HDA_INPUT), |
| 7678 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", |
| 7679 | 0x0d, 1, 0x0, HDA_OUTPUT), |
| 7680 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0d, 2, 0x0, HDA_OUTPUT), |
| 7681 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0d, 1, 2, HDA_INPUT), |
| 7682 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0d, 2, 2, HDA_INPUT), |
| 7683 | HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
| 7684 | HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT), |
| 7685 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 7686 | HDA_CODEC_MUTE("iSpeaker Playback Switch", 0x1a, 0x0, HDA_OUTPUT), |
| 7687 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 7688 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 7689 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 7690 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 7691 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 7692 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 7693 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 7694 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 7695 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
| 7696 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 7697 | { } /* end */ |
| 7698 | }; |
| 7699 | |
| 7700 | static struct hda_bind_ctls alc883_bind_cap_vol = { |
| 7701 | .ops = &snd_hda_bind_vol, |
| 7702 | .values = { |
| 7703 | HDA_COMPOSE_AMP_VAL(0x08, 3, 0, HDA_INPUT), |
| 7704 | HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_INPUT), |
| 7705 | 0 |
| 7706 | }, |
| 7707 | }; |
| 7708 | |
| 7709 | static struct hda_bind_ctls alc883_bind_cap_switch = { |
| 7710 | .ops = &snd_hda_bind_sw, |
| 7711 | .values = { |
| 7712 | HDA_COMPOSE_AMP_VAL(0x08, 3, 0, HDA_INPUT), |
| 7713 | HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_INPUT), |
| 7714 | 0 |
| 7715 | }, |
| 7716 | }; |
| 7717 | |
| 7718 | static struct snd_kcontrol_new alc883_asus_eee1601_mixer[] = { |
| 7719 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 7720 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 7721 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 7722 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 7723 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 7724 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 7725 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 7726 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 7727 | { } /* end */ |
| 7728 | }; |
| 7729 | |
| 7730 | static struct snd_kcontrol_new alc883_asus_eee1601_cap_mixer[] = { |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 7731 | HDA_BIND_VOL("Capture Volume", &alc883_bind_cap_vol), |
| 7732 | HDA_BIND_SW("Capture Switch", &alc883_bind_cap_switch), |
| 7733 | { |
| 7734 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 7735 | /* .name = "Capture Source", */ |
| 7736 | .name = "Input Source", |
| 7737 | .count = 1, |
Takashi Iwai | 54cbc9a | 2008-10-31 15:24:04 +0100 | [diff] [blame] | 7738 | .info = alc_mux_enum_info, |
| 7739 | .get = alc_mux_enum_get, |
| 7740 | .put = alc_mux_enum_put, |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 7741 | }, |
| 7742 | { } /* end */ |
| 7743 | }; |
| 7744 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7745 | static struct snd_kcontrol_new alc883_chmode_mixer[] = { |
| 7746 | { |
| 7747 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 7748 | .name = "Channel Mode", |
| 7749 | .info = alc_ch_mode_info, |
| 7750 | .get = alc_ch_mode_get, |
| 7751 | .put = alc_ch_mode_put, |
| 7752 | }, |
| 7753 | { } /* end */ |
| 7754 | }; |
| 7755 | |
| 7756 | static struct hda_verb alc883_init_verbs[] = { |
| 7757 | /* ADC1: mute amp left and right */ |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 7758 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7759 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7760 | /* ADC2: mute amp left and right */ |
| 7761 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7762 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7763 | /* Front mixer: unmute input/output amp left and right (volume = 0) */ |
| 7764 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 7765 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7766 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 7767 | /* Rear mixer */ |
| 7768 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 7769 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7770 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 7771 | /* CLFE mixer */ |
| 7772 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 7773 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7774 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 7775 | /* Side mixer */ |
| 7776 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 7777 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7778 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 7779 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 7780 | /* mute analog input loopbacks */ |
| 7781 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7782 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 7783 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 7784 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 7785 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7786 | |
| 7787 | /* Front Pin: output 0 (0x0c) */ |
| 7788 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 7789 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 7790 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7791 | /* Rear Pin: output 1 (0x0d) */ |
| 7792 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 7793 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 7794 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 7795 | /* CLFE Pin: output 2 (0x0e) */ |
| 7796 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 7797 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 7798 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 7799 | /* Side Pin: output 3 (0x0f) */ |
| 7800 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 7801 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 7802 | {0x17, AC_VERB_SET_CONNECT_SEL, 0x03}, |
| 7803 | /* Mic (rear) pin: input vref at 80% */ |
| 7804 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 7805 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 7806 | /* Front Mic pin: input vref at 80% */ |
| 7807 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 7808 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 7809 | /* Line In pin: input */ |
| 7810 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 7811 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 7812 | /* Line-2 In: Headphone output (output 0 - 0x0c) */ |
| 7813 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 7814 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 7815 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7816 | /* CD pin widget for input */ |
| 7817 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 7818 | |
| 7819 | /* FIXME: use matrix-type input source selection */ |
| 7820 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 7821 | /* Input mixer2 */ |
| 7822 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 7823 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 7824 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 7825 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7826 | /* Input mixer3 */ |
| 7827 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 7828 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 7829 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 7830 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7831 | { } |
| 7832 | }; |
| 7833 | |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 7834 | /* toggle speaker-output according to the hp-jack state */ |
| 7835 | static void alc883_mitac_hp_automute(struct hda_codec *codec) |
| 7836 | { |
| 7837 | unsigned int present; |
| 7838 | |
| 7839 | present = snd_hda_codec_read(codec, 0x15, 0, |
| 7840 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 7841 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 7842 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
| 7843 | snd_hda_codec_amp_stereo(codec, 0x17, HDA_OUTPUT, 0, |
| 7844 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
| 7845 | } |
| 7846 | |
| 7847 | /* auto-toggle front mic */ |
| 7848 | /* |
| 7849 | static void alc883_mitac_mic_automute(struct hda_codec *codec) |
| 7850 | { |
| 7851 | unsigned int present; |
| 7852 | unsigned char bits; |
| 7853 | |
| 7854 | present = snd_hda_codec_read(codec, 0x18, 0, |
| 7855 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 7856 | bits = present ? HDA_AMP_MUTE : 0; |
| 7857 | snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, 1, HDA_AMP_MUTE, bits); |
| 7858 | } |
| 7859 | */ |
| 7860 | |
| 7861 | static void alc883_mitac_automute(struct hda_codec *codec) |
| 7862 | { |
| 7863 | alc883_mitac_hp_automute(codec); |
| 7864 | /* alc883_mitac_mic_automute(codec); */ |
| 7865 | } |
| 7866 | |
| 7867 | static void alc883_mitac_unsol_event(struct hda_codec *codec, |
| 7868 | unsigned int res) |
| 7869 | { |
| 7870 | switch (res >> 26) { |
| 7871 | case ALC880_HP_EVENT: |
| 7872 | alc883_mitac_hp_automute(codec); |
| 7873 | break; |
| 7874 | case ALC880_MIC_EVENT: |
| 7875 | /* alc883_mitac_mic_automute(codec); */ |
| 7876 | break; |
| 7877 | } |
| 7878 | } |
| 7879 | |
| 7880 | static struct hda_verb alc883_mitac_verbs[] = { |
| 7881 | /* HP */ |
| 7882 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7883 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 7884 | /* Subwoofer */ |
| 7885 | {0x17, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 7886 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 7887 | |
| 7888 | /* enable unsolicited event */ |
| 7889 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 7890 | /* {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN}, */ |
| 7891 | |
| 7892 | { } /* end */ |
| 7893 | }; |
| 7894 | |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 7895 | static struct hda_verb alc883_clevo_m720_verbs[] = { |
Jiang zhe | 368c7a9 | 2008-03-04 11:20:33 +0100 | [diff] [blame] | 7896 | /* HP */ |
| 7897 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7898 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 7899 | /* Int speaker */ |
| 7900 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 7901 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 7902 | |
| 7903 | /* enable unsolicited event */ |
| 7904 | {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] | 7905 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN}, |
Jiang zhe | 368c7a9 | 2008-03-04 11:20:33 +0100 | [diff] [blame] | 7906 | |
| 7907 | { } /* end */ |
| 7908 | }; |
| 7909 | |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 7910 | static struct hda_verb alc883_2ch_fujitsu_pi2515_verbs[] = { |
| 7911 | /* HP */ |
| 7912 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7913 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 7914 | /* Subwoofer */ |
| 7915 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 7916 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 7917 | |
| 7918 | /* enable unsolicited event */ |
| 7919 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 7920 | |
| 7921 | { } /* end */ |
| 7922 | }; |
| 7923 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 7924 | static struct hda_verb alc883_tagra_verbs[] = { |
| 7925 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7926 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 7927 | |
| 7928 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 7929 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 7930 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 7931 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */ |
| 7932 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */ |
| 7933 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 7934 | |
| 7935 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 7936 | {0x01, AC_VERB_SET_GPIO_MASK, 0x03}, |
| 7937 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x03}, |
| 7938 | {0x01, AC_VERB_SET_GPIO_DATA, 0x03}, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 7939 | |
| 7940 | { } /* end */ |
| 7941 | }; |
| 7942 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 7943 | static struct hda_verb alc883_lenovo_101e_verbs[] = { |
| 7944 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7945 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_FRONT_EVENT|AC_USRSP_EN}, |
| 7946 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT|AC_USRSP_EN}, |
| 7947 | { } /* end */ |
| 7948 | }; |
| 7949 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7950 | static struct hda_verb alc883_lenovo_nb0763_verbs[] = { |
| 7951 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7952 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 7953 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 7954 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 7955 | { } /* end */ |
| 7956 | }; |
| 7957 | |
| 7958 | static struct hda_verb alc888_lenovo_ms7195_verbs[] = { |
| 7959 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7960 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 7961 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7962 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_FRONT_EVENT | AC_USRSP_EN}, |
| 7963 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 7964 | { } /* end */ |
| 7965 | }; |
| 7966 | |
Kailang Yang | 189609a | 2007-08-20 11:31:23 +0200 | [diff] [blame] | 7967 | static struct hda_verb alc883_haier_w66_verbs[] = { |
| 7968 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7969 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 7970 | |
| 7971 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 7972 | |
| 7973 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7974 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 7975 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 7976 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 7977 | { } /* end */ |
| 7978 | }; |
| 7979 | |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 7980 | static struct hda_verb alc888_lenovo_sky_verbs[] = { |
| 7981 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7982 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 7983 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7984 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7985 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7986 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 7987 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7988 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 7989 | { } /* end */ |
| 7990 | }; |
| 7991 | |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 7992 | static struct hda_verb alc888_3st_hp_verbs[] = { |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 7993 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front: output 0 (0x0c) */ |
Herton Ronaldo Krzesinski | f32a19e | 2008-03-18 09:27:08 +0100 | [diff] [blame] | 7994 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Rear : output 1 (0x0d) */ |
| 7995 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* CLFE : output 2 (0x0e) */ |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 7996 | { } |
| 7997 | }; |
| 7998 | |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 7999 | static struct hda_verb alc888_6st_dell_verbs[] = { |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 8000 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 8001 | { } |
| 8002 | }; |
| 8003 | |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 8004 | static struct hda_verb alc888_3st_hp_2ch_init[] = { |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 8005 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 8006 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 8007 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 8008 | { 0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 8009 | { } |
| 8010 | }; |
| 8011 | |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 8012 | static struct hda_verb alc888_3st_hp_6ch_init[] = { |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 8013 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 8014 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 8015 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 8016 | { 0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 8017 | { } |
| 8018 | }; |
| 8019 | |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 8020 | static struct hda_channel_mode alc888_3st_hp_modes[2] = { |
| 8021 | { 2, alc888_3st_hp_2ch_init }, |
| 8022 | { 6, alc888_3st_hp_6ch_init }, |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 8023 | }; |
| 8024 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8025 | /* toggle front-jack and RCA according to the hp-jack state */ |
| 8026 | static void alc888_lenovo_ms7195_front_automute(struct hda_codec *codec) |
| 8027 | { |
| 8028 | unsigned int present; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 8029 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8030 | present = snd_hda_codec_read(codec, 0x1b, 0, |
| 8031 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 8032 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 8033 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
| 8034 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 8035 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8036 | } |
| 8037 | |
| 8038 | /* toggle RCA according to the front-jack state */ |
| 8039 | static void alc888_lenovo_ms7195_rca_automute(struct hda_codec *codec) |
| 8040 | { |
| 8041 | unsigned int present; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 8042 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8043 | present = snd_hda_codec_read(codec, 0x14, 0, |
| 8044 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 8045 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 8046 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8047 | } |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 8048 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8049 | static void alc883_lenovo_ms7195_unsol_event(struct hda_codec *codec, |
| 8050 | unsigned int res) |
| 8051 | { |
| 8052 | if ((res >> 26) == ALC880_HP_EVENT) |
| 8053 | alc888_lenovo_ms7195_front_automute(codec); |
| 8054 | if ((res >> 26) == ALC880_FRONT_EVENT) |
| 8055 | alc888_lenovo_ms7195_rca_automute(codec); |
| 8056 | } |
| 8057 | |
| 8058 | static struct hda_verb alc883_medion_md2_verbs[] = { |
| 8059 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8060 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8061 | |
| 8062 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 8063 | |
| 8064 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 8065 | { } /* end */ |
| 8066 | }; |
| 8067 | |
| 8068 | /* toggle speaker-output according to the hp-jack state */ |
| 8069 | static void alc883_medion_md2_automute(struct hda_codec *codec) |
| 8070 | { |
| 8071 | unsigned int present; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 8072 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8073 | present = snd_hda_codec_read(codec, 0x14, 0, |
| 8074 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 8075 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 8076 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8077 | } |
| 8078 | |
| 8079 | static void alc883_medion_md2_unsol_event(struct hda_codec *codec, |
| 8080 | unsigned int res) |
| 8081 | { |
| 8082 | if ((res >> 26) == ALC880_HP_EVENT) |
| 8083 | alc883_medion_md2_automute(codec); |
| 8084 | } |
| 8085 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8086 | /* toggle speaker-output according to the hp-jack state */ |
| 8087 | static void alc883_tagra_automute(struct hda_codec *codec) |
| 8088 | { |
| 8089 | unsigned int present; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 8090 | unsigned char bits; |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8091 | |
| 8092 | present = snd_hda_codec_read(codec, 0x14, 0, |
| 8093 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 8094 | bits = present ? HDA_AMP_MUTE : 0; |
| 8095 | snd_hda_codec_amp_stereo(codec, 0x1b, HDA_OUTPUT, 0, |
| 8096 | HDA_AMP_MUTE, bits); |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 8097 | snd_hda_codec_write_cache(codec, 1, 0, AC_VERB_SET_GPIO_DATA, |
| 8098 | present ? 1 : 3); |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8099 | } |
| 8100 | |
| 8101 | static void alc883_tagra_unsol_event(struct hda_codec *codec, unsigned int res) |
| 8102 | { |
| 8103 | if ((res >> 26) == ALC880_HP_EVENT) |
| 8104 | alc883_tagra_automute(codec); |
| 8105 | } |
| 8106 | |
Jiang zhe | 368c7a9 | 2008-03-04 11:20:33 +0100 | [diff] [blame] | 8107 | /* toggle speaker-output according to the hp-jack state */ |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 8108 | static void alc883_clevo_m720_hp_automute(struct hda_codec *codec) |
Jiang zhe | 368c7a9 | 2008-03-04 11:20:33 +0100 | [diff] [blame] | 8109 | { |
| 8110 | unsigned int present; |
| 8111 | unsigned char bits; |
| 8112 | |
| 8113 | present = snd_hda_codec_read(codec, 0x15, 0, AC_VERB_GET_PIN_SENSE, 0) |
| 8114 | & AC_PINSENSE_PRESENCE; |
| 8115 | bits = present ? HDA_AMP_MUTE : 0; |
| 8116 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 8117 | HDA_AMP_MUTE, bits); |
| 8118 | } |
| 8119 | |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 8120 | static void alc883_clevo_m720_mic_automute(struct hda_codec *codec) |
| 8121 | { |
| 8122 | unsigned int present; |
| 8123 | |
| 8124 | present = snd_hda_codec_read(codec, 0x18, 0, |
| 8125 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 8126 | snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, 1, |
| 8127 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
| 8128 | } |
| 8129 | |
| 8130 | static void alc883_clevo_m720_automute(struct hda_codec *codec) |
| 8131 | { |
| 8132 | alc883_clevo_m720_hp_automute(codec); |
| 8133 | alc883_clevo_m720_mic_automute(codec); |
| 8134 | } |
| 8135 | |
| 8136 | static void alc883_clevo_m720_unsol_event(struct hda_codec *codec, |
Jiang zhe | 368c7a9 | 2008-03-04 11:20:33 +0100 | [diff] [blame] | 8137 | unsigned int res) |
| 8138 | { |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 8139 | switch (res >> 26) { |
| 8140 | case ALC880_HP_EVENT: |
| 8141 | alc883_clevo_m720_hp_automute(codec); |
| 8142 | break; |
| 8143 | case ALC880_MIC_EVENT: |
| 8144 | alc883_clevo_m720_mic_automute(codec); |
| 8145 | break; |
| 8146 | } |
Jiang zhe | 368c7a9 | 2008-03-04 11:20:33 +0100 | [diff] [blame] | 8147 | } |
| 8148 | |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 8149 | /* toggle speaker-output according to the hp-jack state */ |
| 8150 | static void alc883_2ch_fujitsu_pi2515_automute(struct hda_codec *codec) |
| 8151 | { |
| 8152 | unsigned int present; |
| 8153 | unsigned char bits; |
| 8154 | |
| 8155 | present = snd_hda_codec_read(codec, 0x14, 0, AC_VERB_GET_PIN_SENSE, 0) |
| 8156 | & AC_PINSENSE_PRESENCE; |
| 8157 | bits = present ? HDA_AMP_MUTE : 0; |
| 8158 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 8159 | HDA_AMP_MUTE, bits); |
| 8160 | } |
| 8161 | |
| 8162 | static void alc883_2ch_fujitsu_pi2515_unsol_event(struct hda_codec *codec, |
| 8163 | unsigned int res) |
| 8164 | { |
| 8165 | if ((res >> 26) == ALC880_HP_EVENT) |
| 8166 | alc883_2ch_fujitsu_pi2515_automute(codec); |
| 8167 | } |
| 8168 | |
Kailang Yang | 189609a | 2007-08-20 11:31:23 +0200 | [diff] [blame] | 8169 | static void alc883_haier_w66_automute(struct hda_codec *codec) |
| 8170 | { |
| 8171 | unsigned int present; |
| 8172 | unsigned char bits; |
| 8173 | |
| 8174 | present = snd_hda_codec_read(codec, 0x1b, 0, |
| 8175 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 8176 | bits = present ? 0x80 : 0; |
| 8177 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 8178 | 0x80, bits); |
| 8179 | } |
| 8180 | |
| 8181 | static void alc883_haier_w66_unsol_event(struct hda_codec *codec, |
| 8182 | unsigned int res) |
| 8183 | { |
| 8184 | if ((res >> 26) == ALC880_HP_EVENT) |
| 8185 | alc883_haier_w66_automute(codec); |
| 8186 | } |
| 8187 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 8188 | static void alc883_lenovo_101e_ispeaker_automute(struct hda_codec *codec) |
| 8189 | { |
| 8190 | unsigned int present; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 8191 | unsigned char bits; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 8192 | |
| 8193 | present = snd_hda_codec_read(codec, 0x14, 0, |
| 8194 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 8195 | bits = present ? HDA_AMP_MUTE : 0; |
| 8196 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 8197 | HDA_AMP_MUTE, bits); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 8198 | } |
| 8199 | |
| 8200 | static void alc883_lenovo_101e_all_automute(struct hda_codec *codec) |
| 8201 | { |
| 8202 | unsigned int present; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 8203 | unsigned char bits; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 8204 | |
| 8205 | present = snd_hda_codec_read(codec, 0x1b, 0, |
| 8206 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 8207 | bits = present ? HDA_AMP_MUTE : 0; |
| 8208 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 8209 | HDA_AMP_MUTE, bits); |
| 8210 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 8211 | HDA_AMP_MUTE, bits); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 8212 | } |
| 8213 | |
| 8214 | static void alc883_lenovo_101e_unsol_event(struct hda_codec *codec, |
| 8215 | unsigned int res) |
| 8216 | { |
| 8217 | if ((res >> 26) == ALC880_HP_EVENT) |
| 8218 | alc883_lenovo_101e_all_automute(codec); |
| 8219 | if ((res >> 26) == ALC880_FRONT_EVENT) |
| 8220 | alc883_lenovo_101e_ispeaker_automute(codec); |
| 8221 | } |
| 8222 | |
Takashi Iwai | 676a9b5 | 2007-08-16 15:23:35 +0200 | [diff] [blame] | 8223 | /* toggle speaker-output according to the hp-jack state */ |
| 8224 | static void alc883_acer_aspire_automute(struct hda_codec *codec) |
| 8225 | { |
| 8226 | unsigned int present; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 8227 | |
Takashi Iwai | 676a9b5 | 2007-08-16 15:23:35 +0200 | [diff] [blame] | 8228 | present = snd_hda_codec_read(codec, 0x14, 0, |
| 8229 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 8230 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 8231 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
| 8232 | snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0, |
| 8233 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
| 8234 | } |
| 8235 | |
| 8236 | static void alc883_acer_aspire_unsol_event(struct hda_codec *codec, |
| 8237 | unsigned int res) |
| 8238 | { |
| 8239 | if ((res >> 26) == ALC880_HP_EVENT) |
| 8240 | alc883_acer_aspire_automute(codec); |
| 8241 | } |
| 8242 | |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 8243 | static struct hda_verb alc883_acer_eapd_verbs[] = { |
| 8244 | /* HP Pin: output 0 (0x0c) */ |
| 8245 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 8246 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8247 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8248 | /* Front Pin: output 0 (0x0c) */ |
Takashi Iwai | 676a9b5 | 2007-08-16 15:23:35 +0200 | [diff] [blame] | 8249 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 8250 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 8251 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 8252 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8253 | /* eanable EAPD on medion laptop */ |
| 8254 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 8255 | {0x20, AC_VERB_SET_PROC_COEF, 0x3050}, |
Takashi Iwai | 676a9b5 | 2007-08-16 15:23:35 +0200 | [diff] [blame] | 8256 | /* enable unsolicited event */ |
| 8257 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 8258 | { } |
| 8259 | }; |
| 8260 | |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 8261 | static void alc888_6st_dell_front_automute(struct hda_codec *codec) |
| 8262 | { |
| 8263 | unsigned int present; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 8264 | |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 8265 | present = snd_hda_codec_read(codec, 0x1b, 0, |
| 8266 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 8267 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 8268 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
| 8269 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 8270 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
| 8271 | snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0, |
| 8272 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
| 8273 | snd_hda_codec_amp_stereo(codec, 0x17, HDA_OUTPUT, 0, |
| 8274 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
| 8275 | } |
| 8276 | |
| 8277 | static void alc888_6st_dell_unsol_event(struct hda_codec *codec, |
| 8278 | unsigned int res) |
| 8279 | { |
| 8280 | switch (res >> 26) { |
| 8281 | case ALC880_HP_EVENT: |
Takashi Iwai | 939778a | 2009-02-05 15:57:55 +0100 | [diff] [blame] | 8282 | /* printk(KERN_DEBUG "hp_event\n"); */ |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 8283 | alc888_6st_dell_front_automute(codec); |
| 8284 | break; |
| 8285 | } |
| 8286 | } |
| 8287 | |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 8288 | static void alc888_lenovo_sky_front_automute(struct hda_codec *codec) |
| 8289 | { |
| 8290 | unsigned int mute; |
| 8291 | unsigned int present; |
| 8292 | |
| 8293 | snd_hda_codec_read(codec, 0x1b, 0, AC_VERB_SET_PIN_SENSE, 0); |
| 8294 | present = snd_hda_codec_read(codec, 0x1b, 0, |
| 8295 | AC_VERB_GET_PIN_SENSE, 0); |
| 8296 | present = (present & 0x80000000) != 0; |
| 8297 | if (present) { |
| 8298 | /* mute internal speaker */ |
| 8299 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 8300 | HDA_AMP_MUTE, HDA_AMP_MUTE); |
| 8301 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 8302 | HDA_AMP_MUTE, HDA_AMP_MUTE); |
| 8303 | snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0, |
| 8304 | HDA_AMP_MUTE, HDA_AMP_MUTE); |
| 8305 | snd_hda_codec_amp_stereo(codec, 0x17, HDA_OUTPUT, 0, |
| 8306 | HDA_AMP_MUTE, HDA_AMP_MUTE); |
| 8307 | snd_hda_codec_amp_stereo(codec, 0x1a, HDA_OUTPUT, 0, |
| 8308 | HDA_AMP_MUTE, HDA_AMP_MUTE); |
| 8309 | } else { |
| 8310 | /* unmute internal speaker if necessary */ |
| 8311 | mute = snd_hda_codec_amp_read(codec, 0x1b, 0, HDA_OUTPUT, 0); |
| 8312 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 8313 | HDA_AMP_MUTE, mute); |
| 8314 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 8315 | HDA_AMP_MUTE, mute); |
| 8316 | snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0, |
| 8317 | HDA_AMP_MUTE, mute); |
| 8318 | snd_hda_codec_amp_stereo(codec, 0x17, HDA_OUTPUT, 0, |
| 8319 | HDA_AMP_MUTE, mute); |
| 8320 | snd_hda_codec_amp_stereo(codec, 0x1a, HDA_OUTPUT, 0, |
| 8321 | HDA_AMP_MUTE, mute); |
| 8322 | } |
| 8323 | } |
| 8324 | |
| 8325 | static void alc883_lenovo_sky_unsol_event(struct hda_codec *codec, |
| 8326 | unsigned int res) |
| 8327 | { |
| 8328 | if ((res >> 26) == ALC880_HP_EVENT) |
| 8329 | alc888_lenovo_sky_front_automute(codec); |
| 8330 | } |
| 8331 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8332 | /* |
| 8333 | * generic initialization of ADC, input mixers and output mixers |
| 8334 | */ |
| 8335 | static struct hda_verb alc883_auto_init_verbs[] = { |
| 8336 | /* |
| 8337 | * Unmute ADC0-2 and set the default input to mic-in |
| 8338 | */ |
| 8339 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8340 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8341 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8342 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8343 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 8344 | /* 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] | 8345 | * mixer widget |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 8346 | * Note: PASD motherboards uses the Line In 2 as the input for |
| 8347 | * front panel mic (mic 2) |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8348 | */ |
| 8349 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 8350 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8351 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 8352 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 8353 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 8354 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8355 | |
| 8356 | /* |
| 8357 | * Set up output mixers (0x0c - 0x0f) |
| 8358 | */ |
| 8359 | /* set vol=0 to output mixers */ |
| 8360 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 8361 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 8362 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 8363 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 8364 | /* set up input amps for analog loopback */ |
| 8365 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 8366 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8367 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8368 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8369 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8370 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8371 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8372 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8373 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8374 | {0x26, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8375 | {0x26, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8376 | |
| 8377 | /* FIXME: use matrix-type input source selection */ |
| 8378 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 8379 | /* Input mixer1 */ |
| 8380 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8381 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8382 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 8383 | /* {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, */ |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8384 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)}, |
| 8385 | /* Input mixer2 */ |
| 8386 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8387 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8388 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 8389 | /* {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, */ |
Andy Shevchenko | e3cde64 | 2007-12-03 16:50:58 +0100 | [diff] [blame] | 8390 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)}, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8391 | |
| 8392 | { } |
| 8393 | }; |
| 8394 | |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 8395 | static struct hda_verb alc888_asus_m90v_verbs[] = { |
| 8396 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8397 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8398 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8399 | /* enable unsolicited event */ |
| 8400 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 8401 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN}, |
| 8402 | { } /* end */ |
| 8403 | }; |
| 8404 | |
| 8405 | static void alc883_nb_mic_automute(struct hda_codec *codec) |
| 8406 | { |
| 8407 | unsigned int present; |
| 8408 | |
| 8409 | present = snd_hda_codec_read(codec, 0x18, 0, |
| 8410 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 8411 | snd_hda_codec_write(codec, 0x23, 0, AC_VERB_SET_AMP_GAIN_MUTE, |
| 8412 | 0x7000 | (0x00 << 8) | (present ? 0 : 0x80)); |
| 8413 | snd_hda_codec_write(codec, 0x23, 0, AC_VERB_SET_AMP_GAIN_MUTE, |
| 8414 | 0x7000 | (0x01 << 8) | (present ? 0x80 : 0)); |
| 8415 | } |
| 8416 | |
| 8417 | static void alc883_M90V_speaker_automute(struct hda_codec *codec) |
| 8418 | { |
| 8419 | unsigned int present; |
| 8420 | unsigned char bits; |
| 8421 | |
| 8422 | present = snd_hda_codec_read(codec, 0x1b, 0, |
| 8423 | AC_VERB_GET_PIN_SENSE, 0) |
| 8424 | & AC_PINSENSE_PRESENCE; |
| 8425 | bits = present ? 0 : PIN_OUT; |
| 8426 | snd_hda_codec_write(codec, 0x14, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 8427 | bits); |
| 8428 | snd_hda_codec_write(codec, 0x15, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 8429 | bits); |
| 8430 | snd_hda_codec_write(codec, 0x16, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 8431 | bits); |
| 8432 | } |
| 8433 | |
| 8434 | static void alc883_mode2_unsol_event(struct hda_codec *codec, |
| 8435 | unsigned int res) |
| 8436 | { |
| 8437 | switch (res >> 26) { |
| 8438 | case ALC880_HP_EVENT: |
| 8439 | alc883_M90V_speaker_automute(codec); |
| 8440 | break; |
| 8441 | case ALC880_MIC_EVENT: |
| 8442 | alc883_nb_mic_automute(codec); |
| 8443 | break; |
| 8444 | } |
| 8445 | } |
| 8446 | |
| 8447 | static void alc883_mode2_inithook(struct hda_codec *codec) |
| 8448 | { |
| 8449 | alc883_M90V_speaker_automute(codec); |
| 8450 | alc883_nb_mic_automute(codec); |
| 8451 | } |
| 8452 | |
| 8453 | static struct hda_verb alc888_asus_eee1601_verbs[] = { |
| 8454 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 8455 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 8456 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8457 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8458 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 8459 | {0x20, AC_VERB_SET_COEF_INDEX, 0x0b}, |
| 8460 | {0x20, AC_VERB_SET_PROC_COEF, 0x0838}, |
| 8461 | /* enable unsolicited event */ |
| 8462 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 8463 | { } /* end */ |
| 8464 | }; |
| 8465 | |
| 8466 | static void alc883_eee1601_speaker_automute(struct hda_codec *codec) |
| 8467 | { |
| 8468 | unsigned int present; |
| 8469 | unsigned char bits; |
| 8470 | |
| 8471 | present = snd_hda_codec_read(codec, 0x14, 0, |
| 8472 | AC_VERB_GET_PIN_SENSE, 0) |
| 8473 | & AC_PINSENSE_PRESENCE; |
| 8474 | bits = present ? 0 : PIN_OUT; |
| 8475 | snd_hda_codec_write(codec, 0x1b, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 8476 | bits); |
| 8477 | } |
| 8478 | |
| 8479 | static void alc883_eee1601_unsol_event(struct hda_codec *codec, |
| 8480 | unsigned int res) |
| 8481 | { |
| 8482 | switch (res >> 26) { |
| 8483 | case ALC880_HP_EVENT: |
| 8484 | alc883_eee1601_speaker_automute(codec); |
| 8485 | break; |
| 8486 | } |
| 8487 | } |
| 8488 | |
| 8489 | static void alc883_eee1601_inithook(struct hda_codec *codec) |
| 8490 | { |
| 8491 | alc883_eee1601_speaker_automute(codec); |
| 8492 | } |
| 8493 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 8494 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 8495 | #define alc883_loopbacks alc880_loopbacks |
| 8496 | #endif |
| 8497 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8498 | /* pcm configuration: identiacal with ALC880 */ |
| 8499 | #define alc883_pcm_analog_playback alc880_pcm_analog_playback |
| 8500 | #define alc883_pcm_analog_capture alc880_pcm_analog_capture |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 8501 | #define alc883_pcm_analog_alt_capture alc880_pcm_analog_alt_capture |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8502 | #define alc883_pcm_digital_playback alc880_pcm_digital_playback |
| 8503 | #define alc883_pcm_digital_capture alc880_pcm_digital_capture |
| 8504 | |
| 8505 | /* |
| 8506 | * configuration and preset |
| 8507 | */ |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 8508 | static const char *alc883_models[ALC883_MODEL_LAST] = { |
| 8509 | [ALC883_3ST_2ch_DIG] = "3stack-dig", |
| 8510 | [ALC883_3ST_6ch_DIG] = "3stack-6ch-dig", |
| 8511 | [ALC883_3ST_6ch] = "3stack-6ch", |
| 8512 | [ALC883_6ST_DIG] = "6stack-dig", |
| 8513 | [ALC883_TARGA_DIG] = "targa-dig", |
| 8514 | [ALC883_TARGA_2ch_DIG] = "targa-2ch-dig", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 8515 | [ALC883_ACER] = "acer", |
Tobin Davis | 2880a86 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 8516 | [ALC883_ACER_ASPIRE] = "acer-aspire", |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 8517 | [ALC888_ACER_ASPIRE_4930G] = "acer-aspire-4930g", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 8518 | [ALC883_MEDION] = "medion", |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8519 | [ALC883_MEDION_MD2] = "medion-md2", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 8520 | [ALC883_LAPTOP_EAPD] = "laptop-eapd", |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 8521 | [ALC883_LENOVO_101E_2ch] = "lenovo-101e", |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8522 | [ALC883_LENOVO_NB0763] = "lenovo-nb0763", |
| 8523 | [ALC888_LENOVO_MS7195_DIG] = "lenovo-ms7195-dig", |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 8524 | [ALC888_LENOVO_SKY] = "lenovo-sky", |
Kailang Yang | 189609a | 2007-08-20 11:31:23 +0200 | [diff] [blame] | 8525 | [ALC883_HAIER_W66] = "haier-w66", |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 8526 | [ALC888_3ST_HP] = "3stack-hp", |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 8527 | [ALC888_6ST_DELL] = "6stack-dell", |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 8528 | [ALC883_MITAC] = "mitac", |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 8529 | [ALC883_CLEVO_M720] = "clevo-m720", |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 8530 | [ALC883_FUJITSU_PI2515] = "fujitsu-pi2515", |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 8531 | [ALC888_FUJITSU_XA3530] = "fujitsu-xa3530", |
Jiang zhe | 17bba1b | 2008-06-04 12:11:07 +0200 | [diff] [blame] | 8532 | [ALC883_3ST_6ch_INTEL] = "3stack-6ch-intel", |
Wu Fengguang | 3ab9093 | 2008-11-17 09:51:09 +0100 | [diff] [blame] | 8533 | [ALC1200_ASUS_P5Q] = "asus-p5q", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 8534 | [ALC883_AUTO] = "auto", |
| 8535 | }; |
| 8536 | |
| 8537 | static struct snd_pci_quirk alc883_cfg_tbl[] = { |
| 8538 | SND_PCI_QUIRK(0x1019, 0x6668, "ECS", ALC883_3ST_6ch_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 8539 | SND_PCI_QUIRK(0x1025, 0x006c, "Acer Aspire 9810", ALC883_ACER_ASPIRE), |
Takashi Iwai | 69e5028 | 2008-11-03 10:07:43 +0100 | [diff] [blame] | 8540 | SND_PCI_QUIRK(0x1025, 0x0090, "Acer Aspire", ALC883_ACER_ASPIRE), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 8541 | SND_PCI_QUIRK(0x1025, 0x0110, "Acer Aspire", ALC883_ACER_ASPIRE), |
| 8542 | SND_PCI_QUIRK(0x1025, 0x0112, "Acer Aspire 9303", ALC883_ACER_ASPIRE), |
Jaroslav Kysela | 0b18cb1 | 2008-07-28 17:07:07 +0200 | [diff] [blame] | 8543 | SND_PCI_QUIRK(0x1025, 0x0121, "Acer Aspire 5920G", ALC883_ACER_ASPIRE), |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 8544 | SND_PCI_QUIRK(0x1025, 0x013e, "Acer Aspire 4930G", |
| 8545 | ALC888_ACER_ASPIRE_4930G), |
Lukasz Wojnilowicz | a8e4f9d | 2009-01-08 12:00:49 +0100 | [diff] [blame] | 8546 | SND_PCI_QUIRK(0x1025, 0x013f, "Acer Aspire 5930G", |
| 8547 | ALC888_ACER_ASPIRE_4930G), |
Takashi Iwai | 9468350 | 2009-02-13 09:31:20 +0100 | [diff] [blame] | 8548 | SND_PCI_QUIRK(0x1025, 0x0158, "Acer AX1700-U3700A", ALC883_AUTO), |
Lukasz Wojnilowicz | a8e4f9d | 2009-01-08 12:00:49 +0100 | [diff] [blame] | 8549 | SND_PCI_QUIRK(0x1025, 0x015e, "Acer Aspire 6930G", |
| 8550 | ALC888_ACER_ASPIRE_4930G), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 8551 | /* default Acer */ |
| 8552 | SND_PCI_QUIRK_VENDOR(0x1025, "Acer laptop", ALC883_ACER), |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 8553 | SND_PCI_QUIRK(0x1028, 0x020d, "Dell Inspiron 530", ALC888_6ST_DELL), |
Tobin Davis | febe337 | 2007-06-12 11:27:46 +0200 | [diff] [blame] | 8554 | SND_PCI_QUIRK(0x103c, 0x2a3d, "HP Pavillion", ALC883_6ST_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 8555 | SND_PCI_QUIRK(0x103c, 0x2a4f, "HP Samba", ALC888_3ST_HP), |
| 8556 | SND_PCI_QUIRK(0x103c, 0x2a60, "HP Lucknow", ALC888_3ST_HP), |
Herton Ronaldo Krzesinski | 5d85f8d | 2008-03-20 12:13:46 +0100 | [diff] [blame] | 8557 | SND_PCI_QUIRK(0x103c, 0x2a61, "HP Nettle", ALC883_6ST_DIG), |
Chris Bagwell | 06bf3e1 | 2009-01-01 10:32:08 +0100 | [diff] [blame] | 8558 | SND_PCI_QUIRK(0x103c, 0x2a66, "HP Acacia", ALC888_3ST_HP), |
Kailang Yang | a01c30c | 2008-10-15 11:14:58 +0200 | [diff] [blame] | 8559 | SND_PCI_QUIRK(0x1043, 0x1873, "Asus M90V", ALC888_ASUS_M90V), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 8560 | 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] | 8561 | SND_PCI_QUIRK(0x1043, 0x8284, "Asus Z37E", ALC883_6ST_DIG), |
Wu Fengguang | 3ab9093 | 2008-11-17 09:51:09 +0100 | [diff] [blame] | 8562 | SND_PCI_QUIRK(0x1043, 0x82fe, "Asus P5Q-EM HDMI", ALC1200_ASUS_P5Q), |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 8563 | SND_PCI_QUIRK(0x1043, 0x835f, "Asus Eee 1601", ALC888_ASUS_EEE1601), |
Travis Place | 97ec710 | 2008-05-23 18:31:46 +0200 | [diff] [blame] | 8564 | SND_PCI_QUIRK(0x105b, 0x0ce8, "Foxconn P35AX-S", ALC883_6ST_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 8565 | SND_PCI_QUIRK(0x105b, 0x6668, "Foxconn", ALC883_6ST_DIG), |
Luke Yelavich | 2de686d | 2009-01-16 15:08:02 +1100 | [diff] [blame] | 8566 | SND_PCI_QUIRK(0x1071, 0x8227, "Mitac 82801H", ALC883_MITAC), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 8567 | SND_PCI_QUIRK(0x1071, 0x8253, "Mitac 8252d", ALC883_MITAC), |
| 8568 | SND_PCI_QUIRK(0x1071, 0x8258, "Evesham Voyaeger", ALC883_LAPTOP_EAPD), |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 8569 | SND_PCI_QUIRK(0x10f1, 0x2350, "TYAN-S2350", ALC888_6ST_DELL), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 8570 | SND_PCI_QUIRK(0x108e, 0x534d, NULL, ALC883_3ST_6ch), |
Tobin Davis | 57b14f2 | 2007-04-18 23:05:36 +0200 | [diff] [blame] | 8571 | SND_PCI_QUIRK(0x1458, 0xa002, "MSI", ALC883_6ST_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 8572 | SND_PCI_QUIRK(0x1462, 0x0349, "MSI", ALC883_TARGA_2ch_DIG), |
| 8573 | SND_PCI_QUIRK(0x1462, 0x040d, "MSI", ALC883_TARGA_2ch_DIG), |
| 8574 | SND_PCI_QUIRK(0x1462, 0x0579, "MSI", ALC883_TARGA_2ch_DIG), |
Jiang zhe | 4383fae | 2008-04-14 12:58:57 +0200 | [diff] [blame] | 8575 | SND_PCI_QUIRK(0x1462, 0x2fb3, "MSI", ALC883_TARGA_2ch_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 8576 | SND_PCI_QUIRK(0x1462, 0x3729, "MSI S420", ALC883_TARGA_DIG), |
Pascal Terjan | 8280823 | 2008-03-04 11:33:28 +0100 | [diff] [blame] | 8577 | SND_PCI_QUIRK(0x1462, 0x3783, "NEC S970", ALC883_TARGA_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 8578 | SND_PCI_QUIRK(0x1462, 0x3b7f, "MSI", ALC883_TARGA_2ch_DIG), |
| 8579 | SND_PCI_QUIRK(0x1462, 0x3ef9, "MSI", ALC883_TARGA_DIG), |
| 8580 | SND_PCI_QUIRK(0x1462, 0x3fc1, "MSI", ALC883_TARGA_DIG), |
| 8581 | SND_PCI_QUIRK(0x1462, 0x3fc3, "MSI", ALC883_TARGA_DIG), |
| 8582 | SND_PCI_QUIRK(0x1462, 0x3fcc, "MSI", ALC883_TARGA_DIG), |
| 8583 | SND_PCI_QUIRK(0x1462, 0x3fdf, "MSI", ALC883_TARGA_DIG), |
| 8584 | SND_PCI_QUIRK(0x1462, 0x4314, "MSI", ALC883_TARGA_DIG), |
| 8585 | SND_PCI_QUIRK(0x1462, 0x4319, "MSI", ALC883_TARGA_DIG), |
| 8586 | SND_PCI_QUIRK(0x1462, 0x4324, "MSI", ALC883_TARGA_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 8587 | SND_PCI_QUIRK(0x1462, 0x6668, "MSI", ALC883_6ST_DIG), |
| 8588 | SND_PCI_QUIRK(0x1462, 0x7187, "MSI", ALC883_6ST_DIG), |
Tobin Davis | 799f88a | 2007-05-29 14:29:08 +0200 | [diff] [blame] | 8589 | SND_PCI_QUIRK(0x1462, 0x7250, "MSI", ALC883_6ST_DIG), |
Takashi Iwai | ee09543 | 2008-11-25 15:03:38 +0100 | [diff] [blame] | 8590 | SND_PCI_QUIRK(0x1462, 0x7260, "MSI 7260", ALC883_TARGA_DIG), |
Herton Ronaldo Krzesinski | 86d34b7 | 2008-03-18 09:27:59 +0100 | [diff] [blame] | 8591 | SND_PCI_QUIRK(0x1462, 0x7267, "MSI", ALC883_3ST_6ch_DIG), |
Leonard Norrgard | 2a296cb | 2007-01-08 11:28:22 +0100 | [diff] [blame] | 8592 | SND_PCI_QUIRK(0x1462, 0x7280, "MSI", ALC883_6ST_DIG), |
Tobin Davis | 2dcd522 | 2007-07-10 17:04:57 +0200 | [diff] [blame] | 8593 | SND_PCI_QUIRK(0x1462, 0x7327, "MSI", ALC883_6ST_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 8594 | SND_PCI_QUIRK(0x1462, 0xa422, "MSI", ALC883_TARGA_2ch_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 8595 | SND_PCI_QUIRK(0x147b, 0x1083, "Abit IP35-PRO", ALC883_6ST_DIG), |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 8596 | SND_PCI_QUIRK(0x1558, 0x0721, "Clevo laptop M720R", ALC883_CLEVO_M720), |
| 8597 | SND_PCI_QUIRK(0x1558, 0x0722, "Clevo laptop M720SR", ALC883_CLEVO_M720), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 8598 | SND_PCI_QUIRK_VENDOR(0x1558, "Clevo laptop", ALC883_LAPTOP_EAPD), |
Daniel T Chen | e60623b | 2007-05-29 03:41:55 -0400 | [diff] [blame] | 8599 | SND_PCI_QUIRK(0x15d9, 0x8780, "Supermicro PDSBA", ALC883_3ST_6ch), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 8600 | SND_PCI_QUIRK(0x161f, 0x2054, "Medion laptop", ALC883_MEDION), |
Takashi Iwai | f67d817 | 2009-02-04 23:30:19 +0100 | [diff] [blame] | 8601 | SND_PCI_QUIRK(0x1734, 0x1107, "FSC AMILO Xi2550", |
| 8602 | ALC883_FUJITSU_PI2515), |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 8603 | SND_PCI_QUIRK(0x1734, 0x1108, "Fujitsu AMILO Pi2515", ALC883_FUJITSU_PI2515), |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 8604 | SND_PCI_QUIRK(0x1734, 0x113d, "Fujitsu AMILO Xa3530", |
| 8605 | ALC888_FUJITSU_XA3530), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8606 | SND_PCI_QUIRK(0x17aa, 0x101e, "Lenovo 101e", ALC883_LENOVO_101E_2ch), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8607 | SND_PCI_QUIRK(0x17aa, 0x2085, "Lenovo NB0763", ALC883_LENOVO_NB0763), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 8608 | SND_PCI_QUIRK(0x17aa, 0x3bfc, "Lenovo NB0763", ALC883_LENOVO_NB0763), |
| 8609 | SND_PCI_QUIRK(0x17aa, 0x3bfd, "Lenovo NB0763", ALC883_LENOVO_NB0763), |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 8610 | SND_PCI_QUIRK(0x17aa, 0x101d, "Lenovo Sky", ALC888_LENOVO_SKY), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8611 | SND_PCI_QUIRK(0x17c0, 0x4071, "MEDION MD2", ALC883_MEDION_MD2), |
Takashi Iwai | 959973b | 2008-11-05 11:30:56 +0100 | [diff] [blame] | 8612 | SND_PCI_QUIRK(0x17c0, 0x4085, "MEDION MD96630", ALC888_LENOVO_MS7195_DIG), |
Andrew Paprocki | 0b167bf | 2008-02-03 10:15:44 +0100 | [diff] [blame] | 8613 | SND_PCI_QUIRK(0x17f2, 0x5000, "Albatron KI690-AM2", ALC883_6ST_DIG), |
Kailang Yang | 189609a | 2007-08-20 11:31:23 +0200 | [diff] [blame] | 8614 | SND_PCI_QUIRK(0x1991, 0x5625, "Haier W66", ALC883_HAIER_W66), |
Jiang zhe | 17bba1b | 2008-06-04 12:11:07 +0200 | [diff] [blame] | 8615 | SND_PCI_QUIRK(0x8086, 0x0001, "DG33BUC", ALC883_3ST_6ch_INTEL), |
| 8616 | SND_PCI_QUIRK(0x8086, 0x0002, "DG33FBC", ALC883_3ST_6ch_INTEL), |
Luke Yelavich | 2de686d | 2009-01-16 15:08:02 +1100 | [diff] [blame] | 8617 | SND_PCI_QUIRK(0x8086, 0x2503, "82801H", ALC883_MITAC), |
Wu Fengguang | 4b55899 | 2009-01-12 09:18:58 +0800 | [diff] [blame] | 8618 | SND_PCI_QUIRK(0x8086, 0x0022, "DX58SO", ALC883_3ST_6ch_INTEL), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 8619 | SND_PCI_QUIRK(0x8086, 0xd601, "D102GGC", ALC883_3ST_6ch), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8620 | {} |
| 8621 | }; |
| 8622 | |
Wu Fengguang | b25c9da | 2009-02-06 15:02:27 +0800 | [diff] [blame] | 8623 | static hda_nid_t alc1200_slave_dig_outs[] = { |
| 8624 | ALC883_DIGOUT_NID, 0, |
| 8625 | }; |
| 8626 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8627 | static struct alc_config_preset alc883_presets[] = { |
| 8628 | [ALC883_3ST_2ch_DIG] = { |
| 8629 | .mixers = { alc883_3ST_2ch_mixer }, |
| 8630 | .init_verbs = { alc883_init_verbs }, |
| 8631 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 8632 | .dac_nids = alc883_dac_nids, |
| 8633 | .dig_out_nid = ALC883_DIGOUT_NID, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8634 | .dig_in_nid = ALC883_DIGIN_NID, |
| 8635 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 8636 | .channel_mode = alc883_3ST_2ch_modes, |
| 8637 | .input_mux = &alc883_capture_source, |
| 8638 | }, |
| 8639 | [ALC883_3ST_6ch_DIG] = { |
| 8640 | .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer }, |
| 8641 | .init_verbs = { alc883_init_verbs }, |
| 8642 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 8643 | .dac_nids = alc883_dac_nids, |
| 8644 | .dig_out_nid = ALC883_DIGOUT_NID, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8645 | .dig_in_nid = ALC883_DIGIN_NID, |
| 8646 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes), |
| 8647 | .channel_mode = alc883_3ST_6ch_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 8648 | .need_dac_fix = 1, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8649 | .input_mux = &alc883_capture_source, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 8650 | }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8651 | [ALC883_3ST_6ch] = { |
| 8652 | .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer }, |
| 8653 | .init_verbs = { alc883_init_verbs }, |
| 8654 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 8655 | .dac_nids = alc883_dac_nids, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8656 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes), |
| 8657 | .channel_mode = alc883_3ST_6ch_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 8658 | .need_dac_fix = 1, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8659 | .input_mux = &alc883_capture_source, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 8660 | }, |
Jiang zhe | 17bba1b | 2008-06-04 12:11:07 +0200 | [diff] [blame] | 8661 | [ALC883_3ST_6ch_INTEL] = { |
| 8662 | .mixers = { alc883_3ST_6ch_intel_mixer, alc883_chmode_mixer }, |
| 8663 | .init_verbs = { alc883_init_verbs }, |
| 8664 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 8665 | .dac_nids = alc883_dac_nids, |
| 8666 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 8667 | .dig_in_nid = ALC883_DIGIN_NID, |
| 8668 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_intel_modes), |
| 8669 | .channel_mode = alc883_3ST_6ch_intel_modes, |
| 8670 | .need_dac_fix = 1, |
| 8671 | .input_mux = &alc883_3stack_6ch_intel, |
| 8672 | }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8673 | [ALC883_6ST_DIG] = { |
| 8674 | .mixers = { alc883_base_mixer, alc883_chmode_mixer }, |
| 8675 | .init_verbs = { alc883_init_verbs }, |
| 8676 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 8677 | .dac_nids = alc883_dac_nids, |
| 8678 | .dig_out_nid = ALC883_DIGOUT_NID, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8679 | .dig_in_nid = ALC883_DIGIN_NID, |
| 8680 | .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes), |
| 8681 | .channel_mode = alc883_sixstack_modes, |
| 8682 | .input_mux = &alc883_capture_source, |
| 8683 | }, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8684 | [ALC883_TARGA_DIG] = { |
| 8685 | .mixers = { alc883_tagra_mixer, alc883_chmode_mixer }, |
| 8686 | .init_verbs = { alc883_init_verbs, alc883_tagra_verbs}, |
| 8687 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 8688 | .dac_nids = alc883_dac_nids, |
| 8689 | .dig_out_nid = ALC883_DIGOUT_NID, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8690 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes), |
| 8691 | .channel_mode = alc883_3ST_6ch_modes, |
| 8692 | .need_dac_fix = 1, |
| 8693 | .input_mux = &alc883_capture_source, |
| 8694 | .unsol_event = alc883_tagra_unsol_event, |
| 8695 | .init_hook = alc883_tagra_automute, |
| 8696 | }, |
| 8697 | [ALC883_TARGA_2ch_DIG] = { |
| 8698 | .mixers = { alc883_tagra_2ch_mixer}, |
| 8699 | .init_verbs = { alc883_init_verbs, alc883_tagra_verbs}, |
| 8700 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 8701 | .dac_nids = alc883_dac_nids, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 8702 | .adc_nids = alc883_adc_nids_alt, |
| 8703 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_alt), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8704 | .dig_out_nid = ALC883_DIGOUT_NID, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8705 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 8706 | .channel_mode = alc883_3ST_2ch_modes, |
| 8707 | .input_mux = &alc883_capture_source, |
| 8708 | .unsol_event = alc883_tagra_unsol_event, |
| 8709 | .init_hook = alc883_tagra_automute, |
| 8710 | }, |
Vladimir Avdonin | bab282b | 2006-08-22 13:31:58 +0200 | [diff] [blame] | 8711 | [ALC883_ACER] = { |
Takashi Iwai | 676a9b5 | 2007-08-16 15:23:35 +0200 | [diff] [blame] | 8712 | .mixers = { alc883_base_mixer }, |
Vladimir Avdonin | bab282b | 2006-08-22 13:31:58 +0200 | [diff] [blame] | 8713 | /* On TravelMate laptops, GPIO 0 enables the internal speaker |
| 8714 | * and the headphone jack. Turn this on and rely on the |
| 8715 | * standard mute methods whenever the user wants to turn |
| 8716 | * these outputs off. |
| 8717 | */ |
| 8718 | .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs }, |
| 8719 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 8720 | .dac_nids = alc883_dac_nids, |
Vladimir Avdonin | bab282b | 2006-08-22 13:31:58 +0200 | [diff] [blame] | 8721 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 8722 | .channel_mode = alc883_3ST_2ch_modes, |
| 8723 | .input_mux = &alc883_capture_source, |
| 8724 | }, |
Tobin Davis | 2880a86 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 8725 | [ALC883_ACER_ASPIRE] = { |
Takashi Iwai | 676a9b5 | 2007-08-16 15:23:35 +0200 | [diff] [blame] | 8726 | .mixers = { alc883_acer_aspire_mixer }, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 8727 | .init_verbs = { alc883_init_verbs, alc883_acer_eapd_verbs }, |
Tobin Davis | 2880a86 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 8728 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 8729 | .dac_nids = alc883_dac_nids, |
| 8730 | .dig_out_nid = ALC883_DIGOUT_NID, |
Tobin Davis | 2880a86 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 8731 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 8732 | .channel_mode = alc883_3ST_2ch_modes, |
| 8733 | .input_mux = &alc883_capture_source, |
Takashi Iwai | 676a9b5 | 2007-08-16 15:23:35 +0200 | [diff] [blame] | 8734 | .unsol_event = alc883_acer_aspire_unsol_event, |
| 8735 | .init_hook = alc883_acer_aspire_automute, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 8736 | }, |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 8737 | [ALC888_ACER_ASPIRE_4930G] = { |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 8738 | .mixers = { alc888_base_mixer, |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 8739 | alc883_chmode_mixer }, |
| 8740 | .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs, |
| 8741 | alc888_acer_aspire_4930g_verbs }, |
| 8742 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 8743 | .dac_nids = alc883_dac_nids, |
| 8744 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev), |
| 8745 | .adc_nids = alc883_adc_nids_rev, |
| 8746 | .capsrc_nids = alc883_capsrc_nids_rev, |
| 8747 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 8748 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes), |
| 8749 | .channel_mode = alc883_3ST_6ch_modes, |
| 8750 | .need_dac_fix = 1, |
| 8751 | .num_mux_defs = |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 8752 | ARRAY_SIZE(alc888_2_capture_sources), |
| 8753 | .input_mux = alc888_2_capture_sources, |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 8754 | .unsol_event = alc888_acer_aspire_4930g_unsol_event, |
| 8755 | .init_hook = alc888_acer_aspire_4930g_automute, |
| 8756 | }, |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 8757 | [ALC883_MEDION] = { |
| 8758 | .mixers = { alc883_fivestack_mixer, |
| 8759 | alc883_chmode_mixer }, |
| 8760 | .init_verbs = { alc883_init_verbs, |
Andrew L. Neporada | b373bde | 2006-11-07 11:37:08 +0100 | [diff] [blame] | 8761 | alc883_medion_eapd_verbs }, |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 8762 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 8763 | .dac_nids = alc883_dac_nids, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 8764 | .adc_nids = alc883_adc_nids_alt, |
| 8765 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_alt), |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 8766 | .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes), |
| 8767 | .channel_mode = alc883_sixstack_modes, |
| 8768 | .input_mux = &alc883_capture_source, |
Andrew L. Neporada | b373bde | 2006-11-07 11:37:08 +0100 | [diff] [blame] | 8769 | }, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8770 | [ALC883_MEDION_MD2] = { |
| 8771 | .mixers = { alc883_medion_md2_mixer}, |
| 8772 | .init_verbs = { alc883_init_verbs, alc883_medion_md2_verbs}, |
| 8773 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 8774 | .dac_nids = alc883_dac_nids, |
| 8775 | .dig_out_nid = ALC883_DIGOUT_NID, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8776 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 8777 | .channel_mode = alc883_3ST_2ch_modes, |
| 8778 | .input_mux = &alc883_capture_source, |
| 8779 | .unsol_event = alc883_medion_md2_unsol_event, |
| 8780 | .init_hook = alc883_medion_md2_automute, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 8781 | }, |
Andrew L. Neporada | b373bde | 2006-11-07 11:37:08 +0100 | [diff] [blame] | 8782 | [ALC883_LAPTOP_EAPD] = { |
Takashi Iwai | 676a9b5 | 2007-08-16 15:23:35 +0200 | [diff] [blame] | 8783 | .mixers = { alc883_base_mixer }, |
Andrew L. Neporada | b373bde | 2006-11-07 11:37:08 +0100 | [diff] [blame] | 8784 | .init_verbs = { alc883_init_verbs, alc882_eapd_verbs }, |
| 8785 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 8786 | .dac_nids = alc883_dac_nids, |
Andrew L. Neporada | b373bde | 2006-11-07 11:37:08 +0100 | [diff] [blame] | 8787 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 8788 | .channel_mode = alc883_3ST_2ch_modes, |
| 8789 | .input_mux = &alc883_capture_source, |
| 8790 | }, |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 8791 | [ALC883_CLEVO_M720] = { |
| 8792 | .mixers = { alc883_clevo_m720_mixer }, |
| 8793 | .init_verbs = { alc883_init_verbs, alc883_clevo_m720_verbs }, |
Jiang zhe | 368c7a9 | 2008-03-04 11:20:33 +0100 | [diff] [blame] | 8794 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 8795 | .dac_nids = alc883_dac_nids, |
| 8796 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 8797 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 8798 | .channel_mode = alc883_3ST_2ch_modes, |
| 8799 | .input_mux = &alc883_capture_source, |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 8800 | .unsol_event = alc883_clevo_m720_unsol_event, |
| 8801 | .init_hook = alc883_clevo_m720_automute, |
Jiang zhe | 368c7a9 | 2008-03-04 11:20:33 +0100 | [diff] [blame] | 8802 | }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 8803 | [ALC883_LENOVO_101E_2ch] = { |
| 8804 | .mixers = { alc883_lenovo_101e_2ch_mixer}, |
| 8805 | .init_verbs = { alc883_init_verbs, alc883_lenovo_101e_verbs}, |
| 8806 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 8807 | .dac_nids = alc883_dac_nids, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 8808 | .adc_nids = alc883_adc_nids_alt, |
| 8809 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_alt), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 8810 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 8811 | .channel_mode = alc883_3ST_2ch_modes, |
| 8812 | .input_mux = &alc883_lenovo_101e_capture_source, |
| 8813 | .unsol_event = alc883_lenovo_101e_unsol_event, |
| 8814 | .init_hook = alc883_lenovo_101e_all_automute, |
| 8815 | }, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8816 | [ALC883_LENOVO_NB0763] = { |
| 8817 | .mixers = { alc883_lenovo_nb0763_mixer }, |
| 8818 | .init_verbs = { alc883_init_verbs, alc883_lenovo_nb0763_verbs}, |
| 8819 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 8820 | .dac_nids = alc883_dac_nids, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8821 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 8822 | .channel_mode = alc883_3ST_2ch_modes, |
| 8823 | .need_dac_fix = 1, |
| 8824 | .input_mux = &alc883_lenovo_nb0763_capture_source, |
| 8825 | .unsol_event = alc883_medion_md2_unsol_event, |
| 8826 | .init_hook = alc883_medion_md2_automute, |
| 8827 | }, |
| 8828 | [ALC888_LENOVO_MS7195_DIG] = { |
| 8829 | .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer }, |
| 8830 | .init_verbs = { alc883_init_verbs, alc888_lenovo_ms7195_verbs}, |
| 8831 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 8832 | .dac_nids = alc883_dac_nids, |
| 8833 | .dig_out_nid = ALC883_DIGOUT_NID, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8834 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes), |
| 8835 | .channel_mode = alc883_3ST_6ch_modes, |
| 8836 | .need_dac_fix = 1, |
| 8837 | .input_mux = &alc883_capture_source, |
| 8838 | .unsol_event = alc883_lenovo_ms7195_unsol_event, |
| 8839 | .init_hook = alc888_lenovo_ms7195_front_automute, |
Kailang Yang | 189609a | 2007-08-20 11:31:23 +0200 | [diff] [blame] | 8840 | }, |
| 8841 | [ALC883_HAIER_W66] = { |
| 8842 | .mixers = { alc883_tagra_2ch_mixer}, |
| 8843 | .init_verbs = { alc883_init_verbs, alc883_haier_w66_verbs}, |
| 8844 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 8845 | .dac_nids = alc883_dac_nids, |
| 8846 | .dig_out_nid = ALC883_DIGOUT_NID, |
Kailang Yang | 189609a | 2007-08-20 11:31:23 +0200 | [diff] [blame] | 8847 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 8848 | .channel_mode = alc883_3ST_2ch_modes, |
| 8849 | .input_mux = &alc883_capture_source, |
| 8850 | .unsol_event = alc883_haier_w66_unsol_event, |
| 8851 | .init_hook = alc883_haier_w66_automute, |
Herton Ronaldo Krzesinski | eea6419 | 2008-03-20 12:14:59 +0100 | [diff] [blame] | 8852 | }, |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 8853 | [ALC888_3ST_HP] = { |
Herton Ronaldo Krzesinski | eea6419 | 2008-03-20 12:14:59 +0100 | [diff] [blame] | 8854 | .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer }, |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 8855 | .init_verbs = { alc883_init_verbs, alc888_3st_hp_verbs }, |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 8856 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 8857 | .dac_nids = alc883_dac_nids, |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 8858 | .num_channel_mode = ARRAY_SIZE(alc888_3st_hp_modes), |
| 8859 | .channel_mode = alc888_3st_hp_modes, |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 8860 | .need_dac_fix = 1, |
| 8861 | .input_mux = &alc883_capture_source, |
| 8862 | }, |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 8863 | [ALC888_6ST_DELL] = { |
Herton Ronaldo Krzesinski | f24dbdc | 2008-03-20 12:14:28 +0100 | [diff] [blame] | 8864 | .mixers = { alc883_base_mixer, alc883_chmode_mixer }, |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 8865 | .init_verbs = { alc883_init_verbs, alc888_6st_dell_verbs }, |
| 8866 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 8867 | .dac_nids = alc883_dac_nids, |
| 8868 | .dig_out_nid = ALC883_DIGOUT_NID, |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 8869 | .dig_in_nid = ALC883_DIGIN_NID, |
| 8870 | .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes), |
| 8871 | .channel_mode = alc883_sixstack_modes, |
| 8872 | .input_mux = &alc883_capture_source, |
| 8873 | .unsol_event = alc888_6st_dell_unsol_event, |
| 8874 | .init_hook = alc888_6st_dell_front_automute, |
| 8875 | }, |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 8876 | [ALC883_MITAC] = { |
| 8877 | .mixers = { alc883_mitac_mixer }, |
| 8878 | .init_verbs = { alc883_init_verbs, alc883_mitac_verbs }, |
| 8879 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 8880 | .dac_nids = alc883_dac_nids, |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 8881 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 8882 | .channel_mode = alc883_3ST_2ch_modes, |
| 8883 | .input_mux = &alc883_capture_source, |
| 8884 | .unsol_event = alc883_mitac_unsol_event, |
| 8885 | .init_hook = alc883_mitac_automute, |
| 8886 | }, |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 8887 | [ALC883_FUJITSU_PI2515] = { |
| 8888 | .mixers = { alc883_2ch_fujitsu_pi2515_mixer }, |
| 8889 | .init_verbs = { alc883_init_verbs, |
| 8890 | alc883_2ch_fujitsu_pi2515_verbs}, |
| 8891 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 8892 | .dac_nids = alc883_dac_nids, |
| 8893 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 8894 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 8895 | .channel_mode = alc883_3ST_2ch_modes, |
| 8896 | .input_mux = &alc883_fujitsu_pi2515_capture_source, |
| 8897 | .unsol_event = alc883_2ch_fujitsu_pi2515_unsol_event, |
| 8898 | .init_hook = alc883_2ch_fujitsu_pi2515_automute, |
| 8899 | }, |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 8900 | [ALC888_FUJITSU_XA3530] = { |
| 8901 | .mixers = { alc888_base_mixer, alc883_chmode_mixer }, |
| 8902 | .init_verbs = { alc883_init_verbs, |
| 8903 | alc888_fujitsu_xa3530_verbs }, |
| 8904 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 8905 | .dac_nids = alc883_dac_nids, |
| 8906 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev), |
| 8907 | .adc_nids = alc883_adc_nids_rev, |
| 8908 | .capsrc_nids = alc883_capsrc_nids_rev, |
| 8909 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 8910 | .num_channel_mode = ARRAY_SIZE(alc888_4ST_8ch_intel_modes), |
| 8911 | .channel_mode = alc888_4ST_8ch_intel_modes, |
| 8912 | .num_mux_defs = |
| 8913 | ARRAY_SIZE(alc888_2_capture_sources), |
| 8914 | .input_mux = alc888_2_capture_sources, |
| 8915 | .unsol_event = alc888_fujitsu_xa3530_unsol_event, |
| 8916 | .init_hook = alc888_fujitsu_xa3530_automute, |
| 8917 | }, |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 8918 | [ALC888_LENOVO_SKY] = { |
| 8919 | .mixers = { alc888_lenovo_sky_mixer, alc883_chmode_mixer }, |
| 8920 | .init_verbs = { alc883_init_verbs, alc888_lenovo_sky_verbs}, |
| 8921 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 8922 | .dac_nids = alc883_dac_nids, |
| 8923 | .dig_out_nid = ALC883_DIGOUT_NID, |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 8924 | .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes), |
| 8925 | .channel_mode = alc883_sixstack_modes, |
| 8926 | .need_dac_fix = 1, |
| 8927 | .input_mux = &alc883_lenovo_sky_capture_source, |
| 8928 | .unsol_event = alc883_lenovo_sky_unsol_event, |
| 8929 | .init_hook = alc888_lenovo_sky_front_automute, |
| 8930 | }, |
| 8931 | [ALC888_ASUS_M90V] = { |
| 8932 | .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer }, |
| 8933 | .init_verbs = { alc883_init_verbs, alc888_asus_m90v_verbs }, |
| 8934 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 8935 | .dac_nids = alc883_dac_nids, |
| 8936 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 8937 | .dig_in_nid = ALC883_DIGIN_NID, |
| 8938 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes), |
| 8939 | .channel_mode = alc883_3ST_6ch_modes, |
| 8940 | .need_dac_fix = 1, |
| 8941 | .input_mux = &alc883_fujitsu_pi2515_capture_source, |
| 8942 | .unsol_event = alc883_mode2_unsol_event, |
| 8943 | .init_hook = alc883_mode2_inithook, |
| 8944 | }, |
| 8945 | [ALC888_ASUS_EEE1601] = { |
| 8946 | .mixers = { alc883_asus_eee1601_mixer }, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 8947 | .cap_mixer = alc883_asus_eee1601_cap_mixer, |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 8948 | .init_verbs = { alc883_init_verbs, alc888_asus_eee1601_verbs }, |
| 8949 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 8950 | .dac_nids = alc883_dac_nids, |
| 8951 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 8952 | .dig_in_nid = ALC883_DIGIN_NID, |
| 8953 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 8954 | .channel_mode = alc883_3ST_2ch_modes, |
| 8955 | .need_dac_fix = 1, |
| 8956 | .input_mux = &alc883_asus_eee1601_capture_source, |
| 8957 | .unsol_event = alc883_eee1601_unsol_event, |
| 8958 | .init_hook = alc883_eee1601_inithook, |
| 8959 | }, |
Wu Fengguang | 3ab9093 | 2008-11-17 09:51:09 +0100 | [diff] [blame] | 8960 | [ALC1200_ASUS_P5Q] = { |
| 8961 | .mixers = { alc883_base_mixer, alc883_chmode_mixer }, |
| 8962 | .init_verbs = { alc883_init_verbs }, |
| 8963 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 8964 | .dac_nids = alc883_dac_nids, |
| 8965 | .dig_out_nid = ALC1200_DIGOUT_NID, |
| 8966 | .dig_in_nid = ALC883_DIGIN_NID, |
Wu Fengguang | b25c9da | 2009-02-06 15:02:27 +0800 | [diff] [blame] | 8967 | .slave_dig_outs = alc1200_slave_dig_outs, |
Wu Fengguang | 3ab9093 | 2008-11-17 09:51:09 +0100 | [diff] [blame] | 8968 | .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes), |
| 8969 | .channel_mode = alc883_sixstack_modes, |
| 8970 | .input_mux = &alc883_capture_source, |
| 8971 | }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8972 | }; |
| 8973 | |
| 8974 | |
| 8975 | /* |
| 8976 | * BIOS auto configuration |
| 8977 | */ |
| 8978 | static void alc883_auto_set_output_and_unmute(struct hda_codec *codec, |
| 8979 | hda_nid_t nid, int pin_type, |
| 8980 | int dac_idx) |
| 8981 | { |
| 8982 | /* set as output */ |
| 8983 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 8984 | int idx; |
| 8985 | |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 8986 | alc_set_pin_output(codec, nid, pin_type); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8987 | if (spec->multiout.dac_nids[dac_idx] == 0x25) |
| 8988 | idx = 4; |
| 8989 | else |
| 8990 | idx = spec->multiout.dac_nids[dac_idx] - 2; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8991 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_CONNECT_SEL, idx); |
| 8992 | |
| 8993 | } |
| 8994 | |
| 8995 | static void alc883_auto_init_multi_out(struct hda_codec *codec) |
| 8996 | { |
| 8997 | struct alc_spec *spec = codec->spec; |
| 8998 | int i; |
| 8999 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 9000 | alc_subsystem_id(codec, 0x15, 0x1b, 0x14); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9001 | for (i = 0; i <= HDA_SIDE; i++) { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9002 | hda_nid_t nid = spec->autocfg.line_out_pins[i]; |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 9003 | int pin_type = get_pin_type(spec->autocfg.line_out_type); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9004 | if (nid) |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 9005 | alc883_auto_set_output_and_unmute(codec, nid, pin_type, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9006 | i); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9007 | } |
| 9008 | } |
| 9009 | |
| 9010 | static void alc883_auto_init_hp_out(struct hda_codec *codec) |
| 9011 | { |
| 9012 | struct alc_spec *spec = codec->spec; |
| 9013 | hda_nid_t pin; |
| 9014 | |
Takashi Iwai | eb06ed8 | 2006-09-20 17:10:27 +0200 | [diff] [blame] | 9015 | pin = spec->autocfg.hp_pins[0]; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9016 | if (pin) /* connect to front */ |
| 9017 | /* use dac 0 */ |
| 9018 | alc883_auto_set_output_and_unmute(codec, pin, PIN_HP, 0); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 9019 | pin = spec->autocfg.speaker_pins[0]; |
| 9020 | if (pin) |
| 9021 | alc883_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9022 | } |
| 9023 | |
| 9024 | #define alc883_is_input_pin(nid) alc880_is_input_pin(nid) |
| 9025 | #define ALC883_PIN_CD_NID ALC880_PIN_CD_NID |
| 9026 | |
| 9027 | static void alc883_auto_init_analog_input(struct hda_codec *codec) |
| 9028 | { |
| 9029 | struct alc_spec *spec = codec->spec; |
| 9030 | int i; |
| 9031 | |
| 9032 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
| 9033 | hda_nid_t nid = spec->autocfg.input_pins[i]; |
| 9034 | if (alc883_is_input_pin(nid)) { |
| 9035 | snd_hda_codec_write(codec, nid, 0, |
| 9036 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 9037 | (i <= AUTO_PIN_FRONT_MIC ? |
| 9038 | PIN_VREF80 : PIN_IN)); |
| 9039 | if (nid != ALC883_PIN_CD_NID) |
| 9040 | snd_hda_codec_write(codec, nid, 0, |
| 9041 | AC_VERB_SET_AMP_GAIN_MUTE, |
| 9042 | AMP_OUT_MUTE); |
| 9043 | } |
| 9044 | } |
| 9045 | } |
| 9046 | |
Takashi Iwai | f511b01 | 2008-08-15 16:46:42 +0200 | [diff] [blame] | 9047 | #define alc883_auto_init_input_src alc882_auto_init_input_src |
| 9048 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9049 | /* almost identical with ALC880 parser... */ |
| 9050 | static int alc883_parse_auto_config(struct hda_codec *codec) |
| 9051 | { |
| 9052 | struct alc_spec *spec = codec->spec; |
| 9053 | int err = alc880_parse_auto_config(codec); |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 9054 | struct auto_pin_cfg *cfg = &spec->autocfg; |
| 9055 | int i; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9056 | |
| 9057 | if (err < 0) |
| 9058 | return err; |
Takashi Iwai | 776e184 | 2007-08-29 15:07:11 +0200 | [diff] [blame] | 9059 | else if (!err) |
| 9060 | return 0; /* no config found */ |
| 9061 | |
| 9062 | err = alc_auto_add_mic_boost(codec); |
| 9063 | if (err < 0) |
| 9064 | return err; |
| 9065 | |
| 9066 | /* hack - override the init verbs */ |
| 9067 | spec->init_verbs[0] = alc883_auto_init_verbs; |
Takashi Iwai | 776e184 | 2007-08-29 15:07:11 +0200 | [diff] [blame] | 9068 | |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 9069 | /* setup input_mux for ALC889 */ |
| 9070 | if (codec->vendor_id == 0x10ec0889) { |
| 9071 | /* digital-mic input pin is excluded in alc880_auto_create..() |
| 9072 | * because it's under 0x18 |
| 9073 | */ |
| 9074 | if (cfg->input_pins[AUTO_PIN_MIC] == 0x12 || |
| 9075 | cfg->input_pins[AUTO_PIN_FRONT_MIC] == 0x12) { |
| 9076 | struct hda_input_mux *imux = &spec->private_imux[0]; |
| 9077 | for (i = 1; i < 3; i++) |
| 9078 | memcpy(&spec->private_imux[i], |
| 9079 | &spec->private_imux[0], |
| 9080 | sizeof(spec->private_imux[0])); |
| 9081 | imux->items[imux->num_items].label = "Int DMic"; |
| 9082 | imux->items[imux->num_items].index = 0x0b; |
| 9083 | imux->num_items++; |
| 9084 | spec->num_mux_defs = 3; |
| 9085 | spec->input_mux = spec->private_imux; |
| 9086 | } |
| 9087 | } |
| 9088 | |
Takashi Iwai | 776e184 | 2007-08-29 15:07:11 +0200 | [diff] [blame] | 9089 | return 1; /* config found */ |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9090 | } |
| 9091 | |
| 9092 | /* additional initialization for auto-configuration model */ |
| 9093 | static void alc883_auto_init(struct hda_codec *codec) |
| 9094 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 9095 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9096 | alc883_auto_init_multi_out(codec); |
| 9097 | alc883_auto_init_hp_out(codec); |
| 9098 | alc883_auto_init_analog_input(codec); |
Takashi Iwai | f511b01 | 2008-08-15 16:46:42 +0200 | [diff] [blame] | 9099 | alc883_auto_init_input_src(codec); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 9100 | if (spec->unsol_event) |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 9101 | alc_inithook(codec); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9102 | } |
| 9103 | |
| 9104 | static int patch_alc883(struct hda_codec *codec) |
| 9105 | { |
| 9106 | struct alc_spec *spec; |
| 9107 | int err, board_config; |
| 9108 | |
| 9109 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
| 9110 | if (spec == NULL) |
| 9111 | return -ENOMEM; |
| 9112 | |
| 9113 | codec->spec = spec; |
| 9114 | |
Takashi Iwai | 2c3bf9a | 2008-06-04 12:39:38 +0200 | [diff] [blame] | 9115 | alc_fix_pll_init(codec, 0x20, 0x0a, 10); |
| 9116 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 9117 | board_config = snd_hda_check_board_config(codec, ALC883_MODEL_LAST, |
| 9118 | alc883_models, |
| 9119 | alc883_cfg_tbl); |
| 9120 | if (board_config < 0) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9121 | printk(KERN_INFO "hda_codec: Unknown model for ALC883, " |
| 9122 | "trying auto-probe from BIOS...\n"); |
| 9123 | board_config = ALC883_AUTO; |
| 9124 | } |
| 9125 | |
| 9126 | if (board_config == ALC883_AUTO) { |
| 9127 | /* automatic parse from the BIOS config */ |
| 9128 | err = alc883_parse_auto_config(codec); |
| 9129 | if (err < 0) { |
| 9130 | alc_free(codec); |
| 9131 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9132 | } else if (!err) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9133 | printk(KERN_INFO |
| 9134 | "hda_codec: Cannot set up configuration " |
| 9135 | "from BIOS. Using base mode...\n"); |
| 9136 | board_config = ALC883_3ST_2ch_DIG; |
| 9137 | } |
| 9138 | } |
| 9139 | |
Kusanagi Kouichi | 680cd53 | 2009-02-05 00:00:58 +0900 | [diff] [blame] | 9140 | err = snd_hda_attach_beep_device(codec, 0x1); |
| 9141 | if (err < 0) { |
| 9142 | alc_free(codec); |
| 9143 | return err; |
| 9144 | } |
| 9145 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9146 | if (board_config != ALC883_AUTO) |
| 9147 | setup_preset(spec, &alc883_presets[board_config]); |
| 9148 | |
Kailang Yang | 2f89328 | 2008-05-27 12:14:47 +0200 | [diff] [blame] | 9149 | switch (codec->vendor_id) { |
| 9150 | case 0x10ec0888: |
Kailang Yang | 4442608 | 2008-10-15 11:18:05 +0200 | [diff] [blame] | 9151 | if (codec->revision_id == 0x100101) { |
| 9152 | spec->stream_name_analog = "ALC1200 Analog"; |
| 9153 | spec->stream_name_digital = "ALC1200 Digital"; |
| 9154 | } else { |
| 9155 | spec->stream_name_analog = "ALC888 Analog"; |
| 9156 | spec->stream_name_digital = "ALC888 Digital"; |
| 9157 | } |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 9158 | if (!spec->num_adc_nids) { |
| 9159 | spec->num_adc_nids = ARRAY_SIZE(alc883_adc_nids); |
| 9160 | spec->adc_nids = alc883_adc_nids; |
| 9161 | } |
| 9162 | if (!spec->capsrc_nids) |
| 9163 | spec->capsrc_nids = alc883_capsrc_nids; |
| 9164 | spec->capture_style = CAPT_MIX; /* matrix-style capture */ |
Kailang Yang | 2f89328 | 2008-05-27 12:14:47 +0200 | [diff] [blame] | 9165 | break; |
| 9166 | case 0x10ec0889: |
| 9167 | spec->stream_name_analog = "ALC889 Analog"; |
| 9168 | spec->stream_name_digital = "ALC889 Digital"; |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 9169 | if (!spec->num_adc_nids) { |
| 9170 | spec->num_adc_nids = ARRAY_SIZE(alc889_adc_nids); |
| 9171 | spec->adc_nids = alc889_adc_nids; |
| 9172 | } |
| 9173 | if (!spec->capsrc_nids) |
| 9174 | spec->capsrc_nids = alc889_capsrc_nids; |
| 9175 | spec->capture_style = CAPT_1MUX_MIX; /* 1mux/Nmix-style |
| 9176 | capture */ |
Kailang Yang | 2f89328 | 2008-05-27 12:14:47 +0200 | [diff] [blame] | 9177 | break; |
| 9178 | default: |
| 9179 | spec->stream_name_analog = "ALC883 Analog"; |
| 9180 | spec->stream_name_digital = "ALC883 Digital"; |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 9181 | if (!spec->num_adc_nids) { |
| 9182 | spec->num_adc_nids = ARRAY_SIZE(alc883_adc_nids); |
| 9183 | spec->adc_nids = alc883_adc_nids; |
| 9184 | } |
| 9185 | if (!spec->capsrc_nids) |
| 9186 | spec->capsrc_nids = alc883_capsrc_nids; |
| 9187 | spec->capture_style = CAPT_MIX; /* matrix-style capture */ |
Kailang Yang | 2f89328 | 2008-05-27 12:14:47 +0200 | [diff] [blame] | 9188 | break; |
| 9189 | } |
| 9190 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9191 | spec->stream_analog_playback = &alc883_pcm_analog_playback; |
| 9192 | spec->stream_analog_capture = &alc883_pcm_analog_capture; |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 9193 | spec->stream_analog_alt_capture = &alc883_pcm_analog_alt_capture; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9194 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9195 | spec->stream_digital_playback = &alc883_pcm_digital_playback; |
| 9196 | spec->stream_digital_capture = &alc883_pcm_digital_capture; |
| 9197 | |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 9198 | if (!spec->cap_mixer) |
| 9199 | set_capture_mixer(spec); |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 9200 | set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9201 | |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 9202 | spec->vmaster_nid = 0x0c; |
| 9203 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9204 | codec->patch_ops = alc_patch_ops; |
| 9205 | if (board_config == ALC883_AUTO) |
| 9206 | spec->init_hook = alc883_auto_init; |
Kailang Yang | f9423e7 | 2008-05-27 12:32:25 +0200 | [diff] [blame] | 9207 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 9208 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 9209 | if (!spec->loopback.amplist) |
| 9210 | spec->loopback.amplist = alc883_loopbacks; |
| 9211 | #endif |
Takashi Iwai | daead53 | 2008-11-28 12:55:36 +0100 | [diff] [blame] | 9212 | codec->proc_widget_hook = print_realtek_coef; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9213 | |
| 9214 | return 0; |
| 9215 | } |
| 9216 | |
| 9217 | /* |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9218 | * ALC262 support |
| 9219 | */ |
| 9220 | |
| 9221 | #define ALC262_DIGOUT_NID ALC880_DIGOUT_NID |
| 9222 | #define ALC262_DIGIN_NID ALC880_DIGIN_NID |
| 9223 | |
| 9224 | #define alc262_dac_nids alc260_dac_nids |
| 9225 | #define alc262_adc_nids alc882_adc_nids |
| 9226 | #define alc262_adc_nids_alt alc882_adc_nids_alt |
Takashi Iwai | 88c71a9 | 2008-02-14 17:27:17 +0100 | [diff] [blame] | 9227 | #define alc262_capsrc_nids alc882_capsrc_nids |
| 9228 | #define alc262_capsrc_nids_alt alc882_capsrc_nids_alt |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9229 | |
| 9230 | #define alc262_modes alc260_modes |
Takashi Iwai | c5f2ea0 | 2005-12-06 18:54:31 +0100 | [diff] [blame] | 9231 | #define alc262_capture_source alc882_capture_source |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9232 | |
Kailang Yang | 4e555fe | 2008-08-26 13:05:55 +0200 | [diff] [blame] | 9233 | static hda_nid_t alc262_dmic_adc_nids[1] = { |
| 9234 | /* ADC0 */ |
| 9235 | 0x09 |
| 9236 | }; |
| 9237 | |
| 9238 | static hda_nid_t alc262_dmic_capsrc_nids[1] = { 0x22 }; |
| 9239 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9240 | static struct snd_kcontrol_new alc262_base_mixer[] = { |
| 9241 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 9242 | HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 9243 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 9244 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 9245 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 9246 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 9247 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 9248 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Takashi Iwai | cc69d12 | 2007-02-15 19:29:26 +0100 | [diff] [blame] | 9249 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9250 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 9251 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
Takashi Iwai | cc69d12 | 2007-02-15 19:29:26 +0100 | [diff] [blame] | 9252 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9253 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0D, 0x0, HDA_OUTPUT), |
| 9254 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 9255 | HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 9256 | HDA_CODEC_MUTE_MONO("Mono Playback Switch", 0x16, 2, 0x0, HDA_OUTPUT), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9257 | { } /* end */ |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 9258 | }; |
| 9259 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 9260 | static struct snd_kcontrol_new alc262_hippo1_mixer[] = { |
| 9261 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 9262 | HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 9263 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 9264 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 9265 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 9266 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 9267 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 9268 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Takashi Iwai | cc69d12 | 2007-02-15 19:29:26 +0100 | [diff] [blame] | 9269 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 9270 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 9271 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
Takashi Iwai | cc69d12 | 2007-02-15 19:29:26 +0100 | [diff] [blame] | 9272 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 9273 | /*HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0D, 0x0, HDA_OUTPUT),*/ |
| 9274 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 9275 | { } /* end */ |
| 9276 | }; |
| 9277 | |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 9278 | /* update HP, line and mono-out pins according to the master switch */ |
| 9279 | static void alc262_hp_master_update(struct hda_codec *codec) |
| 9280 | { |
| 9281 | struct alc_spec *spec = codec->spec; |
| 9282 | int val = spec->master_sw; |
| 9283 | |
| 9284 | /* HP & line-out */ |
| 9285 | snd_hda_codec_write_cache(codec, 0x1b, 0, |
| 9286 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 9287 | val ? PIN_HP : 0); |
| 9288 | snd_hda_codec_write_cache(codec, 0x15, 0, |
| 9289 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 9290 | val ? PIN_HP : 0); |
| 9291 | /* mono (speaker) depending on the HP jack sense */ |
| 9292 | val = val && !spec->jack_present; |
| 9293 | snd_hda_codec_write_cache(codec, 0x16, 0, |
| 9294 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 9295 | val ? PIN_OUT : 0); |
| 9296 | } |
| 9297 | |
| 9298 | static void alc262_hp_bpc_automute(struct hda_codec *codec) |
| 9299 | { |
| 9300 | struct alc_spec *spec = codec->spec; |
| 9301 | unsigned int presence; |
| 9302 | presence = snd_hda_codec_read(codec, 0x1b, 0, |
| 9303 | AC_VERB_GET_PIN_SENSE, 0); |
| 9304 | spec->jack_present = !!(presence & AC_PINSENSE_PRESENCE); |
| 9305 | alc262_hp_master_update(codec); |
| 9306 | } |
| 9307 | |
| 9308 | static void alc262_hp_bpc_unsol_event(struct hda_codec *codec, unsigned int res) |
| 9309 | { |
| 9310 | if ((res >> 26) != ALC880_HP_EVENT) |
| 9311 | return; |
| 9312 | alc262_hp_bpc_automute(codec); |
| 9313 | } |
| 9314 | |
| 9315 | static void alc262_hp_wildwest_automute(struct hda_codec *codec) |
| 9316 | { |
| 9317 | struct alc_spec *spec = codec->spec; |
| 9318 | unsigned int presence; |
| 9319 | presence = snd_hda_codec_read(codec, 0x15, 0, |
| 9320 | AC_VERB_GET_PIN_SENSE, 0); |
| 9321 | spec->jack_present = !!(presence & AC_PINSENSE_PRESENCE); |
| 9322 | alc262_hp_master_update(codec); |
| 9323 | } |
| 9324 | |
| 9325 | static void alc262_hp_wildwest_unsol_event(struct hda_codec *codec, |
| 9326 | unsigned int res) |
| 9327 | { |
| 9328 | if ((res >> 26) != ALC880_HP_EVENT) |
| 9329 | return; |
| 9330 | alc262_hp_wildwest_automute(codec); |
| 9331 | } |
| 9332 | |
| 9333 | static int alc262_hp_master_sw_get(struct snd_kcontrol *kcontrol, |
| 9334 | struct snd_ctl_elem_value *ucontrol) |
| 9335 | { |
| 9336 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 9337 | struct alc_spec *spec = codec->spec; |
| 9338 | *ucontrol->value.integer.value = spec->master_sw; |
| 9339 | return 0; |
| 9340 | } |
| 9341 | |
| 9342 | static int alc262_hp_master_sw_put(struct snd_kcontrol *kcontrol, |
| 9343 | struct snd_ctl_elem_value *ucontrol) |
| 9344 | { |
| 9345 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 9346 | struct alc_spec *spec = codec->spec; |
| 9347 | int val = !!*ucontrol->value.integer.value; |
| 9348 | |
| 9349 | if (val == spec->master_sw) |
| 9350 | return 0; |
| 9351 | spec->master_sw = val; |
| 9352 | alc262_hp_master_update(codec); |
| 9353 | return 1; |
| 9354 | } |
| 9355 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9356 | static struct snd_kcontrol_new alc262_HP_BPC_mixer[] = { |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 9357 | { |
| 9358 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 9359 | .name = "Master Playback Switch", |
| 9360 | .info = snd_ctl_boolean_mono_info, |
| 9361 | .get = alc262_hp_master_sw_get, |
| 9362 | .put = alc262_hp_master_sw_put, |
| 9363 | }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9364 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 9365 | HDA_CODEC_MUTE("Front Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 9366 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 9367 | HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0e, 2, 0x0, |
| 9368 | HDA_OUTPUT), |
| 9369 | HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x16, 2, 0x0, |
| 9370 | HDA_OUTPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9371 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 9372 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Takashi Iwai | cc69d12 | 2007-02-15 19:29:26 +0100 | [diff] [blame] | 9373 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9374 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 9375 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
Takashi Iwai | cc69d12 | 2007-02-15 19:29:26 +0100 | [diff] [blame] | 9376 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9377 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 9378 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 9379 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 9380 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9381 | HDA_CODEC_VOLUME("AUX IN Playback Volume", 0x0b, 0x06, HDA_INPUT), |
| 9382 | HDA_CODEC_MUTE("AUX IN Playback Switch", 0x0b, 0x06, HDA_INPUT), |
| 9383 | { } /* end */ |
| 9384 | }; |
| 9385 | |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 9386 | static struct snd_kcontrol_new alc262_HP_BPC_WildWest_mixer[] = { |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 9387 | { |
| 9388 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 9389 | .name = "Master Playback Switch", |
| 9390 | .info = snd_ctl_boolean_mono_info, |
| 9391 | .get = alc262_hp_master_sw_get, |
| 9392 | .put = alc262_hp_master_sw_put, |
| 9393 | }, |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 9394 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 9395 | HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 9396 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 9397 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 9398 | HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0e, 2, 0x0, |
| 9399 | HDA_OUTPUT), |
| 9400 | HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x16, 2, 0x0, |
| 9401 | HDA_OUTPUT), |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 9402 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 9403 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x02, HDA_INPUT), |
Takashi Iwai | cc69d12 | 2007-02-15 19:29:26 +0100 | [diff] [blame] | 9404 | HDA_CODEC_VOLUME("Front Mic Boost", 0x1a, 0, HDA_INPUT), |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 9405 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 9406 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 9407 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 9408 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 9409 | { } /* end */ |
| 9410 | }; |
| 9411 | |
| 9412 | static struct snd_kcontrol_new alc262_HP_BPC_WildWest_option_mixer[] = { |
| 9413 | HDA_CODEC_VOLUME("Rear Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 9414 | HDA_CODEC_MUTE("Rear Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Takashi Iwai | cc69d12 | 2007-02-15 19:29:26 +0100 | [diff] [blame] | 9415 | HDA_CODEC_VOLUME("Rear Mic Boost", 0x18, 0, HDA_INPUT), |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 9416 | { } /* end */ |
| 9417 | }; |
| 9418 | |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 9419 | /* mute/unmute internal speaker according to the hp jack and mute state */ |
| 9420 | static void alc262_hp_t5735_automute(struct hda_codec *codec, int force) |
| 9421 | { |
| 9422 | struct alc_spec *spec = codec->spec; |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 9423 | |
| 9424 | if (force || !spec->sense_updated) { |
| 9425 | unsigned int present; |
| 9426 | present = snd_hda_codec_read(codec, 0x15, 0, |
| 9427 | AC_VERB_GET_PIN_SENSE, 0); |
Takashi Iwai | 4bb2613 | 2008-01-28 18:12:42 +0100 | [diff] [blame] | 9428 | spec->jack_present = (present & AC_PINSENSE_PRESENCE) != 0; |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 9429 | spec->sense_updated = 1; |
| 9430 | } |
Takashi Iwai | 4bb2613 | 2008-01-28 18:12:42 +0100 | [diff] [blame] | 9431 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_OUTPUT, 0, HDA_AMP_MUTE, |
| 9432 | spec->jack_present ? HDA_AMP_MUTE : 0); |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 9433 | } |
| 9434 | |
| 9435 | static void alc262_hp_t5735_unsol_event(struct hda_codec *codec, |
| 9436 | unsigned int res) |
| 9437 | { |
| 9438 | if ((res >> 26) != ALC880_HP_EVENT) |
| 9439 | return; |
| 9440 | alc262_hp_t5735_automute(codec, 1); |
| 9441 | } |
| 9442 | |
| 9443 | static void alc262_hp_t5735_init_hook(struct hda_codec *codec) |
| 9444 | { |
| 9445 | alc262_hp_t5735_automute(codec, 1); |
| 9446 | } |
| 9447 | |
| 9448 | static struct snd_kcontrol_new alc262_hp_t5735_mixer[] = { |
Takashi Iwai | 86cd929 | 2008-01-28 18:09:56 +0100 | [diff] [blame] | 9449 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 9450 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 9451 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 9452 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 9453 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 9454 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 9455 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 9456 | { } /* end */ |
| 9457 | }; |
| 9458 | |
| 9459 | static struct hda_verb alc262_hp_t5735_verbs[] = { |
| 9460 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 9461 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 9462 | |
| 9463 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 9464 | { } |
| 9465 | }; |
| 9466 | |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 9467 | static struct snd_kcontrol_new alc262_hp_rp5700_mixer[] = { |
Takashi Iwai | f2f48e1 | 2008-01-28 18:14:43 +0100 | [diff] [blame] | 9468 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 9469 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
Takashi Iwai | 86cd929 | 2008-01-28 18:09:56 +0100 | [diff] [blame] | 9470 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0e, 0x0, HDA_OUTPUT), |
| 9471 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x16, 0x0, HDA_OUTPUT), |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 9472 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 9473 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 9474 | { } /* end */ |
| 9475 | }; |
| 9476 | |
| 9477 | static struct hda_verb alc262_hp_rp5700_verbs[] = { |
| 9478 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 9479 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 9480 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 9481 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 9482 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 9483 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 9484 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 9485 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 9486 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x00 << 8))}, |
| 9487 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x00 << 8))}, |
| 9488 | {} |
| 9489 | }; |
| 9490 | |
| 9491 | static struct hda_input_mux alc262_hp_rp5700_capture_source = { |
| 9492 | .num_items = 1, |
| 9493 | .items = { |
| 9494 | { "Line", 0x1 }, |
| 9495 | }, |
| 9496 | }; |
| 9497 | |
Takashi Iwai | 0724ea2 | 2007-08-23 00:31:43 +0200 | [diff] [blame] | 9498 | /* bind hp and internal speaker mute (with plug check) */ |
| 9499 | static int alc262_sony_master_sw_put(struct snd_kcontrol *kcontrol, |
| 9500 | struct snd_ctl_elem_value *ucontrol) |
| 9501 | { |
| 9502 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 9503 | long *valp = ucontrol->value.integer.value; |
| 9504 | int change; |
| 9505 | |
| 9506 | /* change hp mute */ |
| 9507 | change = snd_hda_codec_amp_update(codec, 0x15, 0, HDA_OUTPUT, 0, |
| 9508 | HDA_AMP_MUTE, |
| 9509 | valp[0] ? 0 : HDA_AMP_MUTE); |
| 9510 | change |= snd_hda_codec_amp_update(codec, 0x15, 1, HDA_OUTPUT, 0, |
| 9511 | HDA_AMP_MUTE, |
| 9512 | valp[1] ? 0 : HDA_AMP_MUTE); |
| 9513 | if (change) { |
| 9514 | /* change speaker according to HP jack state */ |
| 9515 | struct alc_spec *spec = codec->spec; |
| 9516 | unsigned int mute; |
| 9517 | if (spec->jack_present) |
| 9518 | mute = HDA_AMP_MUTE; |
| 9519 | else |
| 9520 | mute = snd_hda_codec_amp_read(codec, 0x15, 0, |
| 9521 | HDA_OUTPUT, 0); |
| 9522 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 9523 | HDA_AMP_MUTE, mute); |
| 9524 | } |
| 9525 | return change; |
| 9526 | } |
Takashi Iwai | 5b31954 | 2007-07-26 11:49:22 +0200 | [diff] [blame] | 9527 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 9528 | static struct snd_kcontrol_new alc262_sony_mixer[] = { |
Takashi Iwai | 0724ea2 | 2007-08-23 00:31:43 +0200 | [diff] [blame] | 9529 | HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 9530 | { |
| 9531 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 9532 | .name = "Master Playback Switch", |
| 9533 | .info = snd_hda_mixer_amp_switch_info, |
| 9534 | .get = snd_hda_mixer_amp_switch_get, |
| 9535 | .put = alc262_sony_master_sw_put, |
| 9536 | .private_value = HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT), |
| 9537 | }, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 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("ATAPI Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 9541 | HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 9542 | { } /* end */ |
| 9543 | }; |
| 9544 | |
Kailang Yang | 83c3421 | 2007-07-05 11:43:05 +0200 | [diff] [blame] | 9545 | static struct snd_kcontrol_new alc262_benq_t31_mixer[] = { |
| 9546 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 9547 | HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 9548 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 9549 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 9550 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 9551 | HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 9552 | HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 9553 | { } /* end */ |
| 9554 | }; |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 9555 | |
Tony Vroon | ba340e8 | 2009-02-02 19:01:30 +0000 | [diff] [blame] | 9556 | static struct snd_kcontrol_new alc262_tyan_mixer[] = { |
| 9557 | HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 9558 | HDA_BIND_MUTE("Master Playback Switch", 0x0c, 2, HDA_INPUT), |
| 9559 | HDA_CODEC_VOLUME("Aux Playback Volume", 0x0b, 0x06, HDA_INPUT), |
| 9560 | HDA_CODEC_MUTE("Aux Playback Switch", 0x0b, 0x06, HDA_INPUT), |
| 9561 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 9562 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 9563 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 9564 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 9565 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 9566 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 9567 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 9568 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
| 9569 | { } /* end */ |
| 9570 | }; |
| 9571 | |
| 9572 | static struct hda_verb alc262_tyan_verbs[] = { |
| 9573 | /* Headphone automute */ |
| 9574 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 9575 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 9576 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 9577 | |
| 9578 | /* P11 AUX_IN, white 4-pin connector */ |
| 9579 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 9580 | {0x14, AC_VERB_SET_CONFIG_DEFAULT_BYTES_1, 0xe1}, |
| 9581 | {0x14, AC_VERB_SET_CONFIG_DEFAULT_BYTES_2, 0x93}, |
| 9582 | {0x14, AC_VERB_SET_CONFIG_DEFAULT_BYTES_3, 0x19}, |
| 9583 | |
| 9584 | {} |
| 9585 | }; |
| 9586 | |
| 9587 | /* unsolicited event for HP jack sensing */ |
| 9588 | static void alc262_tyan_automute(struct hda_codec *codec) |
| 9589 | { |
| 9590 | unsigned int mute; |
| 9591 | unsigned int present; |
| 9592 | |
| 9593 | snd_hda_codec_read(codec, 0x1b, 0, AC_VERB_SET_PIN_SENSE, 0); |
| 9594 | present = snd_hda_codec_read(codec, 0x1b, 0, |
| 9595 | AC_VERB_GET_PIN_SENSE, 0); |
| 9596 | present = (present & 0x80000000) != 0; |
| 9597 | if (present) { |
| 9598 | /* mute line output on ATX panel */ |
| 9599 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 9600 | HDA_AMP_MUTE, HDA_AMP_MUTE); |
| 9601 | } else { |
| 9602 | /* unmute line output if necessary */ |
| 9603 | mute = snd_hda_codec_amp_read(codec, 0x1b, 0, HDA_OUTPUT, 0); |
| 9604 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 9605 | HDA_AMP_MUTE, mute); |
| 9606 | } |
| 9607 | } |
| 9608 | |
| 9609 | static void alc262_tyan_unsol_event(struct hda_codec *codec, |
| 9610 | unsigned int res) |
| 9611 | { |
| 9612 | if ((res >> 26) != ALC880_HP_EVENT) |
| 9613 | return; |
| 9614 | alc262_tyan_automute(codec); |
| 9615 | } |
| 9616 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9617 | #define alc262_capture_mixer alc882_capture_mixer |
| 9618 | #define alc262_capture_alt_mixer alc882_capture_alt_mixer |
| 9619 | |
| 9620 | /* |
| 9621 | * generic initialization of ADC, input mixers and output mixers |
| 9622 | */ |
| 9623 | static struct hda_verb alc262_init_verbs[] = { |
| 9624 | /* |
| 9625 | * Unmute ADC0-2 and set the default input to mic-in |
| 9626 | */ |
| 9627 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 9628 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9629 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 9630 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9631 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 9632 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9633 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 9634 | /* 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] | 9635 | * mixer widget |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9636 | * Note: PASD motherboards uses the Line In 2 as the input for |
| 9637 | * front panel mic (mic 2) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9638 | */ |
| 9639 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 9640 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 9641 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 9642 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 9643 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 9644 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9645 | |
| 9646 | /* |
| 9647 | * Set up output mixers (0x0c - 0x0e) |
| 9648 | */ |
| 9649 | /* set vol=0 to output mixers */ |
| 9650 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 9651 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 9652 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 9653 | /* set up input amps for analog loopback */ |
| 9654 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 9655 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9656 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 9657 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9658 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 9659 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9660 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 9661 | |
| 9662 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, |
| 9663 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0}, |
| 9664 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, |
| 9665 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 9666 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 9667 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 9668 | |
| 9669 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
| 9670 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
| 9671 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
| 9672 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
| 9673 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 9674 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9675 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 9676 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 9677 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9678 | /* FIXME: use matrix-type input source selection */ |
| 9679 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 9680 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ |
| 9681 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 9682 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 9683 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 9684 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 9685 | /* Input mixer2 */ |
| 9686 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 9687 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 9688 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 9689 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 9690 | /* Input mixer3 */ |
| 9691 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 9692 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 9693 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9694 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9695 | |
| 9696 | { } |
| 9697 | }; |
| 9698 | |
Kailang Yang | 4e555fe | 2008-08-26 13:05:55 +0200 | [diff] [blame] | 9699 | static struct hda_verb alc262_eapd_verbs[] = { |
| 9700 | {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 9701 | {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 9702 | { } |
| 9703 | }; |
| 9704 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 9705 | static struct hda_verb alc262_hippo_unsol_verbs[] = { |
| 9706 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 9707 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 9708 | {} |
| 9709 | }; |
| 9710 | |
| 9711 | static struct hda_verb alc262_hippo1_unsol_verbs[] = { |
| 9712 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0}, |
| 9713 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 9714 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
| 9715 | |
| 9716 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 9717 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 9718 | {} |
| 9719 | }; |
| 9720 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 9721 | static struct hda_verb alc262_sony_unsol_verbs[] = { |
| 9722 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0}, |
| 9723 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 9724 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, // Front Mic |
| 9725 | |
| 9726 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 9727 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Akio Idehara | 7b1e879 | 2008-06-09 22:46:07 +0900 | [diff] [blame] | 9728 | {} |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 9729 | }; |
| 9730 | |
Kailang Yang | 4e555fe | 2008-08-26 13:05:55 +0200 | [diff] [blame] | 9731 | static struct hda_input_mux alc262_dmic_capture_source = { |
| 9732 | .num_items = 2, |
| 9733 | .items = { |
| 9734 | { "Int DMic", 0x9 }, |
| 9735 | { "Mic", 0x0 }, |
| 9736 | }, |
| 9737 | }; |
| 9738 | |
| 9739 | static struct snd_kcontrol_new alc262_toshiba_s06_mixer[] = { |
| 9740 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 9741 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 9742 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 9743 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 9744 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Kailang Yang | 4e555fe | 2008-08-26 13:05:55 +0200 | [diff] [blame] | 9745 | { } /* end */ |
| 9746 | }; |
| 9747 | |
| 9748 | static struct hda_verb alc262_toshiba_s06_verbs[] = { |
| 9749 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 9750 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 9751 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 9752 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 9753 | {0x22, AC_VERB_SET_CONNECT_SEL, 0x09}, |
| 9754 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 9755 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 9756 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 9757 | {} |
| 9758 | }; |
| 9759 | |
| 9760 | static void alc262_dmic_automute(struct hda_codec *codec) |
| 9761 | { |
| 9762 | unsigned int present; |
| 9763 | |
| 9764 | present = snd_hda_codec_read(codec, 0x18, 0, |
| 9765 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 9766 | snd_hda_codec_write(codec, 0x22, 0, |
| 9767 | AC_VERB_SET_CONNECT_SEL, present ? 0x0 : 0x09); |
| 9768 | } |
| 9769 | |
| 9770 | /* toggle speaker-output according to the hp-jack state */ |
| 9771 | static void alc262_toshiba_s06_speaker_automute(struct hda_codec *codec) |
| 9772 | { |
| 9773 | unsigned int present; |
| 9774 | unsigned char bits; |
| 9775 | |
| 9776 | present = snd_hda_codec_read(codec, 0x15, 0, |
| 9777 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 9778 | bits = present ? 0 : PIN_OUT; |
| 9779 | snd_hda_codec_write(codec, 0x14, 0, |
| 9780 | AC_VERB_SET_PIN_WIDGET_CONTROL, bits); |
| 9781 | } |
| 9782 | |
| 9783 | |
| 9784 | |
| 9785 | /* unsolicited event for HP jack sensing */ |
| 9786 | static void alc262_toshiba_s06_unsol_event(struct hda_codec *codec, |
| 9787 | unsigned int res) |
| 9788 | { |
| 9789 | if ((res >> 26) == ALC880_HP_EVENT) |
| 9790 | alc262_toshiba_s06_speaker_automute(codec); |
| 9791 | if ((res >> 26) == ALC880_MIC_EVENT) |
| 9792 | alc262_dmic_automute(codec); |
| 9793 | |
| 9794 | } |
| 9795 | |
| 9796 | static void alc262_toshiba_s06_init_hook(struct hda_codec *codec) |
| 9797 | { |
| 9798 | alc262_toshiba_s06_speaker_automute(codec); |
| 9799 | alc262_dmic_automute(codec); |
| 9800 | } |
| 9801 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 9802 | /* mute/unmute internal speaker according to the hp jack and mute state */ |
Takashi Iwai | 5b31954 | 2007-07-26 11:49:22 +0200 | [diff] [blame] | 9803 | static void alc262_hippo_automute(struct hda_codec *codec) |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 9804 | { |
| 9805 | struct alc_spec *spec = codec->spec; |
| 9806 | unsigned int mute; |
Takashi Iwai | 5b31954 | 2007-07-26 11:49:22 +0200 | [diff] [blame] | 9807 | unsigned int present; |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 9808 | |
Takashi Iwai | 5b31954 | 2007-07-26 11:49:22 +0200 | [diff] [blame] | 9809 | /* need to execute and sync at first */ |
| 9810 | snd_hda_codec_read(codec, 0x15, 0, AC_VERB_SET_PIN_SENSE, 0); |
| 9811 | present = snd_hda_codec_read(codec, 0x15, 0, |
| 9812 | AC_VERB_GET_PIN_SENSE, 0); |
| 9813 | spec->jack_present = (present & 0x80000000) != 0; |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 9814 | if (spec->jack_present) { |
| 9815 | /* mute internal speaker */ |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 9816 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 9817 | HDA_AMP_MUTE, HDA_AMP_MUTE); |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 9818 | } else { |
| 9819 | /* unmute internal speaker if necessary */ |
| 9820 | mute = snd_hda_codec_amp_read(codec, 0x15, 0, HDA_OUTPUT, 0); |
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, mute); |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 9823 | } |
| 9824 | } |
| 9825 | |
| 9826 | /* unsolicited event for HP jack sensing */ |
| 9827 | static void alc262_hippo_unsol_event(struct hda_codec *codec, |
| 9828 | unsigned int res) |
| 9829 | { |
| 9830 | if ((res >> 26) != ALC880_HP_EVENT) |
| 9831 | return; |
Takashi Iwai | 5b31954 | 2007-07-26 11:49:22 +0200 | [diff] [blame] | 9832 | alc262_hippo_automute(codec); |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 9833 | } |
| 9834 | |
Takashi Iwai | 5b31954 | 2007-07-26 11:49:22 +0200 | [diff] [blame] | 9835 | static void alc262_hippo1_automute(struct hda_codec *codec) |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 9836 | { |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 9837 | unsigned int mute; |
Takashi Iwai | 5b31954 | 2007-07-26 11:49:22 +0200 | [diff] [blame] | 9838 | unsigned int present; |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 9839 | |
Takashi Iwai | 5b31954 | 2007-07-26 11:49:22 +0200 | [diff] [blame] | 9840 | snd_hda_codec_read(codec, 0x1b, 0, AC_VERB_SET_PIN_SENSE, 0); |
| 9841 | present = snd_hda_codec_read(codec, 0x1b, 0, |
| 9842 | AC_VERB_GET_PIN_SENSE, 0); |
| 9843 | present = (present & 0x80000000) != 0; |
| 9844 | if (present) { |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 9845 | /* mute internal speaker */ |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 9846 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 9847 | HDA_AMP_MUTE, HDA_AMP_MUTE); |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 9848 | } else { |
| 9849 | /* unmute internal speaker if necessary */ |
| 9850 | mute = snd_hda_codec_amp_read(codec, 0x1b, 0, HDA_OUTPUT, 0); |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 9851 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 9852 | HDA_AMP_MUTE, mute); |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 9853 | } |
| 9854 | } |
| 9855 | |
| 9856 | /* unsolicited event for HP jack sensing */ |
| 9857 | static void alc262_hippo1_unsol_event(struct hda_codec *codec, |
| 9858 | unsigned int res) |
| 9859 | { |
| 9860 | if ((res >> 26) != ALC880_HP_EVENT) |
| 9861 | return; |
Takashi Iwai | 5b31954 | 2007-07-26 11:49:22 +0200 | [diff] [blame] | 9862 | alc262_hippo1_automute(codec); |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 9863 | } |
| 9864 | |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 9865 | /* |
Pascal Terjan | e8f9ae2 | 2008-08-04 14:36:05 +0200 | [diff] [blame] | 9866 | * nec model |
| 9867 | * 0x15 = headphone |
| 9868 | * 0x16 = internal speaker |
| 9869 | * 0x18 = external mic |
| 9870 | */ |
| 9871 | |
| 9872 | static struct snd_kcontrol_new alc262_nec_mixer[] = { |
| 9873 | HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 9874 | HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x16, 0, 0x0, HDA_OUTPUT), |
| 9875 | |
| 9876 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 9877 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 9878 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 9879 | |
| 9880 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 9881 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 9882 | { } /* end */ |
| 9883 | }; |
| 9884 | |
| 9885 | static struct hda_verb alc262_nec_verbs[] = { |
| 9886 | /* Unmute Speaker */ |
| 9887 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 9888 | |
| 9889 | /* Headphone */ |
| 9890 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 9891 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 9892 | |
| 9893 | /* External mic to headphone */ |
| 9894 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 9895 | /* External mic to speaker */ |
| 9896 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 9897 | {} |
| 9898 | }; |
| 9899 | |
| 9900 | /* |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 9901 | * fujitsu model |
Tony Vroon | 5d9fab2 | 2008-03-14 17:09:18 +0100 | [diff] [blame] | 9902 | * 0x14 = headphone/spdif-out, 0x15 = internal speaker, |
| 9903 | * 0x1b = port replicator headphone out |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 9904 | */ |
| 9905 | |
| 9906 | #define ALC_HP_EVENT 0x37 |
| 9907 | |
| 9908 | static struct hda_verb alc262_fujitsu_unsol_verbs[] = { |
| 9909 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT}, |
| 9910 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Tony Vroon | 5d9fab2 | 2008-03-14 17:09:18 +0100 | [diff] [blame] | 9911 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT}, |
| 9912 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 9913 | {} |
| 9914 | }; |
| 9915 | |
Jiang zhe | 0e31daf | 2008-03-20 12:12:39 +0100 | [diff] [blame] | 9916 | static struct hda_verb alc262_lenovo_3000_unsol_verbs[] = { |
| 9917 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT}, |
| 9918 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 9919 | {} |
| 9920 | }; |
| 9921 | |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 9922 | static struct hda_input_mux alc262_fujitsu_capture_source = { |
Takashi Iwai | 39d3ed3 | 2007-10-12 15:03:48 +0200 | [diff] [blame] | 9923 | .num_items = 3, |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 9924 | .items = { |
| 9925 | { "Mic", 0x0 }, |
Takashi Iwai | 39d3ed3 | 2007-10-12 15:03:48 +0200 | [diff] [blame] | 9926 | { "Int Mic", 0x1 }, |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 9927 | { "CD", 0x4 }, |
| 9928 | }, |
| 9929 | }; |
| 9930 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9931 | static struct hda_input_mux alc262_HP_capture_source = { |
| 9932 | .num_items = 5, |
| 9933 | .items = { |
| 9934 | { "Mic", 0x0 }, |
zhejiang | accbe49 | 2007-08-31 12:36:05 +0200 | [diff] [blame] | 9935 | { "Front Mic", 0x1 }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9936 | { "Line", 0x2 }, |
| 9937 | { "CD", 0x4 }, |
| 9938 | { "AUX IN", 0x6 }, |
| 9939 | }, |
| 9940 | }; |
| 9941 | |
zhejiang | accbe49 | 2007-08-31 12:36:05 +0200 | [diff] [blame] | 9942 | static struct hda_input_mux alc262_HP_D7000_capture_source = { |
| 9943 | .num_items = 4, |
| 9944 | .items = { |
| 9945 | { "Mic", 0x0 }, |
| 9946 | { "Front Mic", 0x2 }, |
| 9947 | { "Line", 0x1 }, |
| 9948 | { "CD", 0x4 }, |
| 9949 | }, |
| 9950 | }; |
| 9951 | |
Takashi Iwai | ebc7a40 | 2008-05-20 09:23:05 +0200 | [diff] [blame] | 9952 | /* mute/unmute internal speaker according to the hp jacks and mute state */ |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 9953 | static void alc262_fujitsu_automute(struct hda_codec *codec, int force) |
| 9954 | { |
| 9955 | struct alc_spec *spec = codec->spec; |
| 9956 | unsigned int mute; |
| 9957 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9958 | if (force || !spec->sense_updated) { |
Takashi Iwai | ebc7a40 | 2008-05-20 09:23:05 +0200 | [diff] [blame] | 9959 | unsigned int present; |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 9960 | /* need to execute and sync at first */ |
| 9961 | 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] | 9962 | /* check laptop HP jack */ |
| 9963 | present = snd_hda_codec_read(codec, 0x14, 0, |
| 9964 | AC_VERB_GET_PIN_SENSE, 0); |
| 9965 | /* need to execute and sync at first */ |
| 9966 | snd_hda_codec_read(codec, 0x1b, 0, AC_VERB_SET_PIN_SENSE, 0); |
| 9967 | /* check docking HP jack */ |
| 9968 | present |= snd_hda_codec_read(codec, 0x1b, 0, |
| 9969 | AC_VERB_GET_PIN_SENSE, 0); |
| 9970 | if (present & AC_PINSENSE_PRESENCE) |
| 9971 | spec->jack_present = 1; |
| 9972 | else |
| 9973 | spec->jack_present = 0; |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 9974 | spec->sense_updated = 1; |
| 9975 | } |
Takashi Iwai | ebc7a40 | 2008-05-20 09:23:05 +0200 | [diff] [blame] | 9976 | /* unmute internal speaker only if both HPs are unplugged and |
| 9977 | * master switch is on |
| 9978 | */ |
| 9979 | if (spec->jack_present) |
| 9980 | mute = HDA_AMP_MUTE; |
| 9981 | else |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 9982 | mute = snd_hda_codec_amp_read(codec, 0x14, 0, HDA_OUTPUT, 0); |
Takashi Iwai | ebc7a40 | 2008-05-20 09:23:05 +0200 | [diff] [blame] | 9983 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 9984 | HDA_AMP_MUTE, mute); |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 9985 | } |
| 9986 | |
| 9987 | /* unsolicited event for HP jack sensing */ |
| 9988 | static void alc262_fujitsu_unsol_event(struct hda_codec *codec, |
| 9989 | unsigned int res) |
| 9990 | { |
| 9991 | if ((res >> 26) != ALC_HP_EVENT) |
| 9992 | return; |
| 9993 | alc262_fujitsu_automute(codec, 1); |
| 9994 | } |
| 9995 | |
Takashi Iwai | ebc7a40 | 2008-05-20 09:23:05 +0200 | [diff] [blame] | 9996 | static void alc262_fujitsu_init_hook(struct hda_codec *codec) |
| 9997 | { |
| 9998 | alc262_fujitsu_automute(codec, 1); |
| 9999 | } |
| 10000 | |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 10001 | /* bind volumes of both NID 0x0c and 0x0d */ |
Takashi Iwai | cca3b37 | 2007-08-10 17:12:15 +0200 | [diff] [blame] | 10002 | static struct hda_bind_ctls alc262_fujitsu_bind_master_vol = { |
| 10003 | .ops = &snd_hda_bind_vol, |
| 10004 | .values = { |
| 10005 | HDA_COMPOSE_AMP_VAL(0x0c, 3, 0, HDA_OUTPUT), |
| 10006 | HDA_COMPOSE_AMP_VAL(0x0d, 3, 0, HDA_OUTPUT), |
| 10007 | 0 |
| 10008 | }, |
| 10009 | }; |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 10010 | |
Jiang zhe | 0e31daf | 2008-03-20 12:12:39 +0100 | [diff] [blame] | 10011 | /* mute/unmute internal speaker according to the hp jack and mute state */ |
| 10012 | static void alc262_lenovo_3000_automute(struct hda_codec *codec, int force) |
| 10013 | { |
| 10014 | struct alc_spec *spec = codec->spec; |
| 10015 | unsigned int mute; |
| 10016 | |
| 10017 | if (force || !spec->sense_updated) { |
| 10018 | unsigned int present_int_hp; |
| 10019 | /* need to execute and sync at first */ |
| 10020 | snd_hda_codec_read(codec, 0x1b, 0, AC_VERB_SET_PIN_SENSE, 0); |
| 10021 | present_int_hp = snd_hda_codec_read(codec, 0x1b, 0, |
| 10022 | AC_VERB_GET_PIN_SENSE, 0); |
| 10023 | spec->jack_present = (present_int_hp & 0x80000000) != 0; |
| 10024 | spec->sense_updated = 1; |
| 10025 | } |
| 10026 | if (spec->jack_present) { |
| 10027 | /* mute internal speaker */ |
| 10028 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 10029 | HDA_AMP_MUTE, HDA_AMP_MUTE); |
| 10030 | snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0, |
| 10031 | HDA_AMP_MUTE, HDA_AMP_MUTE); |
| 10032 | } else { |
| 10033 | /* unmute internal speaker if necessary */ |
| 10034 | mute = snd_hda_codec_amp_read(codec, 0x1b, 0, HDA_OUTPUT, 0); |
| 10035 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 10036 | HDA_AMP_MUTE, mute); |
| 10037 | snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0, |
| 10038 | HDA_AMP_MUTE, mute); |
| 10039 | } |
| 10040 | } |
| 10041 | |
| 10042 | /* unsolicited event for HP jack sensing */ |
| 10043 | static void alc262_lenovo_3000_unsol_event(struct hda_codec *codec, |
| 10044 | unsigned int res) |
| 10045 | { |
| 10046 | if ((res >> 26) != ALC_HP_EVENT) |
| 10047 | return; |
| 10048 | alc262_lenovo_3000_automute(codec, 1); |
| 10049 | } |
| 10050 | |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 10051 | /* bind hp and internal speaker mute (with plug check) */ |
| 10052 | static int alc262_fujitsu_master_sw_put(struct snd_kcontrol *kcontrol, |
| 10053 | struct snd_ctl_elem_value *ucontrol) |
| 10054 | { |
| 10055 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 10056 | long *valp = ucontrol->value.integer.value; |
| 10057 | int change; |
| 10058 | |
Tony Vroon | 5d9fab2 | 2008-03-14 17:09:18 +0100 | [diff] [blame] | 10059 | change = snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 10060 | HDA_AMP_MUTE, |
| 10061 | valp ? 0 : HDA_AMP_MUTE); |
| 10062 | change |= snd_hda_codec_amp_stereo(codec, 0x1b, HDA_OUTPUT, 0, |
| 10063 | HDA_AMP_MUTE, |
| 10064 | valp ? 0 : HDA_AMP_MUTE); |
| 10065 | |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 10066 | if (change) |
| 10067 | alc262_fujitsu_automute(codec, 0); |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 10068 | return change; |
| 10069 | } |
| 10070 | |
| 10071 | static struct snd_kcontrol_new alc262_fujitsu_mixer[] = { |
Takashi Iwai | cca3b37 | 2007-08-10 17:12:15 +0200 | [diff] [blame] | 10072 | HDA_BIND_VOL("Master Playback Volume", &alc262_fujitsu_bind_master_vol), |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 10073 | { |
| 10074 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 10075 | .name = "Master Playback Switch", |
| 10076 | .info = snd_hda_mixer_amp_switch_info, |
| 10077 | .get = snd_hda_mixer_amp_switch_get, |
| 10078 | .put = alc262_fujitsu_master_sw_put, |
| 10079 | .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), |
| 10080 | }, |
| 10081 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 10082 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 10083 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 10084 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 10085 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Takashi Iwai | 39d3ed3 | 2007-10-12 15:03:48 +0200 | [diff] [blame] | 10086 | HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT), |
| 10087 | HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 10088 | HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 10089 | { } /* end */ |
| 10090 | }; |
| 10091 | |
Jiang zhe | 0e31daf | 2008-03-20 12:12:39 +0100 | [diff] [blame] | 10092 | /* bind hp and internal speaker mute (with plug check) */ |
| 10093 | static int alc262_lenovo_3000_master_sw_put(struct snd_kcontrol *kcontrol, |
| 10094 | struct snd_ctl_elem_value *ucontrol) |
| 10095 | { |
| 10096 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 10097 | long *valp = ucontrol->value.integer.value; |
| 10098 | int change; |
| 10099 | |
| 10100 | change = snd_hda_codec_amp_stereo(codec, 0x1b, HDA_OUTPUT, 0, |
| 10101 | HDA_AMP_MUTE, |
| 10102 | valp ? 0 : HDA_AMP_MUTE); |
| 10103 | |
| 10104 | if (change) |
| 10105 | alc262_lenovo_3000_automute(codec, 0); |
| 10106 | return change; |
| 10107 | } |
| 10108 | |
| 10109 | static struct snd_kcontrol_new alc262_lenovo_3000_mixer[] = { |
| 10110 | HDA_BIND_VOL("Master Playback Volume", &alc262_fujitsu_bind_master_vol), |
| 10111 | { |
| 10112 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 10113 | .name = "Master Playback Switch", |
| 10114 | .info = snd_hda_mixer_amp_switch_info, |
| 10115 | .get = snd_hda_mixer_amp_switch_get, |
| 10116 | .put = alc262_lenovo_3000_master_sw_put, |
| 10117 | .private_value = HDA_COMPOSE_AMP_VAL(0x1b, 3, 0, HDA_OUTPUT), |
| 10118 | }, |
| 10119 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 10120 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 10121 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 10122 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 10123 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 10124 | HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT), |
| 10125 | HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 10126 | HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 10127 | { } /* end */ |
| 10128 | }; |
| 10129 | |
Hiroshi Miura | 9f99a63 | 2008-08-28 16:09:06 +0200 | [diff] [blame] | 10130 | static struct snd_kcontrol_new alc262_toshiba_rx1_mixer[] = { |
| 10131 | HDA_BIND_VOL("Master Playback Volume", &alc262_fujitsu_bind_master_vol), |
| 10132 | { |
| 10133 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 10134 | .name = "Master Playback Switch", |
| 10135 | .info = snd_hda_mixer_amp_switch_info, |
| 10136 | .get = snd_hda_mixer_amp_switch_get, |
| 10137 | .put = alc262_sony_master_sw_put, |
| 10138 | .private_value = HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT), |
| 10139 | }, |
| 10140 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 10141 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 10142 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 10143 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 10144 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 10145 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
| 10146 | { } /* end */ |
| 10147 | }; |
| 10148 | |
Takashi Iwai | 304dcaa | 2006-07-25 14:51:16 +0200 | [diff] [blame] | 10149 | /* additional init verbs for Benq laptops */ |
| 10150 | static struct hda_verb alc262_EAPD_verbs[] = { |
| 10151 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 10152 | {0x20, AC_VERB_SET_PROC_COEF, 0x3070}, |
| 10153 | {} |
| 10154 | }; |
| 10155 | |
Kailang Yang | 83c3421 | 2007-07-05 11:43:05 +0200 | [diff] [blame] | 10156 | static struct hda_verb alc262_benq_t31_EAPD_verbs[] = { |
| 10157 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 10158 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 10159 | |
| 10160 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 10161 | {0x20, AC_VERB_SET_PROC_COEF, 0x3050}, |
| 10162 | {} |
| 10163 | }; |
| 10164 | |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 10165 | /* Samsung Q1 Ultra Vista model setup */ |
| 10166 | static struct snd_kcontrol_new alc262_ultra_mixer[] = { |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 10167 | HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 10168 | HDA_BIND_MUTE("Master Playback Switch", 0x0c, 2, HDA_INPUT), |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 10169 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 10170 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 10171 | HDA_CODEC_VOLUME("Mic Boost", 0x19, 0, HDA_INPUT), |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 10172 | HDA_CODEC_VOLUME("Headphone Mic Boost", 0x15, 0, HDA_INPUT), |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 10173 | { } /* end */ |
| 10174 | }; |
| 10175 | |
| 10176 | static struct hda_verb alc262_ultra_verbs[] = { |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 10177 | /* output mixer */ |
| 10178 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 10179 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 10180 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 10181 | /* speaker */ |
| 10182 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 10183 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 10184 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10185 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 10186 | /* HP */ |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 10187 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 10188 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 10189 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10190 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 10191 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 10192 | /* internal mic */ |
| 10193 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 10194 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 10195 | /* ADC, choose mic */ |
| 10196 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 10197 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 10198 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 10199 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 10200 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 10201 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 10202 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, |
| 10203 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, |
| 10204 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, |
| 10205 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(8)}, |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 10206 | {} |
| 10207 | }; |
| 10208 | |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 10209 | /* mute/unmute internal speaker according to the hp jack and mute state */ |
| 10210 | static void alc262_ultra_automute(struct hda_codec *codec) |
| 10211 | { |
| 10212 | struct alc_spec *spec = codec->spec; |
| 10213 | unsigned int mute; |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 10214 | |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 10215 | mute = 0; |
| 10216 | /* auto-mute only when HP is used as HP */ |
| 10217 | if (!spec->cur_mux[0]) { |
| 10218 | unsigned int present; |
| 10219 | /* need to execute and sync at first */ |
| 10220 | snd_hda_codec_read(codec, 0x15, 0, AC_VERB_SET_PIN_SENSE, 0); |
| 10221 | present = snd_hda_codec_read(codec, 0x15, 0, |
| 10222 | AC_VERB_GET_PIN_SENSE, 0); |
| 10223 | spec->jack_present = (present & AC_PINSENSE_PRESENCE) != 0; |
| 10224 | if (spec->jack_present) |
| 10225 | mute = HDA_AMP_MUTE; |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 10226 | } |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 10227 | /* mute/unmute internal speaker */ |
| 10228 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 10229 | HDA_AMP_MUTE, mute); |
| 10230 | /* mute/unmute HP */ |
| 10231 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 10232 | HDA_AMP_MUTE, mute ? 0 : HDA_AMP_MUTE); |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 10233 | } |
| 10234 | |
| 10235 | /* unsolicited event for HP jack sensing */ |
| 10236 | static void alc262_ultra_unsol_event(struct hda_codec *codec, |
| 10237 | unsigned int res) |
| 10238 | { |
| 10239 | if ((res >> 26) != ALC880_HP_EVENT) |
| 10240 | return; |
| 10241 | alc262_ultra_automute(codec); |
| 10242 | } |
| 10243 | |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 10244 | static struct hda_input_mux alc262_ultra_capture_source = { |
| 10245 | .num_items = 2, |
| 10246 | .items = { |
| 10247 | { "Mic", 0x1 }, |
| 10248 | { "Headphone", 0x7 }, |
| 10249 | }, |
| 10250 | }; |
| 10251 | |
| 10252 | static int alc262_ultra_mux_enum_put(struct snd_kcontrol *kcontrol, |
| 10253 | struct snd_ctl_elem_value *ucontrol) |
| 10254 | { |
| 10255 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 10256 | struct alc_spec *spec = codec->spec; |
| 10257 | int ret; |
| 10258 | |
Takashi Iwai | 54cbc9a | 2008-10-31 15:24:04 +0100 | [diff] [blame] | 10259 | ret = alc_mux_enum_put(kcontrol, ucontrol); |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 10260 | if (!ret) |
| 10261 | return 0; |
| 10262 | /* reprogram the HP pin as mic or HP according to the input source */ |
| 10263 | snd_hda_codec_write_cache(codec, 0x15, 0, |
| 10264 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 10265 | spec->cur_mux[0] ? PIN_VREF80 : PIN_HP); |
| 10266 | alc262_ultra_automute(codec); /* mute/unmute HP */ |
| 10267 | return ret; |
| 10268 | } |
| 10269 | |
| 10270 | static struct snd_kcontrol_new alc262_ultra_capture_mixer[] = { |
| 10271 | HDA_CODEC_VOLUME("Capture Volume", 0x07, 0x0, HDA_INPUT), |
| 10272 | HDA_CODEC_MUTE("Capture Switch", 0x07, 0x0, HDA_INPUT), |
| 10273 | { |
| 10274 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 10275 | .name = "Capture Source", |
Takashi Iwai | 54cbc9a | 2008-10-31 15:24:04 +0100 | [diff] [blame] | 10276 | .info = alc_mux_enum_info, |
| 10277 | .get = alc_mux_enum_get, |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 10278 | .put = alc262_ultra_mux_enum_put, |
| 10279 | }, |
| 10280 | { } /* end */ |
| 10281 | }; |
| 10282 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10283 | /* add playback controls from the parsed DAC table */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10284 | static int alc262_auto_create_multi_out_ctls(struct alc_spec *spec, |
| 10285 | const struct auto_pin_cfg *cfg) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10286 | { |
| 10287 | hda_nid_t nid; |
| 10288 | int err; |
| 10289 | |
| 10290 | spec->multiout.num_dacs = 1; /* only use one dac */ |
| 10291 | spec->multiout.dac_nids = spec->private_dac_nids; |
| 10292 | spec->multiout.dac_nids[0] = 2; |
| 10293 | |
| 10294 | nid = cfg->line_out_pins[0]; |
| 10295 | if (nid) { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10296 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 10297 | "Front Playback Volume", |
| 10298 | HDA_COMPOSE_AMP_VAL(0x0c, 3, 0, HDA_OUTPUT)); |
| 10299 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10300 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10301 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, |
| 10302 | "Front Playback Switch", |
| 10303 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT)); |
| 10304 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10305 | return err; |
| 10306 | } |
| 10307 | |
Takashi Iwai | 82bc955 | 2006-03-21 11:24:42 +0100 | [diff] [blame] | 10308 | nid = cfg->speaker_pins[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10309 | if (nid) { |
| 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 | "Speaker 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 | "Speaker 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 | "Speaker 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 | eb06ed8 | 2006-09-20 17:10:27 +0200 | [diff] [blame] | 10332 | nid = cfg->hp_pins[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10333 | if (nid) { |
| 10334 | /* spec->multiout.hp_nid = 2; */ |
| 10335 | if (nid == 0x16) { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10336 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 10337 | "Headphone Playback Volume", |
| 10338 | HDA_COMPOSE_AMP_VAL(0x0e, 2, 0, |
| 10339 | HDA_OUTPUT)); |
| 10340 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10341 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10342 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, |
| 10343 | "Headphone Playback Switch", |
| 10344 | HDA_COMPOSE_AMP_VAL(nid, 2, 0, |
| 10345 | HDA_OUTPUT)); |
| 10346 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10347 | return err; |
| 10348 | } else { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10349 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, |
| 10350 | "Headphone Playback Switch", |
| 10351 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, |
| 10352 | HDA_OUTPUT)); |
| 10353 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10354 | return err; |
| 10355 | } |
| 10356 | } |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10357 | return 0; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10358 | } |
| 10359 | |
| 10360 | /* identical with ALC880 */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10361 | #define alc262_auto_create_analog_input_ctls \ |
| 10362 | alc880_auto_create_analog_input_ctls |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10363 | |
| 10364 | /* |
| 10365 | * generic initialization of ADC, input mixers and output mixers |
| 10366 | */ |
| 10367 | static struct hda_verb alc262_volume_init_verbs[] = { |
| 10368 | /* |
| 10369 | * Unmute ADC0-2 and set the default input to mic-in |
| 10370 | */ |
| 10371 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 10372 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10373 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 10374 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10375 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 10376 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10377 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 10378 | /* 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] | 10379 | * mixer widget |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10380 | * Note: PASD motherboards uses the Line In 2 as the input for |
| 10381 | * front panel mic (mic 2) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10382 | */ |
| 10383 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 10384 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 10385 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 10386 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 10387 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 10388 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10389 | |
| 10390 | /* |
| 10391 | * Set up output mixers (0x0c - 0x0f) |
| 10392 | */ |
| 10393 | /* set vol=0 to output mixers */ |
| 10394 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 10395 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 10396 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 10397 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10398 | /* set up input amps for analog loopback */ |
| 10399 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 10400 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10401 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 10402 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10403 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 10404 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10405 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 10406 | |
| 10407 | /* FIXME: use matrix-type input source selection */ |
| 10408 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 10409 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ |
| 10410 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 10411 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 10412 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 10413 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 10414 | /* Input mixer2 */ |
| 10415 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 10416 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 10417 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 10418 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 10419 | /* Input mixer3 */ |
| 10420 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 10421 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 10422 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 10423 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 10424 | |
| 10425 | { } |
| 10426 | }; |
| 10427 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10428 | static struct hda_verb alc262_HP_BPC_init_verbs[] = { |
| 10429 | /* |
| 10430 | * Unmute ADC0-2 and set the default input to mic-in |
| 10431 | */ |
| 10432 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 10433 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10434 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 10435 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10436 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 10437 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10438 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 10439 | /* 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] | 10440 | * mixer widget |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10441 | * Note: PASD motherboards uses the Line In 2 as the input for |
| 10442 | * front panel mic (mic 2) |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10443 | */ |
| 10444 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 10445 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 10446 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 10447 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 10448 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 10449 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 10450 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, |
| 10451 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 10452 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10453 | /* |
| 10454 | * Set up output mixers (0x0c - 0x0e) |
| 10455 | */ |
| 10456 | /* set vol=0 to output mixers */ |
| 10457 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 10458 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 10459 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 10460 | |
| 10461 | /* set up input amps for analog loopback */ |
| 10462 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 10463 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10464 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 10465 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10466 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 10467 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10468 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 10469 | |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 10470 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10471 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 10472 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 10473 | |
| 10474 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 10475 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 10476 | |
| 10477 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 10478 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 10479 | |
| 10480 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 10481 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 10482 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 10483 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 10484 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 10485 | |
| 10486 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x7023 }, |
| 10487 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
| 10488 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
| 10489 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, 0x7023 }, |
| 10490 | {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
| 10491 | {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
| 10492 | |
| 10493 | |
| 10494 | /* FIXME: use matrix-type input source selection */ |
| 10495 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 10496 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ |
| 10497 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 10498 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))}, |
| 10499 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))}, |
| 10500 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))}, |
| 10501 | /* Input mixer2 */ |
| 10502 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 10503 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))}, |
| 10504 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))}, |
| 10505 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))}, |
| 10506 | /* Input mixer3 */ |
| 10507 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 10508 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))}, |
| 10509 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))}, |
| 10510 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))}, |
| 10511 | |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 10512 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 10513 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10514 | { } |
| 10515 | }; |
| 10516 | |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 10517 | static struct hda_verb alc262_HP_BPC_WildWest_init_verbs[] = { |
| 10518 | /* |
| 10519 | * Unmute ADC0-2 and set the default input to mic-in |
| 10520 | */ |
| 10521 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 10522 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10523 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 10524 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10525 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 10526 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10527 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 10528 | /* 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] | 10529 | * mixer widget |
| 10530 | * Note: PASD motherboards uses the Line In 2 as the input for front |
| 10531 | * panel mic (mic 2) |
| 10532 | */ |
| 10533 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 10534 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 10535 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 10536 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 10537 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 10538 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 10539 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, |
| 10540 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, |
| 10541 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 10542 | /* |
| 10543 | * Set up output mixers (0x0c - 0x0e) |
| 10544 | */ |
| 10545 | /* set vol=0 to output mixers */ |
| 10546 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 10547 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 10548 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 10549 | |
| 10550 | /* set up input amps for analog loopback */ |
| 10551 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 10552 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10553 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 10554 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10555 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 10556 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10557 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 10558 | |
| 10559 | |
| 10560 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, /* HP */ |
| 10561 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, /* Mono */ |
| 10562 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* rear MIC */ |
| 10563 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, /* Line in */ |
| 10564 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* Front MIC */ |
| 10565 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, /* Line out */ |
| 10566 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, /* CD in */ |
| 10567 | |
| 10568 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 10569 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 10570 | |
| 10571 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 10572 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 10573 | |
| 10574 | /* {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x7023 }, */ |
| 10575 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
| 10576 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
| 10577 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, 0x7023 }, |
| 10578 | {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
| 10579 | {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
| 10580 | |
| 10581 | /* FIXME: use matrix-type input source selection */ |
| 10582 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 10583 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ |
| 10584 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, /*rear MIC*/ |
| 10585 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, /*Line in*/ |
| 10586 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))}, /*F MIC*/ |
| 10587 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))}, /*Front*/ |
| 10588 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))}, /*CD*/ |
| 10589 | /* {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */ |
| 10590 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x07 << 8))}, /*HP*/ |
| 10591 | /* Input mixer2 */ |
| 10592 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 10593 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 10594 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))}, |
| 10595 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))}, |
| 10596 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))}, |
| 10597 | /* {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */ |
| 10598 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x07 << 8))}, |
| 10599 | /* Input mixer3 */ |
| 10600 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 10601 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 10602 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))}, |
| 10603 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))}, |
| 10604 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))}, |
| 10605 | /* {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */ |
| 10606 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x07 << 8))}, |
| 10607 | |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 10608 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 10609 | |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 10610 | { } |
| 10611 | }; |
| 10612 | |
Hiroshi Miura | 9f99a63 | 2008-08-28 16:09:06 +0200 | [diff] [blame] | 10613 | static struct hda_verb alc262_toshiba_rx1_unsol_verbs[] = { |
| 10614 | |
| 10615 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, /* Front Speaker */ |
| 10616 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 10617 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 10618 | |
| 10619 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* MIC jack */ |
| 10620 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* Front MIC */ |
| 10621 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0) }, |
| 10622 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0) }, |
| 10623 | |
| 10624 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, /* HP jack */ |
| 10625 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 10626 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 10627 | {} |
| 10628 | }; |
| 10629 | |
| 10630 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 10631 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 10632 | #define alc262_loopbacks alc880_loopbacks |
| 10633 | #endif |
| 10634 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10635 | /* pcm configuration: identiacal with ALC880 */ |
| 10636 | #define alc262_pcm_analog_playback alc880_pcm_analog_playback |
| 10637 | #define alc262_pcm_analog_capture alc880_pcm_analog_capture |
| 10638 | #define alc262_pcm_digital_playback alc880_pcm_digital_playback |
| 10639 | #define alc262_pcm_digital_capture alc880_pcm_digital_capture |
| 10640 | |
| 10641 | /* |
| 10642 | * BIOS auto configuration |
| 10643 | */ |
| 10644 | static int alc262_parse_auto_config(struct hda_codec *codec) |
| 10645 | { |
| 10646 | struct alc_spec *spec = codec->spec; |
| 10647 | int err; |
| 10648 | static hda_nid_t alc262_ignore[] = { 0x1d, 0 }; |
| 10649 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10650 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 10651 | alc262_ignore); |
| 10652 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10653 | return err; |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 10654 | if (!spec->autocfg.line_outs) { |
Takashi Iwai | 0852d7a | 2009-02-11 11:35:15 +0100 | [diff] [blame] | 10655 | if (spec->autocfg.dig_outs || spec->autocfg.dig_in_pin) { |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 10656 | spec->multiout.max_channels = 2; |
| 10657 | spec->no_analog = 1; |
| 10658 | goto dig_only; |
| 10659 | } |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10660 | return 0; /* can't find valid BIOS pin config */ |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 10661 | } |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10662 | err = alc262_auto_create_multi_out_ctls(spec, &spec->autocfg); |
| 10663 | if (err < 0) |
| 10664 | return err; |
| 10665 | err = alc262_auto_create_analog_input_ctls(spec, &spec->autocfg); |
| 10666 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10667 | return err; |
| 10668 | |
| 10669 | spec->multiout.max_channels = spec->multiout.num_dacs * 2; |
| 10670 | |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 10671 | dig_only: |
Takashi Iwai | 0852d7a | 2009-02-11 11:35:15 +0100 | [diff] [blame] | 10672 | if (spec->autocfg.dig_outs) { |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10673 | spec->multiout.dig_out_nid = ALC262_DIGOUT_NID; |
Takashi Iwai | 0852d7a | 2009-02-11 11:35:15 +0100 | [diff] [blame] | 10674 | spec->dig_out_type = spec->autocfg.dig_out_type[0]; |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 10675 | } |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10676 | if (spec->autocfg.dig_in_pin) |
| 10677 | spec->dig_in_nid = ALC262_DIGIN_NID; |
| 10678 | |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 10679 | if (spec->kctls.list) |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 10680 | add_mixer(spec, spec->kctls.list); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10681 | |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 10682 | add_verb(spec, alc262_volume_init_verbs); |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 10683 | spec->num_mux_defs = 1; |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 10684 | spec->input_mux = &spec->private_imux[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10685 | |
Takashi Iwai | 776e184 | 2007-08-29 15:07:11 +0200 | [diff] [blame] | 10686 | err = alc_auto_add_mic_boost(codec); |
| 10687 | if (err < 0) |
| 10688 | return err; |
| 10689 | |
Takashi Iwai | e044c39 | 2008-10-27 16:56:24 +0100 | [diff] [blame] | 10690 | store_pin_configs(codec); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10691 | return 1; |
| 10692 | } |
| 10693 | |
| 10694 | #define alc262_auto_init_multi_out alc882_auto_init_multi_out |
| 10695 | #define alc262_auto_init_hp_out alc882_auto_init_hp_out |
| 10696 | #define alc262_auto_init_analog_input alc882_auto_init_analog_input |
Takashi Iwai | f511b01 | 2008-08-15 16:46:42 +0200 | [diff] [blame] | 10697 | #define alc262_auto_init_input_src alc882_auto_init_input_src |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10698 | |
| 10699 | |
| 10700 | /* init callback for auto-configuration model -- overriding the default init */ |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 10701 | static void alc262_auto_init(struct hda_codec *codec) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10702 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 10703 | struct alc_spec *spec = codec->spec; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10704 | alc262_auto_init_multi_out(codec); |
| 10705 | alc262_auto_init_hp_out(codec); |
| 10706 | alc262_auto_init_analog_input(codec); |
Takashi Iwai | f511b01 | 2008-08-15 16:46:42 +0200 | [diff] [blame] | 10707 | alc262_auto_init_input_src(codec); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 10708 | if (spec->unsol_event) |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 10709 | alc_inithook(codec); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10710 | } |
| 10711 | |
| 10712 | /* |
| 10713 | * configuration and preset |
| 10714 | */ |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 10715 | static const char *alc262_models[ALC262_MODEL_LAST] = { |
| 10716 | [ALC262_BASIC] = "basic", |
| 10717 | [ALC262_HIPPO] = "hippo", |
| 10718 | [ALC262_HIPPO_1] = "hippo_1", |
| 10719 | [ALC262_FUJITSU] = "fujitsu", |
| 10720 | [ALC262_HP_BPC] = "hp-bpc", |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 10721 | [ALC262_HP_BPC_D7000_WL]= "hp-bpc-d7000", |
Takashi Iwai | 61dc35d | 2007-11-14 12:26:44 +0100 | [diff] [blame] | 10722 | [ALC262_HP_TC_T5735] = "hp-tc-t5735", |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 10723 | [ALC262_HP_RP5700] = "hp-rp5700", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 10724 | [ALC262_BENQ_ED8] = "benq", |
Takashi Iwai | 0f40502 | 2007-07-06 12:24:11 +0200 | [diff] [blame] | 10725 | [ALC262_BENQ_T31] = "benq-t31", |
| 10726 | [ALC262_SONY_ASSAMD] = "sony-assamd", |
Takashi Iwai | 2922c9a | 2008-08-27 18:12:42 +0200 | [diff] [blame] | 10727 | [ALC262_TOSHIBA_S06] = "toshiba-s06", |
Hiroshi Miura | 9f99a63 | 2008-08-28 16:09:06 +0200 | [diff] [blame] | 10728 | [ALC262_TOSHIBA_RX1] = "toshiba-rx1", |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 10729 | [ALC262_ULTRA] = "ultra", |
Jiang zhe | 0e31daf | 2008-03-20 12:12:39 +0100 | [diff] [blame] | 10730 | [ALC262_LENOVO_3000] = "lenovo-3000", |
Pascal Terjan | e8f9ae2 | 2008-08-04 14:36:05 +0200 | [diff] [blame] | 10731 | [ALC262_NEC] = "nec", |
Tony Vroon | ba340e8 | 2009-02-02 19:01:30 +0000 | [diff] [blame] | 10732 | [ALC262_TYAN] = "tyan", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 10733 | [ALC262_AUTO] = "auto", |
| 10734 | }; |
| 10735 | |
| 10736 | static struct snd_pci_quirk alc262_cfg_tbl[] = { |
| 10737 | SND_PCI_QUIRK(0x1002, 0x437b, "Hippo", ALC262_HIPPO), |
Pascal Terjan | e8f9ae2 | 2008-08-04 14:36:05 +0200 | [diff] [blame] | 10738 | SND_PCI_QUIRK(0x1033, 0x8895, "NEC Versa S9100", ALC262_NEC), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 10739 | SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x1200, "HP xw series", |
| 10740 | ALC262_HP_BPC), |
| 10741 | SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x1300, "HP xw series", |
| 10742 | ALC262_HP_BPC), |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 10743 | SND_PCI_QUIRK(0x103c, 0x2800, "HP D7000", ALC262_HP_BPC_D7000_WL), |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 10744 | SND_PCI_QUIRK(0x103c, 0x2801, "HP D7000", ALC262_HP_BPC_D7000_WF), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 10745 | SND_PCI_QUIRK(0x103c, 0x2802, "HP D7000", ALC262_HP_BPC_D7000_WL), |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 10746 | SND_PCI_QUIRK(0x103c, 0x2803, "HP D7000", ALC262_HP_BPC_D7000_WF), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 10747 | SND_PCI_QUIRK(0x103c, 0x2804, "HP D7000", ALC262_HP_BPC_D7000_WL), |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 10748 | SND_PCI_QUIRK(0x103c, 0x2805, "HP D7000", ALC262_HP_BPC_D7000_WF), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 10749 | SND_PCI_QUIRK(0x103c, 0x2806, "HP D7000", ALC262_HP_BPC_D7000_WL), |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 10750 | SND_PCI_QUIRK(0x103c, 0x2807, "HP D7000", ALC262_HP_BPC_D7000_WF), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 10751 | SND_PCI_QUIRK(0x103c, 0x280c, "HP xw4400", ALC262_HP_BPC), |
| 10752 | SND_PCI_QUIRK(0x103c, 0x3014, "HP xw6400", ALC262_HP_BPC), |
| 10753 | SND_PCI_QUIRK(0x103c, 0x3015, "HP xw8400", ALC262_HP_BPC), |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 10754 | SND_PCI_QUIRK(0x103c, 0x302f, "HP Thin Client T5735", |
| 10755 | ALC262_HP_TC_T5735), |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 10756 | SND_PCI_QUIRK(0x103c, 0x2817, "HP RP5700", ALC262_HP_RP5700), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 10757 | SND_PCI_QUIRK(0x104d, 0x1f00, "Sony ASSAMD", ALC262_SONY_ASSAMD), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 10758 | SND_PCI_QUIRK(0x104d, 0x8203, "Sony UX-90", ALC262_HIPPO), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 10759 | SND_PCI_QUIRK(0x104d, 0x820f, "Sony ASSAMD", ALC262_SONY_ASSAMD), |
| 10760 | SND_PCI_QUIRK(0x104d, 0x900e, "Sony ASSAMD", ALC262_SONY_ASSAMD), |
| 10761 | SND_PCI_QUIRK(0x104d, 0x9015, "Sony 0x9015", ALC262_SONY_ASSAMD), |
Takashi Iwai | 57a5ef4 | 2008-11-28 14:46:28 +0100 | [diff] [blame] | 10762 | SND_PCI_QUIRK(0x104d, 0x9033, "Sony VAIO VGN-SR19XN", |
| 10763 | ALC262_SONY_ASSAMD), |
Akio Idehara | 36ca6e1 | 2008-06-09 22:57:40 +0900 | [diff] [blame] | 10764 | SND_PCI_QUIRK(0x1179, 0x0001, "Toshiba dynabook SS RX1", |
Hiroshi Miura | 9f99a63 | 2008-08-28 16:09:06 +0200 | [diff] [blame] | 10765 | ALC262_TOSHIBA_RX1), |
Kailang Yang | 80ffe86 | 2008-10-15 11:23:27 +0200 | [diff] [blame] | 10766 | SND_PCI_QUIRK(0x1179, 0xff7b, "Toshiba S06", ALC262_TOSHIBA_S06), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 10767 | SND_PCI_QUIRK(0x10cf, 0x1397, "Fujitsu", ALC262_FUJITSU), |
Tony Vroon | 3f1eeae | 2008-02-25 16:44:13 +0100 | [diff] [blame] | 10768 | SND_PCI_QUIRK(0x10cf, 0x142d, "Fujitsu Lifebook E8410", ALC262_FUJITSU), |
Tony Vroon | ba340e8 | 2009-02-02 19:01:30 +0000 | [diff] [blame] | 10769 | SND_PCI_QUIRK(0x10f1, 0x2915, "Tyan Thunder n6650W", ALC262_TYAN), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 10770 | SND_PCI_QUIRK_MASK(0x144d, 0xff00, 0xc032, "Samsung Q1", |
| 10771 | ALC262_ULTRA), |
Luke Yelavich | 3e420e7 | 2008-12-16 12:37:47 +1100 | [diff] [blame] | 10772 | SND_PCI_QUIRK(0x144d, 0xc510, "Samsung Q45", ALC262_HIPPO), |
Jiang zhe | 0e31daf | 2008-03-20 12:12:39 +0100 | [diff] [blame] | 10773 | SND_PCI_QUIRK(0x17aa, 0x384e, "Lenovo 3000 y410", ALC262_LENOVO_3000), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 10774 | SND_PCI_QUIRK(0x17ff, 0x0560, "Benq ED8", ALC262_BENQ_ED8), |
Kailang Yang | 83c3421 | 2007-07-05 11:43:05 +0200 | [diff] [blame] | 10775 | SND_PCI_QUIRK(0x17ff, 0x058d, "Benq T31-16", ALC262_BENQ_T31), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 10776 | SND_PCI_QUIRK(0x17ff, 0x058f, "Benq Hippo", ALC262_HIPPO_1), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10777 | {} |
| 10778 | }; |
| 10779 | |
| 10780 | static struct alc_config_preset alc262_presets[] = { |
| 10781 | [ALC262_BASIC] = { |
| 10782 | .mixers = { alc262_base_mixer }, |
| 10783 | .init_verbs = { alc262_init_verbs }, |
| 10784 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 10785 | .dac_nids = alc262_dac_nids, |
| 10786 | .hp_nid = 0x03, |
| 10787 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 10788 | .channel_mode = alc262_modes, |
Takashi Iwai | a3bcba3 | 2005-12-06 19:05:29 +0100 | [diff] [blame] | 10789 | .input_mux = &alc262_capture_source, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10790 | }, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 10791 | [ALC262_HIPPO] = { |
| 10792 | .mixers = { alc262_base_mixer }, |
| 10793 | .init_verbs = { alc262_init_verbs, alc262_hippo_unsol_verbs}, |
| 10794 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 10795 | .dac_nids = alc262_dac_nids, |
| 10796 | .hp_nid = 0x03, |
| 10797 | .dig_out_nid = ALC262_DIGOUT_NID, |
| 10798 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 10799 | .channel_mode = alc262_modes, |
| 10800 | .input_mux = &alc262_capture_source, |
| 10801 | .unsol_event = alc262_hippo_unsol_event, |
Takashi Iwai | 5b31954 | 2007-07-26 11:49:22 +0200 | [diff] [blame] | 10802 | .init_hook = alc262_hippo_automute, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 10803 | }, |
| 10804 | [ALC262_HIPPO_1] = { |
| 10805 | .mixers = { alc262_hippo1_mixer }, |
| 10806 | .init_verbs = { alc262_init_verbs, alc262_hippo1_unsol_verbs}, |
| 10807 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 10808 | .dac_nids = alc262_dac_nids, |
| 10809 | .hp_nid = 0x02, |
| 10810 | .dig_out_nid = ALC262_DIGOUT_NID, |
| 10811 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 10812 | .channel_mode = alc262_modes, |
| 10813 | .input_mux = &alc262_capture_source, |
| 10814 | .unsol_event = alc262_hippo1_unsol_event, |
Takashi Iwai | 5b31954 | 2007-07-26 11:49:22 +0200 | [diff] [blame] | 10815 | .init_hook = alc262_hippo1_automute, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 10816 | }, |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 10817 | [ALC262_FUJITSU] = { |
| 10818 | .mixers = { alc262_fujitsu_mixer }, |
Takashi Iwai | 39d3ed3 | 2007-10-12 15:03:48 +0200 | [diff] [blame] | 10819 | .init_verbs = { alc262_init_verbs, alc262_EAPD_verbs, |
| 10820 | alc262_fujitsu_unsol_verbs }, |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 10821 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 10822 | .dac_nids = alc262_dac_nids, |
| 10823 | .hp_nid = 0x03, |
| 10824 | .dig_out_nid = ALC262_DIGOUT_NID, |
| 10825 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 10826 | .channel_mode = alc262_modes, |
| 10827 | .input_mux = &alc262_fujitsu_capture_source, |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 10828 | .unsol_event = alc262_fujitsu_unsol_event, |
Takashi Iwai | ebc7a40 | 2008-05-20 09:23:05 +0200 | [diff] [blame] | 10829 | .init_hook = alc262_fujitsu_init_hook, |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 10830 | }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10831 | [ALC262_HP_BPC] = { |
| 10832 | .mixers = { alc262_HP_BPC_mixer }, |
| 10833 | .init_verbs = { alc262_HP_BPC_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, |
| 10839 | .input_mux = &alc262_HP_capture_source, |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 10840 | .unsol_event = alc262_hp_bpc_unsol_event, |
| 10841 | .init_hook = alc262_hp_bpc_automute, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10842 | }, |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 10843 | [ALC262_HP_BPC_D7000_WF] = { |
| 10844 | .mixers = { alc262_HP_BPC_WildWest_mixer }, |
| 10845 | .init_verbs = { alc262_HP_BPC_WildWest_init_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, |
zhejiang | accbe49 | 2007-08-31 12:36:05 +0200 | [diff] [blame] | 10851 | .input_mux = &alc262_HP_D7000_capture_source, |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 10852 | .unsol_event = alc262_hp_wildwest_unsol_event, |
| 10853 | .init_hook = alc262_hp_wildwest_automute, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10854 | }, |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 10855 | [ALC262_HP_BPC_D7000_WL] = { |
| 10856 | .mixers = { alc262_HP_BPC_WildWest_mixer, |
| 10857 | alc262_HP_BPC_WildWest_option_mixer }, |
| 10858 | .init_verbs = { alc262_HP_BPC_WildWest_init_verbs }, |
| 10859 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 10860 | .dac_nids = alc262_dac_nids, |
| 10861 | .hp_nid = 0x03, |
| 10862 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 10863 | .channel_mode = alc262_modes, |
zhejiang | accbe49 | 2007-08-31 12:36:05 +0200 | [diff] [blame] | 10864 | .input_mux = &alc262_HP_D7000_capture_source, |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 10865 | .unsol_event = alc262_hp_wildwest_unsol_event, |
| 10866 | .init_hook = alc262_hp_wildwest_automute, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10867 | }, |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 10868 | [ALC262_HP_TC_T5735] = { |
| 10869 | .mixers = { alc262_hp_t5735_mixer }, |
| 10870 | .init_verbs = { alc262_init_verbs, alc262_hp_t5735_verbs }, |
| 10871 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 10872 | .dac_nids = alc262_dac_nids, |
| 10873 | .hp_nid = 0x03, |
| 10874 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 10875 | .channel_mode = alc262_modes, |
| 10876 | .input_mux = &alc262_capture_source, |
| 10877 | .unsol_event = alc262_hp_t5735_unsol_event, |
| 10878 | .init_hook = alc262_hp_t5735_init_hook, |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 10879 | }, |
| 10880 | [ALC262_HP_RP5700] = { |
| 10881 | .mixers = { alc262_hp_rp5700_mixer }, |
| 10882 | .init_verbs = { alc262_init_verbs, alc262_hp_rp5700_verbs }, |
| 10883 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 10884 | .dac_nids = alc262_dac_nids, |
| 10885 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 10886 | .channel_mode = alc262_modes, |
| 10887 | .input_mux = &alc262_hp_rp5700_capture_source, |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 10888 | }, |
Takashi Iwai | 304dcaa | 2006-07-25 14:51:16 +0200 | [diff] [blame] | 10889 | [ALC262_BENQ_ED8] = { |
| 10890 | .mixers = { alc262_base_mixer }, |
| 10891 | .init_verbs = { alc262_init_verbs, alc262_EAPD_verbs }, |
| 10892 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 10893 | .dac_nids = alc262_dac_nids, |
| 10894 | .hp_nid = 0x03, |
| 10895 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 10896 | .channel_mode = alc262_modes, |
| 10897 | .input_mux = &alc262_capture_source, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10898 | }, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 10899 | [ALC262_SONY_ASSAMD] = { |
| 10900 | .mixers = { alc262_sony_mixer }, |
| 10901 | .init_verbs = { alc262_init_verbs, alc262_sony_unsol_verbs}, |
| 10902 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 10903 | .dac_nids = alc262_dac_nids, |
| 10904 | .hp_nid = 0x02, |
| 10905 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 10906 | .channel_mode = alc262_modes, |
| 10907 | .input_mux = &alc262_capture_source, |
| 10908 | .unsol_event = alc262_hippo_unsol_event, |
Takashi Iwai | 5b31954 | 2007-07-26 11:49:22 +0200 | [diff] [blame] | 10909 | .init_hook = alc262_hippo_automute, |
Kailang Yang | 83c3421 | 2007-07-05 11:43:05 +0200 | [diff] [blame] | 10910 | }, |
| 10911 | [ALC262_BENQ_T31] = { |
| 10912 | .mixers = { alc262_benq_t31_mixer }, |
| 10913 | .init_verbs = { alc262_init_verbs, alc262_benq_t31_EAPD_verbs, alc262_hippo_unsol_verbs }, |
| 10914 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 10915 | .dac_nids = alc262_dac_nids, |
| 10916 | .hp_nid = 0x03, |
| 10917 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 10918 | .channel_mode = alc262_modes, |
| 10919 | .input_mux = &alc262_capture_source, |
| 10920 | .unsol_event = alc262_hippo_unsol_event, |
Takashi Iwai | 5b31954 | 2007-07-26 11:49:22 +0200 | [diff] [blame] | 10921 | .init_hook = alc262_hippo_automute, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 10922 | }, |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 10923 | [ALC262_ULTRA] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 10924 | .mixers = { alc262_ultra_mixer }, |
| 10925 | .cap_mixer = alc262_ultra_capture_mixer, |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 10926 | .init_verbs = { alc262_ultra_verbs }, |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 10927 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 10928 | .dac_nids = alc262_dac_nids, |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 10929 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 10930 | .channel_mode = alc262_modes, |
| 10931 | .input_mux = &alc262_ultra_capture_source, |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 10932 | .adc_nids = alc262_adc_nids, /* ADC0 */ |
| 10933 | .capsrc_nids = alc262_capsrc_nids, |
| 10934 | .num_adc_nids = 1, /* single ADC */ |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 10935 | .unsol_event = alc262_ultra_unsol_event, |
| 10936 | .init_hook = alc262_ultra_automute, |
| 10937 | }, |
Jiang zhe | 0e31daf | 2008-03-20 12:12:39 +0100 | [diff] [blame] | 10938 | [ALC262_LENOVO_3000] = { |
| 10939 | .mixers = { alc262_lenovo_3000_mixer }, |
| 10940 | .init_verbs = { alc262_init_verbs, alc262_EAPD_verbs, |
| 10941 | alc262_lenovo_3000_unsol_verbs }, |
| 10942 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 10943 | .dac_nids = alc262_dac_nids, |
| 10944 | .hp_nid = 0x03, |
| 10945 | .dig_out_nid = ALC262_DIGOUT_NID, |
| 10946 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 10947 | .channel_mode = alc262_modes, |
| 10948 | .input_mux = &alc262_fujitsu_capture_source, |
| 10949 | .unsol_event = alc262_lenovo_3000_unsol_event, |
| 10950 | }, |
Pascal Terjan | e8f9ae2 | 2008-08-04 14:36:05 +0200 | [diff] [blame] | 10951 | [ALC262_NEC] = { |
| 10952 | .mixers = { alc262_nec_mixer }, |
| 10953 | .init_verbs = { alc262_nec_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 | }, |
Kailang Yang | 4e555fe | 2008-08-26 13:05:55 +0200 | [diff] [blame] | 10961 | [ALC262_TOSHIBA_S06] = { |
| 10962 | .mixers = { alc262_toshiba_s06_mixer }, |
| 10963 | .init_verbs = { alc262_init_verbs, alc262_toshiba_s06_verbs, |
| 10964 | alc262_eapd_verbs }, |
| 10965 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 10966 | .capsrc_nids = alc262_dmic_capsrc_nids, |
| 10967 | .dac_nids = alc262_dac_nids, |
| 10968 | .adc_nids = alc262_dmic_adc_nids, /* ADC0 */ |
| 10969 | .dig_out_nid = ALC262_DIGOUT_NID, |
| 10970 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 10971 | .channel_mode = alc262_modes, |
| 10972 | .input_mux = &alc262_dmic_capture_source, |
| 10973 | .unsol_event = alc262_toshiba_s06_unsol_event, |
| 10974 | .init_hook = alc262_toshiba_s06_init_hook, |
| 10975 | }, |
Hiroshi Miura | 9f99a63 | 2008-08-28 16:09:06 +0200 | [diff] [blame] | 10976 | [ALC262_TOSHIBA_RX1] = { |
| 10977 | .mixers = { alc262_toshiba_rx1_mixer }, |
| 10978 | .init_verbs = { alc262_init_verbs, alc262_toshiba_rx1_unsol_verbs }, |
| 10979 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 10980 | .dac_nids = alc262_dac_nids, |
| 10981 | .hp_nid = 0x03, |
| 10982 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 10983 | .channel_mode = alc262_modes, |
| 10984 | .input_mux = &alc262_capture_source, |
| 10985 | .unsol_event = alc262_hippo_unsol_event, |
| 10986 | .init_hook = alc262_hippo_automute, |
| 10987 | }, |
Tony Vroon | ba340e8 | 2009-02-02 19:01:30 +0000 | [diff] [blame] | 10988 | [ALC262_TYAN] = { |
| 10989 | .mixers = { alc262_tyan_mixer }, |
| 10990 | .init_verbs = { alc262_init_verbs, alc262_tyan_verbs}, |
| 10991 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 10992 | .dac_nids = alc262_dac_nids, |
| 10993 | .hp_nid = 0x02, |
| 10994 | .dig_out_nid = ALC262_DIGOUT_NID, |
| 10995 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 10996 | .channel_mode = alc262_modes, |
| 10997 | .input_mux = &alc262_capture_source, |
| 10998 | .unsol_event = alc262_tyan_unsol_event, |
| 10999 | .init_hook = alc262_tyan_automute, |
| 11000 | }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11001 | }; |
| 11002 | |
| 11003 | static int patch_alc262(struct hda_codec *codec) |
| 11004 | { |
| 11005 | struct alc_spec *spec; |
| 11006 | int board_config; |
| 11007 | int err; |
| 11008 | |
Robert P. J. Day | dc041e0 | 2006-12-19 14:44:15 +0100 | [diff] [blame] | 11009 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11010 | if (spec == NULL) |
| 11011 | return -ENOMEM; |
| 11012 | |
| 11013 | codec->spec = spec; |
| 11014 | #if 0 |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11015 | /* pshou 07/11/05 set a zero PCM sample to DAC when FIFO is |
| 11016 | * under-run |
| 11017 | */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11018 | { |
| 11019 | int tmp; |
| 11020 | snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_COEF_INDEX, 7); |
| 11021 | tmp = snd_hda_codec_read(codec, 0x20, 0, AC_VERB_GET_PROC_COEF, 0); |
| 11022 | snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_COEF_INDEX, 7); |
| 11023 | snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_PROC_COEF, tmp | 0x80); |
| 11024 | } |
| 11025 | #endif |
| 11026 | |
Takashi Iwai | 2c3bf9a | 2008-06-04 12:39:38 +0200 | [diff] [blame] | 11027 | alc_fix_pll_init(codec, 0x20, 0x0a, 10); |
| 11028 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 11029 | board_config = snd_hda_check_board_config(codec, ALC262_MODEL_LAST, |
| 11030 | alc262_models, |
| 11031 | alc262_cfg_tbl); |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 11032 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 11033 | if (board_config < 0) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11034 | printk(KERN_INFO "hda_codec: Unknown model for ALC262, " |
| 11035 | "trying auto-probe from BIOS...\n"); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11036 | board_config = ALC262_AUTO; |
| 11037 | } |
| 11038 | |
| 11039 | if (board_config == ALC262_AUTO) { |
| 11040 | /* automatic parse from the BIOS config */ |
| 11041 | err = alc262_parse_auto_config(codec); |
| 11042 | if (err < 0) { |
| 11043 | alc_free(codec); |
| 11044 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11045 | } else if (!err) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11046 | printk(KERN_INFO |
| 11047 | "hda_codec: Cannot set up configuration " |
| 11048 | "from BIOS. Using base mode...\n"); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11049 | board_config = ALC262_BASIC; |
| 11050 | } |
| 11051 | } |
| 11052 | |
Kusanagi Kouichi | 680cd53 | 2009-02-05 00:00:58 +0900 | [diff] [blame] | 11053 | err = snd_hda_attach_beep_device(codec, 0x1); |
| 11054 | if (err < 0) { |
| 11055 | alc_free(codec); |
| 11056 | return err; |
| 11057 | } |
| 11058 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11059 | if (board_config != ALC262_AUTO) |
| 11060 | setup_preset(spec, &alc262_presets[board_config]); |
| 11061 | |
| 11062 | spec->stream_name_analog = "ALC262 Analog"; |
| 11063 | spec->stream_analog_playback = &alc262_pcm_analog_playback; |
| 11064 | spec->stream_analog_capture = &alc262_pcm_analog_capture; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 11065 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11066 | spec->stream_name_digital = "ALC262 Digital"; |
| 11067 | spec->stream_digital_playback = &alc262_pcm_digital_playback; |
| 11068 | spec->stream_digital_capture = &alc262_pcm_digital_capture; |
| 11069 | |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 11070 | spec->capture_style = CAPT_MIX; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11071 | if (!spec->adc_nids && spec->input_mux) { |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11072 | /* check whether NID 0x07 is valid */ |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 11073 | unsigned int wcap = get_wcaps(codec, 0x07); |
| 11074 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11075 | /* get type */ |
| 11076 | wcap = (wcap & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11077 | if (wcap != AC_WID_AUD_IN) { |
| 11078 | spec->adc_nids = alc262_adc_nids_alt; |
| 11079 | spec->num_adc_nids = ARRAY_SIZE(alc262_adc_nids_alt); |
Takashi Iwai | 88c71a9 | 2008-02-14 17:27:17 +0100 | [diff] [blame] | 11080 | spec->capsrc_nids = alc262_capsrc_nids_alt; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11081 | } else { |
| 11082 | spec->adc_nids = alc262_adc_nids; |
| 11083 | spec->num_adc_nids = ARRAY_SIZE(alc262_adc_nids); |
Takashi Iwai | 88c71a9 | 2008-02-14 17:27:17 +0100 | [diff] [blame] | 11084 | spec->capsrc_nids = alc262_capsrc_nids; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11085 | } |
| 11086 | } |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 11087 | if (!spec->cap_mixer && !spec->no_analog) |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 11088 | set_capture_mixer(spec); |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 11089 | set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11090 | |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 11091 | spec->vmaster_nid = 0x0c; |
| 11092 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11093 | codec->patch_ops = alc_patch_ops; |
| 11094 | if (board_config == ALC262_AUTO) |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 11095 | spec->init_hook = alc262_auto_init; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 11096 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 11097 | if (!spec->loopback.amplist) |
| 11098 | spec->loopback.amplist = alc262_loopbacks; |
| 11099 | #endif |
Takashi Iwai | daead53 | 2008-11-28 12:55:36 +0100 | [diff] [blame] | 11100 | codec->proc_widget_hook = print_realtek_coef; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 11101 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11102 | return 0; |
| 11103 | } |
| 11104 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11105 | /* |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11106 | * ALC268 channel source setting (2 channel) |
| 11107 | */ |
| 11108 | #define ALC268_DIGOUT_NID ALC880_DIGOUT_NID |
| 11109 | #define alc268_modes alc260_modes |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 11110 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11111 | static hda_nid_t alc268_dac_nids[2] = { |
| 11112 | /* front, hp */ |
| 11113 | 0x02, 0x03 |
| 11114 | }; |
| 11115 | |
| 11116 | static hda_nid_t alc268_adc_nids[2] = { |
| 11117 | /* ADC0-1 */ |
| 11118 | 0x08, 0x07 |
| 11119 | }; |
| 11120 | |
| 11121 | static hda_nid_t alc268_adc_nids_alt[1] = { |
| 11122 | /* ADC0 */ |
| 11123 | 0x08 |
| 11124 | }; |
| 11125 | |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 11126 | static hda_nid_t alc268_capsrc_nids[2] = { 0x23, 0x24 }; |
| 11127 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11128 | static struct snd_kcontrol_new alc268_base_mixer[] = { |
| 11129 | /* output mixer control */ |
| 11130 | HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT), |
| 11131 | HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 11132 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x3, 0x0, HDA_OUTPUT), |
| 11133 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
Takashi Iwai | 33bf17a | 2007-08-21 11:51:42 +0200 | [diff] [blame] | 11134 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 11135 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
| 11136 | HDA_CODEC_VOLUME("Line In Boost", 0x1a, 0, HDA_INPUT), |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11137 | { } |
| 11138 | }; |
| 11139 | |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 11140 | /* bind Beep switches of both NID 0x0f and 0x10 */ |
| 11141 | static struct hda_bind_ctls alc268_bind_beep_sw = { |
| 11142 | .ops = &snd_hda_bind_sw, |
| 11143 | .values = { |
| 11144 | HDA_COMPOSE_AMP_VAL(0x0f, 3, 1, HDA_INPUT), |
| 11145 | HDA_COMPOSE_AMP_VAL(0x10, 3, 1, HDA_INPUT), |
| 11146 | 0 |
| 11147 | }, |
| 11148 | }; |
| 11149 | |
| 11150 | static struct snd_kcontrol_new alc268_beep_mixer[] = { |
| 11151 | HDA_CODEC_VOLUME("Beep Playback Volume", 0x1d, 0x0, HDA_INPUT), |
| 11152 | HDA_BIND_SW("Beep Playback Switch", &alc268_bind_beep_sw), |
| 11153 | { } |
| 11154 | }; |
| 11155 | |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 11156 | static struct hda_verb alc268_eapd_verbs[] = { |
| 11157 | {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 11158 | {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 11159 | { } |
| 11160 | }; |
| 11161 | |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 11162 | /* Toshiba specific */ |
| 11163 | #define alc268_toshiba_automute alc262_hippo_automute |
| 11164 | |
| 11165 | static struct hda_verb alc268_toshiba_verbs[] = { |
| 11166 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 11167 | { } /* end */ |
| 11168 | }; |
| 11169 | |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 11170 | static struct hda_input_mux alc268_acer_lc_capture_source = { |
| 11171 | .num_items = 2, |
| 11172 | .items = { |
| 11173 | { "i-Mic", 0x6 }, |
| 11174 | { "E-Mic", 0x0 }, |
| 11175 | }, |
| 11176 | }; |
| 11177 | |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 11178 | /* Acer specific */ |
Takashi Iwai | 889c439 | 2007-08-23 18:56:52 +0200 | [diff] [blame] | 11179 | /* bind volumes of both NID 0x02 and 0x03 */ |
Takashi Iwai | 6bc9685 | 2007-08-17 09:02:12 +0200 | [diff] [blame] | 11180 | static struct hda_bind_ctls alc268_acer_bind_master_vol = { |
| 11181 | .ops = &snd_hda_bind_vol, |
| 11182 | .values = { |
| 11183 | HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT), |
| 11184 | HDA_COMPOSE_AMP_VAL(0x03, 3, 0, HDA_OUTPUT), |
| 11185 | 0 |
| 11186 | }, |
| 11187 | }; |
| 11188 | |
Takashi Iwai | 889c439 | 2007-08-23 18:56:52 +0200 | [diff] [blame] | 11189 | /* mute/unmute internal speaker according to the hp jack and mute state */ |
| 11190 | static void alc268_acer_automute(struct hda_codec *codec, int force) |
| 11191 | { |
| 11192 | struct alc_spec *spec = codec->spec; |
| 11193 | unsigned int mute; |
| 11194 | |
| 11195 | if (force || !spec->sense_updated) { |
| 11196 | unsigned int present; |
| 11197 | present = snd_hda_codec_read(codec, 0x14, 0, |
| 11198 | AC_VERB_GET_PIN_SENSE, 0); |
| 11199 | spec->jack_present = (present & 0x80000000) != 0; |
| 11200 | spec->sense_updated = 1; |
| 11201 | } |
| 11202 | if (spec->jack_present) |
| 11203 | mute = HDA_AMP_MUTE; /* mute internal speaker */ |
| 11204 | else /* unmute internal speaker if necessary */ |
| 11205 | mute = snd_hda_codec_amp_read(codec, 0x14, 0, HDA_OUTPUT, 0); |
| 11206 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 11207 | HDA_AMP_MUTE, mute); |
| 11208 | } |
| 11209 | |
| 11210 | |
| 11211 | /* bind hp and internal speaker mute (with plug check) */ |
| 11212 | static int alc268_acer_master_sw_put(struct snd_kcontrol *kcontrol, |
| 11213 | struct snd_ctl_elem_value *ucontrol) |
| 11214 | { |
| 11215 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 11216 | long *valp = ucontrol->value.integer.value; |
| 11217 | int change; |
| 11218 | |
| 11219 | change = snd_hda_codec_amp_update(codec, 0x14, 0, HDA_OUTPUT, 0, |
| 11220 | HDA_AMP_MUTE, |
| 11221 | valp[0] ? 0 : HDA_AMP_MUTE); |
| 11222 | change |= snd_hda_codec_amp_update(codec, 0x14, 1, HDA_OUTPUT, 0, |
| 11223 | HDA_AMP_MUTE, |
| 11224 | valp[1] ? 0 : HDA_AMP_MUTE); |
| 11225 | if (change) |
| 11226 | alc268_acer_automute(codec, 0); |
| 11227 | return change; |
| 11228 | } |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 11229 | |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 11230 | static struct snd_kcontrol_new alc268_acer_aspire_one_mixer[] = { |
| 11231 | /* output mixer control */ |
| 11232 | HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol), |
| 11233 | { |
| 11234 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 11235 | .name = "Master Playback Switch", |
| 11236 | .info = snd_hda_mixer_amp_switch_info, |
| 11237 | .get = snd_hda_mixer_amp_switch_get, |
| 11238 | .put = alc268_acer_master_sw_put, |
| 11239 | .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), |
| 11240 | }, |
| 11241 | HDA_CODEC_VOLUME("Mic Boost Capture Volume", 0x18, 0, HDA_INPUT), |
| 11242 | { } |
| 11243 | }; |
| 11244 | |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 11245 | static struct snd_kcontrol_new alc268_acer_mixer[] = { |
| 11246 | /* output mixer control */ |
| 11247 | HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol), |
| 11248 | { |
| 11249 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 11250 | .name = "Master Playback Switch", |
| 11251 | .info = snd_hda_mixer_amp_switch_info, |
| 11252 | .get = snd_hda_mixer_amp_switch_get, |
| 11253 | .put = alc268_acer_master_sw_put, |
| 11254 | .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), |
| 11255 | }, |
Takashi Iwai | 33bf17a | 2007-08-21 11:51:42 +0200 | [diff] [blame] | 11256 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 11257 | HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT), |
| 11258 | HDA_CODEC_VOLUME("Line In Boost", 0x1a, 0, HDA_INPUT), |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 11259 | { } |
| 11260 | }; |
| 11261 | |
Takashi Iwai | c238b4f | 2008-11-05 14:57:20 +0100 | [diff] [blame] | 11262 | static struct snd_kcontrol_new alc268_acer_dmic_mixer[] = { |
| 11263 | /* output mixer control */ |
| 11264 | HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol), |
| 11265 | { |
| 11266 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 11267 | .name = "Master Playback Switch", |
| 11268 | .info = snd_hda_mixer_amp_switch_info, |
| 11269 | .get = snd_hda_mixer_amp_switch_get, |
| 11270 | .put = alc268_acer_master_sw_put, |
| 11271 | .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), |
| 11272 | }, |
| 11273 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 11274 | HDA_CODEC_VOLUME("Line In Boost", 0x1a, 0, HDA_INPUT), |
| 11275 | { } |
| 11276 | }; |
| 11277 | |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 11278 | static struct hda_verb alc268_acer_aspire_one_verbs[] = { |
| 11279 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 11280 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 11281 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 11282 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 11283 | {0x23, AC_VERB_SET_CONNECT_SEL, 0x06}, |
| 11284 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, 0xa017}, |
| 11285 | { } |
| 11286 | }; |
| 11287 | |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 11288 | static struct hda_verb alc268_acer_verbs[] = { |
Takashi Iwai | 0ccb541 | 2008-03-06 16:58:35 +0100 | [diff] [blame] | 11289 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, /* internal dmic? */ |
| 11290 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 11291 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 11292 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | 0ccb541 | 2008-03-06 16:58:35 +0100 | [diff] [blame] | 11293 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 11294 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 11295 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 11296 | { } |
| 11297 | }; |
| 11298 | |
| 11299 | /* unsolicited event for HP jack sensing */ |
| 11300 | static void alc268_toshiba_unsol_event(struct hda_codec *codec, |
| 11301 | unsigned int res) |
| 11302 | { |
Takashi Iwai | 889c439 | 2007-08-23 18:56:52 +0200 | [diff] [blame] | 11303 | if ((res >> 26) != ALC880_HP_EVENT) |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 11304 | return; |
| 11305 | alc268_toshiba_automute(codec); |
| 11306 | } |
| 11307 | |
| 11308 | static void alc268_acer_unsol_event(struct hda_codec *codec, |
| 11309 | unsigned int res) |
| 11310 | { |
Takashi Iwai | 889c439 | 2007-08-23 18:56:52 +0200 | [diff] [blame] | 11311 | if ((res >> 26) != ALC880_HP_EVENT) |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 11312 | return; |
| 11313 | alc268_acer_automute(codec, 1); |
| 11314 | } |
| 11315 | |
Takashi Iwai | 889c439 | 2007-08-23 18:56:52 +0200 | [diff] [blame] | 11316 | static void alc268_acer_init_hook(struct hda_codec *codec) |
| 11317 | { |
| 11318 | alc268_acer_automute(codec, 1); |
| 11319 | } |
| 11320 | |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 11321 | /* toggle speaker-output according to the hp-jack state */ |
| 11322 | static void alc268_aspire_one_speaker_automute(struct hda_codec *codec) |
| 11323 | { |
| 11324 | unsigned int present; |
| 11325 | unsigned char bits; |
| 11326 | |
| 11327 | present = snd_hda_codec_read(codec, 0x15, 0, |
| 11328 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 11329 | bits = present ? AMP_IN_MUTE(0) : 0; |
| 11330 | snd_hda_codec_amp_stereo(codec, 0x0f, HDA_INPUT, 0, |
| 11331 | AMP_IN_MUTE(0), bits); |
| 11332 | snd_hda_codec_amp_stereo(codec, 0x0f, HDA_INPUT, 1, |
| 11333 | AMP_IN_MUTE(0), bits); |
| 11334 | } |
| 11335 | |
| 11336 | |
| 11337 | static void alc268_acer_mic_automute(struct hda_codec *codec) |
| 11338 | { |
| 11339 | unsigned int present; |
| 11340 | |
| 11341 | present = snd_hda_codec_read(codec, 0x18, 0, |
| 11342 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 11343 | snd_hda_codec_write(codec, 0x23, 0, AC_VERB_SET_CONNECT_SEL, |
| 11344 | present ? 0x0 : 0x6); |
| 11345 | } |
| 11346 | |
| 11347 | static void alc268_acer_lc_unsol_event(struct hda_codec *codec, |
| 11348 | unsigned int res) |
| 11349 | { |
| 11350 | if ((res >> 26) == ALC880_HP_EVENT) |
| 11351 | alc268_aspire_one_speaker_automute(codec); |
| 11352 | if ((res >> 26) == ALC880_MIC_EVENT) |
| 11353 | alc268_acer_mic_automute(codec); |
| 11354 | } |
| 11355 | |
| 11356 | static void alc268_acer_lc_init_hook(struct hda_codec *codec) |
| 11357 | { |
| 11358 | alc268_aspire_one_speaker_automute(codec); |
| 11359 | alc268_acer_mic_automute(codec); |
| 11360 | } |
| 11361 | |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 11362 | static struct snd_kcontrol_new alc268_dell_mixer[] = { |
| 11363 | /* output mixer control */ |
| 11364 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 11365 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 11366 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 11367 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 11368 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 11369 | HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT), |
| 11370 | { } |
| 11371 | }; |
| 11372 | |
| 11373 | static struct hda_verb alc268_dell_verbs[] = { |
| 11374 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 11375 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 11376 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 11377 | { } |
| 11378 | }; |
| 11379 | |
| 11380 | /* mute/unmute internal speaker according to the hp jack and mute state */ |
| 11381 | static void alc268_dell_automute(struct hda_codec *codec) |
| 11382 | { |
| 11383 | unsigned int present; |
| 11384 | unsigned int mute; |
| 11385 | |
| 11386 | present = snd_hda_codec_read(codec, 0x15, 0, AC_VERB_GET_PIN_SENSE, 0); |
| 11387 | if (present & 0x80000000) |
| 11388 | mute = HDA_AMP_MUTE; |
| 11389 | else |
| 11390 | mute = snd_hda_codec_amp_read(codec, 0x15, 0, HDA_OUTPUT, 0); |
| 11391 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 11392 | HDA_AMP_MUTE, mute); |
| 11393 | } |
| 11394 | |
| 11395 | static void alc268_dell_unsol_event(struct hda_codec *codec, |
| 11396 | unsigned int res) |
| 11397 | { |
| 11398 | if ((res >> 26) != ALC880_HP_EVENT) |
| 11399 | return; |
| 11400 | alc268_dell_automute(codec); |
| 11401 | } |
| 11402 | |
| 11403 | #define alc268_dell_init_hook alc268_dell_automute |
| 11404 | |
Herton Ronaldo Krzesinski | eb5a662 | 2008-04-14 13:46:28 +0200 | [diff] [blame] | 11405 | static struct snd_kcontrol_new alc267_quanta_il1_mixer[] = { |
| 11406 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x2, 0x0, HDA_OUTPUT), |
| 11407 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 11408 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x3, 0x0, HDA_OUTPUT), |
| 11409 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 11410 | HDA_CODEC_VOLUME("Mic Capture Volume", 0x23, 0x0, HDA_OUTPUT), |
| 11411 | HDA_BIND_MUTE("Mic Capture Switch", 0x23, 2, HDA_OUTPUT), |
| 11412 | HDA_CODEC_VOLUME("Ext Mic Boost", 0x18, 0, HDA_INPUT), |
| 11413 | HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT), |
| 11414 | { } |
| 11415 | }; |
| 11416 | |
| 11417 | static struct hda_verb alc267_quanta_il1_verbs[] = { |
| 11418 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 11419 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN}, |
| 11420 | { } |
| 11421 | }; |
| 11422 | |
| 11423 | static void alc267_quanta_il1_hp_automute(struct hda_codec *codec) |
| 11424 | { |
| 11425 | unsigned int present; |
| 11426 | |
| 11427 | present = snd_hda_codec_read(codec, 0x15, 0, AC_VERB_GET_PIN_SENSE, 0) |
| 11428 | & AC_PINSENSE_PRESENCE; |
| 11429 | snd_hda_codec_write(codec, 0x14, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 11430 | present ? 0 : PIN_OUT); |
| 11431 | } |
| 11432 | |
| 11433 | static void alc267_quanta_il1_mic_automute(struct hda_codec *codec) |
| 11434 | { |
| 11435 | unsigned int present; |
| 11436 | |
| 11437 | present = snd_hda_codec_read(codec, 0x18, 0, |
| 11438 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 11439 | snd_hda_codec_write(codec, 0x23, 0, |
| 11440 | AC_VERB_SET_CONNECT_SEL, |
| 11441 | present ? 0x00 : 0x01); |
| 11442 | } |
| 11443 | |
| 11444 | static void alc267_quanta_il1_automute(struct hda_codec *codec) |
| 11445 | { |
| 11446 | alc267_quanta_il1_hp_automute(codec); |
| 11447 | alc267_quanta_il1_mic_automute(codec); |
| 11448 | } |
| 11449 | |
| 11450 | static void alc267_quanta_il1_unsol_event(struct hda_codec *codec, |
| 11451 | unsigned int res) |
| 11452 | { |
| 11453 | switch (res >> 26) { |
| 11454 | case ALC880_HP_EVENT: |
| 11455 | alc267_quanta_il1_hp_automute(codec); |
| 11456 | break; |
| 11457 | case ALC880_MIC_EVENT: |
| 11458 | alc267_quanta_il1_mic_automute(codec); |
| 11459 | break; |
| 11460 | } |
| 11461 | } |
| 11462 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11463 | /* |
| 11464 | * generic initialization of ADC, input mixers and output mixers |
| 11465 | */ |
| 11466 | static struct hda_verb alc268_base_init_verbs[] = { |
| 11467 | /* Unmute DAC0-1 and set vol = 0 */ |
| 11468 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11469 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11470 | |
| 11471 | /* |
| 11472 | * Set up output mixers (0x0c - 0x0e) |
| 11473 | */ |
| 11474 | /* set vol=0 to output mixers */ |
| 11475 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11476 | {0x0e, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 11477 | |
| 11478 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11479 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11480 | |
| 11481 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, |
| 11482 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0}, |
| 11483 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, |
| 11484 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 11485 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 11486 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 11487 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 11488 | {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 11489 | |
| 11490 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 11491 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 11492 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 11493 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11494 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 11495 | |
| 11496 | /* set PCBEEP vol = 0, mute connections */ |
| 11497 | {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11498 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 11499 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11500 | |
Jiang Zhe | a9b3aa8 | 2007-12-20 13:13:13 +0100 | [diff] [blame] | 11501 | /* Unmute Selector 23h,24h and set the default input to mic-in */ |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 11502 | |
Jiang Zhe | a9b3aa8 | 2007-12-20 13:13:13 +0100 | [diff] [blame] | 11503 | {0x23, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 11504 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 11505 | {0x24, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 11506 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11507 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11508 | { } |
| 11509 | }; |
| 11510 | |
| 11511 | /* |
| 11512 | * generic initialization of ADC, input mixers and output mixers |
| 11513 | */ |
| 11514 | static struct hda_verb alc268_volume_init_verbs[] = { |
| 11515 | /* set output DAC */ |
Takashi Iwai | 4cfb91c | 2009-01-23 12:53:09 +0100 | [diff] [blame] | 11516 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 11517 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11518 | |
| 11519 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 11520 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 11521 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 11522 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 11523 | {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 11524 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11525 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11526 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11527 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11528 | |
| 11529 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11530 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11531 | |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 11532 | /* set PCBEEP vol = 0, mute connections */ |
| 11533 | {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11534 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 11535 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11536 | |
| 11537 | { } |
| 11538 | }; |
| 11539 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11540 | static struct snd_kcontrol_new alc268_capture_alt_mixer[] = { |
| 11541 | HDA_CODEC_VOLUME("Capture Volume", 0x23, 0x0, HDA_OUTPUT), |
| 11542 | HDA_CODEC_MUTE("Capture Switch", 0x23, 0x0, HDA_OUTPUT), |
| 11543 | { |
| 11544 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 11545 | /* The multiple "Capture Source" controls confuse alsamixer |
| 11546 | * So call somewhat different.. |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11547 | */ |
| 11548 | /* .name = "Capture Source", */ |
| 11549 | .name = "Input Source", |
| 11550 | .count = 1, |
Takashi Iwai | 54cbc9a | 2008-10-31 15:24:04 +0100 | [diff] [blame] | 11551 | .info = alc_mux_enum_info, |
| 11552 | .get = alc_mux_enum_get, |
| 11553 | .put = alc_mux_enum_put, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11554 | }, |
| 11555 | { } /* end */ |
| 11556 | }; |
| 11557 | |
| 11558 | static struct snd_kcontrol_new alc268_capture_mixer[] = { |
| 11559 | HDA_CODEC_VOLUME("Capture Volume", 0x23, 0x0, HDA_OUTPUT), |
| 11560 | HDA_CODEC_MUTE("Capture Switch", 0x23, 0x0, HDA_OUTPUT), |
| 11561 | HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x24, 0x0, HDA_OUTPUT), |
| 11562 | HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x24, 0x0, HDA_OUTPUT), |
| 11563 | { |
| 11564 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 11565 | /* The multiple "Capture Source" controls confuse alsamixer |
| 11566 | * So call somewhat different.. |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11567 | */ |
| 11568 | /* .name = "Capture Source", */ |
| 11569 | .name = "Input Source", |
| 11570 | .count = 2, |
Takashi Iwai | 54cbc9a | 2008-10-31 15:24:04 +0100 | [diff] [blame] | 11571 | .info = alc_mux_enum_info, |
| 11572 | .get = alc_mux_enum_get, |
| 11573 | .put = alc_mux_enum_put, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11574 | }, |
| 11575 | { } /* end */ |
| 11576 | }; |
| 11577 | |
| 11578 | static struct hda_input_mux alc268_capture_source = { |
| 11579 | .num_items = 4, |
| 11580 | .items = { |
| 11581 | { "Mic", 0x0 }, |
| 11582 | { "Front Mic", 0x1 }, |
| 11583 | { "Line", 0x2 }, |
| 11584 | { "CD", 0x3 }, |
| 11585 | }, |
| 11586 | }; |
| 11587 | |
Takashi Iwai | 0ccb541 | 2008-03-06 16:58:35 +0100 | [diff] [blame] | 11588 | static struct hda_input_mux alc268_acer_capture_source = { |
| 11589 | .num_items = 3, |
| 11590 | .items = { |
| 11591 | { "Mic", 0x0 }, |
Takashi Iwai | c238b4f | 2008-11-05 14:57:20 +0100 | [diff] [blame] | 11592 | { "Internal Mic", 0x1 }, |
| 11593 | { "Line", 0x2 }, |
| 11594 | }, |
| 11595 | }; |
| 11596 | |
| 11597 | static struct hda_input_mux alc268_acer_dmic_capture_source = { |
| 11598 | .num_items = 3, |
| 11599 | .items = { |
| 11600 | { "Mic", 0x0 }, |
Takashi Iwai | 0ccb541 | 2008-03-06 16:58:35 +0100 | [diff] [blame] | 11601 | { "Internal Mic", 0x6 }, |
| 11602 | { "Line", 0x2 }, |
| 11603 | }, |
| 11604 | }; |
| 11605 | |
Jonathan Woithe | 86c53bd | 2008-01-08 12:33:19 +0100 | [diff] [blame] | 11606 | #ifdef CONFIG_SND_DEBUG |
| 11607 | static struct snd_kcontrol_new alc268_test_mixer[] = { |
Jonathan Woithe | 86c53bd | 2008-01-08 12:33:19 +0100 | [diff] [blame] | 11608 | /* Volume widgets */ |
| 11609 | HDA_CODEC_VOLUME("LOUT1 Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 11610 | HDA_CODEC_VOLUME("LOUT2 Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 11611 | HDA_BIND_MUTE_MONO("Mono sum Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 11612 | HDA_BIND_MUTE("LINE-OUT sum Playback Switch", 0x0f, 2, HDA_INPUT), |
| 11613 | HDA_BIND_MUTE("HP-OUT sum Playback Switch", 0x10, 2, HDA_INPUT), |
| 11614 | HDA_BIND_MUTE("LINE-OUT Playback Switch", 0x14, 2, HDA_OUTPUT), |
| 11615 | HDA_BIND_MUTE("HP-OUT Playback Switch", 0x15, 2, HDA_OUTPUT), |
| 11616 | HDA_BIND_MUTE("Mono Playback Switch", 0x16, 2, HDA_OUTPUT), |
| 11617 | HDA_CODEC_VOLUME("MIC1 Capture Volume", 0x18, 0x0, HDA_INPUT), |
| 11618 | HDA_BIND_MUTE("MIC1 Capture Switch", 0x18, 2, HDA_OUTPUT), |
| 11619 | HDA_CODEC_VOLUME("MIC2 Capture Volume", 0x19, 0x0, HDA_INPUT), |
| 11620 | HDA_CODEC_VOLUME("LINE1 Capture Volume", 0x1a, 0x0, HDA_INPUT), |
| 11621 | HDA_BIND_MUTE("LINE1 Capture Switch", 0x1a, 2, HDA_OUTPUT), |
Takashi Iwai | f0747ee | 2008-01-15 11:41:41 +0100 | [diff] [blame] | 11622 | /* The below appears problematic on some hardwares */ |
| 11623 | /*HDA_CODEC_VOLUME("PCBEEP Playback Volume", 0x1d, 0x0, HDA_INPUT),*/ |
Jonathan Woithe | 86c53bd | 2008-01-08 12:33:19 +0100 | [diff] [blame] | 11624 | HDA_CODEC_VOLUME("PCM-IN1 Capture Volume", 0x23, 0x0, HDA_OUTPUT), |
| 11625 | HDA_BIND_MUTE("PCM-IN1 Capture Switch", 0x23, 2, HDA_OUTPUT), |
| 11626 | HDA_CODEC_VOLUME("PCM-IN2 Capture Volume", 0x24, 0x0, HDA_OUTPUT), |
| 11627 | HDA_BIND_MUTE("PCM-IN2 Capture Switch", 0x24, 2, HDA_OUTPUT), |
| 11628 | |
| 11629 | /* Modes for retasking pin widgets */ |
| 11630 | ALC_PIN_MODE("LINE-OUT pin mode", 0x14, ALC_PIN_DIR_INOUT), |
| 11631 | ALC_PIN_MODE("HP-OUT pin mode", 0x15, ALC_PIN_DIR_INOUT), |
| 11632 | ALC_PIN_MODE("MIC1 pin mode", 0x18, ALC_PIN_DIR_INOUT), |
| 11633 | ALC_PIN_MODE("LINE1 pin mode", 0x1a, ALC_PIN_DIR_INOUT), |
| 11634 | |
| 11635 | /* Controls for GPIO pins, assuming they are configured as outputs */ |
| 11636 | ALC_GPIO_DATA_SWITCH("GPIO pin 0", 0x01, 0x01), |
| 11637 | ALC_GPIO_DATA_SWITCH("GPIO pin 1", 0x01, 0x02), |
| 11638 | ALC_GPIO_DATA_SWITCH("GPIO pin 2", 0x01, 0x04), |
| 11639 | ALC_GPIO_DATA_SWITCH("GPIO pin 3", 0x01, 0x08), |
| 11640 | |
| 11641 | /* Switches to allow the digital SPDIF output pin to be enabled. |
| 11642 | * The ALC268 does not have an SPDIF input. |
| 11643 | */ |
| 11644 | ALC_SPDIF_CTRL_SWITCH("SPDIF Playback Switch", 0x06, 0x01), |
| 11645 | |
| 11646 | /* A switch allowing EAPD to be enabled. Some laptops seem to use |
| 11647 | * this output to turn on an external amplifier. |
| 11648 | */ |
| 11649 | ALC_EAPD_CTRL_SWITCH("LINE-OUT EAPD Enable Switch", 0x0f, 0x02), |
| 11650 | ALC_EAPD_CTRL_SWITCH("HP-OUT EAPD Enable Switch", 0x10, 0x02), |
| 11651 | |
| 11652 | { } /* end */ |
| 11653 | }; |
| 11654 | #endif |
| 11655 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11656 | /* create input playback/capture controls for the given pin */ |
| 11657 | static int alc268_new_analog_output(struct alc_spec *spec, hda_nid_t nid, |
| 11658 | const char *ctlname, int idx) |
| 11659 | { |
| 11660 | char name[32]; |
| 11661 | int err; |
| 11662 | |
| 11663 | sprintf(name, "%s Playback Volume", ctlname); |
| 11664 | if (nid == 0x14) { |
| 11665 | err = add_control(spec, ALC_CTL_WIDGET_VOL, name, |
| 11666 | HDA_COMPOSE_AMP_VAL(0x02, 3, idx, |
| 11667 | HDA_OUTPUT)); |
| 11668 | if (err < 0) |
| 11669 | return err; |
| 11670 | } else if (nid == 0x15) { |
| 11671 | err = add_control(spec, ALC_CTL_WIDGET_VOL, name, |
| 11672 | HDA_COMPOSE_AMP_VAL(0x03, 3, idx, |
| 11673 | HDA_OUTPUT)); |
| 11674 | if (err < 0) |
| 11675 | return err; |
| 11676 | } else |
| 11677 | return -1; |
| 11678 | sprintf(name, "%s Playback Switch", ctlname); |
| 11679 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, name, |
| 11680 | HDA_COMPOSE_AMP_VAL(nid, 3, idx, HDA_OUTPUT)); |
| 11681 | if (err < 0) |
| 11682 | return err; |
| 11683 | return 0; |
| 11684 | } |
| 11685 | |
| 11686 | /* add playback controls from the parsed DAC table */ |
| 11687 | static int alc268_auto_create_multi_out_ctls(struct alc_spec *spec, |
| 11688 | const struct auto_pin_cfg *cfg) |
| 11689 | { |
| 11690 | hda_nid_t nid; |
| 11691 | int err; |
| 11692 | |
| 11693 | spec->multiout.num_dacs = 2; /* only use one dac */ |
| 11694 | spec->multiout.dac_nids = spec->private_dac_nids; |
| 11695 | spec->multiout.dac_nids[0] = 2; |
| 11696 | spec->multiout.dac_nids[1] = 3; |
| 11697 | |
| 11698 | nid = cfg->line_out_pins[0]; |
| 11699 | if (nid) |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 11700 | alc268_new_analog_output(spec, nid, "Front", 0); |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11701 | |
| 11702 | nid = cfg->speaker_pins[0]; |
| 11703 | if (nid == 0x1d) { |
| 11704 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 11705 | "Speaker Playback Volume", |
| 11706 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_INPUT)); |
| 11707 | if (err < 0) |
| 11708 | return err; |
| 11709 | } |
| 11710 | nid = cfg->hp_pins[0]; |
| 11711 | if (nid) |
| 11712 | alc268_new_analog_output(spec, nid, "Headphone", 0); |
| 11713 | |
| 11714 | nid = cfg->line_out_pins[1] | cfg->line_out_pins[2]; |
| 11715 | if (nid == 0x16) { |
| 11716 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, |
| 11717 | "Mono Playback Switch", |
| 11718 | HDA_COMPOSE_AMP_VAL(nid, 2, 0, HDA_INPUT)); |
| 11719 | if (err < 0) |
| 11720 | return err; |
| 11721 | } |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 11722 | return 0; |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11723 | } |
| 11724 | |
| 11725 | /* create playback/capture controls for input pins */ |
| 11726 | static int alc268_auto_create_analog_input_ctls(struct alc_spec *spec, |
| 11727 | const struct auto_pin_cfg *cfg) |
| 11728 | { |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 11729 | struct hda_input_mux *imux = &spec->private_imux[0]; |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11730 | int i, idx1; |
| 11731 | |
| 11732 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
| 11733 | switch(cfg->input_pins[i]) { |
| 11734 | case 0x18: |
| 11735 | idx1 = 0; /* Mic 1 */ |
| 11736 | break; |
| 11737 | case 0x19: |
| 11738 | idx1 = 1; /* Mic 2 */ |
| 11739 | break; |
| 11740 | case 0x1a: |
| 11741 | idx1 = 2; /* Line In */ |
| 11742 | break; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 11743 | case 0x1c: |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11744 | idx1 = 3; /* CD */ |
| 11745 | break; |
Takashi Iwai | 7194cae | 2008-03-06 16:58:17 +0100 | [diff] [blame] | 11746 | case 0x12: |
| 11747 | case 0x13: |
| 11748 | idx1 = 6; /* digital mics */ |
| 11749 | break; |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11750 | default: |
| 11751 | continue; |
| 11752 | } |
| 11753 | imux->items[imux->num_items].label = auto_pin_cfg_labels[i]; |
| 11754 | imux->items[imux->num_items].index = idx1; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 11755 | imux->num_items++; |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11756 | } |
| 11757 | return 0; |
| 11758 | } |
| 11759 | |
| 11760 | static void alc268_auto_init_mono_speaker_out(struct hda_codec *codec) |
| 11761 | { |
| 11762 | struct alc_spec *spec = codec->spec; |
| 11763 | hda_nid_t speaker_nid = spec->autocfg.speaker_pins[0]; |
| 11764 | hda_nid_t hp_nid = spec->autocfg.hp_pins[0]; |
| 11765 | hda_nid_t line_nid = spec->autocfg.line_out_pins[0]; |
| 11766 | unsigned int dac_vol1, dac_vol2; |
| 11767 | |
| 11768 | if (speaker_nid) { |
| 11769 | snd_hda_codec_write(codec, speaker_nid, 0, |
| 11770 | AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT); |
| 11771 | snd_hda_codec_write(codec, 0x0f, 0, |
| 11772 | AC_VERB_SET_AMP_GAIN_MUTE, |
| 11773 | AMP_IN_UNMUTE(1)); |
| 11774 | snd_hda_codec_write(codec, 0x10, 0, |
| 11775 | AC_VERB_SET_AMP_GAIN_MUTE, |
| 11776 | AMP_IN_UNMUTE(1)); |
| 11777 | } else { |
| 11778 | snd_hda_codec_write(codec, 0x0f, 0, |
| 11779 | AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)); |
| 11780 | snd_hda_codec_write(codec, 0x10, 0, |
| 11781 | AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)); |
| 11782 | } |
| 11783 | |
| 11784 | dac_vol1 = dac_vol2 = 0xb000 | 0x40; /* set max volume */ |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 11785 | if (line_nid == 0x14) |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11786 | dac_vol2 = AMP_OUT_ZERO; |
| 11787 | else if (line_nid == 0x15) |
| 11788 | dac_vol1 = AMP_OUT_ZERO; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 11789 | if (hp_nid == 0x14) |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11790 | dac_vol2 = AMP_OUT_ZERO; |
| 11791 | else if (hp_nid == 0x15) |
| 11792 | dac_vol1 = AMP_OUT_ZERO; |
| 11793 | if (line_nid != 0x16 || hp_nid != 0x16 || |
| 11794 | spec->autocfg.line_out_pins[1] != 0x16 || |
| 11795 | spec->autocfg.line_out_pins[2] != 0x16) |
| 11796 | dac_vol1 = dac_vol2 = AMP_OUT_ZERO; |
| 11797 | |
| 11798 | snd_hda_codec_write(codec, 0x02, 0, |
| 11799 | AC_VERB_SET_AMP_GAIN_MUTE, dac_vol1); |
| 11800 | snd_hda_codec_write(codec, 0x03, 0, |
| 11801 | AC_VERB_SET_AMP_GAIN_MUTE, dac_vol2); |
| 11802 | } |
| 11803 | |
| 11804 | /* pcm configuration: identiacal with ALC880 */ |
| 11805 | #define alc268_pcm_analog_playback alc880_pcm_analog_playback |
| 11806 | #define alc268_pcm_analog_capture alc880_pcm_analog_capture |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 11807 | #define alc268_pcm_analog_alt_capture alc880_pcm_analog_alt_capture |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11808 | #define alc268_pcm_digital_playback alc880_pcm_digital_playback |
| 11809 | |
| 11810 | /* |
| 11811 | * BIOS auto configuration |
| 11812 | */ |
| 11813 | static int alc268_parse_auto_config(struct hda_codec *codec) |
| 11814 | { |
| 11815 | struct alc_spec *spec = codec->spec; |
| 11816 | int err; |
| 11817 | static hda_nid_t alc268_ignore[] = { 0 }; |
| 11818 | |
| 11819 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 11820 | alc268_ignore); |
| 11821 | if (err < 0) |
| 11822 | return err; |
| 11823 | if (!spec->autocfg.line_outs) |
| 11824 | return 0; /* can't find valid BIOS pin config */ |
| 11825 | |
| 11826 | err = alc268_auto_create_multi_out_ctls(spec, &spec->autocfg); |
| 11827 | if (err < 0) |
| 11828 | return err; |
| 11829 | err = alc268_auto_create_analog_input_ctls(spec, &spec->autocfg); |
| 11830 | if (err < 0) |
| 11831 | return err; |
| 11832 | |
| 11833 | spec->multiout.max_channels = 2; |
| 11834 | |
| 11835 | /* digital only support output */ |
Takashi Iwai | 0852d7a | 2009-02-11 11:35:15 +0100 | [diff] [blame] | 11836 | if (spec->autocfg.dig_outs) |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11837 | spec->multiout.dig_out_nid = ALC268_DIGOUT_NID; |
| 11838 | |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 11839 | if (spec->kctls.list) |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 11840 | add_mixer(spec, spec->kctls.list); |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11841 | |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 11842 | if (spec->autocfg.speaker_pins[0] != 0x1d) |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 11843 | add_mixer(spec, alc268_beep_mixer); |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 11844 | |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 11845 | add_verb(spec, alc268_volume_init_verbs); |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11846 | spec->num_mux_defs = 1; |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 11847 | spec->input_mux = &spec->private_imux[0]; |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11848 | |
Takashi Iwai | 776e184 | 2007-08-29 15:07:11 +0200 | [diff] [blame] | 11849 | err = alc_auto_add_mic_boost(codec); |
| 11850 | if (err < 0) |
| 11851 | return err; |
| 11852 | |
Takashi Iwai | e044c39 | 2008-10-27 16:56:24 +0100 | [diff] [blame] | 11853 | store_pin_configs(codec); |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11854 | return 1; |
| 11855 | } |
| 11856 | |
| 11857 | #define alc268_auto_init_multi_out alc882_auto_init_multi_out |
| 11858 | #define alc268_auto_init_hp_out alc882_auto_init_hp_out |
| 11859 | #define alc268_auto_init_analog_input alc882_auto_init_analog_input |
| 11860 | |
| 11861 | /* init callback for auto-configuration model -- overriding the default init */ |
| 11862 | static void alc268_auto_init(struct hda_codec *codec) |
| 11863 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 11864 | struct alc_spec *spec = codec->spec; |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11865 | alc268_auto_init_multi_out(codec); |
| 11866 | alc268_auto_init_hp_out(codec); |
| 11867 | alc268_auto_init_mono_speaker_out(codec); |
| 11868 | alc268_auto_init_analog_input(codec); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 11869 | if (spec->unsol_event) |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 11870 | alc_inithook(codec); |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11871 | } |
| 11872 | |
| 11873 | /* |
| 11874 | * configuration and preset |
| 11875 | */ |
| 11876 | static const char *alc268_models[ALC268_MODEL_LAST] = { |
Herton Ronaldo Krzesinski | eb5a662 | 2008-04-14 13:46:28 +0200 | [diff] [blame] | 11877 | [ALC267_QUANTA_IL1] = "quanta-il1", |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11878 | [ALC268_3ST] = "3stack", |
Takashi Iwai | 983f8ae | 2007-08-15 16:44:04 +0200 | [diff] [blame] | 11879 | [ALC268_TOSHIBA] = "toshiba", |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 11880 | [ALC268_ACER] = "acer", |
Takashi Iwai | c238b4f | 2008-11-05 14:57:20 +0100 | [diff] [blame] | 11881 | [ALC268_ACER_DMIC] = "acer-dmic", |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 11882 | [ALC268_ACER_ASPIRE_ONE] = "acer-aspire", |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 11883 | [ALC268_DELL] = "dell", |
Mirco Tischler | f12462c | 2008-02-04 12:33:59 +0100 | [diff] [blame] | 11884 | [ALC268_ZEPTO] = "zepto", |
Jonathan Woithe | 86c53bd | 2008-01-08 12:33:19 +0100 | [diff] [blame] | 11885 | #ifdef CONFIG_SND_DEBUG |
| 11886 | [ALC268_TEST] = "test", |
| 11887 | #endif |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11888 | [ALC268_AUTO] = "auto", |
| 11889 | }; |
| 11890 | |
| 11891 | static struct snd_pci_quirk alc268_cfg_tbl[] = { |
Takashi Iwai | a0b8f7d | 2008-04-22 19:39:49 +0200 | [diff] [blame] | 11892 | SND_PCI_QUIRK(0x1025, 0x011e, "Acer Aspire 5720z", ALC268_ACER), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 11893 | SND_PCI_QUIRK(0x1025, 0x0126, "Acer", ALC268_ACER), |
Andy Shevchenko | dafc835 | 2008-01-25 11:53:50 +0100 | [diff] [blame] | 11894 | SND_PCI_QUIRK(0x1025, 0x012e, "Acer Aspire 5310", ALC268_ACER), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 11895 | SND_PCI_QUIRK(0x1025, 0x0130, "Acer Extensa 5210", ALC268_ACER), |
Andy Shevchenko | 29a52c2 | 2008-01-24 17:29:00 +0100 | [diff] [blame] | 11896 | SND_PCI_QUIRK(0x1025, 0x0136, "Acer Aspire 5315", ALC268_ACER), |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 11897 | SND_PCI_QUIRK(0x1025, 0x015b, "Acer Aspire One", |
| 11898 | ALC268_ACER_ASPIRE_ONE), |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 11899 | SND_PCI_QUIRK(0x1028, 0x0253, "Dell OEM", ALC268_DELL), |
Takashi Iwai | 57d1392 | 2009-01-08 15:52:09 +0100 | [diff] [blame] | 11900 | SND_PCI_QUIRK(0x1028, 0x02b0, "Dell Inspiron Mini9", ALC268_DELL), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 11901 | SND_PCI_QUIRK(0x103c, 0x30cc, "TOSHIBA", ALC268_TOSHIBA), |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11902 | SND_PCI_QUIRK(0x1043, 0x1205, "ASUS W7J", ALC268_3ST), |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 11903 | SND_PCI_QUIRK(0x1179, 0xff10, "TOSHIBA A205", ALC268_TOSHIBA), |
Takashi Iwai | 8e7f00f | 2007-09-07 10:58:58 +0200 | [diff] [blame] | 11904 | SND_PCI_QUIRK(0x1179, 0xff50, "TOSHIBA A305", ALC268_TOSHIBA), |
Travis Place | 2346d0c | 2008-09-01 08:24:00 +0200 | [diff] [blame] | 11905 | SND_PCI_QUIRK(0x1179, 0xff64, "TOSHIBA L305", ALC268_TOSHIBA), |
Tony Vroon | 378bd6a | 2008-06-04 12:08:30 +0200 | [diff] [blame] | 11906 | SND_PCI_QUIRK(0x14c0, 0x0025, "COMPAL IFL90/JFL-92", ALC268_TOSHIBA), |
Takashi Iwai | b875bf3 | 2007-09-06 15:00:27 +0200 | [diff] [blame] | 11907 | SND_PCI_QUIRK(0x152d, 0x0763, "Diverse (CPR2000)", ALC268_ACER), |
Herton Ronaldo Krzesinski | eb5a662 | 2008-04-14 13:46:28 +0200 | [diff] [blame] | 11908 | SND_PCI_QUIRK(0x152d, 0x0771, "Quanta IL1", ALC267_QUANTA_IL1), |
Mirco Tischler | f12462c | 2008-02-04 12:33:59 +0100 | [diff] [blame] | 11909 | SND_PCI_QUIRK(0x1170, 0x0040, "ZEPTO", ALC268_ZEPTO), |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11910 | {} |
| 11911 | }; |
| 11912 | |
| 11913 | static struct alc_config_preset alc268_presets[] = { |
Herton Ronaldo Krzesinski | eb5a662 | 2008-04-14 13:46:28 +0200 | [diff] [blame] | 11914 | [ALC267_QUANTA_IL1] = { |
Takashi Iwai | 22971e3 | 2009-02-10 11:56:44 +0100 | [diff] [blame] | 11915 | .mixers = { alc267_quanta_il1_mixer, alc268_beep_mixer }, |
Herton Ronaldo Krzesinski | eb5a662 | 2008-04-14 13:46:28 +0200 | [diff] [blame] | 11916 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, |
| 11917 | alc267_quanta_il1_verbs }, |
| 11918 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), |
| 11919 | .dac_nids = alc268_dac_nids, |
| 11920 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), |
| 11921 | .adc_nids = alc268_adc_nids_alt, |
| 11922 | .hp_nid = 0x03, |
| 11923 | .num_channel_mode = ARRAY_SIZE(alc268_modes), |
| 11924 | .channel_mode = alc268_modes, |
| 11925 | .input_mux = &alc268_capture_source, |
| 11926 | .unsol_event = alc267_quanta_il1_unsol_event, |
| 11927 | .init_hook = alc267_quanta_il1_automute, |
| 11928 | }, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11929 | [ALC268_3ST] = { |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 11930 | .mixers = { alc268_base_mixer, alc268_capture_alt_mixer, |
| 11931 | alc268_beep_mixer }, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11932 | .init_verbs = { alc268_base_init_verbs }, |
| 11933 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), |
| 11934 | .dac_nids = alc268_dac_nids, |
| 11935 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), |
| 11936 | .adc_nids = alc268_adc_nids_alt, |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 11937 | .capsrc_nids = alc268_capsrc_nids, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11938 | .hp_nid = 0x03, |
| 11939 | .dig_out_nid = ALC268_DIGOUT_NID, |
| 11940 | .num_channel_mode = ARRAY_SIZE(alc268_modes), |
| 11941 | .channel_mode = alc268_modes, |
| 11942 | .input_mux = &alc268_capture_source, |
| 11943 | }, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 11944 | [ALC268_TOSHIBA] = { |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 11945 | .mixers = { alc268_base_mixer, alc268_capture_alt_mixer, |
| 11946 | alc268_beep_mixer }, |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 11947 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, |
| 11948 | alc268_toshiba_verbs }, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 11949 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), |
| 11950 | .dac_nids = alc268_dac_nids, |
| 11951 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), |
| 11952 | .adc_nids = alc268_adc_nids_alt, |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 11953 | .capsrc_nids = alc268_capsrc_nids, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 11954 | .hp_nid = 0x03, |
| 11955 | .num_channel_mode = ARRAY_SIZE(alc268_modes), |
| 11956 | .channel_mode = alc268_modes, |
| 11957 | .input_mux = &alc268_capture_source, |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 11958 | .unsol_event = alc268_toshiba_unsol_event, |
| 11959 | .init_hook = alc268_toshiba_automute, |
| 11960 | }, |
| 11961 | [ALC268_ACER] = { |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 11962 | .mixers = { alc268_acer_mixer, alc268_capture_alt_mixer, |
| 11963 | alc268_beep_mixer }, |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 11964 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, |
| 11965 | alc268_acer_verbs }, |
| 11966 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), |
| 11967 | .dac_nids = alc268_dac_nids, |
| 11968 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), |
| 11969 | .adc_nids = alc268_adc_nids_alt, |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 11970 | .capsrc_nids = alc268_capsrc_nids, |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 11971 | .hp_nid = 0x02, |
| 11972 | .num_channel_mode = ARRAY_SIZE(alc268_modes), |
| 11973 | .channel_mode = alc268_modes, |
Takashi Iwai | 0ccb541 | 2008-03-06 16:58:35 +0100 | [diff] [blame] | 11974 | .input_mux = &alc268_acer_capture_source, |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 11975 | .unsol_event = alc268_acer_unsol_event, |
Takashi Iwai | 889c439 | 2007-08-23 18:56:52 +0200 | [diff] [blame] | 11976 | .init_hook = alc268_acer_init_hook, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 11977 | }, |
Takashi Iwai | c238b4f | 2008-11-05 14:57:20 +0100 | [diff] [blame] | 11978 | [ALC268_ACER_DMIC] = { |
| 11979 | .mixers = { alc268_acer_dmic_mixer, alc268_capture_alt_mixer, |
| 11980 | alc268_beep_mixer }, |
| 11981 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, |
| 11982 | alc268_acer_verbs }, |
| 11983 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), |
| 11984 | .dac_nids = alc268_dac_nids, |
| 11985 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), |
| 11986 | .adc_nids = alc268_adc_nids_alt, |
| 11987 | .capsrc_nids = alc268_capsrc_nids, |
| 11988 | .hp_nid = 0x02, |
| 11989 | .num_channel_mode = ARRAY_SIZE(alc268_modes), |
| 11990 | .channel_mode = alc268_modes, |
| 11991 | .input_mux = &alc268_acer_dmic_capture_source, |
| 11992 | .unsol_event = alc268_acer_unsol_event, |
| 11993 | .init_hook = alc268_acer_init_hook, |
| 11994 | }, |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 11995 | [ALC268_ACER_ASPIRE_ONE] = { |
| 11996 | .mixers = { alc268_acer_aspire_one_mixer, |
Takashi Iwai | 22971e3 | 2009-02-10 11:56:44 +0100 | [diff] [blame] | 11997 | alc268_beep_mixer, |
| 11998 | alc268_capture_alt_mixer }, |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 11999 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, |
| 12000 | alc268_acer_aspire_one_verbs }, |
| 12001 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), |
| 12002 | .dac_nids = alc268_dac_nids, |
| 12003 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), |
| 12004 | .adc_nids = alc268_adc_nids_alt, |
| 12005 | .capsrc_nids = alc268_capsrc_nids, |
| 12006 | .hp_nid = 0x03, |
| 12007 | .num_channel_mode = ARRAY_SIZE(alc268_modes), |
| 12008 | .channel_mode = alc268_modes, |
| 12009 | .input_mux = &alc268_acer_lc_capture_source, |
| 12010 | .unsol_event = alc268_acer_lc_unsol_event, |
| 12011 | .init_hook = alc268_acer_lc_init_hook, |
| 12012 | }, |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 12013 | [ALC268_DELL] = { |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 12014 | .mixers = { alc268_dell_mixer, alc268_beep_mixer }, |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 12015 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, |
| 12016 | alc268_dell_verbs }, |
| 12017 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), |
| 12018 | .dac_nids = alc268_dac_nids, |
| 12019 | .hp_nid = 0x02, |
| 12020 | .num_channel_mode = ARRAY_SIZE(alc268_modes), |
| 12021 | .channel_mode = alc268_modes, |
| 12022 | .unsol_event = alc268_dell_unsol_event, |
| 12023 | .init_hook = alc268_dell_init_hook, |
| 12024 | .input_mux = &alc268_capture_source, |
| 12025 | }, |
Mirco Tischler | f12462c | 2008-02-04 12:33:59 +0100 | [diff] [blame] | 12026 | [ALC268_ZEPTO] = { |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 12027 | .mixers = { alc268_base_mixer, alc268_capture_alt_mixer, |
| 12028 | alc268_beep_mixer }, |
Mirco Tischler | f12462c | 2008-02-04 12:33:59 +0100 | [diff] [blame] | 12029 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, |
| 12030 | alc268_toshiba_verbs }, |
| 12031 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), |
| 12032 | .dac_nids = alc268_dac_nids, |
| 12033 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), |
| 12034 | .adc_nids = alc268_adc_nids_alt, |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 12035 | .capsrc_nids = alc268_capsrc_nids, |
Mirco Tischler | f12462c | 2008-02-04 12:33:59 +0100 | [diff] [blame] | 12036 | .hp_nid = 0x03, |
| 12037 | .dig_out_nid = ALC268_DIGOUT_NID, |
| 12038 | .num_channel_mode = ARRAY_SIZE(alc268_modes), |
| 12039 | .channel_mode = alc268_modes, |
| 12040 | .input_mux = &alc268_capture_source, |
| 12041 | .unsol_event = alc268_toshiba_unsol_event, |
| 12042 | .init_hook = alc268_toshiba_automute |
| 12043 | }, |
Jonathan Woithe | 86c53bd | 2008-01-08 12:33:19 +0100 | [diff] [blame] | 12044 | #ifdef CONFIG_SND_DEBUG |
| 12045 | [ALC268_TEST] = { |
| 12046 | .mixers = { alc268_test_mixer, alc268_capture_mixer }, |
| 12047 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, |
| 12048 | alc268_volume_init_verbs }, |
| 12049 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), |
| 12050 | .dac_nids = alc268_dac_nids, |
| 12051 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), |
| 12052 | .adc_nids = alc268_adc_nids_alt, |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 12053 | .capsrc_nids = alc268_capsrc_nids, |
Jonathan Woithe | 86c53bd | 2008-01-08 12:33:19 +0100 | [diff] [blame] | 12054 | .hp_nid = 0x03, |
| 12055 | .dig_out_nid = ALC268_DIGOUT_NID, |
| 12056 | .num_channel_mode = ARRAY_SIZE(alc268_modes), |
| 12057 | .channel_mode = alc268_modes, |
| 12058 | .input_mux = &alc268_capture_source, |
| 12059 | }, |
| 12060 | #endif |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12061 | }; |
| 12062 | |
| 12063 | static int patch_alc268(struct hda_codec *codec) |
| 12064 | { |
| 12065 | struct alc_spec *spec; |
| 12066 | int board_config; |
Takashi Iwai | 22971e3 | 2009-02-10 11:56:44 +0100 | [diff] [blame] | 12067 | int i, has_beep, err; |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12068 | |
| 12069 | spec = kcalloc(1, sizeof(*spec), GFP_KERNEL); |
| 12070 | if (spec == NULL) |
| 12071 | return -ENOMEM; |
| 12072 | |
| 12073 | codec->spec = spec; |
| 12074 | |
| 12075 | board_config = snd_hda_check_board_config(codec, ALC268_MODEL_LAST, |
| 12076 | alc268_models, |
| 12077 | alc268_cfg_tbl); |
| 12078 | |
| 12079 | if (board_config < 0 || board_config >= ALC268_MODEL_LAST) { |
| 12080 | printk(KERN_INFO "hda_codec: Unknown model for ALC268, " |
| 12081 | "trying auto-probe from BIOS...\n"); |
| 12082 | board_config = ALC268_AUTO; |
| 12083 | } |
| 12084 | |
| 12085 | if (board_config == ALC268_AUTO) { |
| 12086 | /* automatic parse from the BIOS config */ |
| 12087 | err = alc268_parse_auto_config(codec); |
| 12088 | if (err < 0) { |
| 12089 | alc_free(codec); |
| 12090 | return err; |
| 12091 | } else if (!err) { |
| 12092 | printk(KERN_INFO |
| 12093 | "hda_codec: Cannot set up configuration " |
| 12094 | "from BIOS. Using base mode...\n"); |
| 12095 | board_config = ALC268_3ST; |
| 12096 | } |
| 12097 | } |
| 12098 | |
Kusanagi Kouichi | 680cd53 | 2009-02-05 00:00:58 +0900 | [diff] [blame] | 12099 | err = snd_hda_attach_beep_device(codec, 0x1); |
| 12100 | if (err < 0) { |
| 12101 | alc_free(codec); |
| 12102 | return err; |
| 12103 | } |
| 12104 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12105 | if (board_config != ALC268_AUTO) |
| 12106 | setup_preset(spec, &alc268_presets[board_config]); |
| 12107 | |
Kailang Yang | 2f89328 | 2008-05-27 12:14:47 +0200 | [diff] [blame] | 12108 | if (codec->vendor_id == 0x10ec0267) { |
| 12109 | spec->stream_name_analog = "ALC267 Analog"; |
| 12110 | spec->stream_name_digital = "ALC267 Digital"; |
| 12111 | } else { |
| 12112 | spec->stream_name_analog = "ALC268 Analog"; |
| 12113 | spec->stream_name_digital = "ALC268 Digital"; |
| 12114 | } |
| 12115 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12116 | spec->stream_analog_playback = &alc268_pcm_analog_playback; |
| 12117 | spec->stream_analog_capture = &alc268_pcm_analog_capture; |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 12118 | spec->stream_analog_alt_capture = &alc268_pcm_analog_alt_capture; |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12119 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12120 | spec->stream_digital_playback = &alc268_pcm_digital_playback; |
| 12121 | |
Takashi Iwai | 22971e3 | 2009-02-10 11:56:44 +0100 | [diff] [blame] | 12122 | has_beep = 0; |
| 12123 | for (i = 0; i < spec->num_mixers; i++) { |
| 12124 | if (spec->mixers[i] == alc268_beep_mixer) { |
| 12125 | has_beep = 1; |
| 12126 | break; |
| 12127 | } |
| 12128 | } |
| 12129 | |
| 12130 | if (has_beep) { |
| 12131 | err = snd_hda_attach_beep_device(codec, 0x1); |
| 12132 | if (err < 0) { |
| 12133 | alc_free(codec); |
| 12134 | return err; |
| 12135 | } |
| 12136 | if (!query_amp_caps(codec, 0x1d, HDA_INPUT)) |
| 12137 | /* override the amp caps for beep generator */ |
| 12138 | snd_hda_override_amp_caps(codec, 0x1d, HDA_INPUT, |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 12139 | (0x0c << AC_AMPCAP_OFFSET_SHIFT) | |
| 12140 | (0x0c << AC_AMPCAP_NUM_STEPS_SHIFT) | |
| 12141 | (0x07 << AC_AMPCAP_STEP_SIZE_SHIFT) | |
| 12142 | (0 << AC_AMPCAP_MUTE_SHIFT)); |
Takashi Iwai | 22971e3 | 2009-02-10 11:56:44 +0100 | [diff] [blame] | 12143 | } |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 12144 | |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 12145 | if (!spec->adc_nids && spec->input_mux) { |
| 12146 | /* check whether NID 0x07 is valid */ |
| 12147 | unsigned int wcap = get_wcaps(codec, 0x07); |
Takashi Iwai | 85860c0 | 2008-02-19 15:00:15 +0100 | [diff] [blame] | 12148 | int i; |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12149 | |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 12150 | /* get type */ |
| 12151 | wcap = (wcap & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT; |
Takashi Iwai | 67ebcb0 | 2008-02-19 15:03:57 +0100 | [diff] [blame] | 12152 | if (wcap != AC_WID_AUD_IN || spec->input_mux->num_items == 1) { |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 12153 | spec->adc_nids = alc268_adc_nids_alt; |
| 12154 | spec->num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt); |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 12155 | add_mixer(spec, alc268_capture_alt_mixer); |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 12156 | } else { |
| 12157 | spec->adc_nids = alc268_adc_nids; |
| 12158 | spec->num_adc_nids = ARRAY_SIZE(alc268_adc_nids); |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 12159 | add_mixer(spec, alc268_capture_mixer); |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12160 | } |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 12161 | spec->capsrc_nids = alc268_capsrc_nids; |
Takashi Iwai | 85860c0 | 2008-02-19 15:00:15 +0100 | [diff] [blame] | 12162 | /* set default input source */ |
| 12163 | for (i = 0; i < spec->num_adc_nids; i++) |
| 12164 | snd_hda_codec_write_cache(codec, alc268_capsrc_nids[i], |
| 12165 | 0, AC_VERB_SET_CONNECT_SEL, |
| 12166 | spec->input_mux->items[0].index); |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12167 | } |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 12168 | |
| 12169 | spec->vmaster_nid = 0x02; |
| 12170 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12171 | codec->patch_ops = alc_patch_ops; |
| 12172 | if (board_config == ALC268_AUTO) |
| 12173 | spec->init_hook = alc268_auto_init; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 12174 | |
Takashi Iwai | daead53 | 2008-11-28 12:55:36 +0100 | [diff] [blame] | 12175 | codec->proc_widget_hook = print_realtek_coef; |
| 12176 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12177 | return 0; |
| 12178 | } |
| 12179 | |
| 12180 | /* |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 12181 | * ALC269 channel source setting (2 channel) |
| 12182 | */ |
| 12183 | #define ALC269_DIGOUT_NID ALC880_DIGOUT_NID |
| 12184 | |
| 12185 | #define alc269_dac_nids alc260_dac_nids |
| 12186 | |
| 12187 | static hda_nid_t alc269_adc_nids[1] = { |
| 12188 | /* ADC1 */ |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 12189 | 0x08, |
| 12190 | }; |
| 12191 | |
Takashi Iwai | e01bf50 | 2008-08-21 16:25:07 +0200 | [diff] [blame] | 12192 | static hda_nid_t alc269_capsrc_nids[1] = { |
| 12193 | 0x23, |
| 12194 | }; |
| 12195 | |
| 12196 | /* NOTE: ADC2 (0x07) is connected from a recording *MIXER* (0x24), |
| 12197 | * not a mux! |
| 12198 | */ |
| 12199 | |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 12200 | static struct hda_input_mux alc269_eeepc_dmic_capture_source = { |
| 12201 | .num_items = 2, |
| 12202 | .items = { |
| 12203 | { "i-Mic", 0x5 }, |
| 12204 | { "e-Mic", 0x0 }, |
| 12205 | }, |
| 12206 | }; |
| 12207 | |
| 12208 | static struct hda_input_mux alc269_eeepc_amic_capture_source = { |
| 12209 | .num_items = 2, |
| 12210 | .items = { |
| 12211 | { "i-Mic", 0x1 }, |
| 12212 | { "e-Mic", 0x0 }, |
| 12213 | }, |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 12214 | }; |
| 12215 | |
| 12216 | #define alc269_modes alc260_modes |
| 12217 | #define alc269_capture_source alc880_lg_lw_capture_source |
| 12218 | |
| 12219 | static struct snd_kcontrol_new alc269_base_mixer[] = { |
| 12220 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 12221 | HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 12222 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 12223 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 12224 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 12225 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 12226 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 12227 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 12228 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 12229 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
| 12230 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 12231 | HDA_CODEC_MUTE_MONO("Mono Playback Switch", 0x16, 2, 0x0, HDA_OUTPUT), |
| 12232 | { } /* end */ |
| 12233 | }; |
| 12234 | |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 12235 | static struct snd_kcontrol_new alc269_quanta_fl1_mixer[] = { |
| 12236 | /* output mixer control */ |
| 12237 | HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol), |
| 12238 | { |
| 12239 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 12240 | .name = "Master Playback Switch", |
| 12241 | .info = snd_hda_mixer_amp_switch_info, |
| 12242 | .get = snd_hda_mixer_amp_switch_get, |
| 12243 | .put = alc268_acer_master_sw_put, |
| 12244 | .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), |
| 12245 | }, |
| 12246 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 12247 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 12248 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 12249 | HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 12250 | HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 12251 | HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT), |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 12252 | { } |
| 12253 | }; |
| 12254 | |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 12255 | static struct snd_kcontrol_new alc269_lifebook_mixer[] = { |
| 12256 | /* output mixer control */ |
| 12257 | HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol), |
| 12258 | { |
| 12259 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 12260 | .name = "Master Playback Switch", |
| 12261 | .info = snd_hda_mixer_amp_switch_info, |
| 12262 | .get = snd_hda_mixer_amp_switch_get, |
| 12263 | .put = alc268_acer_master_sw_put, |
| 12264 | .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), |
| 12265 | }, |
| 12266 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 12267 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 12268 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 12269 | HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 12270 | HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 12271 | HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT), |
| 12272 | HDA_CODEC_VOLUME("Dock Mic Playback Volume", 0x0b, 0x03, HDA_INPUT), |
| 12273 | HDA_CODEC_MUTE("Dock Mic Playback Switch", 0x0b, 0x03, HDA_INPUT), |
| 12274 | HDA_CODEC_VOLUME("Dock Mic Boost", 0x1b, 0, HDA_INPUT), |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 12275 | { } |
| 12276 | }; |
| 12277 | |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 12278 | /* bind volumes of both NID 0x0c and 0x0d */ |
| 12279 | static struct hda_bind_ctls alc269_epc_bind_vol = { |
| 12280 | .ops = &snd_hda_bind_vol, |
| 12281 | .values = { |
| 12282 | HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT), |
| 12283 | HDA_COMPOSE_AMP_VAL(0x03, 3, 0, HDA_OUTPUT), |
| 12284 | 0 |
| 12285 | }, |
| 12286 | }; |
| 12287 | |
| 12288 | static struct snd_kcontrol_new alc269_eeepc_mixer[] = { |
| 12289 | HDA_CODEC_MUTE("iSpeaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 12290 | HDA_BIND_VOL("LineOut Playback Volume", &alc269_epc_bind_vol), |
| 12291 | HDA_CODEC_MUTE("LineOut Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 12292 | { } /* end */ |
| 12293 | }; |
| 12294 | |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 12295 | /* capture mixer elements */ |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 12296 | static struct snd_kcontrol_new alc269_epc_capture_mixer[] = { |
| 12297 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 12298 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
Takashi Iwai | 26f5df2 | 2008-11-03 17:39:46 +0100 | [diff] [blame] | 12299 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 12300 | { } /* end */ |
| 12301 | }; |
| 12302 | |
| 12303 | /* FSC amilo */ |
| 12304 | static struct snd_kcontrol_new alc269_fujitsu_mixer[] = { |
| 12305 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 12306 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 12307 | HDA_BIND_VOL("PCM Playback Volume", &alc269_epc_bind_vol), |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 12308 | { } /* end */ |
| 12309 | }; |
| 12310 | |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 12311 | static struct hda_verb alc269_quanta_fl1_verbs[] = { |
| 12312 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 12313 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 12314 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 12315 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 12316 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 12317 | {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 12318 | { } |
| 12319 | }; |
| 12320 | |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 12321 | static struct hda_verb alc269_lifebook_verbs[] = { |
| 12322 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 12323 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 12324 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 12325 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 12326 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 12327 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 12328 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 12329 | {0x1a, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 12330 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 12331 | {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 12332 | { } |
| 12333 | }; |
| 12334 | |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 12335 | /* toggle speaker-output according to the hp-jack state */ |
| 12336 | static void alc269_quanta_fl1_speaker_automute(struct hda_codec *codec) |
| 12337 | { |
| 12338 | unsigned int present; |
| 12339 | unsigned char bits; |
| 12340 | |
| 12341 | present = snd_hda_codec_read(codec, 0x15, 0, |
| 12342 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 12343 | bits = present ? AMP_IN_MUTE(0) : 0; |
| 12344 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0, |
| 12345 | AMP_IN_MUTE(0), bits); |
| 12346 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1, |
| 12347 | AMP_IN_MUTE(0), bits); |
| 12348 | |
| 12349 | snd_hda_codec_write(codec, 0x20, 0, |
| 12350 | AC_VERB_SET_COEF_INDEX, 0x0c); |
| 12351 | snd_hda_codec_write(codec, 0x20, 0, |
| 12352 | AC_VERB_SET_PROC_COEF, 0x680); |
| 12353 | |
| 12354 | snd_hda_codec_write(codec, 0x20, 0, |
| 12355 | AC_VERB_SET_COEF_INDEX, 0x0c); |
| 12356 | snd_hda_codec_write(codec, 0x20, 0, |
| 12357 | AC_VERB_SET_PROC_COEF, 0x480); |
| 12358 | } |
| 12359 | |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 12360 | /* toggle speaker-output according to the hp-jacks state */ |
| 12361 | static void alc269_lifebook_speaker_automute(struct hda_codec *codec) |
| 12362 | { |
| 12363 | unsigned int present; |
| 12364 | unsigned char bits; |
| 12365 | |
| 12366 | /* Check laptop headphone socket */ |
| 12367 | present = snd_hda_codec_read(codec, 0x15, 0, |
| 12368 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 12369 | |
| 12370 | /* Check port replicator headphone socket */ |
| 12371 | present |= snd_hda_codec_read(codec, 0x1a, 0, |
| 12372 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 12373 | |
| 12374 | bits = present ? AMP_IN_MUTE(0) : 0; |
| 12375 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0, |
| 12376 | AMP_IN_MUTE(0), bits); |
| 12377 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1, |
| 12378 | AMP_IN_MUTE(0), bits); |
| 12379 | |
| 12380 | snd_hda_codec_write(codec, 0x20, 0, |
| 12381 | AC_VERB_SET_COEF_INDEX, 0x0c); |
| 12382 | snd_hda_codec_write(codec, 0x20, 0, |
| 12383 | AC_VERB_SET_PROC_COEF, 0x680); |
| 12384 | |
| 12385 | snd_hda_codec_write(codec, 0x20, 0, |
| 12386 | AC_VERB_SET_COEF_INDEX, 0x0c); |
| 12387 | snd_hda_codec_write(codec, 0x20, 0, |
| 12388 | AC_VERB_SET_PROC_COEF, 0x480); |
| 12389 | } |
| 12390 | |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 12391 | static void alc269_quanta_fl1_mic_automute(struct hda_codec *codec) |
| 12392 | { |
| 12393 | unsigned int present; |
| 12394 | |
| 12395 | present = snd_hda_codec_read(codec, 0x18, 0, |
| 12396 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 12397 | snd_hda_codec_write(codec, 0x23, 0, |
| 12398 | AC_VERB_SET_CONNECT_SEL, present ? 0x0 : 0x1); |
| 12399 | } |
| 12400 | |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 12401 | static void alc269_lifebook_mic_autoswitch(struct hda_codec *codec) |
| 12402 | { |
| 12403 | unsigned int present_laptop; |
| 12404 | unsigned int present_dock; |
| 12405 | |
| 12406 | present_laptop = snd_hda_codec_read(codec, 0x18, 0, |
| 12407 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 12408 | |
| 12409 | present_dock = snd_hda_codec_read(codec, 0x1b, 0, |
| 12410 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 12411 | |
| 12412 | /* Laptop mic port overrides dock mic port, design decision */ |
| 12413 | if (present_dock) |
| 12414 | snd_hda_codec_write(codec, 0x23, 0, |
| 12415 | AC_VERB_SET_CONNECT_SEL, 0x3); |
| 12416 | if (present_laptop) |
| 12417 | snd_hda_codec_write(codec, 0x23, 0, |
| 12418 | AC_VERB_SET_CONNECT_SEL, 0x0); |
| 12419 | if (!present_dock && !present_laptop) |
| 12420 | snd_hda_codec_write(codec, 0x23, 0, |
| 12421 | AC_VERB_SET_CONNECT_SEL, 0x1); |
| 12422 | } |
| 12423 | |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 12424 | static void alc269_quanta_fl1_unsol_event(struct hda_codec *codec, |
| 12425 | unsigned int res) |
| 12426 | { |
| 12427 | if ((res >> 26) == ALC880_HP_EVENT) |
| 12428 | alc269_quanta_fl1_speaker_automute(codec); |
| 12429 | if ((res >> 26) == ALC880_MIC_EVENT) |
| 12430 | alc269_quanta_fl1_mic_automute(codec); |
| 12431 | } |
| 12432 | |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 12433 | static void alc269_lifebook_unsol_event(struct hda_codec *codec, |
| 12434 | unsigned int res) |
| 12435 | { |
| 12436 | if ((res >> 26) == ALC880_HP_EVENT) |
| 12437 | alc269_lifebook_speaker_automute(codec); |
| 12438 | if ((res >> 26) == ALC880_MIC_EVENT) |
| 12439 | alc269_lifebook_mic_autoswitch(codec); |
| 12440 | } |
| 12441 | |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 12442 | static void alc269_quanta_fl1_init_hook(struct hda_codec *codec) |
| 12443 | { |
| 12444 | alc269_quanta_fl1_speaker_automute(codec); |
| 12445 | alc269_quanta_fl1_mic_automute(codec); |
| 12446 | } |
| 12447 | |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 12448 | static void alc269_lifebook_init_hook(struct hda_codec *codec) |
| 12449 | { |
| 12450 | alc269_lifebook_speaker_automute(codec); |
| 12451 | alc269_lifebook_mic_autoswitch(codec); |
| 12452 | } |
| 12453 | |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 12454 | static struct hda_verb alc269_eeepc_dmic_init_verbs[] = { |
| 12455 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 12456 | {0x23, AC_VERB_SET_CONNECT_SEL, 0x05}, |
| 12457 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, 0xb026 }, |
| 12458 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7019 | (0x00 << 8))}, |
| 12459 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 12460 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 12461 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 12462 | {} |
| 12463 | }; |
| 12464 | |
| 12465 | static struct hda_verb alc269_eeepc_amic_init_verbs[] = { |
| 12466 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 12467 | {0x23, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 12468 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, 0xb026 }, |
| 12469 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x701b | (0x00 << 8))}, |
| 12470 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 12471 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 12472 | {} |
| 12473 | }; |
| 12474 | |
| 12475 | /* toggle speaker-output according to the hp-jack state */ |
| 12476 | static void alc269_speaker_automute(struct hda_codec *codec) |
| 12477 | { |
| 12478 | unsigned int present; |
| 12479 | unsigned char bits; |
| 12480 | |
| 12481 | present = snd_hda_codec_read(codec, 0x15, 0, |
| 12482 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 12483 | bits = present ? AMP_IN_MUTE(0) : 0; |
| 12484 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0, |
| 12485 | AMP_IN_MUTE(0), bits); |
| 12486 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1, |
| 12487 | AMP_IN_MUTE(0), bits); |
| 12488 | } |
| 12489 | |
| 12490 | static void alc269_eeepc_dmic_automute(struct hda_codec *codec) |
| 12491 | { |
| 12492 | unsigned int present; |
| 12493 | |
| 12494 | present = snd_hda_codec_read(codec, 0x18, 0, |
| 12495 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 12496 | snd_hda_codec_write(codec, 0x23, 0, |
| 12497 | AC_VERB_SET_CONNECT_SEL, (present ? 0 : 5)); |
| 12498 | } |
| 12499 | |
| 12500 | static void alc269_eeepc_amic_automute(struct hda_codec *codec) |
| 12501 | { |
| 12502 | unsigned int present; |
| 12503 | |
| 12504 | present = snd_hda_codec_read(codec, 0x18, 0, |
| 12505 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 12506 | snd_hda_codec_write(codec, 0x24, 0, AC_VERB_SET_AMP_GAIN_MUTE, |
| 12507 | 0x7000 | (0x00 << 8) | (present ? 0 : 0x80)); |
| 12508 | snd_hda_codec_write(codec, 0x24, 0, AC_VERB_SET_AMP_GAIN_MUTE, |
| 12509 | 0x7000 | (0x01 << 8) | (present ? 0x80 : 0)); |
| 12510 | } |
| 12511 | |
| 12512 | /* unsolicited event for HP jack sensing */ |
| 12513 | static void alc269_eeepc_dmic_unsol_event(struct hda_codec *codec, |
| 12514 | unsigned int res) |
| 12515 | { |
| 12516 | if ((res >> 26) == ALC880_HP_EVENT) |
| 12517 | alc269_speaker_automute(codec); |
| 12518 | |
| 12519 | if ((res >> 26) == ALC880_MIC_EVENT) |
| 12520 | alc269_eeepc_dmic_automute(codec); |
| 12521 | } |
| 12522 | |
| 12523 | static void alc269_eeepc_dmic_inithook(struct hda_codec *codec) |
| 12524 | { |
| 12525 | alc269_speaker_automute(codec); |
| 12526 | alc269_eeepc_dmic_automute(codec); |
| 12527 | } |
| 12528 | |
| 12529 | /* unsolicited event for HP jack sensing */ |
| 12530 | static void alc269_eeepc_amic_unsol_event(struct hda_codec *codec, |
| 12531 | unsigned int res) |
| 12532 | { |
| 12533 | if ((res >> 26) == ALC880_HP_EVENT) |
| 12534 | alc269_speaker_automute(codec); |
| 12535 | |
| 12536 | if ((res >> 26) == ALC880_MIC_EVENT) |
| 12537 | alc269_eeepc_amic_automute(codec); |
| 12538 | } |
| 12539 | |
| 12540 | static void alc269_eeepc_amic_inithook(struct hda_codec *codec) |
| 12541 | { |
| 12542 | alc269_speaker_automute(codec); |
| 12543 | alc269_eeepc_amic_automute(codec); |
| 12544 | } |
| 12545 | |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 12546 | /* |
| 12547 | * generic initialization of ADC, input mixers and output mixers |
| 12548 | */ |
| 12549 | static struct hda_verb alc269_init_verbs[] = { |
| 12550 | /* |
| 12551 | * Unmute ADC0 and set the default input to mic-in |
| 12552 | */ |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 12553 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 12554 | |
| 12555 | /* Mute input amps (PCBeep, Line In, Mic 1 & Mic 2) of the |
| 12556 | * analog-loopback mixer widget |
| 12557 | * Note: PASD motherboards uses the Line In 2 as the input for |
| 12558 | * front panel mic (mic 2) |
| 12559 | */ |
| 12560 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
| 12561 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 12562 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 12563 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 12564 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 12565 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 12566 | |
| 12567 | /* |
| 12568 | * Set up output mixers (0x0c - 0x0e) |
| 12569 | */ |
| 12570 | /* set vol=0 to output mixers */ |
| 12571 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 12572 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 12573 | |
| 12574 | /* set up input amps for analog loopback */ |
| 12575 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 12576 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12577 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 12578 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12579 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 12580 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12581 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 12582 | |
| 12583 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 12584 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 12585 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 12586 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 12587 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 12588 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 12589 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 12590 | |
| 12591 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 12592 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 12593 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 12594 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 12595 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 12596 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 12597 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 12598 | |
| 12599 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 12600 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 12601 | |
| 12602 | /* FIXME: use matrix-type input source selection */ |
| 12603 | /* Mixer elements: 0x18, 19, 1a, 1b, 1d, 0b */ |
| 12604 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 12605 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 12606 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 12607 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 12608 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 12609 | |
| 12610 | /* set EAPD */ |
| 12611 | {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 12612 | {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 12613 | { } |
| 12614 | }; |
| 12615 | |
| 12616 | /* add playback controls from the parsed DAC table */ |
| 12617 | static int alc269_auto_create_multi_out_ctls(struct alc_spec *spec, |
| 12618 | const struct auto_pin_cfg *cfg) |
| 12619 | { |
| 12620 | hda_nid_t nid; |
| 12621 | int err; |
| 12622 | |
| 12623 | spec->multiout.num_dacs = 1; /* only use one dac */ |
| 12624 | spec->multiout.dac_nids = spec->private_dac_nids; |
| 12625 | spec->multiout.dac_nids[0] = 2; |
| 12626 | |
| 12627 | nid = cfg->line_out_pins[0]; |
| 12628 | if (nid) { |
| 12629 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 12630 | "Front Playback Volume", |
| 12631 | HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT)); |
| 12632 | if (err < 0) |
| 12633 | return err; |
| 12634 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, |
| 12635 | "Front Playback Switch", |
| 12636 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT)); |
| 12637 | if (err < 0) |
| 12638 | return err; |
| 12639 | } |
| 12640 | |
| 12641 | nid = cfg->speaker_pins[0]; |
| 12642 | if (nid) { |
| 12643 | if (!cfg->line_out_pins[0]) { |
| 12644 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 12645 | "Speaker Playback Volume", |
| 12646 | HDA_COMPOSE_AMP_VAL(0x02, 3, 0, |
| 12647 | HDA_OUTPUT)); |
| 12648 | if (err < 0) |
| 12649 | return err; |
| 12650 | } |
| 12651 | if (nid == 0x16) { |
| 12652 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, |
| 12653 | "Speaker Playback Switch", |
| 12654 | HDA_COMPOSE_AMP_VAL(nid, 2, 0, |
| 12655 | HDA_OUTPUT)); |
| 12656 | if (err < 0) |
| 12657 | return err; |
| 12658 | } else { |
| 12659 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, |
| 12660 | "Speaker Playback Switch", |
| 12661 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, |
| 12662 | HDA_OUTPUT)); |
| 12663 | if (err < 0) |
| 12664 | return err; |
| 12665 | } |
| 12666 | } |
| 12667 | nid = cfg->hp_pins[0]; |
| 12668 | if (nid) { |
| 12669 | /* spec->multiout.hp_nid = 2; */ |
| 12670 | if (!cfg->line_out_pins[0] && !cfg->speaker_pins[0]) { |
| 12671 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 12672 | "Headphone Playback Volume", |
| 12673 | HDA_COMPOSE_AMP_VAL(0x02, 3, 0, |
| 12674 | HDA_OUTPUT)); |
| 12675 | if (err < 0) |
| 12676 | return err; |
| 12677 | } |
| 12678 | if (nid == 0x16) { |
| 12679 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, |
| 12680 | "Headphone Playback Switch", |
| 12681 | HDA_COMPOSE_AMP_VAL(nid, 2, 0, |
| 12682 | HDA_OUTPUT)); |
| 12683 | if (err < 0) |
| 12684 | return err; |
| 12685 | } else { |
| 12686 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, |
| 12687 | "Headphone Playback Switch", |
| 12688 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, |
| 12689 | HDA_OUTPUT)); |
| 12690 | if (err < 0) |
| 12691 | return err; |
| 12692 | } |
| 12693 | } |
| 12694 | return 0; |
| 12695 | } |
| 12696 | |
Takashi Iwai | ee956e0 | 2008-10-31 17:16:31 +0100 | [diff] [blame] | 12697 | static int alc269_auto_create_analog_input_ctls(struct alc_spec *spec, |
| 12698 | const struct auto_pin_cfg *cfg) |
| 12699 | { |
| 12700 | int err; |
| 12701 | |
| 12702 | err = alc880_auto_create_analog_input_ctls(spec, cfg); |
| 12703 | if (err < 0) |
| 12704 | return err; |
| 12705 | /* digital-mic input pin is excluded in alc880_auto_create..() |
| 12706 | * because it's under 0x18 |
| 12707 | */ |
| 12708 | if (cfg->input_pins[AUTO_PIN_MIC] == 0x12 || |
| 12709 | cfg->input_pins[AUTO_PIN_FRONT_MIC] == 0x12) { |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 12710 | struct hda_input_mux *imux = &spec->private_imux[0]; |
Takashi Iwai | ee956e0 | 2008-10-31 17:16:31 +0100 | [diff] [blame] | 12711 | imux->items[imux->num_items].label = "Int Mic"; |
| 12712 | imux->items[imux->num_items].index = 0x05; |
| 12713 | imux->num_items++; |
| 12714 | } |
| 12715 | return 0; |
| 12716 | } |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 12717 | |
| 12718 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 12719 | #define alc269_loopbacks alc880_loopbacks |
| 12720 | #endif |
| 12721 | |
| 12722 | /* pcm configuration: identiacal with ALC880 */ |
| 12723 | #define alc269_pcm_analog_playback alc880_pcm_analog_playback |
| 12724 | #define alc269_pcm_analog_capture alc880_pcm_analog_capture |
| 12725 | #define alc269_pcm_digital_playback alc880_pcm_digital_playback |
| 12726 | #define alc269_pcm_digital_capture alc880_pcm_digital_capture |
| 12727 | |
| 12728 | /* |
| 12729 | * BIOS auto configuration |
| 12730 | */ |
| 12731 | static int alc269_parse_auto_config(struct hda_codec *codec) |
| 12732 | { |
| 12733 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | cfb9fb5 | 2009-02-06 17:34:03 +0100 | [diff] [blame] | 12734 | int err; |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 12735 | static hda_nid_t alc269_ignore[] = { 0x1d, 0 }; |
| 12736 | |
| 12737 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 12738 | alc269_ignore); |
| 12739 | if (err < 0) |
| 12740 | return err; |
| 12741 | |
| 12742 | err = alc269_auto_create_multi_out_ctls(spec, &spec->autocfg); |
| 12743 | if (err < 0) |
| 12744 | return err; |
| 12745 | err = alc269_auto_create_analog_input_ctls(spec, &spec->autocfg); |
| 12746 | if (err < 0) |
| 12747 | return err; |
| 12748 | |
| 12749 | spec->multiout.max_channels = spec->multiout.num_dacs * 2; |
| 12750 | |
Takashi Iwai | 0852d7a | 2009-02-11 11:35:15 +0100 | [diff] [blame] | 12751 | if (spec->autocfg.dig_outs) |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 12752 | spec->multiout.dig_out_nid = ALC269_DIGOUT_NID; |
| 12753 | |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 12754 | if (spec->kctls.list) |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 12755 | add_mixer(spec, spec->kctls.list); |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 12756 | |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 12757 | add_verb(spec, alc269_init_verbs); |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 12758 | spec->num_mux_defs = 1; |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 12759 | spec->input_mux = &spec->private_imux[0]; |
Takashi Iwai | e01bf50 | 2008-08-21 16:25:07 +0200 | [diff] [blame] | 12760 | /* set default input source */ |
| 12761 | snd_hda_codec_write_cache(codec, alc269_capsrc_nids[0], |
| 12762 | 0, AC_VERB_SET_CONNECT_SEL, |
| 12763 | spec->input_mux->items[0].index); |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 12764 | |
| 12765 | err = alc_auto_add_mic_boost(codec); |
| 12766 | if (err < 0) |
| 12767 | return err; |
| 12768 | |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 12769 | if (!spec->cap_mixer) |
| 12770 | set_capture_mixer(spec); |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 12771 | |
Takashi Iwai | e044c39 | 2008-10-27 16:56:24 +0100 | [diff] [blame] | 12772 | store_pin_configs(codec); |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 12773 | return 1; |
| 12774 | } |
| 12775 | |
| 12776 | #define alc269_auto_init_multi_out alc882_auto_init_multi_out |
| 12777 | #define alc269_auto_init_hp_out alc882_auto_init_hp_out |
| 12778 | #define alc269_auto_init_analog_input alc882_auto_init_analog_input |
| 12779 | |
| 12780 | |
| 12781 | /* init callback for auto-configuration model -- overriding the default init */ |
| 12782 | static void alc269_auto_init(struct hda_codec *codec) |
| 12783 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 12784 | struct alc_spec *spec = codec->spec; |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 12785 | alc269_auto_init_multi_out(codec); |
| 12786 | alc269_auto_init_hp_out(codec); |
| 12787 | alc269_auto_init_analog_input(codec); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 12788 | if (spec->unsol_event) |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 12789 | alc_inithook(codec); |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 12790 | } |
| 12791 | |
| 12792 | /* |
| 12793 | * configuration and preset |
| 12794 | */ |
| 12795 | static const char *alc269_models[ALC269_MODEL_LAST] = { |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 12796 | [ALC269_BASIC] = "basic", |
Takashi Iwai | 2922c9a | 2008-08-27 18:12:42 +0200 | [diff] [blame] | 12797 | [ALC269_QUANTA_FL1] = "quanta", |
| 12798 | [ALC269_ASUS_EEEPC_P703] = "eeepc-p703", |
Takashi Iwai | 26f5df2 | 2008-11-03 17:39:46 +0100 | [diff] [blame] | 12799 | [ALC269_ASUS_EEEPC_P901] = "eeepc-p901", |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 12800 | [ALC269_FUJITSU] = "fujitsu", |
| 12801 | [ALC269_LIFEBOOK] = "lifebook" |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 12802 | }; |
| 12803 | |
| 12804 | static struct snd_pci_quirk alc269_cfg_tbl[] = { |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 12805 | SND_PCI_QUIRK(0x17aa, 0x3bf8, "Quanta FL1", ALC269_QUANTA_FL1), |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 12806 | SND_PCI_QUIRK(0x1043, 0x8330, "ASUS Eeepc P703 P900A", |
| 12807 | ALC269_ASUS_EEEPC_P703), |
| 12808 | SND_PCI_QUIRK(0x1043, 0x831a, "ASUS Eeepc P901", |
| 12809 | ALC269_ASUS_EEEPC_P901), |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 12810 | SND_PCI_QUIRK(0x1043, 0x834a, "ASUS Eeepc S101", |
| 12811 | ALC269_ASUS_EEEPC_P901), |
Takashi Iwai | 26f5df2 | 2008-11-03 17:39:46 +0100 | [diff] [blame] | 12812 | SND_PCI_QUIRK(0x1734, 0x115d, "FSC Amilo", ALC269_FUJITSU), |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 12813 | SND_PCI_QUIRK(0x10cf, 0x1475, "Lifebook ICH9M-based", ALC269_LIFEBOOK), |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 12814 | {} |
| 12815 | }; |
| 12816 | |
| 12817 | static struct alc_config_preset alc269_presets[] = { |
| 12818 | [ALC269_BASIC] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 12819 | .mixers = { alc269_base_mixer }, |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 12820 | .init_verbs = { alc269_init_verbs }, |
| 12821 | .num_dacs = ARRAY_SIZE(alc269_dac_nids), |
| 12822 | .dac_nids = alc269_dac_nids, |
| 12823 | .hp_nid = 0x03, |
| 12824 | .num_channel_mode = ARRAY_SIZE(alc269_modes), |
| 12825 | .channel_mode = alc269_modes, |
| 12826 | .input_mux = &alc269_capture_source, |
| 12827 | }, |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 12828 | [ALC269_QUANTA_FL1] = { |
| 12829 | .mixers = { alc269_quanta_fl1_mixer }, |
| 12830 | .init_verbs = { alc269_init_verbs, alc269_quanta_fl1_verbs }, |
| 12831 | .num_dacs = ARRAY_SIZE(alc269_dac_nids), |
| 12832 | .dac_nids = alc269_dac_nids, |
| 12833 | .hp_nid = 0x03, |
| 12834 | .num_channel_mode = ARRAY_SIZE(alc269_modes), |
| 12835 | .channel_mode = alc269_modes, |
| 12836 | .input_mux = &alc269_capture_source, |
| 12837 | .unsol_event = alc269_quanta_fl1_unsol_event, |
| 12838 | .init_hook = alc269_quanta_fl1_init_hook, |
| 12839 | }, |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 12840 | [ALC269_ASUS_EEEPC_P703] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 12841 | .mixers = { alc269_eeepc_mixer }, |
| 12842 | .cap_mixer = alc269_epc_capture_mixer, |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 12843 | .init_verbs = { alc269_init_verbs, |
| 12844 | alc269_eeepc_amic_init_verbs }, |
| 12845 | .num_dacs = ARRAY_SIZE(alc269_dac_nids), |
| 12846 | .dac_nids = alc269_dac_nids, |
| 12847 | .hp_nid = 0x03, |
| 12848 | .num_channel_mode = ARRAY_SIZE(alc269_modes), |
| 12849 | .channel_mode = alc269_modes, |
| 12850 | .input_mux = &alc269_eeepc_amic_capture_source, |
| 12851 | .unsol_event = alc269_eeepc_amic_unsol_event, |
| 12852 | .init_hook = alc269_eeepc_amic_inithook, |
| 12853 | }, |
| 12854 | [ALC269_ASUS_EEEPC_P901] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 12855 | .mixers = { alc269_eeepc_mixer }, |
| 12856 | .cap_mixer = alc269_epc_capture_mixer, |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 12857 | .init_verbs = { alc269_init_verbs, |
| 12858 | alc269_eeepc_dmic_init_verbs }, |
| 12859 | .num_dacs = ARRAY_SIZE(alc269_dac_nids), |
| 12860 | .dac_nids = alc269_dac_nids, |
| 12861 | .hp_nid = 0x03, |
| 12862 | .num_channel_mode = ARRAY_SIZE(alc269_modes), |
| 12863 | .channel_mode = alc269_modes, |
| 12864 | .input_mux = &alc269_eeepc_dmic_capture_source, |
| 12865 | .unsol_event = alc269_eeepc_dmic_unsol_event, |
| 12866 | .init_hook = alc269_eeepc_dmic_inithook, |
| 12867 | }, |
Takashi Iwai | 26f5df2 | 2008-11-03 17:39:46 +0100 | [diff] [blame] | 12868 | [ALC269_FUJITSU] = { |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 12869 | .mixers = { alc269_fujitsu_mixer }, |
Takashi Iwai | 26f5df2 | 2008-11-03 17:39:46 +0100 | [diff] [blame] | 12870 | .cap_mixer = alc269_epc_capture_mixer, |
| 12871 | .init_verbs = { alc269_init_verbs, |
| 12872 | alc269_eeepc_dmic_init_verbs }, |
| 12873 | .num_dacs = ARRAY_SIZE(alc269_dac_nids), |
| 12874 | .dac_nids = alc269_dac_nids, |
| 12875 | .hp_nid = 0x03, |
| 12876 | .num_channel_mode = ARRAY_SIZE(alc269_modes), |
| 12877 | .channel_mode = alc269_modes, |
| 12878 | .input_mux = &alc269_eeepc_dmic_capture_source, |
| 12879 | .unsol_event = alc269_eeepc_dmic_unsol_event, |
| 12880 | .init_hook = alc269_eeepc_dmic_inithook, |
| 12881 | }, |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 12882 | [ALC269_LIFEBOOK] = { |
| 12883 | .mixers = { alc269_lifebook_mixer }, |
| 12884 | .init_verbs = { alc269_init_verbs, alc269_lifebook_verbs }, |
| 12885 | .num_dacs = ARRAY_SIZE(alc269_dac_nids), |
| 12886 | .dac_nids = alc269_dac_nids, |
| 12887 | .hp_nid = 0x03, |
| 12888 | .num_channel_mode = ARRAY_SIZE(alc269_modes), |
| 12889 | .channel_mode = alc269_modes, |
| 12890 | .input_mux = &alc269_capture_source, |
| 12891 | .unsol_event = alc269_lifebook_unsol_event, |
| 12892 | .init_hook = alc269_lifebook_init_hook, |
| 12893 | }, |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 12894 | }; |
| 12895 | |
| 12896 | static int patch_alc269(struct hda_codec *codec) |
| 12897 | { |
| 12898 | struct alc_spec *spec; |
| 12899 | int board_config; |
| 12900 | int err; |
| 12901 | |
| 12902 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
| 12903 | if (spec == NULL) |
| 12904 | return -ENOMEM; |
| 12905 | |
| 12906 | codec->spec = spec; |
| 12907 | |
Takashi Iwai | 2c3bf9a | 2008-06-04 12:39:38 +0200 | [diff] [blame] | 12908 | alc_fix_pll_init(codec, 0x20, 0x04, 15); |
| 12909 | |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 12910 | board_config = snd_hda_check_board_config(codec, ALC269_MODEL_LAST, |
| 12911 | alc269_models, |
| 12912 | alc269_cfg_tbl); |
| 12913 | |
| 12914 | if (board_config < 0) { |
| 12915 | printk(KERN_INFO "hda_codec: Unknown model for ALC269, " |
| 12916 | "trying auto-probe from BIOS...\n"); |
| 12917 | board_config = ALC269_AUTO; |
| 12918 | } |
| 12919 | |
| 12920 | if (board_config == ALC269_AUTO) { |
| 12921 | /* automatic parse from the BIOS config */ |
| 12922 | err = alc269_parse_auto_config(codec); |
| 12923 | if (err < 0) { |
| 12924 | alc_free(codec); |
| 12925 | return err; |
| 12926 | } else if (!err) { |
| 12927 | printk(KERN_INFO |
| 12928 | "hda_codec: Cannot set up configuration " |
| 12929 | "from BIOS. Using base mode...\n"); |
| 12930 | board_config = ALC269_BASIC; |
| 12931 | } |
| 12932 | } |
| 12933 | |
Kusanagi Kouichi | 680cd53 | 2009-02-05 00:00:58 +0900 | [diff] [blame] | 12934 | err = snd_hda_attach_beep_device(codec, 0x1); |
| 12935 | if (err < 0) { |
| 12936 | alc_free(codec); |
| 12937 | return err; |
| 12938 | } |
| 12939 | |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 12940 | if (board_config != ALC269_AUTO) |
| 12941 | setup_preset(spec, &alc269_presets[board_config]); |
| 12942 | |
| 12943 | spec->stream_name_analog = "ALC269 Analog"; |
| 12944 | spec->stream_analog_playback = &alc269_pcm_analog_playback; |
| 12945 | spec->stream_analog_capture = &alc269_pcm_analog_capture; |
| 12946 | |
| 12947 | spec->stream_name_digital = "ALC269 Digital"; |
| 12948 | spec->stream_digital_playback = &alc269_pcm_digital_playback; |
| 12949 | spec->stream_digital_capture = &alc269_pcm_digital_capture; |
| 12950 | |
| 12951 | spec->adc_nids = alc269_adc_nids; |
| 12952 | spec->num_adc_nids = ARRAY_SIZE(alc269_adc_nids); |
Takashi Iwai | e01bf50 | 2008-08-21 16:25:07 +0200 | [diff] [blame] | 12953 | spec->capsrc_nids = alc269_capsrc_nids; |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 12954 | if (!spec->cap_mixer) |
| 12955 | set_capture_mixer(spec); |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 12956 | set_beep_amp(spec, 0x0b, 0x04, HDA_INPUT); |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 12957 | |
| 12958 | codec->patch_ops = alc_patch_ops; |
| 12959 | if (board_config == ALC269_AUTO) |
| 12960 | spec->init_hook = alc269_auto_init; |
| 12961 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 12962 | if (!spec->loopback.amplist) |
| 12963 | spec->loopback.amplist = alc269_loopbacks; |
| 12964 | #endif |
Takashi Iwai | daead53 | 2008-11-28 12:55:36 +0100 | [diff] [blame] | 12965 | codec->proc_widget_hook = print_realtek_coef; |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 12966 | |
| 12967 | return 0; |
| 12968 | } |
| 12969 | |
| 12970 | /* |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12971 | * ALC861 channel source setting (2/6 channel selection for 3-stack) |
| 12972 | */ |
| 12973 | |
| 12974 | /* |
| 12975 | * set the path ways for 2 channel output |
| 12976 | * need to set the codec line out and mic 1 pin widgets to inputs |
| 12977 | */ |
| 12978 | static struct hda_verb alc861_threestack_ch2_init[] = { |
| 12979 | /* set pin widget 1Ah (line in) for input */ |
| 12980 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12981 | /* set pin widget 18h (mic1/2) for input, for mic also enable |
| 12982 | * the vref |
| 12983 | */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12984 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 12985 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 12986 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c }, |
| 12987 | #if 0 |
| 12988 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/ |
| 12989 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8)) }, /*line-in*/ |
| 12990 | #endif |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12991 | { } /* end */ |
| 12992 | }; |
| 12993 | /* |
| 12994 | * 6ch mode |
| 12995 | * need to set the codec line out and mic 1 pin widgets to outputs |
| 12996 | */ |
| 12997 | static struct hda_verb alc861_threestack_ch6_init[] = { |
| 12998 | /* set pin widget 1Ah (line in) for output (Back Surround)*/ |
| 12999 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 13000 | /* set pin widget 18h (mic1) for output (CLFE)*/ |
| 13001 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 13002 | |
| 13003 | { 0x0c, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 13004 | { 0x0d, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13005 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 13006 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb080 }, |
| 13007 | #if 0 |
| 13008 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/ |
| 13009 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8)) }, /*line in*/ |
| 13010 | #endif |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13011 | { } /* end */ |
| 13012 | }; |
| 13013 | |
| 13014 | static struct hda_channel_mode alc861_threestack_modes[2] = { |
| 13015 | { 2, alc861_threestack_ch2_init }, |
| 13016 | { 6, alc861_threestack_ch6_init }, |
| 13017 | }; |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 13018 | /* Set mic1 as input and unmute the mixer */ |
| 13019 | static struct hda_verb alc861_uniwill_m31_ch2_init[] = { |
| 13020 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 13021 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/ |
| 13022 | { } /* end */ |
| 13023 | }; |
| 13024 | /* Set mic1 as output and mute mixer */ |
| 13025 | static struct hda_verb alc861_uniwill_m31_ch4_init[] = { |
| 13026 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 13027 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/ |
| 13028 | { } /* end */ |
| 13029 | }; |
| 13030 | |
| 13031 | static struct hda_channel_mode alc861_uniwill_m31_modes[2] = { |
| 13032 | { 2, alc861_uniwill_m31_ch2_init }, |
| 13033 | { 4, alc861_uniwill_m31_ch4_init }, |
| 13034 | }; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13035 | |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 13036 | /* Set mic1 and line-in as input and unmute the mixer */ |
| 13037 | static struct hda_verb alc861_asus_ch2_init[] = { |
| 13038 | /* set pin widget 1Ah (line in) for input */ |
| 13039 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13040 | /* set pin widget 18h (mic1/2) for input, for mic also enable |
| 13041 | * the vref |
| 13042 | */ |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 13043 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 13044 | |
| 13045 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c }, |
| 13046 | #if 0 |
| 13047 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/ |
| 13048 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8)) }, /*line-in*/ |
| 13049 | #endif |
| 13050 | { } /* end */ |
| 13051 | }; |
| 13052 | /* Set mic1 nad line-in as output and mute mixer */ |
| 13053 | static struct hda_verb alc861_asus_ch6_init[] = { |
| 13054 | /* set pin widget 1Ah (line in) for output (Back Surround)*/ |
| 13055 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 13056 | /* { 0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, */ |
| 13057 | /* set pin widget 18h (mic1) for output (CLFE)*/ |
| 13058 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 13059 | /* { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, */ |
| 13060 | { 0x0c, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 13061 | { 0x0d, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 13062 | |
| 13063 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb080 }, |
| 13064 | #if 0 |
| 13065 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/ |
| 13066 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8)) }, /*line in*/ |
| 13067 | #endif |
| 13068 | { } /* end */ |
| 13069 | }; |
| 13070 | |
| 13071 | static struct hda_channel_mode alc861_asus_modes[2] = { |
| 13072 | { 2, alc861_asus_ch2_init }, |
| 13073 | { 6, alc861_asus_ch6_init }, |
| 13074 | }; |
| 13075 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13076 | /* patch-ALC861 */ |
| 13077 | |
| 13078 | static struct snd_kcontrol_new alc861_base_mixer[] = { |
| 13079 | /* output mixer control */ |
| 13080 | HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT), |
| 13081 | HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT), |
| 13082 | HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT), |
| 13083 | HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT), |
| 13084 | HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), |
| 13085 | |
| 13086 | /*Input mixer control */ |
| 13087 | /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT), |
| 13088 | HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */ |
| 13089 | HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT), |
| 13090 | HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT), |
| 13091 | HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT), |
| 13092 | HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT), |
| 13093 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT), |
| 13094 | HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT), |
| 13095 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT), |
| 13096 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT), |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13097 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13098 | { } /* end */ |
| 13099 | }; |
| 13100 | |
| 13101 | static struct snd_kcontrol_new alc861_3ST_mixer[] = { |
| 13102 | /* output mixer control */ |
| 13103 | HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT), |
| 13104 | HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT), |
| 13105 | HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT), |
| 13106 | HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT), |
| 13107 | /*HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), */ |
| 13108 | |
| 13109 | /* Input mixer control */ |
| 13110 | /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT), |
| 13111 | HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */ |
| 13112 | HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT), |
| 13113 | HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT), |
| 13114 | HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT), |
| 13115 | HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT), |
| 13116 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT), |
| 13117 | HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT), |
| 13118 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT), |
| 13119 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT), |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13120 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13121 | { |
| 13122 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 13123 | .name = "Channel Mode", |
| 13124 | .info = alc_ch_mode_info, |
| 13125 | .get = alc_ch_mode_get, |
| 13126 | .put = alc_ch_mode_put, |
| 13127 | .private_value = ARRAY_SIZE(alc861_threestack_modes), |
| 13128 | }, |
| 13129 | { } /* end */ |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 13130 | }; |
| 13131 | |
Takashi Iwai | d1d985f | 2006-11-23 19:27:12 +0100 | [diff] [blame] | 13132 | static struct snd_kcontrol_new alc861_toshiba_mixer[] = { |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 13133 | /* output mixer control */ |
| 13134 | HDA_CODEC_MUTE("Master Playback Switch", 0x03, 0x0, HDA_OUTPUT), |
| 13135 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT), |
| 13136 | HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT), |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 13137 | |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 13138 | { } /* end */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13139 | }; |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 13140 | |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 13141 | static struct snd_kcontrol_new alc861_uniwill_m31_mixer[] = { |
| 13142 | /* output mixer control */ |
| 13143 | HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT), |
| 13144 | HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT), |
| 13145 | HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT), |
| 13146 | HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT), |
| 13147 | /*HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), */ |
| 13148 | |
| 13149 | /* Input mixer control */ |
| 13150 | /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT), |
| 13151 | HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */ |
| 13152 | HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT), |
| 13153 | HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT), |
| 13154 | HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT), |
| 13155 | HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT), |
| 13156 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT), |
| 13157 | HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT), |
| 13158 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT), |
| 13159 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT), |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13160 | |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 13161 | { |
| 13162 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 13163 | .name = "Channel Mode", |
| 13164 | .info = alc_ch_mode_info, |
| 13165 | .get = alc_ch_mode_get, |
| 13166 | .put = alc_ch_mode_put, |
| 13167 | .private_value = ARRAY_SIZE(alc861_uniwill_m31_modes), |
| 13168 | }, |
| 13169 | { } /* end */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13170 | }; |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 13171 | |
| 13172 | static struct snd_kcontrol_new alc861_asus_mixer[] = { |
| 13173 | /* output mixer control */ |
| 13174 | HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT), |
| 13175 | HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT), |
| 13176 | HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT), |
| 13177 | HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT), |
| 13178 | HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), |
| 13179 | |
| 13180 | /* Input mixer control */ |
| 13181 | HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT), |
| 13182 | HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 13183 | HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT), |
| 13184 | HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT), |
| 13185 | HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT), |
| 13186 | HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT), |
| 13187 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT), |
| 13188 | HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT), |
| 13189 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT), |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13190 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_OUTPUT), |
| 13191 | |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 13192 | { |
| 13193 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 13194 | .name = "Channel Mode", |
| 13195 | .info = alc_ch_mode_info, |
| 13196 | .get = alc_ch_mode_get, |
| 13197 | .put = alc_ch_mode_put, |
| 13198 | .private_value = ARRAY_SIZE(alc861_asus_modes), |
| 13199 | }, |
| 13200 | { } |
Takashi Iwai | 56bb0ca | 2006-11-22 11:52:52 +0100 | [diff] [blame] | 13201 | }; |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 13202 | |
Takashi Iwai | 56bb0ca | 2006-11-22 11:52:52 +0100 | [diff] [blame] | 13203 | /* additional mixer */ |
Takashi Iwai | d1d985f | 2006-11-23 19:27:12 +0100 | [diff] [blame] | 13204 | static struct snd_kcontrol_new alc861_asus_laptop_mixer[] = { |
Takashi Iwai | 56bb0ca | 2006-11-22 11:52:52 +0100 | [diff] [blame] | 13205 | HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT), |
| 13206 | HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT), |
Takashi Iwai | 56bb0ca | 2006-11-22 11:52:52 +0100 | [diff] [blame] | 13207 | { } |
| 13208 | }; |
| 13209 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13210 | /* |
| 13211 | * generic initialization of ADC, input mixers and output mixers |
| 13212 | */ |
| 13213 | static struct hda_verb alc861_base_init_verbs[] = { |
| 13214 | /* |
| 13215 | * Unmute ADC0 and set the default input to mic-in |
| 13216 | */ |
| 13217 | /* port-A for surround (rear panel) */ |
| 13218 | { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 13219 | { 0x0e, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 13220 | /* port-B for mic-in (rear panel) with vref */ |
| 13221 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 13222 | /* port-C for line-in (rear panel) */ |
| 13223 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 13224 | /* port-D for Front */ |
| 13225 | { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 13226 | { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 13227 | /* port-E for HP out (front panel) */ |
| 13228 | { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 }, |
| 13229 | /* route front PCM to HP */ |
Takashi Iwai | 9dece1d | 2006-11-16 17:12:49 +0100 | [diff] [blame] | 13230 | { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13231 | /* port-F for mic-in (front panel) with vref */ |
| 13232 | { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 13233 | /* port-G for CLFE (rear panel) */ |
| 13234 | { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 13235 | { 0x1f, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 13236 | /* port-H for side (rear panel) */ |
| 13237 | { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 13238 | { 0x20, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 13239 | /* CD-in */ |
| 13240 | { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 13241 | /* route front mic to ADC1*/ |
| 13242 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 13243 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 13244 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13245 | /* Unmute DAC0~3 & spdif out*/ |
| 13246 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 13247 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 13248 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 13249 | {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 13250 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 13251 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13252 | /* Unmute Mixer 14 (mic) 1c (Line in)*/ |
| 13253 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13254 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 13255 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13256 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 13257 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13258 | /* Unmute Stereo Mixer 15 */ |
| 13259 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13260 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 13261 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13262 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13263 | |
| 13264 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13265 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 13266 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13267 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 13268 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13269 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 13270 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13271 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13272 | /* hp used DAC 3 (Front) */ |
| 13273 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13274 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 13275 | |
| 13276 | { } |
| 13277 | }; |
| 13278 | |
| 13279 | static struct hda_verb alc861_threestack_init_verbs[] = { |
| 13280 | /* |
| 13281 | * Unmute ADC0 and set the default input to mic-in |
| 13282 | */ |
| 13283 | /* port-A for surround (rear panel) */ |
| 13284 | { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 13285 | /* port-B for mic-in (rear panel) with vref */ |
| 13286 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 13287 | /* port-C for line-in (rear panel) */ |
| 13288 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 13289 | /* port-D for Front */ |
| 13290 | { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 13291 | { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 13292 | /* port-E for HP out (front panel) */ |
| 13293 | { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 }, |
| 13294 | /* route front PCM to HP */ |
Takashi Iwai | 9dece1d | 2006-11-16 17:12:49 +0100 | [diff] [blame] | 13295 | { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13296 | /* port-F for mic-in (front panel) with vref */ |
| 13297 | { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 13298 | /* port-G for CLFE (rear panel) */ |
| 13299 | { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 13300 | /* port-H for side (rear panel) */ |
| 13301 | { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 13302 | /* CD-in */ |
| 13303 | { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 13304 | /* route front mic to ADC1*/ |
| 13305 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 13306 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13307 | /* Unmute DAC0~3 & spdif out*/ |
| 13308 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 13309 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 13310 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 13311 | {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 13312 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 13313 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13314 | /* Unmute Mixer 14 (mic) 1c (Line in)*/ |
| 13315 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13316 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 13317 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13318 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 13319 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13320 | /* Unmute Stereo Mixer 15 */ |
| 13321 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13322 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 13323 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13324 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13325 | |
| 13326 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13327 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 13328 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13329 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 13330 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13331 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 13332 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13333 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13334 | /* hp used DAC 3 (Front) */ |
| 13335 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13336 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 13337 | { } |
| 13338 | }; |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 13339 | |
| 13340 | static struct hda_verb alc861_uniwill_m31_init_verbs[] = { |
| 13341 | /* |
| 13342 | * Unmute ADC0 and set the default input to mic-in |
| 13343 | */ |
| 13344 | /* port-A for surround (rear panel) */ |
| 13345 | { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 13346 | /* port-B for mic-in (rear panel) with vref */ |
| 13347 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 13348 | /* port-C for line-in (rear panel) */ |
| 13349 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 13350 | /* port-D for Front */ |
| 13351 | { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 13352 | { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 13353 | /* port-E for HP out (front panel) */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13354 | /* this has to be set to VREF80 */ |
| 13355 | { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 13356 | /* route front PCM to HP */ |
Takashi Iwai | 9dece1d | 2006-11-16 17:12:49 +0100 | [diff] [blame] | 13357 | { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 13358 | /* port-F for mic-in (front panel) with vref */ |
| 13359 | { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 13360 | /* port-G for CLFE (rear panel) */ |
| 13361 | { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 13362 | /* port-H for side (rear panel) */ |
| 13363 | { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 13364 | /* CD-in */ |
| 13365 | { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 13366 | /* route front mic to ADC1*/ |
| 13367 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 13368 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13369 | /* Unmute DAC0~3 & spdif out*/ |
| 13370 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 13371 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 13372 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 13373 | {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 13374 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 13375 | |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 13376 | /* Unmute Mixer 14 (mic) 1c (Line in)*/ |
| 13377 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13378 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 13379 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13380 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 13381 | |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 13382 | /* Unmute Stereo Mixer 15 */ |
| 13383 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13384 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 13385 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13386 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */ |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 13387 | |
| 13388 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13389 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 13390 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13391 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 13392 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13393 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 13394 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13395 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13396 | /* hp used DAC 3 (Front) */ |
| 13397 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 13398 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 13399 | { } |
| 13400 | }; |
| 13401 | |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 13402 | static struct hda_verb alc861_asus_init_verbs[] = { |
| 13403 | /* |
| 13404 | * Unmute ADC0 and set the default input to mic-in |
| 13405 | */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13406 | /* port-A for surround (rear panel) |
| 13407 | * according to codec#0 this is the HP jack |
| 13408 | */ |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 13409 | { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 }, /* was 0x00 */ |
| 13410 | /* route front PCM to HP */ |
| 13411 | { 0x0e, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 13412 | /* port-B for mic-in (rear panel) with vref */ |
| 13413 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 13414 | /* port-C for line-in (rear panel) */ |
| 13415 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 13416 | /* port-D for Front */ |
| 13417 | { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 13418 | { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 13419 | /* port-E for HP out (front panel) */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13420 | /* this has to be set to VREF80 */ |
| 13421 | { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 13422 | /* route front PCM to HP */ |
Takashi Iwai | 9dece1d | 2006-11-16 17:12:49 +0100 | [diff] [blame] | 13423 | { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 13424 | /* port-F for mic-in (front panel) with vref */ |
| 13425 | { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 13426 | /* port-G for CLFE (rear panel) */ |
| 13427 | { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 13428 | /* port-H for side (rear panel) */ |
| 13429 | { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 13430 | /* CD-in */ |
| 13431 | { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 13432 | /* route front mic to ADC1*/ |
| 13433 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 13434 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13435 | /* Unmute DAC0~3 & spdif out*/ |
| 13436 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 13437 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 13438 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 13439 | {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 13440 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 13441 | /* Unmute Mixer 14 (mic) 1c (Line in)*/ |
| 13442 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13443 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 13444 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13445 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 13446 | |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 13447 | /* Unmute Stereo Mixer 15 */ |
| 13448 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13449 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 13450 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13451 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */ |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 13452 | |
| 13453 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13454 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 13455 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13456 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 13457 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13458 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 13459 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13460 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13461 | /* hp used DAC 3 (Front) */ |
| 13462 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 13463 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 13464 | { } |
| 13465 | }; |
| 13466 | |
Takashi Iwai | 56bb0ca | 2006-11-22 11:52:52 +0100 | [diff] [blame] | 13467 | /* additional init verbs for ASUS laptops */ |
| 13468 | static struct hda_verb alc861_asus_laptop_init_verbs[] = { |
| 13469 | { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x45 }, /* HP-out */ |
| 13470 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2) }, /* mute line-in */ |
| 13471 | { } |
| 13472 | }; |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 13473 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13474 | /* |
| 13475 | * generic initialization of ADC, input mixers and output mixers |
| 13476 | */ |
| 13477 | static struct hda_verb alc861_auto_init_verbs[] = { |
| 13478 | /* |
| 13479 | * Unmute ADC0 and set the default input to mic-in |
| 13480 | */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13481 | /* {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13482 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 13483 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13484 | /* Unmute DAC0~3 & spdif out*/ |
| 13485 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 13486 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 13487 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 13488 | {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 13489 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 13490 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13491 | /* Unmute Mixer 14 (mic) 1c (Line in)*/ |
| 13492 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13493 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 13494 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13495 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 13496 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13497 | /* Unmute Stereo Mixer 15 */ |
| 13498 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13499 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 13500 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 13501 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, |
| 13502 | |
| 13503 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13504 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 13505 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13506 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 13507 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13508 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 13509 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13510 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 13511 | |
| 13512 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 13513 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13514 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 13515 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13516 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 13517 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13518 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 13519 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13520 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13521 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, /* set Mic 1 */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13522 | |
| 13523 | { } |
| 13524 | }; |
| 13525 | |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 13526 | static struct hda_verb alc861_toshiba_init_verbs[] = { |
| 13527 | {0x0f, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13528 | |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 13529 | { } |
| 13530 | }; |
| 13531 | |
| 13532 | /* toggle speaker-output according to the hp-jack state */ |
| 13533 | static void alc861_toshiba_automute(struct hda_codec *codec) |
| 13534 | { |
| 13535 | unsigned int present; |
| 13536 | |
| 13537 | present = snd_hda_codec_read(codec, 0x0f, 0, |
| 13538 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 13539 | snd_hda_codec_amp_stereo(codec, 0x16, HDA_INPUT, 0, |
| 13540 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
| 13541 | snd_hda_codec_amp_stereo(codec, 0x1a, HDA_INPUT, 3, |
| 13542 | HDA_AMP_MUTE, present ? 0 : HDA_AMP_MUTE); |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 13543 | } |
| 13544 | |
| 13545 | static void alc861_toshiba_unsol_event(struct hda_codec *codec, |
| 13546 | unsigned int res) |
| 13547 | { |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 13548 | if ((res >> 26) == ALC880_HP_EVENT) |
| 13549 | alc861_toshiba_automute(codec); |
| 13550 | } |
| 13551 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13552 | /* pcm configuration: identiacal with ALC880 */ |
| 13553 | #define alc861_pcm_analog_playback alc880_pcm_analog_playback |
| 13554 | #define alc861_pcm_analog_capture alc880_pcm_analog_capture |
| 13555 | #define alc861_pcm_digital_playback alc880_pcm_digital_playback |
| 13556 | #define alc861_pcm_digital_capture alc880_pcm_digital_capture |
| 13557 | |
| 13558 | |
| 13559 | #define ALC861_DIGOUT_NID 0x07 |
| 13560 | |
| 13561 | static struct hda_channel_mode alc861_8ch_modes[1] = { |
| 13562 | { 8, NULL } |
| 13563 | }; |
| 13564 | |
| 13565 | static hda_nid_t alc861_dac_nids[4] = { |
| 13566 | /* front, surround, clfe, side */ |
| 13567 | 0x03, 0x06, 0x05, 0x04 |
| 13568 | }; |
| 13569 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 13570 | static hda_nid_t alc660_dac_nids[3] = { |
| 13571 | /* front, clfe, surround */ |
| 13572 | 0x03, 0x05, 0x06 |
| 13573 | }; |
| 13574 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13575 | static hda_nid_t alc861_adc_nids[1] = { |
| 13576 | /* ADC0-2 */ |
| 13577 | 0x08, |
| 13578 | }; |
| 13579 | |
| 13580 | static struct hda_input_mux alc861_capture_source = { |
| 13581 | .num_items = 5, |
| 13582 | .items = { |
| 13583 | { "Mic", 0x0 }, |
| 13584 | { "Front Mic", 0x3 }, |
| 13585 | { "Line", 0x1 }, |
| 13586 | { "CD", 0x4 }, |
| 13587 | { "Mixer", 0x5 }, |
| 13588 | }, |
| 13589 | }; |
| 13590 | |
| 13591 | /* fill in the dac_nids table from the parsed pin configuration */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13592 | static int alc861_auto_fill_dac_nids(struct alc_spec *spec, |
| 13593 | const struct auto_pin_cfg *cfg) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13594 | { |
| 13595 | int i; |
| 13596 | hda_nid_t nid; |
| 13597 | |
| 13598 | spec->multiout.dac_nids = spec->private_dac_nids; |
| 13599 | for (i = 0; i < cfg->line_outs; i++) { |
| 13600 | nid = cfg->line_out_pins[i]; |
| 13601 | if (nid) { |
| 13602 | if (i >= ARRAY_SIZE(alc861_dac_nids)) |
| 13603 | continue; |
| 13604 | spec->multiout.dac_nids[i] = alc861_dac_nids[i]; |
| 13605 | } |
| 13606 | } |
| 13607 | spec->multiout.num_dacs = cfg->line_outs; |
| 13608 | return 0; |
| 13609 | } |
| 13610 | |
| 13611 | /* add playback controls from the parsed DAC table */ |
| 13612 | static int alc861_auto_create_multi_out_ctls(struct alc_spec *spec, |
| 13613 | const struct auto_pin_cfg *cfg) |
| 13614 | { |
| 13615 | char name[32]; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13616 | static const char *chname[4] = { |
| 13617 | "Front", "Surround", NULL /*CLFE*/, "Side" |
| 13618 | }; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13619 | hda_nid_t nid; |
| 13620 | int i, idx, err; |
| 13621 | |
| 13622 | for (i = 0; i < cfg->line_outs; i++) { |
| 13623 | nid = spec->multiout.dac_nids[i]; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13624 | if (!nid) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13625 | continue; |
| 13626 | if (nid == 0x05) { |
| 13627 | /* Center/LFE */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13628 | err = add_control(spec, ALC_CTL_BIND_MUTE, |
| 13629 | "Center Playback Switch", |
| 13630 | HDA_COMPOSE_AMP_VAL(nid, 1, 0, |
| 13631 | HDA_OUTPUT)); |
| 13632 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13633 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13634 | err = add_control(spec, ALC_CTL_BIND_MUTE, |
| 13635 | "LFE Playback Switch", |
| 13636 | HDA_COMPOSE_AMP_VAL(nid, 2, 0, |
| 13637 | HDA_OUTPUT)); |
| 13638 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13639 | return err; |
| 13640 | } else { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13641 | for (idx = 0; idx < ARRAY_SIZE(alc861_dac_nids) - 1; |
| 13642 | idx++) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13643 | if (nid == alc861_dac_nids[idx]) |
| 13644 | break; |
| 13645 | sprintf(name, "%s Playback Switch", chname[idx]); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13646 | err = add_control(spec, ALC_CTL_BIND_MUTE, name, |
| 13647 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, |
| 13648 | HDA_OUTPUT)); |
| 13649 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13650 | return err; |
| 13651 | } |
| 13652 | } |
| 13653 | return 0; |
| 13654 | } |
| 13655 | |
| 13656 | static int alc861_auto_create_hp_ctls(struct alc_spec *spec, hda_nid_t pin) |
| 13657 | { |
| 13658 | int err; |
| 13659 | hda_nid_t nid; |
| 13660 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13661 | if (!pin) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13662 | return 0; |
| 13663 | |
| 13664 | if ((pin >= 0x0b && pin <= 0x10) || pin == 0x1f || pin == 0x20) { |
| 13665 | nid = 0x03; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13666 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, |
| 13667 | "Headphone Playback Switch", |
| 13668 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT)); |
| 13669 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13670 | return err; |
| 13671 | spec->multiout.hp_nid = nid; |
| 13672 | } |
| 13673 | return 0; |
| 13674 | } |
| 13675 | |
| 13676 | /* create playback/capture controls for input pins */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13677 | static int alc861_auto_create_analog_input_ctls(struct alc_spec *spec, |
| 13678 | const struct auto_pin_cfg *cfg) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13679 | { |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 13680 | struct hda_input_mux *imux = &spec->private_imux[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13681 | int i, err, idx, idx1; |
| 13682 | |
| 13683 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13684 | switch (cfg->input_pins[i]) { |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13685 | case 0x0c: |
| 13686 | idx1 = 1; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13687 | idx = 2; /* Line In */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13688 | break; |
| 13689 | case 0x0f: |
| 13690 | idx1 = 2; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13691 | idx = 2; /* Line In */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13692 | break; |
| 13693 | case 0x0d: |
| 13694 | idx1 = 0; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13695 | idx = 1; /* Mic In */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13696 | break; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13697 | case 0x10: |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13698 | idx1 = 3; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13699 | idx = 1; /* Mic In */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13700 | break; |
| 13701 | case 0x11: |
| 13702 | idx1 = 4; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13703 | idx = 0; /* CD */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13704 | break; |
| 13705 | default: |
| 13706 | continue; |
| 13707 | } |
| 13708 | |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 13709 | err = new_analog_input(spec, cfg->input_pins[i], |
| 13710 | auto_pin_cfg_labels[i], idx, 0x15); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13711 | if (err < 0) |
| 13712 | return err; |
| 13713 | |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 13714 | imux->items[imux->num_items].label = auto_pin_cfg_labels[i]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13715 | imux->items[imux->num_items].index = idx1; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13716 | imux->num_items++; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13717 | } |
| 13718 | return 0; |
| 13719 | } |
| 13720 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13721 | static void alc861_auto_set_output_and_unmute(struct hda_codec *codec, |
| 13722 | hda_nid_t nid, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13723 | int pin_type, int dac_idx) |
| 13724 | { |
Jacek Luczak | 564c5be | 2008-05-03 18:41:23 +0200 | [diff] [blame] | 13725 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 13726 | pin_type); |
| 13727 | snd_hda_codec_write(codec, dac_idx, 0, AC_VERB_SET_AMP_GAIN_MUTE, |
| 13728 | AMP_OUT_UNMUTE); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13729 | } |
| 13730 | |
| 13731 | static void alc861_auto_init_multi_out(struct hda_codec *codec) |
| 13732 | { |
| 13733 | struct alc_spec *spec = codec->spec; |
| 13734 | int i; |
| 13735 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13736 | alc_subsystem_id(codec, 0x0e, 0x0f, 0x0b); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13737 | for (i = 0; i < spec->autocfg.line_outs; i++) { |
| 13738 | hda_nid_t nid = spec->autocfg.line_out_pins[i]; |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 13739 | int pin_type = get_pin_type(spec->autocfg.line_out_type); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13740 | if (nid) |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 13741 | alc861_auto_set_output_and_unmute(codec, nid, pin_type, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13742 | spec->multiout.dac_nids[i]); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13743 | } |
| 13744 | } |
| 13745 | |
| 13746 | static void alc861_auto_init_hp_out(struct hda_codec *codec) |
| 13747 | { |
| 13748 | struct alc_spec *spec = codec->spec; |
| 13749 | hda_nid_t pin; |
| 13750 | |
Takashi Iwai | eb06ed8 | 2006-09-20 17:10:27 +0200 | [diff] [blame] | 13751 | pin = spec->autocfg.hp_pins[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13752 | if (pin) /* connect to front */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13753 | alc861_auto_set_output_and_unmute(codec, pin, PIN_HP, |
| 13754 | spec->multiout.dac_nids[0]); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 13755 | pin = spec->autocfg.speaker_pins[0]; |
| 13756 | if (pin) |
| 13757 | alc861_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13758 | } |
| 13759 | |
| 13760 | static void alc861_auto_init_analog_input(struct hda_codec *codec) |
| 13761 | { |
| 13762 | struct alc_spec *spec = codec->spec; |
| 13763 | int i; |
| 13764 | |
| 13765 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
| 13766 | hda_nid_t nid = spec->autocfg.input_pins[i]; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13767 | if (nid >= 0x0c && nid <= 0x11) { |
| 13768 | snd_hda_codec_write(codec, nid, 0, |
| 13769 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 13770 | i <= AUTO_PIN_FRONT_MIC ? |
| 13771 | PIN_VREF80 : PIN_IN); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13772 | } |
| 13773 | } |
| 13774 | } |
| 13775 | |
| 13776 | /* parse the BIOS configuration and set up the alc_spec */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13777 | /* return 1 if successful, 0 if the proper config is not found, |
| 13778 | * or a negative error code |
| 13779 | */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13780 | static int alc861_parse_auto_config(struct hda_codec *codec) |
| 13781 | { |
| 13782 | struct alc_spec *spec = codec->spec; |
| 13783 | int err; |
| 13784 | static hda_nid_t alc861_ignore[] = { 0x1d, 0 }; |
| 13785 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13786 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 13787 | alc861_ignore); |
| 13788 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13789 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13790 | if (!spec->autocfg.line_outs) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13791 | return 0; /* can't find valid BIOS pin config */ |
| 13792 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13793 | err = alc861_auto_fill_dac_nids(spec, &spec->autocfg); |
| 13794 | if (err < 0) |
| 13795 | return err; |
| 13796 | err = alc861_auto_create_multi_out_ctls(spec, &spec->autocfg); |
| 13797 | if (err < 0) |
| 13798 | return err; |
| 13799 | err = alc861_auto_create_hp_ctls(spec, spec->autocfg.hp_pins[0]); |
| 13800 | if (err < 0) |
| 13801 | return err; |
| 13802 | err = alc861_auto_create_analog_input_ctls(spec, &spec->autocfg); |
| 13803 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13804 | return err; |
| 13805 | |
| 13806 | spec->multiout.max_channels = spec->multiout.num_dacs * 2; |
| 13807 | |
Takashi Iwai | 0852d7a | 2009-02-11 11:35:15 +0100 | [diff] [blame] | 13808 | if (spec->autocfg.dig_outs) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13809 | spec->multiout.dig_out_nid = ALC861_DIGOUT_NID; |
| 13810 | |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 13811 | if (spec->kctls.list) |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 13812 | add_mixer(spec, spec->kctls.list); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13813 | |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 13814 | add_verb(spec, alc861_auto_init_verbs); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13815 | |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 13816 | spec->num_mux_defs = 1; |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 13817 | spec->input_mux = &spec->private_imux[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13818 | |
| 13819 | spec->adc_nids = alc861_adc_nids; |
| 13820 | spec->num_adc_nids = ARRAY_SIZE(alc861_adc_nids); |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 13821 | set_capture_mixer(spec); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13822 | |
Takashi Iwai | e044c39 | 2008-10-27 16:56:24 +0100 | [diff] [blame] | 13823 | store_pin_configs(codec); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13824 | return 1; |
| 13825 | } |
| 13826 | |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 13827 | /* additional initialization for auto-configuration model */ |
| 13828 | static void alc861_auto_init(struct hda_codec *codec) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13829 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 13830 | struct alc_spec *spec = codec->spec; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13831 | alc861_auto_init_multi_out(codec); |
| 13832 | alc861_auto_init_hp_out(codec); |
| 13833 | alc861_auto_init_analog_input(codec); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 13834 | if (spec->unsol_event) |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 13835 | alc_inithook(codec); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13836 | } |
| 13837 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 13838 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 13839 | static struct hda_amp_list alc861_loopbacks[] = { |
| 13840 | { 0x15, HDA_INPUT, 0 }, |
| 13841 | { 0x15, HDA_INPUT, 1 }, |
| 13842 | { 0x15, HDA_INPUT, 2 }, |
| 13843 | { 0x15, HDA_INPUT, 3 }, |
| 13844 | { } /* end */ |
| 13845 | }; |
| 13846 | #endif |
| 13847 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13848 | |
| 13849 | /* |
| 13850 | * configuration and preset |
| 13851 | */ |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 13852 | static const char *alc861_models[ALC861_MODEL_LAST] = { |
| 13853 | [ALC861_3ST] = "3stack", |
| 13854 | [ALC660_3ST] = "3stack-660", |
| 13855 | [ALC861_3ST_DIG] = "3stack-dig", |
| 13856 | [ALC861_6ST_DIG] = "6stack-dig", |
| 13857 | [ALC861_UNIWILL_M31] = "uniwill-m31", |
| 13858 | [ALC861_TOSHIBA] = "toshiba", |
| 13859 | [ALC861_ASUS] = "asus", |
| 13860 | [ALC861_ASUS_LAPTOP] = "asus-laptop", |
| 13861 | [ALC861_AUTO] = "auto", |
| 13862 | }; |
| 13863 | |
| 13864 | static struct snd_pci_quirk alc861_cfg_tbl[] = { |
Takashi Iwai | 687a47b | 2007-01-10 11:25:58 +0100 | [diff] [blame] | 13865 | SND_PCI_QUIRK(0x1043, 0x1205, "ASUS W7J", ALC861_3ST), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 13866 | SND_PCI_QUIRK(0x1043, 0x1335, "ASUS F2/3", ALC861_ASUS_LAPTOP), |
| 13867 | SND_PCI_QUIRK(0x1043, 0x1338, "ASUS F2/3", ALC861_ASUS_LAPTOP), |
| 13868 | SND_PCI_QUIRK(0x1043, 0x1393, "ASUS", ALC861_ASUS), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 13869 | SND_PCI_QUIRK(0x1043, 0x13d7, "ASUS A9rp", ALC861_ASUS_LAPTOP), |
Kailang Yang | 83c3421 | 2007-07-05 11:43:05 +0200 | [diff] [blame] | 13870 | SND_PCI_QUIRK(0x1043, 0x81cb, "ASUS P1-AH2", ALC861_3ST_DIG), |
Tobin Davis | ad5e773 | 2007-01-08 10:57:32 +0100 | [diff] [blame] | 13871 | SND_PCI_QUIRK(0x1179, 0xff00, "Toshiba", ALC861_TOSHIBA), |
Takashi Iwai | 341d4eb | 2007-07-09 17:53:18 +0200 | [diff] [blame] | 13872 | /* FIXME: the entry below breaks Toshiba A100 (model=auto works!) |
| 13873 | * Any other models that need this preset? |
| 13874 | */ |
| 13875 | /* SND_PCI_QUIRK(0x1179, 0xff10, "Toshiba", ALC861_TOSHIBA), */ |
Claudio Matsuoka | ef64adb | 2007-07-14 00:26:16 +0200 | [diff] [blame] | 13876 | SND_PCI_QUIRK(0x1462, 0x7254, "HP dx2200 (MSI MS-7254)", ALC861_3ST), |
| 13877 | SND_PCI_QUIRK(0x1462, 0x7297, "HP dx2250 (MSI MS-7297)", ALC861_3ST), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 13878 | SND_PCI_QUIRK(0x1584, 0x2b01, "Uniwill X40AIx", ALC861_UNIWILL_M31), |
| 13879 | SND_PCI_QUIRK(0x1584, 0x9072, "Uniwill m31", ALC861_UNIWILL_M31), |
| 13880 | SND_PCI_QUIRK(0x1584, 0x9075, "Airis Praxis N1212", ALC861_ASUS_LAPTOP), |
| 13881 | /* FIXME: the below seems conflict */ |
| 13882 | /* SND_PCI_QUIRK(0x1584, 0x9075, "Uniwill", ALC861_UNIWILL_M31), */ |
| 13883 | SND_PCI_QUIRK(0x1849, 0x0660, "Asrock 939SLI32", ALC660_3ST), |
| 13884 | SND_PCI_QUIRK(0x8086, 0xd600, "Intel", ALC861_3ST), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13885 | {} |
| 13886 | }; |
| 13887 | |
| 13888 | static struct alc_config_preset alc861_presets[] = { |
| 13889 | [ALC861_3ST] = { |
| 13890 | .mixers = { alc861_3ST_mixer }, |
| 13891 | .init_verbs = { alc861_threestack_init_verbs }, |
| 13892 | .num_dacs = ARRAY_SIZE(alc861_dac_nids), |
| 13893 | .dac_nids = alc861_dac_nids, |
| 13894 | .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes), |
| 13895 | .channel_mode = alc861_threestack_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 13896 | .need_dac_fix = 1, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13897 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
| 13898 | .adc_nids = alc861_adc_nids, |
| 13899 | .input_mux = &alc861_capture_source, |
| 13900 | }, |
| 13901 | [ALC861_3ST_DIG] = { |
| 13902 | .mixers = { alc861_base_mixer }, |
| 13903 | .init_verbs = { alc861_threestack_init_verbs }, |
| 13904 | .num_dacs = ARRAY_SIZE(alc861_dac_nids), |
| 13905 | .dac_nids = alc861_dac_nids, |
| 13906 | .dig_out_nid = ALC861_DIGOUT_NID, |
| 13907 | .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes), |
| 13908 | .channel_mode = alc861_threestack_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 13909 | .need_dac_fix = 1, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13910 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
| 13911 | .adc_nids = alc861_adc_nids, |
| 13912 | .input_mux = &alc861_capture_source, |
| 13913 | }, |
| 13914 | [ALC861_6ST_DIG] = { |
| 13915 | .mixers = { alc861_base_mixer }, |
| 13916 | .init_verbs = { alc861_base_init_verbs }, |
| 13917 | .num_dacs = ARRAY_SIZE(alc861_dac_nids), |
| 13918 | .dac_nids = alc861_dac_nids, |
| 13919 | .dig_out_nid = ALC861_DIGOUT_NID, |
| 13920 | .num_channel_mode = ARRAY_SIZE(alc861_8ch_modes), |
| 13921 | .channel_mode = alc861_8ch_modes, |
| 13922 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
| 13923 | .adc_nids = alc861_adc_nids, |
| 13924 | .input_mux = &alc861_capture_source, |
| 13925 | }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 13926 | [ALC660_3ST] = { |
| 13927 | .mixers = { alc861_3ST_mixer }, |
| 13928 | .init_verbs = { alc861_threestack_init_verbs }, |
| 13929 | .num_dacs = ARRAY_SIZE(alc660_dac_nids), |
| 13930 | .dac_nids = alc660_dac_nids, |
| 13931 | .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes), |
| 13932 | .channel_mode = alc861_threestack_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 13933 | .need_dac_fix = 1, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 13934 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
| 13935 | .adc_nids = alc861_adc_nids, |
| 13936 | .input_mux = &alc861_capture_source, |
| 13937 | }, |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 13938 | [ALC861_UNIWILL_M31] = { |
| 13939 | .mixers = { alc861_uniwill_m31_mixer }, |
| 13940 | .init_verbs = { alc861_uniwill_m31_init_verbs }, |
| 13941 | .num_dacs = ARRAY_SIZE(alc861_dac_nids), |
| 13942 | .dac_nids = alc861_dac_nids, |
| 13943 | .dig_out_nid = ALC861_DIGOUT_NID, |
| 13944 | .num_channel_mode = ARRAY_SIZE(alc861_uniwill_m31_modes), |
| 13945 | .channel_mode = alc861_uniwill_m31_modes, |
| 13946 | .need_dac_fix = 1, |
| 13947 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
| 13948 | .adc_nids = alc861_adc_nids, |
| 13949 | .input_mux = &alc861_capture_source, |
| 13950 | }, |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 13951 | [ALC861_TOSHIBA] = { |
| 13952 | .mixers = { alc861_toshiba_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13953 | .init_verbs = { alc861_base_init_verbs, |
| 13954 | alc861_toshiba_init_verbs }, |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 13955 | .num_dacs = ARRAY_SIZE(alc861_dac_nids), |
| 13956 | .dac_nids = alc861_dac_nids, |
| 13957 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 13958 | .channel_mode = alc883_3ST_2ch_modes, |
| 13959 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
| 13960 | .adc_nids = alc861_adc_nids, |
| 13961 | .input_mux = &alc861_capture_source, |
| 13962 | .unsol_event = alc861_toshiba_unsol_event, |
| 13963 | .init_hook = alc861_toshiba_automute, |
| 13964 | }, |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 13965 | [ALC861_ASUS] = { |
| 13966 | .mixers = { alc861_asus_mixer }, |
| 13967 | .init_verbs = { alc861_asus_init_verbs }, |
| 13968 | .num_dacs = ARRAY_SIZE(alc861_dac_nids), |
| 13969 | .dac_nids = alc861_dac_nids, |
| 13970 | .dig_out_nid = ALC861_DIGOUT_NID, |
| 13971 | .num_channel_mode = ARRAY_SIZE(alc861_asus_modes), |
| 13972 | .channel_mode = alc861_asus_modes, |
| 13973 | .need_dac_fix = 1, |
| 13974 | .hp_nid = 0x06, |
| 13975 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
| 13976 | .adc_nids = alc861_adc_nids, |
| 13977 | .input_mux = &alc861_capture_source, |
| 13978 | }, |
Takashi Iwai | 56bb0ca | 2006-11-22 11:52:52 +0100 | [diff] [blame] | 13979 | [ALC861_ASUS_LAPTOP] = { |
| 13980 | .mixers = { alc861_toshiba_mixer, alc861_asus_laptop_mixer }, |
| 13981 | .init_verbs = { alc861_asus_init_verbs, |
| 13982 | alc861_asus_laptop_init_verbs }, |
| 13983 | .num_dacs = ARRAY_SIZE(alc861_dac_nids), |
| 13984 | .dac_nids = alc861_dac_nids, |
| 13985 | .dig_out_nid = ALC861_DIGOUT_NID, |
| 13986 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 13987 | .channel_mode = alc883_3ST_2ch_modes, |
| 13988 | .need_dac_fix = 1, |
| 13989 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
| 13990 | .adc_nids = alc861_adc_nids, |
| 13991 | .input_mux = &alc861_capture_source, |
| 13992 | }, |
| 13993 | }; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13994 | |
| 13995 | |
| 13996 | static int patch_alc861(struct hda_codec *codec) |
| 13997 | { |
| 13998 | struct alc_spec *spec; |
| 13999 | int board_config; |
| 14000 | int err; |
| 14001 | |
Robert P. J. Day | dc041e0 | 2006-12-19 14:44:15 +0100 | [diff] [blame] | 14002 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14003 | if (spec == NULL) |
| 14004 | return -ENOMEM; |
| 14005 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14006 | codec->spec = spec; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14007 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 14008 | board_config = snd_hda_check_board_config(codec, ALC861_MODEL_LAST, |
| 14009 | alc861_models, |
| 14010 | alc861_cfg_tbl); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 14011 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 14012 | if (board_config < 0) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 14013 | printk(KERN_INFO "hda_codec: Unknown model for ALC861, " |
| 14014 | "trying auto-probe from BIOS...\n"); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14015 | board_config = ALC861_AUTO; |
| 14016 | } |
| 14017 | |
| 14018 | if (board_config == ALC861_AUTO) { |
| 14019 | /* automatic parse from the BIOS config */ |
| 14020 | err = alc861_parse_auto_config(codec); |
| 14021 | if (err < 0) { |
| 14022 | alc_free(codec); |
| 14023 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14024 | } else if (!err) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 14025 | printk(KERN_INFO |
| 14026 | "hda_codec: Cannot set up configuration " |
| 14027 | "from BIOS. Using base mode...\n"); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14028 | board_config = ALC861_3ST_DIG; |
| 14029 | } |
| 14030 | } |
| 14031 | |
Kusanagi Kouichi | 680cd53 | 2009-02-05 00:00:58 +0900 | [diff] [blame] | 14032 | err = snd_hda_attach_beep_device(codec, 0x23); |
| 14033 | if (err < 0) { |
| 14034 | alc_free(codec); |
| 14035 | return err; |
| 14036 | } |
| 14037 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14038 | if (board_config != ALC861_AUTO) |
| 14039 | setup_preset(spec, &alc861_presets[board_config]); |
| 14040 | |
| 14041 | spec->stream_name_analog = "ALC861 Analog"; |
| 14042 | spec->stream_analog_playback = &alc861_pcm_analog_playback; |
| 14043 | spec->stream_analog_capture = &alc861_pcm_analog_capture; |
| 14044 | |
| 14045 | spec->stream_name_digital = "ALC861 Digital"; |
| 14046 | spec->stream_digital_playback = &alc861_pcm_digital_playback; |
| 14047 | spec->stream_digital_capture = &alc861_pcm_digital_capture; |
| 14048 | |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 14049 | set_beep_amp(spec, 0x23, 0, HDA_OUTPUT); |
| 14050 | |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 14051 | spec->vmaster_nid = 0x03; |
| 14052 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14053 | codec->patch_ops = alc_patch_ops; |
| 14054 | if (board_config == ALC861_AUTO) |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 14055 | spec->init_hook = alc861_auto_init; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 14056 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 14057 | if (!spec->loopback.amplist) |
| 14058 | spec->loopback.amplist = alc861_loopbacks; |
| 14059 | #endif |
Takashi Iwai | daead53 | 2008-11-28 12:55:36 +0100 | [diff] [blame] | 14060 | codec->proc_widget_hook = print_realtek_coef; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 14061 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14062 | return 0; |
| 14063 | } |
| 14064 | |
| 14065 | /* |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14066 | * ALC861-VD support |
| 14067 | * |
| 14068 | * Based on ALC882 |
| 14069 | * |
| 14070 | * In addition, an independent DAC |
| 14071 | */ |
| 14072 | #define ALC861VD_DIGOUT_NID 0x06 |
| 14073 | |
| 14074 | static hda_nid_t alc861vd_dac_nids[4] = { |
| 14075 | /* front, surr, clfe, side surr */ |
| 14076 | 0x02, 0x03, 0x04, 0x05 |
| 14077 | }; |
| 14078 | |
| 14079 | /* dac_nids for ALC660vd are in a different order - according to |
| 14080 | * Realtek's driver. |
| 14081 | * This should probably tesult in a different mixer for 6stack models |
| 14082 | * of ALC660vd codecs, but for now there is only 3stack mixer |
| 14083 | * - and it is the same as in 861vd. |
| 14084 | * adc_nids in ALC660vd are (is) the same as in 861vd |
| 14085 | */ |
| 14086 | static hda_nid_t alc660vd_dac_nids[3] = { |
| 14087 | /* front, rear, clfe, rear_surr */ |
| 14088 | 0x02, 0x04, 0x03 |
| 14089 | }; |
| 14090 | |
| 14091 | static hda_nid_t alc861vd_adc_nids[1] = { |
| 14092 | /* ADC0 */ |
| 14093 | 0x09, |
| 14094 | }; |
| 14095 | |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 14096 | static hda_nid_t alc861vd_capsrc_nids[1] = { 0x22 }; |
| 14097 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14098 | /* input MUX */ |
| 14099 | /* FIXME: should be a matrix-type input source selection */ |
| 14100 | static struct hda_input_mux alc861vd_capture_source = { |
| 14101 | .num_items = 4, |
| 14102 | .items = { |
| 14103 | { "Mic", 0x0 }, |
| 14104 | { "Front Mic", 0x1 }, |
| 14105 | { "Line", 0x2 }, |
| 14106 | { "CD", 0x4 }, |
| 14107 | }, |
| 14108 | }; |
| 14109 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 14110 | static struct hda_input_mux alc861vd_dallas_capture_source = { |
Tobin Davis | b419f34 | 2008-03-07 11:57:51 +0100 | [diff] [blame] | 14111 | .num_items = 2, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 14112 | .items = { |
Tobin Davis | b419f34 | 2008-03-07 11:57:51 +0100 | [diff] [blame] | 14113 | { "Ext Mic", 0x0 }, |
| 14114 | { "Int Mic", 0x1 }, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 14115 | }, |
| 14116 | }; |
| 14117 | |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 14118 | static struct hda_input_mux alc861vd_hp_capture_source = { |
| 14119 | .num_items = 2, |
| 14120 | .items = { |
| 14121 | { "Front Mic", 0x0 }, |
| 14122 | { "ATAPI Mic", 0x1 }, |
| 14123 | }, |
| 14124 | }; |
| 14125 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14126 | /* |
| 14127 | * 2ch mode |
| 14128 | */ |
| 14129 | static struct hda_channel_mode alc861vd_3stack_2ch_modes[1] = { |
| 14130 | { 2, NULL } |
| 14131 | }; |
| 14132 | |
| 14133 | /* |
| 14134 | * 6ch mode |
| 14135 | */ |
| 14136 | static struct hda_verb alc861vd_6stack_ch6_init[] = { |
| 14137 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 14138 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 14139 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 14140 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 14141 | { } /* end */ |
| 14142 | }; |
| 14143 | |
| 14144 | /* |
| 14145 | * 8ch mode |
| 14146 | */ |
| 14147 | static struct hda_verb alc861vd_6stack_ch8_init[] = { |
| 14148 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 14149 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 14150 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 14151 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 14152 | { } /* end */ |
| 14153 | }; |
| 14154 | |
| 14155 | static struct hda_channel_mode alc861vd_6stack_modes[2] = { |
| 14156 | { 6, alc861vd_6stack_ch6_init }, |
| 14157 | { 8, alc861vd_6stack_ch8_init }, |
| 14158 | }; |
| 14159 | |
| 14160 | static struct snd_kcontrol_new alc861vd_chmode_mixer[] = { |
| 14161 | { |
| 14162 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 14163 | .name = "Channel Mode", |
| 14164 | .info = alc_ch_mode_info, |
| 14165 | .get = alc_ch_mode_get, |
| 14166 | .put = alc_ch_mode_put, |
| 14167 | }, |
| 14168 | { } /* end */ |
| 14169 | }; |
| 14170 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14171 | /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17 |
| 14172 | * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b |
| 14173 | */ |
| 14174 | static struct snd_kcontrol_new alc861vd_6st_mixer[] = { |
| 14175 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 14176 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 14177 | |
| 14178 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 14179 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
| 14180 | |
| 14181 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, |
| 14182 | HDA_OUTPUT), |
| 14183 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, |
| 14184 | HDA_OUTPUT), |
| 14185 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 14186 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 14187 | |
| 14188 | HDA_CODEC_VOLUME("Side Playback Volume", 0x05, 0x0, HDA_OUTPUT), |
| 14189 | HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT), |
| 14190 | |
| 14191 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 14192 | |
| 14193 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 14194 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 14195 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 14196 | |
| 14197 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
| 14198 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 14199 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 14200 | |
| 14201 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 14202 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 14203 | |
| 14204 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 14205 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 14206 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14207 | { } /* end */ |
| 14208 | }; |
| 14209 | |
| 14210 | static struct snd_kcontrol_new alc861vd_3st_mixer[] = { |
| 14211 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 14212 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 14213 | |
| 14214 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 14215 | |
| 14216 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 14217 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 14218 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 14219 | |
| 14220 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
| 14221 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 14222 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 14223 | |
| 14224 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 14225 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 14226 | |
| 14227 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 14228 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 14229 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14230 | { } /* end */ |
| 14231 | }; |
| 14232 | |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 14233 | static struct snd_kcontrol_new alc861vd_lenovo_mixer[] = { |
| 14234 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 14235 | /*HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),*/ |
| 14236 | HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 14237 | |
| 14238 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 14239 | |
| 14240 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 14241 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 14242 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 14243 | |
| 14244 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
| 14245 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 14246 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 14247 | |
| 14248 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 14249 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 14250 | |
| 14251 | { } /* end */ |
| 14252 | }; |
| 14253 | |
Tobin Davis | b419f34 | 2008-03-07 11:57:51 +0100 | [diff] [blame] | 14254 | /* Pin assignment: Speaker=0x14, HP = 0x15, |
| 14255 | * Ext Mic=0x18, Int Mic = 0x19, CD = 0x1c, PC Beep = 0x1d |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 14256 | */ |
| 14257 | static struct snd_kcontrol_new alc861vd_dallas_mixer[] = { |
Tobin Davis | b419f34 | 2008-03-07 11:57:51 +0100 | [diff] [blame] | 14258 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 14259 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0c, 2, HDA_INPUT), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 14260 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 14261 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT), |
Tobin Davis | b419f34 | 2008-03-07 11:57:51 +0100 | [diff] [blame] | 14262 | HDA_CODEC_VOLUME("Ext Mic Boost", 0x18, 0, HDA_INPUT), |
| 14263 | HDA_CODEC_VOLUME("Ext Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 14264 | HDA_CODEC_MUTE("Ext Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 14265 | HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT), |
| 14266 | HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 14267 | HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 14268 | { } /* end */ |
| 14269 | }; |
| 14270 | |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 14271 | /* Pin assignment: Speaker=0x14, Line-out = 0x15, |
| 14272 | * Front Mic=0x18, ATAPI Mic = 0x19, |
| 14273 | */ |
| 14274 | static struct snd_kcontrol_new alc861vd_hp_mixer[] = { |
| 14275 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 14276 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 14277 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 14278 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT), |
| 14279 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 14280 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 14281 | HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 14282 | HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 14283 | |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 14284 | { } /* end */ |
| 14285 | }; |
| 14286 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14287 | /* |
| 14288 | * generic initialization of ADC, input mixers and output mixers |
| 14289 | */ |
| 14290 | static struct hda_verb alc861vd_volume_init_verbs[] = { |
| 14291 | /* |
| 14292 | * Unmute ADC0 and set the default input to mic-in |
| 14293 | */ |
| 14294 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 14295 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14296 | |
| 14297 | /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of |
| 14298 | * the analog-loopback mixer widget |
| 14299 | */ |
| 14300 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 14301 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 14302 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 14303 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 14304 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 14305 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14306 | |
| 14307 | /* Capture mixer: unmute Mic, F-Mic, Line, CD inputs */ |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 14308 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14309 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 14310 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14311 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)}, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14312 | |
| 14313 | /* |
| 14314 | * Set up output mixers (0x02 - 0x05) |
| 14315 | */ |
| 14316 | /* set vol=0 to output mixers */ |
| 14317 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 14318 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 14319 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 14320 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 14321 | |
| 14322 | /* set up input amps for analog loopback */ |
| 14323 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 14324 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 14325 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 14326 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 14327 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 14328 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 14329 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 14330 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 14331 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 14332 | |
| 14333 | { } |
| 14334 | }; |
| 14335 | |
| 14336 | /* |
| 14337 | * 3-stack pin configuration: |
| 14338 | * front = 0x14, mic/clfe = 0x18, HP = 0x19, line/surr = 0x1a, f-mic = 0x1b |
| 14339 | */ |
| 14340 | static struct hda_verb alc861vd_3stack_init_verbs[] = { |
| 14341 | /* |
| 14342 | * Set pin mode and muting |
| 14343 | */ |
| 14344 | /* set front pin widgets 0x14 for output */ |
| 14345 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 14346 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 14347 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 14348 | |
| 14349 | /* Mic (rear) pin: input vref at 80% */ |
| 14350 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 14351 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 14352 | /* Front Mic pin: input vref at 80% */ |
| 14353 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 14354 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 14355 | /* Line In pin: input */ |
| 14356 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 14357 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 14358 | /* Line-2 In: Headphone output (output 0 - 0x0c) */ |
| 14359 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 14360 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 14361 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 14362 | /* CD pin widget for input */ |
| 14363 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 14364 | |
| 14365 | { } |
| 14366 | }; |
| 14367 | |
| 14368 | /* |
| 14369 | * 6-stack pin configuration: |
| 14370 | */ |
| 14371 | static struct hda_verb alc861vd_6stack_init_verbs[] = { |
| 14372 | /* |
| 14373 | * Set pin mode and muting |
| 14374 | */ |
| 14375 | /* set front pin widgets 0x14 for output */ |
| 14376 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 14377 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 14378 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 14379 | |
| 14380 | /* Rear Pin: output 1 (0x0d) */ |
| 14381 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 14382 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 14383 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 14384 | /* CLFE Pin: output 2 (0x0e) */ |
| 14385 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 14386 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 14387 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 14388 | /* Side Pin: output 3 (0x0f) */ |
| 14389 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 14390 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 14391 | {0x17, AC_VERB_SET_CONNECT_SEL, 0x03}, |
| 14392 | |
| 14393 | /* Mic (rear) pin: input vref at 80% */ |
| 14394 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 14395 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 14396 | /* Front Mic pin: input vref at 80% */ |
| 14397 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 14398 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 14399 | /* Line In pin: input */ |
| 14400 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 14401 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 14402 | /* Line-2 In: Headphone output (output 0 - 0x0c) */ |
| 14403 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 14404 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 14405 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 14406 | /* CD pin widget for input */ |
| 14407 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 14408 | |
| 14409 | { } |
| 14410 | }; |
| 14411 | |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 14412 | static struct hda_verb alc861vd_eapd_verbs[] = { |
| 14413 | {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 14414 | { } |
| 14415 | }; |
| 14416 | |
Kailang Yang | f9423e7 | 2008-05-27 12:32:25 +0200 | [diff] [blame] | 14417 | static struct hda_verb alc660vd_eapd_verbs[] = { |
| 14418 | {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 14419 | {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 14420 | { } |
| 14421 | }; |
| 14422 | |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 14423 | static struct hda_verb alc861vd_lenovo_unsol_verbs[] = { |
| 14424 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14425 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 14426 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, |
| 14427 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 14428 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 14429 | {} |
| 14430 | }; |
| 14431 | |
| 14432 | /* toggle speaker-output according to the hp-jack state */ |
| 14433 | static void alc861vd_lenovo_hp_automute(struct hda_codec *codec) |
| 14434 | { |
| 14435 | unsigned int present; |
| 14436 | unsigned char bits; |
| 14437 | |
| 14438 | present = snd_hda_codec_read(codec, 0x1b, 0, |
| 14439 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 14440 | bits = present ? HDA_AMP_MUTE : 0; |
| 14441 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 14442 | HDA_AMP_MUTE, bits); |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 14443 | } |
| 14444 | |
| 14445 | static void alc861vd_lenovo_mic_automute(struct hda_codec *codec) |
| 14446 | { |
| 14447 | unsigned int present; |
| 14448 | unsigned char bits; |
| 14449 | |
| 14450 | present = snd_hda_codec_read(codec, 0x18, 0, |
| 14451 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 14452 | bits = present ? HDA_AMP_MUTE : 0; |
| 14453 | snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, 1, |
| 14454 | HDA_AMP_MUTE, bits); |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 14455 | } |
| 14456 | |
| 14457 | static void alc861vd_lenovo_automute(struct hda_codec *codec) |
| 14458 | { |
| 14459 | alc861vd_lenovo_hp_automute(codec); |
| 14460 | alc861vd_lenovo_mic_automute(codec); |
| 14461 | } |
| 14462 | |
| 14463 | static void alc861vd_lenovo_unsol_event(struct hda_codec *codec, |
| 14464 | unsigned int res) |
| 14465 | { |
| 14466 | switch (res >> 26) { |
| 14467 | case ALC880_HP_EVENT: |
| 14468 | alc861vd_lenovo_hp_automute(codec); |
| 14469 | break; |
| 14470 | case ALC880_MIC_EVENT: |
| 14471 | alc861vd_lenovo_mic_automute(codec); |
| 14472 | break; |
| 14473 | } |
| 14474 | } |
| 14475 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 14476 | static struct hda_verb alc861vd_dallas_verbs[] = { |
| 14477 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 14478 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 14479 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 14480 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 14481 | |
| 14482 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14483 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 14484 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 14485 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 14486 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 14487 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 14488 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 14489 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 14490 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 14491 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 14492 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 14493 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 14494 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 14495 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 14496 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 14497 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 14498 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 14499 | |
| 14500 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50}, |
| 14501 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 14502 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50}, |
| 14503 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 14504 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 14505 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 14506 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 14507 | {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 14508 | |
| 14509 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14510 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 14511 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 14512 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 14513 | |
| 14514 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 14515 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 14516 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 14517 | |
| 14518 | { } /* end */ |
| 14519 | }; |
| 14520 | |
| 14521 | /* toggle speaker-output according to the hp-jack state */ |
| 14522 | static void alc861vd_dallas_automute(struct hda_codec *codec) |
| 14523 | { |
| 14524 | unsigned int present; |
| 14525 | |
| 14526 | present = snd_hda_codec_read(codec, 0x15, 0, |
| 14527 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 14528 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 14529 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 14530 | } |
| 14531 | |
| 14532 | static void alc861vd_dallas_unsol_event(struct hda_codec *codec, unsigned int res) |
| 14533 | { |
| 14534 | if ((res >> 26) == ALC880_HP_EVENT) |
| 14535 | alc861vd_dallas_automute(codec); |
| 14536 | } |
| 14537 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 14538 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 14539 | #define alc861vd_loopbacks alc880_loopbacks |
| 14540 | #endif |
| 14541 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14542 | /* pcm configuration: identiacal with ALC880 */ |
| 14543 | #define alc861vd_pcm_analog_playback alc880_pcm_analog_playback |
| 14544 | #define alc861vd_pcm_analog_capture alc880_pcm_analog_capture |
| 14545 | #define alc861vd_pcm_digital_playback alc880_pcm_digital_playback |
| 14546 | #define alc861vd_pcm_digital_capture alc880_pcm_digital_capture |
| 14547 | |
| 14548 | /* |
| 14549 | * configuration and preset |
| 14550 | */ |
| 14551 | static const char *alc861vd_models[ALC861VD_MODEL_LAST] = { |
| 14552 | [ALC660VD_3ST] = "3stack-660", |
Takashi Iwai | 983f8ae | 2007-08-15 16:44:04 +0200 | [diff] [blame] | 14553 | [ALC660VD_3ST_DIG] = "3stack-660-digout", |
Takashi Iwai | 13c9474 | 2008-11-05 08:06:08 +0100 | [diff] [blame] | 14554 | [ALC660VD_ASUS_V1S] = "asus-v1s", |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14555 | [ALC861VD_3ST] = "3stack", |
| 14556 | [ALC861VD_3ST_DIG] = "3stack-digout", |
| 14557 | [ALC861VD_6ST_DIG] = "6stack-digout", |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 14558 | [ALC861VD_LENOVO] = "lenovo", |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 14559 | [ALC861VD_DALLAS] = "dallas", |
Takashi Iwai | 983f8ae | 2007-08-15 16:44:04 +0200 | [diff] [blame] | 14560 | [ALC861VD_HP] = "hp", |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14561 | [ALC861VD_AUTO] = "auto", |
| 14562 | }; |
| 14563 | |
| 14564 | static struct snd_pci_quirk alc861vd_cfg_tbl[] = { |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 14565 | SND_PCI_QUIRK(0x1019, 0xa88d, "Realtek ALC660 demo", ALC660VD_3ST), |
| 14566 | SND_PCI_QUIRK(0x103c, 0x30bf, "HP TX1000", ALC861VD_HP), |
Takashi Iwai | 07e038b | 2007-02-15 18:23:41 +0100 | [diff] [blame] | 14567 | SND_PCI_QUIRK(0x1043, 0x12e2, "Asus z35m", ALC660VD_3ST), |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14568 | SND_PCI_QUIRK(0x1043, 0x1339, "Asus G1", ALC660VD_3ST), |
Takashi Iwai | 13c9474 | 2008-11-05 08:06:08 +0100 | [diff] [blame] | 14569 | SND_PCI_QUIRK(0x1043, 0x1633, "Asus V1Sn", ALC660VD_ASUS_V1S), |
Mike Crash | 6963f84 | 2007-06-25 12:12:51 +0200 | [diff] [blame] | 14570 | SND_PCI_QUIRK(0x1043, 0x81e7, "ASUS", ALC660VD_3ST_DIG), |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14571 | SND_PCI_QUIRK(0x10de, 0x03f0, "Realtek ALC660 demo", ALC660VD_3ST), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 14572 | SND_PCI_QUIRK(0x1179, 0xff00, "Toshiba A135", ALC861VD_LENOVO), |
Takashi Iwai | 38baf5a | 2007-08-16 17:52:43 +0200 | [diff] [blame] | 14573 | /*SND_PCI_QUIRK(0x1179, 0xff00, "DALLAS", ALC861VD_DALLAS),*/ /*lenovo*/ |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 14574 | SND_PCI_QUIRK(0x1179, 0xff01, "DALLAS", ALC861VD_DALLAS), |
Takashi Iwai | 542d7c6 | 2007-08-16 18:57:30 +0200 | [diff] [blame] | 14575 | SND_PCI_QUIRK(0x1179, 0xff03, "Toshiba P205", ALC861VD_LENOVO), |
Tobin Davis | b419f34 | 2008-03-07 11:57:51 +0100 | [diff] [blame] | 14576 | SND_PCI_QUIRK(0x1179, 0xff31, "Toshiba L30-149", ALC861VD_DALLAS), |
Takashi Iwai | 39c5d41 | 2007-08-15 16:24:17 +0200 | [diff] [blame] | 14577 | SND_PCI_QUIRK(0x1565, 0x820d, "Biostar NF61S SE", ALC861VD_6ST_DIG), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 14578 | SND_PCI_QUIRK_VENDOR(0x17aa, "Lenovo", ALC861VD_LENOVO), |
Tobin Davis | 625dc0b | 2007-07-30 21:42:10 +0200 | [diff] [blame] | 14579 | SND_PCI_QUIRK(0x1849, 0x0862, "ASRock K8NF6G-VSTA", ALC861VD_6ST_DIG), |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14580 | {} |
| 14581 | }; |
| 14582 | |
| 14583 | static struct alc_config_preset alc861vd_presets[] = { |
| 14584 | [ALC660VD_3ST] = { |
| 14585 | .mixers = { alc861vd_3st_mixer }, |
| 14586 | .init_verbs = { alc861vd_volume_init_verbs, |
| 14587 | alc861vd_3stack_init_verbs }, |
| 14588 | .num_dacs = ARRAY_SIZE(alc660vd_dac_nids), |
| 14589 | .dac_nids = alc660vd_dac_nids, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14590 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), |
| 14591 | .channel_mode = alc861vd_3stack_2ch_modes, |
| 14592 | .input_mux = &alc861vd_capture_source, |
| 14593 | }, |
Mike Crash | 6963f84 | 2007-06-25 12:12:51 +0200 | [diff] [blame] | 14594 | [ALC660VD_3ST_DIG] = { |
| 14595 | .mixers = { alc861vd_3st_mixer }, |
| 14596 | .init_verbs = { alc861vd_volume_init_verbs, |
| 14597 | alc861vd_3stack_init_verbs }, |
| 14598 | .num_dacs = ARRAY_SIZE(alc660vd_dac_nids), |
| 14599 | .dac_nids = alc660vd_dac_nids, |
| 14600 | .dig_out_nid = ALC861VD_DIGOUT_NID, |
Mike Crash | 6963f84 | 2007-06-25 12:12:51 +0200 | [diff] [blame] | 14601 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), |
| 14602 | .channel_mode = alc861vd_3stack_2ch_modes, |
| 14603 | .input_mux = &alc861vd_capture_source, |
| 14604 | }, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14605 | [ALC861VD_3ST] = { |
| 14606 | .mixers = { alc861vd_3st_mixer }, |
| 14607 | .init_verbs = { alc861vd_volume_init_verbs, |
| 14608 | alc861vd_3stack_init_verbs }, |
| 14609 | .num_dacs = ARRAY_SIZE(alc861vd_dac_nids), |
| 14610 | .dac_nids = alc861vd_dac_nids, |
| 14611 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), |
| 14612 | .channel_mode = alc861vd_3stack_2ch_modes, |
| 14613 | .input_mux = &alc861vd_capture_source, |
| 14614 | }, |
| 14615 | [ALC861VD_3ST_DIG] = { |
| 14616 | .mixers = { alc861vd_3st_mixer }, |
| 14617 | .init_verbs = { alc861vd_volume_init_verbs, |
| 14618 | alc861vd_3stack_init_verbs }, |
| 14619 | .num_dacs = ARRAY_SIZE(alc861vd_dac_nids), |
| 14620 | .dac_nids = alc861vd_dac_nids, |
| 14621 | .dig_out_nid = ALC861VD_DIGOUT_NID, |
| 14622 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), |
| 14623 | .channel_mode = alc861vd_3stack_2ch_modes, |
| 14624 | .input_mux = &alc861vd_capture_source, |
| 14625 | }, |
| 14626 | [ALC861VD_6ST_DIG] = { |
| 14627 | .mixers = { alc861vd_6st_mixer, alc861vd_chmode_mixer }, |
| 14628 | .init_verbs = { alc861vd_volume_init_verbs, |
| 14629 | alc861vd_6stack_init_verbs }, |
| 14630 | .num_dacs = ARRAY_SIZE(alc861vd_dac_nids), |
| 14631 | .dac_nids = alc861vd_dac_nids, |
| 14632 | .dig_out_nid = ALC861VD_DIGOUT_NID, |
| 14633 | .num_channel_mode = ARRAY_SIZE(alc861vd_6stack_modes), |
| 14634 | .channel_mode = alc861vd_6stack_modes, |
| 14635 | .input_mux = &alc861vd_capture_source, |
| 14636 | }, |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 14637 | [ALC861VD_LENOVO] = { |
| 14638 | .mixers = { alc861vd_lenovo_mixer }, |
| 14639 | .init_verbs = { alc861vd_volume_init_verbs, |
| 14640 | alc861vd_3stack_init_verbs, |
| 14641 | alc861vd_eapd_verbs, |
| 14642 | alc861vd_lenovo_unsol_verbs }, |
| 14643 | .num_dacs = ARRAY_SIZE(alc660vd_dac_nids), |
| 14644 | .dac_nids = alc660vd_dac_nids, |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 14645 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), |
| 14646 | .channel_mode = alc861vd_3stack_2ch_modes, |
| 14647 | .input_mux = &alc861vd_capture_source, |
| 14648 | .unsol_event = alc861vd_lenovo_unsol_event, |
| 14649 | .init_hook = alc861vd_lenovo_automute, |
| 14650 | }, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 14651 | [ALC861VD_DALLAS] = { |
| 14652 | .mixers = { alc861vd_dallas_mixer }, |
| 14653 | .init_verbs = { alc861vd_dallas_verbs }, |
| 14654 | .num_dacs = ARRAY_SIZE(alc861vd_dac_nids), |
| 14655 | .dac_nids = alc861vd_dac_nids, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 14656 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), |
| 14657 | .channel_mode = alc861vd_3stack_2ch_modes, |
| 14658 | .input_mux = &alc861vd_dallas_capture_source, |
| 14659 | .unsol_event = alc861vd_dallas_unsol_event, |
| 14660 | .init_hook = alc861vd_dallas_automute, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 14661 | }, |
| 14662 | [ALC861VD_HP] = { |
| 14663 | .mixers = { alc861vd_hp_mixer }, |
| 14664 | .init_verbs = { alc861vd_dallas_verbs, alc861vd_eapd_verbs }, |
| 14665 | .num_dacs = ARRAY_SIZE(alc861vd_dac_nids), |
| 14666 | .dac_nids = alc861vd_dac_nids, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 14667 | .dig_out_nid = ALC861VD_DIGOUT_NID, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 14668 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), |
| 14669 | .channel_mode = alc861vd_3stack_2ch_modes, |
| 14670 | .input_mux = &alc861vd_hp_capture_source, |
| 14671 | .unsol_event = alc861vd_dallas_unsol_event, |
| 14672 | .init_hook = alc861vd_dallas_automute, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 14673 | }, |
Takashi Iwai | 13c9474 | 2008-11-05 08:06:08 +0100 | [diff] [blame] | 14674 | [ALC660VD_ASUS_V1S] = { |
| 14675 | .mixers = { alc861vd_lenovo_mixer }, |
| 14676 | .init_verbs = { alc861vd_volume_init_verbs, |
| 14677 | alc861vd_3stack_init_verbs, |
| 14678 | alc861vd_eapd_verbs, |
| 14679 | alc861vd_lenovo_unsol_verbs }, |
| 14680 | .num_dacs = ARRAY_SIZE(alc660vd_dac_nids), |
| 14681 | .dac_nids = alc660vd_dac_nids, |
| 14682 | .dig_out_nid = ALC861VD_DIGOUT_NID, |
| 14683 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), |
| 14684 | .channel_mode = alc861vd_3stack_2ch_modes, |
| 14685 | .input_mux = &alc861vd_capture_source, |
| 14686 | .unsol_event = alc861vd_lenovo_unsol_event, |
| 14687 | .init_hook = alc861vd_lenovo_automute, |
| 14688 | }, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14689 | }; |
| 14690 | |
| 14691 | /* |
| 14692 | * BIOS auto configuration |
| 14693 | */ |
| 14694 | static void alc861vd_auto_set_output_and_unmute(struct hda_codec *codec, |
| 14695 | hda_nid_t nid, int pin_type, int dac_idx) |
| 14696 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 14697 | alc_set_pin_output(codec, nid, pin_type); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14698 | } |
| 14699 | |
| 14700 | static void alc861vd_auto_init_multi_out(struct hda_codec *codec) |
| 14701 | { |
| 14702 | struct alc_spec *spec = codec->spec; |
| 14703 | int i; |
| 14704 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 14705 | alc_subsystem_id(codec, 0x15, 0x1b, 0x14); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14706 | for (i = 0; i <= HDA_SIDE; i++) { |
| 14707 | hda_nid_t nid = spec->autocfg.line_out_pins[i]; |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 14708 | int pin_type = get_pin_type(spec->autocfg.line_out_type); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14709 | if (nid) |
| 14710 | alc861vd_auto_set_output_and_unmute(codec, nid, |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 14711 | pin_type, i); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14712 | } |
| 14713 | } |
| 14714 | |
| 14715 | |
| 14716 | static void alc861vd_auto_init_hp_out(struct hda_codec *codec) |
| 14717 | { |
| 14718 | struct alc_spec *spec = codec->spec; |
| 14719 | hda_nid_t pin; |
| 14720 | |
| 14721 | pin = spec->autocfg.hp_pins[0]; |
| 14722 | if (pin) /* connect to front and use dac 0 */ |
| 14723 | alc861vd_auto_set_output_and_unmute(codec, pin, PIN_HP, 0); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 14724 | pin = spec->autocfg.speaker_pins[0]; |
| 14725 | if (pin) |
| 14726 | alc861vd_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14727 | } |
| 14728 | |
| 14729 | #define alc861vd_is_input_pin(nid) alc880_is_input_pin(nid) |
| 14730 | #define ALC861VD_PIN_CD_NID ALC880_PIN_CD_NID |
| 14731 | |
| 14732 | static void alc861vd_auto_init_analog_input(struct hda_codec *codec) |
| 14733 | { |
| 14734 | struct alc_spec *spec = codec->spec; |
| 14735 | int i; |
| 14736 | |
| 14737 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
| 14738 | hda_nid_t nid = spec->autocfg.input_pins[i]; |
| 14739 | if (alc861vd_is_input_pin(nid)) { |
| 14740 | snd_hda_codec_write(codec, nid, 0, |
| 14741 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 14742 | i <= AUTO_PIN_FRONT_MIC ? |
| 14743 | PIN_VREF80 : PIN_IN); |
| 14744 | if (nid != ALC861VD_PIN_CD_NID) |
| 14745 | snd_hda_codec_write(codec, nid, 0, |
| 14746 | AC_VERB_SET_AMP_GAIN_MUTE, |
| 14747 | AMP_OUT_MUTE); |
| 14748 | } |
| 14749 | } |
| 14750 | } |
| 14751 | |
Takashi Iwai | f511b01 | 2008-08-15 16:46:42 +0200 | [diff] [blame] | 14752 | #define alc861vd_auto_init_input_src alc882_auto_init_input_src |
| 14753 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14754 | #define alc861vd_idx_to_mixer_vol(nid) ((nid) + 0x02) |
| 14755 | #define alc861vd_idx_to_mixer_switch(nid) ((nid) + 0x0c) |
| 14756 | |
| 14757 | /* add playback controls from the parsed DAC table */ |
| 14758 | /* Based on ALC880 version. But ALC861VD has separate, |
| 14759 | * different NIDs for mute/unmute switch and volume control */ |
| 14760 | static int alc861vd_auto_create_multi_out_ctls(struct alc_spec *spec, |
| 14761 | const struct auto_pin_cfg *cfg) |
| 14762 | { |
| 14763 | char name[32]; |
| 14764 | static const char *chname[4] = {"Front", "Surround", "CLFE", "Side"}; |
| 14765 | hda_nid_t nid_v, nid_s; |
| 14766 | int i, err; |
| 14767 | |
| 14768 | for (i = 0; i < cfg->line_outs; i++) { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14769 | if (!spec->multiout.dac_nids[i]) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14770 | continue; |
| 14771 | nid_v = alc861vd_idx_to_mixer_vol( |
| 14772 | alc880_dac_to_idx( |
| 14773 | spec->multiout.dac_nids[i])); |
| 14774 | nid_s = alc861vd_idx_to_mixer_switch( |
| 14775 | alc880_dac_to_idx( |
| 14776 | spec->multiout.dac_nids[i])); |
| 14777 | |
| 14778 | if (i == 2) { |
| 14779 | /* Center/LFE */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14780 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 14781 | "Center Playback Volume", |
| 14782 | HDA_COMPOSE_AMP_VAL(nid_v, 1, 0, |
| 14783 | HDA_OUTPUT)); |
| 14784 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14785 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14786 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 14787 | "LFE Playback Volume", |
| 14788 | HDA_COMPOSE_AMP_VAL(nid_v, 2, 0, |
| 14789 | HDA_OUTPUT)); |
| 14790 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14791 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14792 | err = add_control(spec, ALC_CTL_BIND_MUTE, |
| 14793 | "Center Playback Switch", |
| 14794 | HDA_COMPOSE_AMP_VAL(nid_s, 1, 2, |
| 14795 | HDA_INPUT)); |
| 14796 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14797 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14798 | err = add_control(spec, ALC_CTL_BIND_MUTE, |
| 14799 | "LFE Playback Switch", |
| 14800 | HDA_COMPOSE_AMP_VAL(nid_s, 2, 2, |
| 14801 | HDA_INPUT)); |
| 14802 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14803 | return err; |
| 14804 | } else { |
| 14805 | sprintf(name, "%s Playback Volume", chname[i]); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14806 | err = add_control(spec, ALC_CTL_WIDGET_VOL, name, |
| 14807 | HDA_COMPOSE_AMP_VAL(nid_v, 3, 0, |
| 14808 | HDA_OUTPUT)); |
| 14809 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14810 | return err; |
| 14811 | sprintf(name, "%s Playback Switch", chname[i]); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14812 | err = add_control(spec, ALC_CTL_BIND_MUTE, name, |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 14813 | HDA_COMPOSE_AMP_VAL(nid_s, 3, 2, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14814 | HDA_INPUT)); |
| 14815 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14816 | return err; |
| 14817 | } |
| 14818 | } |
| 14819 | return 0; |
| 14820 | } |
| 14821 | |
| 14822 | /* add playback controls for speaker and HP outputs */ |
| 14823 | /* Based on ALC880 version. But ALC861VD has separate, |
| 14824 | * different NIDs for mute/unmute switch and volume control */ |
| 14825 | static int alc861vd_auto_create_extra_out(struct alc_spec *spec, |
| 14826 | hda_nid_t pin, const char *pfx) |
| 14827 | { |
| 14828 | hda_nid_t nid_v, nid_s; |
| 14829 | int err; |
| 14830 | char name[32]; |
| 14831 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14832 | if (!pin) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14833 | return 0; |
| 14834 | |
| 14835 | if (alc880_is_fixed_pin(pin)) { |
| 14836 | nid_v = alc880_idx_to_dac(alc880_fixed_pin_idx(pin)); |
| 14837 | /* specify the DAC as the extra output */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14838 | if (!spec->multiout.hp_nid) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14839 | spec->multiout.hp_nid = nid_v; |
| 14840 | else |
| 14841 | spec->multiout.extra_out_nid[0] = nid_v; |
| 14842 | /* control HP volume/switch on the output mixer amp */ |
| 14843 | nid_v = alc861vd_idx_to_mixer_vol( |
| 14844 | alc880_fixed_pin_idx(pin)); |
| 14845 | nid_s = alc861vd_idx_to_mixer_switch( |
| 14846 | alc880_fixed_pin_idx(pin)); |
| 14847 | |
| 14848 | sprintf(name, "%s Playback Volume", pfx); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14849 | err = add_control(spec, ALC_CTL_WIDGET_VOL, name, |
| 14850 | HDA_COMPOSE_AMP_VAL(nid_v, 3, 0, HDA_OUTPUT)); |
| 14851 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14852 | return err; |
| 14853 | sprintf(name, "%s Playback Switch", pfx); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14854 | err = add_control(spec, ALC_CTL_BIND_MUTE, name, |
| 14855 | HDA_COMPOSE_AMP_VAL(nid_s, 3, 2, HDA_INPUT)); |
| 14856 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14857 | return err; |
| 14858 | } else if (alc880_is_multi_pin(pin)) { |
| 14859 | /* set manual connection */ |
| 14860 | /* we have only a switch on HP-out PIN */ |
| 14861 | sprintf(name, "%s Playback Switch", pfx); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14862 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, name, |
| 14863 | HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT)); |
| 14864 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14865 | return err; |
| 14866 | } |
| 14867 | return 0; |
| 14868 | } |
| 14869 | |
| 14870 | /* parse the BIOS configuration and set up the alc_spec |
| 14871 | * return 1 if successful, 0 if the proper config is not found, |
| 14872 | * or a negative error code |
| 14873 | * Based on ALC880 version - had to change it to override |
| 14874 | * alc880_auto_create_extra_out and alc880_auto_create_multi_out_ctls */ |
| 14875 | static int alc861vd_parse_auto_config(struct hda_codec *codec) |
| 14876 | { |
| 14877 | struct alc_spec *spec = codec->spec; |
| 14878 | int err; |
| 14879 | static hda_nid_t alc861vd_ignore[] = { 0x1d, 0 }; |
| 14880 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14881 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 14882 | alc861vd_ignore); |
| 14883 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14884 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14885 | if (!spec->autocfg.line_outs) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14886 | return 0; /* can't find valid BIOS pin config */ |
| 14887 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14888 | err = alc880_auto_fill_dac_nids(spec, &spec->autocfg); |
| 14889 | if (err < 0) |
| 14890 | return err; |
| 14891 | err = alc861vd_auto_create_multi_out_ctls(spec, &spec->autocfg); |
| 14892 | if (err < 0) |
| 14893 | return err; |
| 14894 | err = alc861vd_auto_create_extra_out(spec, |
| 14895 | spec->autocfg.speaker_pins[0], |
| 14896 | "Speaker"); |
| 14897 | if (err < 0) |
| 14898 | return err; |
| 14899 | err = alc861vd_auto_create_extra_out(spec, |
| 14900 | spec->autocfg.hp_pins[0], |
| 14901 | "Headphone"); |
| 14902 | if (err < 0) |
| 14903 | return err; |
| 14904 | err = alc880_auto_create_analog_input_ctls(spec, &spec->autocfg); |
| 14905 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14906 | return err; |
| 14907 | |
| 14908 | spec->multiout.max_channels = spec->multiout.num_dacs * 2; |
| 14909 | |
Takashi Iwai | 0852d7a | 2009-02-11 11:35:15 +0100 | [diff] [blame] | 14910 | if (spec->autocfg.dig_outs) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14911 | spec->multiout.dig_out_nid = ALC861VD_DIGOUT_NID; |
| 14912 | |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 14913 | if (spec->kctls.list) |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 14914 | add_mixer(spec, spec->kctls.list); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14915 | |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 14916 | add_verb(spec, alc861vd_volume_init_verbs); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14917 | |
| 14918 | spec->num_mux_defs = 1; |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 14919 | spec->input_mux = &spec->private_imux[0]; |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14920 | |
Takashi Iwai | 776e184 | 2007-08-29 15:07:11 +0200 | [diff] [blame] | 14921 | err = alc_auto_add_mic_boost(codec); |
| 14922 | if (err < 0) |
| 14923 | return err; |
| 14924 | |
Takashi Iwai | e044c39 | 2008-10-27 16:56:24 +0100 | [diff] [blame] | 14925 | store_pin_configs(codec); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14926 | return 1; |
| 14927 | } |
| 14928 | |
| 14929 | /* additional initialization for auto-configuration model */ |
| 14930 | static void alc861vd_auto_init(struct hda_codec *codec) |
| 14931 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 14932 | struct alc_spec *spec = codec->spec; |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14933 | alc861vd_auto_init_multi_out(codec); |
| 14934 | alc861vd_auto_init_hp_out(codec); |
| 14935 | alc861vd_auto_init_analog_input(codec); |
Takashi Iwai | f511b01 | 2008-08-15 16:46:42 +0200 | [diff] [blame] | 14936 | alc861vd_auto_init_input_src(codec); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 14937 | if (spec->unsol_event) |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 14938 | alc_inithook(codec); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14939 | } |
| 14940 | |
| 14941 | static int patch_alc861vd(struct hda_codec *codec) |
| 14942 | { |
| 14943 | struct alc_spec *spec; |
| 14944 | int err, board_config; |
| 14945 | |
| 14946 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
| 14947 | if (spec == NULL) |
| 14948 | return -ENOMEM; |
| 14949 | |
| 14950 | codec->spec = spec; |
| 14951 | |
| 14952 | board_config = snd_hda_check_board_config(codec, ALC861VD_MODEL_LAST, |
| 14953 | alc861vd_models, |
| 14954 | alc861vd_cfg_tbl); |
| 14955 | |
| 14956 | if (board_config < 0 || board_config >= ALC861VD_MODEL_LAST) { |
| 14957 | printk(KERN_INFO "hda_codec: Unknown model for ALC660VD/" |
| 14958 | "ALC861VD, trying auto-probe from BIOS...\n"); |
| 14959 | board_config = ALC861VD_AUTO; |
| 14960 | } |
| 14961 | |
| 14962 | if (board_config == ALC861VD_AUTO) { |
| 14963 | /* automatic parse from the BIOS config */ |
| 14964 | err = alc861vd_parse_auto_config(codec); |
| 14965 | if (err < 0) { |
| 14966 | alc_free(codec); |
| 14967 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14968 | } else if (!err) { |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14969 | printk(KERN_INFO |
| 14970 | "hda_codec: Cannot set up configuration " |
| 14971 | "from BIOS. Using base mode...\n"); |
| 14972 | board_config = ALC861VD_3ST; |
| 14973 | } |
| 14974 | } |
| 14975 | |
Kusanagi Kouichi | 680cd53 | 2009-02-05 00:00:58 +0900 | [diff] [blame] | 14976 | err = snd_hda_attach_beep_device(codec, 0x23); |
| 14977 | if (err < 0) { |
| 14978 | alc_free(codec); |
| 14979 | return err; |
| 14980 | } |
| 14981 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14982 | if (board_config != ALC861VD_AUTO) |
| 14983 | setup_preset(spec, &alc861vd_presets[board_config]); |
| 14984 | |
Kailang Yang | 2f89328 | 2008-05-27 12:14:47 +0200 | [diff] [blame] | 14985 | if (codec->vendor_id == 0x10ec0660) { |
| 14986 | spec->stream_name_analog = "ALC660-VD Analog"; |
| 14987 | spec->stream_name_digital = "ALC660-VD Digital"; |
Kailang Yang | f9423e7 | 2008-05-27 12:32:25 +0200 | [diff] [blame] | 14988 | /* always turn on EAPD */ |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 14989 | add_verb(spec, alc660vd_eapd_verbs); |
Kailang Yang | 2f89328 | 2008-05-27 12:14:47 +0200 | [diff] [blame] | 14990 | } else { |
| 14991 | spec->stream_name_analog = "ALC861VD Analog"; |
| 14992 | spec->stream_name_digital = "ALC861VD Digital"; |
| 14993 | } |
| 14994 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14995 | spec->stream_analog_playback = &alc861vd_pcm_analog_playback; |
| 14996 | spec->stream_analog_capture = &alc861vd_pcm_analog_capture; |
| 14997 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14998 | spec->stream_digital_playback = &alc861vd_pcm_digital_playback; |
| 14999 | spec->stream_digital_capture = &alc861vd_pcm_digital_capture; |
| 15000 | |
| 15001 | spec->adc_nids = alc861vd_adc_nids; |
| 15002 | spec->num_adc_nids = ARRAY_SIZE(alc861vd_adc_nids); |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 15003 | spec->capsrc_nids = alc861vd_capsrc_nids; |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 15004 | spec->capture_style = CAPT_MIX; |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15005 | |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 15006 | set_capture_mixer(spec); |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 15007 | set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15008 | |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 15009 | spec->vmaster_nid = 0x02; |
| 15010 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15011 | codec->patch_ops = alc_patch_ops; |
| 15012 | |
| 15013 | if (board_config == ALC861VD_AUTO) |
| 15014 | spec->init_hook = alc861vd_auto_init; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 15015 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 15016 | if (!spec->loopback.amplist) |
| 15017 | spec->loopback.amplist = alc861vd_loopbacks; |
| 15018 | #endif |
Takashi Iwai | daead53 | 2008-11-28 12:55:36 +0100 | [diff] [blame] | 15019 | codec->proc_widget_hook = print_realtek_coef; |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15020 | |
| 15021 | return 0; |
| 15022 | } |
| 15023 | |
| 15024 | /* |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15025 | * ALC662 support |
| 15026 | * |
| 15027 | * ALC662 is almost identical with ALC880 but has cleaner and more flexible |
| 15028 | * configuration. Each pin widget can choose any input DACs and a mixer. |
| 15029 | * Each ADC is connected from a mixer of all inputs. This makes possible |
| 15030 | * 6-channel independent captures. |
| 15031 | * |
| 15032 | * In addition, an independent DAC for the multi-playback (not used in this |
| 15033 | * driver yet). |
| 15034 | */ |
| 15035 | #define ALC662_DIGOUT_NID 0x06 |
| 15036 | #define ALC662_DIGIN_NID 0x0a |
| 15037 | |
| 15038 | static hda_nid_t alc662_dac_nids[4] = { |
| 15039 | /* front, rear, clfe, rear_surr */ |
| 15040 | 0x02, 0x03, 0x04 |
| 15041 | }; |
| 15042 | |
| 15043 | static hda_nid_t alc662_adc_nids[1] = { |
| 15044 | /* ADC1-2 */ |
| 15045 | 0x09, |
| 15046 | }; |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 15047 | |
Kailang Yang | 77a261b | 2008-02-19 11:38:05 +0100 | [diff] [blame] | 15048 | static hda_nid_t alc662_capsrc_nids[1] = { 0x22 }; |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 15049 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15050 | /* input MUX */ |
| 15051 | /* FIXME: should be a matrix-type input source selection */ |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15052 | static struct hda_input_mux alc662_capture_source = { |
| 15053 | .num_items = 4, |
| 15054 | .items = { |
| 15055 | { "Mic", 0x0 }, |
| 15056 | { "Front Mic", 0x1 }, |
| 15057 | { "Line", 0x2 }, |
| 15058 | { "CD", 0x4 }, |
| 15059 | }, |
| 15060 | }; |
| 15061 | |
| 15062 | static struct hda_input_mux alc662_lenovo_101e_capture_source = { |
| 15063 | .num_items = 2, |
| 15064 | .items = { |
| 15065 | { "Mic", 0x1 }, |
| 15066 | { "Line", 0x2 }, |
| 15067 | }, |
| 15068 | }; |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 15069 | |
| 15070 | static struct hda_input_mux alc662_eeepc_capture_source = { |
| 15071 | .num_items = 2, |
| 15072 | .items = { |
| 15073 | { "i-Mic", 0x1 }, |
| 15074 | { "e-Mic", 0x0 }, |
| 15075 | }, |
| 15076 | }; |
| 15077 | |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 15078 | static struct hda_input_mux alc663_capture_source = { |
| 15079 | .num_items = 3, |
| 15080 | .items = { |
| 15081 | { "Mic", 0x0 }, |
| 15082 | { "Front Mic", 0x1 }, |
| 15083 | { "Line", 0x2 }, |
| 15084 | }, |
| 15085 | }; |
| 15086 | |
| 15087 | static struct hda_input_mux alc663_m51va_capture_source = { |
| 15088 | .num_items = 2, |
| 15089 | .items = { |
| 15090 | { "Ext-Mic", 0x0 }, |
| 15091 | { "D-Mic", 0x9 }, |
| 15092 | }, |
| 15093 | }; |
| 15094 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15095 | /* |
| 15096 | * 2ch mode |
| 15097 | */ |
| 15098 | static struct hda_channel_mode alc662_3ST_2ch_modes[1] = { |
| 15099 | { 2, NULL } |
| 15100 | }; |
| 15101 | |
| 15102 | /* |
| 15103 | * 2ch mode |
| 15104 | */ |
| 15105 | static struct hda_verb alc662_3ST_ch2_init[] = { |
| 15106 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 15107 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 15108 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 15109 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 15110 | { } /* end */ |
| 15111 | }; |
| 15112 | |
| 15113 | /* |
| 15114 | * 6ch mode |
| 15115 | */ |
| 15116 | static struct hda_verb alc662_3ST_ch6_init[] = { |
| 15117 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 15118 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 15119 | { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 }, |
| 15120 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 15121 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 15122 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 15123 | { } /* end */ |
| 15124 | }; |
| 15125 | |
| 15126 | static struct hda_channel_mode alc662_3ST_6ch_modes[2] = { |
| 15127 | { 2, alc662_3ST_ch2_init }, |
| 15128 | { 6, alc662_3ST_ch6_init }, |
| 15129 | }; |
| 15130 | |
| 15131 | /* |
| 15132 | * 2ch mode |
| 15133 | */ |
| 15134 | static struct hda_verb alc662_sixstack_ch6_init[] = { |
| 15135 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 15136 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 15137 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 15138 | { } /* end */ |
| 15139 | }; |
| 15140 | |
| 15141 | /* |
| 15142 | * 6ch mode |
| 15143 | */ |
| 15144 | static struct hda_verb alc662_sixstack_ch8_init[] = { |
| 15145 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 15146 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 15147 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 15148 | { } /* end */ |
| 15149 | }; |
| 15150 | |
| 15151 | static struct hda_channel_mode alc662_5stack_modes[2] = { |
| 15152 | { 2, alc662_sixstack_ch6_init }, |
| 15153 | { 6, alc662_sixstack_ch8_init }, |
| 15154 | }; |
| 15155 | |
| 15156 | /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17 |
| 15157 | * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b |
| 15158 | */ |
| 15159 | |
| 15160 | static struct snd_kcontrol_new alc662_base_mixer[] = { |
| 15161 | /* output mixer control */ |
| 15162 | HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT), |
Herton Ronaldo Krzesinski | 7055ad8 | 2008-03-14 12:52:20 +0100 | [diff] [blame] | 15163 | HDA_CODEC_MUTE("Front Playback Switch", 0x0c, 0x0, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15164 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x3, 0x0, HDA_OUTPUT), |
Herton Ronaldo Krzesinski | 7055ad8 | 2008-03-14 12:52:20 +0100 | [diff] [blame] | 15165 | HDA_CODEC_MUTE("Surround Playback Switch", 0x0d, 0x0, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15166 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT), |
| 15167 | 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] | 15168 | HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x0e, 1, 0x0, HDA_INPUT), |
| 15169 | HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 0x0, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15170 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 15171 | |
| 15172 | /*Input mixer control */ |
| 15173 | HDA_CODEC_VOLUME("CD Playback Volume", 0xb, 0x4, HDA_INPUT), |
| 15174 | HDA_CODEC_MUTE("CD Playback Switch", 0xb, 0x4, HDA_INPUT), |
| 15175 | HDA_CODEC_VOLUME("Line Playback Volume", 0xb, 0x02, HDA_INPUT), |
| 15176 | HDA_CODEC_MUTE("Line Playback Switch", 0xb, 0x02, HDA_INPUT), |
| 15177 | HDA_CODEC_VOLUME("Mic Playback Volume", 0xb, 0x0, HDA_INPUT), |
| 15178 | HDA_CODEC_MUTE("Mic Playback Switch", 0xb, 0x0, HDA_INPUT), |
| 15179 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0xb, 0x01, HDA_INPUT), |
| 15180 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0xb, 0x01, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15181 | { } /* end */ |
| 15182 | }; |
| 15183 | |
| 15184 | static struct snd_kcontrol_new alc662_3ST_2ch_mixer[] = { |
| 15185 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
Herton Ronaldo Krzesinski | 7055ad8 | 2008-03-14 12:52:20 +0100 | [diff] [blame] | 15186 | HDA_CODEC_MUTE("Front Playback Switch", 0x0c, 0x0, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15187 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 15188 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 15189 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 15190 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 15191 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 15192 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 15193 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 15194 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 15195 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15196 | { } /* end */ |
| 15197 | }; |
| 15198 | |
| 15199 | static struct snd_kcontrol_new alc662_3ST_6ch_mixer[] = { |
| 15200 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
Herton Ronaldo Krzesinski | 7055ad8 | 2008-03-14 12:52:20 +0100 | [diff] [blame] | 15201 | HDA_CODEC_MUTE("Front Playback Switch", 0x0c, 0x0, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15202 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
Herton Ronaldo Krzesinski | 7055ad8 | 2008-03-14 12:52:20 +0100 | [diff] [blame] | 15203 | HDA_CODEC_MUTE("Surround Playback Switch", 0x0d, 0x0, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15204 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT), |
| 15205 | 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] | 15206 | HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x0e, 1, 0x0, HDA_INPUT), |
| 15207 | HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 0x0, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15208 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 15209 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 15210 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 15211 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 15212 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 15213 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 15214 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 15215 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 15216 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15217 | { } /* end */ |
| 15218 | }; |
| 15219 | |
| 15220 | static struct snd_kcontrol_new alc662_lenovo_101e_mixer[] = { |
| 15221 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 15222 | HDA_BIND_MUTE("Front Playback Switch", 0x02, 2, HDA_INPUT), |
Takashi Iwai | 86cd929 | 2008-01-28 18:09:56 +0100 | [diff] [blame] | 15223 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 15224 | HDA_BIND_MUTE("Speaker Playback Switch", 0x03, 2, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15225 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 15226 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 15227 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 15228 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 15229 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15230 | { } /* end */ |
| 15231 | }; |
| 15232 | |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 15233 | static struct snd_kcontrol_new alc662_eeepc_p701_mixer[] = { |
Takashi Iwai | 86cd929 | 2008-01-28 18:09:56 +0100 | [diff] [blame] | 15234 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 15235 | |
Herton Ronaldo Krzesinski | b481849 | 2008-02-23 11:34:12 +0100 | [diff] [blame] | 15236 | HDA_CODEC_VOLUME("Line-Out Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 15237 | HDA_CODEC_MUTE("Line-Out Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 15238 | |
| 15239 | HDA_CODEC_VOLUME("e-Mic Boost", 0x18, 0, HDA_INPUT), |
| 15240 | HDA_CODEC_VOLUME("e-Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 15241 | HDA_CODEC_MUTE("e-Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 15242 | |
| 15243 | HDA_CODEC_VOLUME("i-Mic Boost", 0x19, 0, HDA_INPUT), |
| 15244 | HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 15245 | HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 15246 | { } /* end */ |
| 15247 | }; |
| 15248 | |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 15249 | static struct snd_kcontrol_new alc662_eeepc_ep20_mixer[] = { |
Takashi Iwai | 31bffaa | 2008-02-27 16:10:44 +0100 | [diff] [blame] | 15250 | HDA_CODEC_VOLUME("Line-Out Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 15251 | HDA_CODEC_MUTE("Line-Out Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 15252 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 15253 | HDA_BIND_MUTE("Surround Playback Switch", 0x03, 2, HDA_INPUT), |
| 15254 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT), |
| 15255 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, HDA_OUTPUT), |
| 15256 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x04, 1, 2, HDA_INPUT), |
| 15257 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x04, 2, 2, HDA_INPUT), |
Takashi Iwai | 86cd929 | 2008-01-28 18:09:56 +0100 | [diff] [blame] | 15258 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 15259 | HDA_BIND_MUTE("MuteCtrl Playback Switch", 0x0c, 2, HDA_INPUT), |
| 15260 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 15261 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 15262 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 15263 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 15264 | { } /* end */ |
| 15265 | }; |
| 15266 | |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 15267 | static struct hda_bind_ctls alc663_asus_bind_master_vol = { |
| 15268 | .ops = &snd_hda_bind_vol, |
| 15269 | .values = { |
| 15270 | HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT), |
| 15271 | HDA_COMPOSE_AMP_VAL(0x03, 3, 0, HDA_OUTPUT), |
| 15272 | 0 |
| 15273 | }, |
| 15274 | }; |
| 15275 | |
| 15276 | static struct hda_bind_ctls alc663_asus_one_bind_switch = { |
| 15277 | .ops = &snd_hda_bind_sw, |
| 15278 | .values = { |
| 15279 | HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), |
| 15280 | HDA_COMPOSE_AMP_VAL(0x21, 3, 0, HDA_OUTPUT), |
| 15281 | 0 |
| 15282 | }, |
| 15283 | }; |
| 15284 | |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 15285 | static struct snd_kcontrol_new alc663_m51va_mixer[] = { |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 15286 | HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol), |
| 15287 | HDA_BIND_SW("Master Playback Switch", &alc663_asus_one_bind_switch), |
| 15288 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 15289 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 15290 | { } /* end */ |
| 15291 | }; |
| 15292 | |
| 15293 | static struct hda_bind_ctls alc663_asus_tree_bind_switch = { |
| 15294 | .ops = &snd_hda_bind_sw, |
| 15295 | .values = { |
| 15296 | HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), |
| 15297 | HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT), |
| 15298 | HDA_COMPOSE_AMP_VAL(0x21, 3, 0, HDA_OUTPUT), |
| 15299 | 0 |
| 15300 | }, |
| 15301 | }; |
| 15302 | |
| 15303 | static struct snd_kcontrol_new alc663_two_hp_m1_mixer[] = { |
| 15304 | HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol), |
| 15305 | HDA_BIND_SW("Master Playback Switch", &alc663_asus_tree_bind_switch), |
| 15306 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 15307 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 15308 | HDA_CODEC_VOLUME("F-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 15309 | HDA_CODEC_MUTE("F-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 15310 | |
| 15311 | { } /* end */ |
| 15312 | }; |
| 15313 | |
| 15314 | static struct hda_bind_ctls alc663_asus_four_bind_switch = { |
| 15315 | .ops = &snd_hda_bind_sw, |
| 15316 | .values = { |
| 15317 | HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), |
| 15318 | HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT), |
| 15319 | HDA_COMPOSE_AMP_VAL(0x1b, 3, 0, HDA_OUTPUT), |
| 15320 | 0 |
| 15321 | }, |
| 15322 | }; |
| 15323 | |
| 15324 | static struct snd_kcontrol_new alc663_two_hp_m2_mixer[] = { |
| 15325 | HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol), |
| 15326 | HDA_BIND_SW("Master Playback Switch", &alc663_asus_four_bind_switch), |
| 15327 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 15328 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 15329 | HDA_CODEC_VOLUME("F-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 15330 | HDA_CODEC_MUTE("F-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 15331 | { } /* end */ |
| 15332 | }; |
| 15333 | |
| 15334 | static struct snd_kcontrol_new alc662_1bjd_mixer[] = { |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 15335 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 15336 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 15337 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 15338 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 15339 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 15340 | HDA_CODEC_VOLUME("F-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 15341 | HDA_CODEC_MUTE("F-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 15342 | { } /* end */ |
| 15343 | }; |
| 15344 | |
| 15345 | static struct hda_bind_ctls alc663_asus_two_bind_master_vol = { |
| 15346 | .ops = &snd_hda_bind_vol, |
| 15347 | .values = { |
| 15348 | HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT), |
| 15349 | HDA_COMPOSE_AMP_VAL(0x04, 3, 0, HDA_OUTPUT), |
| 15350 | 0 |
| 15351 | }, |
| 15352 | }; |
| 15353 | |
| 15354 | static struct hda_bind_ctls alc663_asus_two_bind_switch = { |
| 15355 | .ops = &snd_hda_bind_sw, |
| 15356 | .values = { |
| 15357 | HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), |
| 15358 | HDA_COMPOSE_AMP_VAL(0x16, 3, 0, HDA_OUTPUT), |
| 15359 | 0 |
| 15360 | }, |
| 15361 | }; |
| 15362 | |
| 15363 | static struct snd_kcontrol_new alc663_asus_21jd_clfe_mixer[] = { |
| 15364 | HDA_BIND_VOL("Master Playback Volume", |
| 15365 | &alc663_asus_two_bind_master_vol), |
| 15366 | HDA_BIND_SW("Master Playback Switch", &alc663_asus_two_bind_switch), |
| 15367 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 15368 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT), |
| 15369 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 15370 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 15371 | { } /* end */ |
| 15372 | }; |
| 15373 | |
| 15374 | static struct snd_kcontrol_new alc663_asus_15jd_clfe_mixer[] = { |
| 15375 | HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol), |
| 15376 | HDA_BIND_SW("Master Playback Switch", &alc663_asus_two_bind_switch), |
| 15377 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 15378 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 15379 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 15380 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 15381 | { } /* end */ |
| 15382 | }; |
| 15383 | |
| 15384 | static struct snd_kcontrol_new alc663_g71v_mixer[] = { |
| 15385 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 15386 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 15387 | HDA_CODEC_VOLUME("Front Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 15388 | HDA_CODEC_MUTE("Front Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 15389 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT), |
| 15390 | |
| 15391 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 15392 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 15393 | HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 15394 | HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 15395 | { } /* end */ |
| 15396 | }; |
| 15397 | |
| 15398 | static struct snd_kcontrol_new alc663_g50v_mixer[] = { |
| 15399 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 15400 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 15401 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT), |
| 15402 | |
| 15403 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 15404 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 15405 | HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 15406 | HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 15407 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 15408 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 15409 | { } /* end */ |
| 15410 | }; |
| 15411 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15412 | static struct snd_kcontrol_new alc662_chmode_mixer[] = { |
| 15413 | { |
| 15414 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 15415 | .name = "Channel Mode", |
| 15416 | .info = alc_ch_mode_info, |
| 15417 | .get = alc_ch_mode_get, |
| 15418 | .put = alc_ch_mode_put, |
| 15419 | }, |
| 15420 | { } /* end */ |
| 15421 | }; |
| 15422 | |
| 15423 | static struct hda_verb alc662_init_verbs[] = { |
| 15424 | /* ADC: mute amp left and right */ |
| 15425 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 15426 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 15427 | /* Front mixer: unmute input/output amp left and right (volume = 0) */ |
| 15428 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 15429 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 15430 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 15431 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 15432 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 15433 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15434 | |
Kailang Yang | b60dd39 | 2007-09-20 12:50:29 +0200 | [diff] [blame] | 15435 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15436 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15437 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15438 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15439 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15440 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15441 | |
| 15442 | /* Front Pin: output 0 (0x0c) */ |
| 15443 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 15444 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15445 | |
| 15446 | /* Rear Pin: output 1 (0x0d) */ |
| 15447 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 15448 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15449 | |
| 15450 | /* CLFE Pin: output 2 (0x0e) */ |
| 15451 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 15452 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15453 | |
| 15454 | /* Mic (rear) pin: input vref at 80% */ |
| 15455 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 15456 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 15457 | /* Front Mic pin: input vref at 80% */ |
| 15458 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 15459 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 15460 | /* Line In pin: input */ |
| 15461 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 15462 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 15463 | /* Line-2 In: Headphone output (output 0 - 0x0c) */ |
| 15464 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 15465 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15466 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 15467 | /* CD pin widget for input */ |
| 15468 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 15469 | |
| 15470 | /* FIXME: use matrix-type input source selection */ |
| 15471 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 15472 | /* Input mixer */ |
| 15473 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15474 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15475 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 15476 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)}, |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 15477 | |
| 15478 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15479 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15480 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 15481 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)}, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 15482 | |
| 15483 | /* always trun on EAPD */ |
| 15484 | {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 15485 | {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 15486 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15487 | { } |
| 15488 | }; |
| 15489 | |
| 15490 | static struct hda_verb alc662_sue_init_verbs[] = { |
| 15491 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_FRONT_EVENT}, |
| 15492 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_HP_EVENT}, |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 15493 | {} |
| 15494 | }; |
| 15495 | |
| 15496 | static struct hda_verb alc662_eeepc_sue_init_verbs[] = { |
| 15497 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 15498 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 15499 | {} |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15500 | }; |
| 15501 | |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 15502 | /* Set Unsolicited Event*/ |
| 15503 | static struct hda_verb alc662_eeepc_ep20_sue_init_verbs[] = { |
| 15504 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 15505 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 15506 | {} |
| 15507 | }; |
| 15508 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15509 | /* |
| 15510 | * generic initialization of ADC, input mixers and output mixers |
| 15511 | */ |
| 15512 | static struct hda_verb alc662_auto_init_verbs[] = { |
| 15513 | /* |
| 15514 | * Unmute ADC and set the default input to mic-in |
| 15515 | */ |
| 15516 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 15517 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15518 | |
| 15519 | /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback |
| 15520 | * mixer widget |
| 15521 | * Note: PASD motherboards uses the Line In 2 as the input for front |
| 15522 | * panel mic (mic 2) |
| 15523 | */ |
| 15524 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 15525 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 15526 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 15527 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 15528 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 15529 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15530 | |
| 15531 | /* |
| 15532 | * Set up output mixers (0x0c - 0x0f) |
| 15533 | */ |
| 15534 | /* set vol=0 to output mixers */ |
| 15535 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 15536 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 15537 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 15538 | |
| 15539 | /* set up input amps for analog loopback */ |
| 15540 | /* Amp Indices: DAC = 0, mixer = 1 */ |
Kailang Yang | b60dd39 | 2007-09-20 12:50:29 +0200 | [diff] [blame] | 15541 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15542 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15543 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15544 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15545 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15546 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15547 | |
| 15548 | |
| 15549 | /* FIXME: use matrix-type input source selection */ |
| 15550 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 15551 | /* Input mixer */ |
| 15552 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 15553 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15554 | { } |
| 15555 | }; |
| 15556 | |
Takashi Iwai | 24fb917 | 2008-09-02 14:48:20 +0200 | [diff] [blame] | 15557 | /* additional verbs for ALC663 */ |
| 15558 | static struct hda_verb alc663_auto_init_verbs[] = { |
| 15559 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15560 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15561 | { } |
| 15562 | }; |
| 15563 | |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 15564 | static struct hda_verb alc663_m51va_init_verbs[] = { |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 15565 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 15566 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 15567 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 15568 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 15569 | {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */ |
| 15570 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 15571 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)}, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 15572 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 15573 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 15574 | {} |
| 15575 | }; |
| 15576 | |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 15577 | static struct hda_verb alc663_21jd_amic_init_verbs[] = { |
| 15578 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 15579 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15580 | {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */ |
| 15581 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 15582 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15583 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 15584 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 15585 | {} |
| 15586 | }; |
| 15587 | |
| 15588 | static struct hda_verb alc662_1bjd_amic_init_verbs[] = { |
| 15589 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 15590 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 15591 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15592 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Headphone */ |
| 15593 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 15594 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15595 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 15596 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 15597 | {} |
| 15598 | }; |
| 15599 | |
| 15600 | static struct hda_verb alc663_15jd_amic_init_verbs[] = { |
| 15601 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 15602 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15603 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */ |
| 15604 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 15605 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15606 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 15607 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 15608 | {} |
| 15609 | }; |
| 15610 | |
| 15611 | static struct hda_verb alc663_two_hp_amic_m1_init_verbs[] = { |
| 15612 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 15613 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 15614 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15615 | {0x21, AC_VERB_SET_CONNECT_SEL, 0x0}, /* Headphone */ |
| 15616 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 15617 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15618 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x0}, /* Headphone */ |
| 15619 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 15620 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15621 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 15622 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 15623 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 15624 | {} |
| 15625 | }; |
| 15626 | |
| 15627 | static struct hda_verb alc663_two_hp_amic_m2_init_verbs[] = { |
| 15628 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 15629 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 15630 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15631 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */ |
| 15632 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 15633 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15634 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */ |
| 15635 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 15636 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15637 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 15638 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 15639 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 15640 | {} |
| 15641 | }; |
| 15642 | |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 15643 | static struct hda_verb alc663_g71v_init_verbs[] = { |
| 15644 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 15645 | /* {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, */ |
| 15646 | /* {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, */ /* Headphone */ |
| 15647 | |
| 15648 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 15649 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15650 | {0x21, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Headphone */ |
| 15651 | |
| 15652 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_FRONT_EVENT}, |
| 15653 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_MIC_EVENT}, |
| 15654 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_HP_EVENT}, |
| 15655 | {} |
| 15656 | }; |
| 15657 | |
| 15658 | static struct hda_verb alc663_g50v_init_verbs[] = { |
| 15659 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 15660 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15661 | {0x21, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Headphone */ |
| 15662 | |
| 15663 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 15664 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 15665 | {} |
| 15666 | }; |
| 15667 | |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 15668 | static struct hda_verb alc662_ecs_init_verbs[] = { |
| 15669 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, 0x701f}, |
| 15670 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 15671 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 15672 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 15673 | {} |
| 15674 | }; |
| 15675 | |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 15676 | static struct snd_kcontrol_new alc662_auto_capture_mixer[] = { |
| 15677 | HDA_CODEC_VOLUME("Capture Volume", 0x09, 0x0, HDA_INPUT), |
| 15678 | HDA_CODEC_MUTE("Capture Switch", 0x09, 0x0, HDA_INPUT), |
| 15679 | { } /* end */ |
| 15680 | }; |
| 15681 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15682 | static void alc662_lenovo_101e_ispeaker_automute(struct hda_codec *codec) |
| 15683 | { |
| 15684 | unsigned int present; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15685 | unsigned char bits; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15686 | |
| 15687 | present = snd_hda_codec_read(codec, 0x14, 0, |
| 15688 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 15689 | bits = present ? HDA_AMP_MUTE : 0; |
| 15690 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 15691 | HDA_AMP_MUTE, bits); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15692 | } |
| 15693 | |
| 15694 | static void alc662_lenovo_101e_all_automute(struct hda_codec *codec) |
| 15695 | { |
| 15696 | unsigned int present; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15697 | unsigned char bits; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15698 | |
| 15699 | present = snd_hda_codec_read(codec, 0x1b, 0, |
| 15700 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 15701 | bits = present ? HDA_AMP_MUTE : 0; |
| 15702 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 15703 | HDA_AMP_MUTE, bits); |
| 15704 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 15705 | HDA_AMP_MUTE, bits); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15706 | } |
| 15707 | |
| 15708 | static void alc662_lenovo_101e_unsol_event(struct hda_codec *codec, |
| 15709 | unsigned int res) |
| 15710 | { |
| 15711 | if ((res >> 26) == ALC880_HP_EVENT) |
| 15712 | alc662_lenovo_101e_all_automute(codec); |
| 15713 | if ((res >> 26) == ALC880_FRONT_EVENT) |
| 15714 | alc662_lenovo_101e_ispeaker_automute(codec); |
| 15715 | } |
| 15716 | |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 15717 | static void alc662_eeepc_mic_automute(struct hda_codec *codec) |
| 15718 | { |
| 15719 | unsigned int present; |
| 15720 | |
| 15721 | present = snd_hda_codec_read(codec, 0x18, 0, |
| 15722 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 15723 | snd_hda_codec_write(codec, 0x22, 0, AC_VERB_SET_AMP_GAIN_MUTE, |
| 15724 | 0x7000 | (0x00 << 8) | (present ? 0 : 0x80)); |
| 15725 | snd_hda_codec_write(codec, 0x23, 0, AC_VERB_SET_AMP_GAIN_MUTE, |
| 15726 | 0x7000 | (0x00 << 8) | (present ? 0 : 0x80)); |
| 15727 | snd_hda_codec_write(codec, 0x22, 0, AC_VERB_SET_AMP_GAIN_MUTE, |
| 15728 | 0x7000 | (0x01 << 8) | (present ? 0x80 : 0)); |
| 15729 | snd_hda_codec_write(codec, 0x23, 0, AC_VERB_SET_AMP_GAIN_MUTE, |
| 15730 | 0x7000 | (0x01 << 8) | (present ? 0x80 : 0)); |
| 15731 | } |
| 15732 | |
| 15733 | /* unsolicited event for HP jack sensing */ |
| 15734 | static void alc662_eeepc_unsol_event(struct hda_codec *codec, |
| 15735 | unsigned int res) |
| 15736 | { |
| 15737 | if ((res >> 26) == ALC880_HP_EVENT) |
| 15738 | alc262_hippo1_automute( codec ); |
| 15739 | |
| 15740 | if ((res >> 26) == ALC880_MIC_EVENT) |
| 15741 | alc662_eeepc_mic_automute(codec); |
| 15742 | } |
| 15743 | |
| 15744 | static void alc662_eeepc_inithook(struct hda_codec *codec) |
| 15745 | { |
| 15746 | alc262_hippo1_automute( codec ); |
| 15747 | alc662_eeepc_mic_automute(codec); |
| 15748 | } |
| 15749 | |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 15750 | static void alc662_eeepc_ep20_automute(struct hda_codec *codec) |
| 15751 | { |
| 15752 | unsigned int mute; |
| 15753 | unsigned int present; |
| 15754 | |
| 15755 | snd_hda_codec_read(codec, 0x14, 0, AC_VERB_SET_PIN_SENSE, 0); |
| 15756 | present = snd_hda_codec_read(codec, 0x14, 0, |
| 15757 | AC_VERB_GET_PIN_SENSE, 0); |
| 15758 | present = (present & 0x80000000) != 0; |
| 15759 | if (present) { |
| 15760 | /* mute internal speaker */ |
| 15761 | snd_hda_codec_amp_stereo(codec, 0x1b, HDA_OUTPUT, 0, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 15762 | HDA_AMP_MUTE, HDA_AMP_MUTE); |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 15763 | } else { |
| 15764 | /* unmute internal speaker if necessary */ |
| 15765 | mute = snd_hda_codec_amp_read(codec, 0x14, 0, HDA_OUTPUT, 0); |
| 15766 | snd_hda_codec_amp_stereo(codec, 0x1b, HDA_OUTPUT, 0, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 15767 | HDA_AMP_MUTE, mute); |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 15768 | } |
| 15769 | } |
| 15770 | |
| 15771 | /* unsolicited event for HP jack sensing */ |
| 15772 | static void alc662_eeepc_ep20_unsol_event(struct hda_codec *codec, |
| 15773 | unsigned int res) |
| 15774 | { |
| 15775 | if ((res >> 26) == ALC880_HP_EVENT) |
| 15776 | alc662_eeepc_ep20_automute(codec); |
| 15777 | } |
| 15778 | |
| 15779 | static void alc662_eeepc_ep20_inithook(struct hda_codec *codec) |
| 15780 | { |
| 15781 | alc662_eeepc_ep20_automute(codec); |
| 15782 | } |
| 15783 | |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 15784 | static void alc663_m51va_speaker_automute(struct hda_codec *codec) |
| 15785 | { |
| 15786 | unsigned int present; |
| 15787 | unsigned char bits; |
| 15788 | |
| 15789 | present = snd_hda_codec_read(codec, 0x21, 0, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 15790 | AC_VERB_GET_PIN_SENSE, 0) |
| 15791 | & AC_PINSENSE_PRESENCE; |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 15792 | bits = present ? HDA_AMP_MUTE : 0; |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 15793 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0, |
| 15794 | AMP_IN_MUTE(0), bits); |
| 15795 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1, |
| 15796 | AMP_IN_MUTE(0), bits); |
| 15797 | } |
| 15798 | |
| 15799 | static void alc663_21jd_two_speaker_automute(struct hda_codec *codec) |
| 15800 | { |
| 15801 | unsigned int present; |
| 15802 | unsigned char bits; |
| 15803 | |
| 15804 | present = snd_hda_codec_read(codec, 0x21, 0, |
| 15805 | AC_VERB_GET_PIN_SENSE, 0) |
| 15806 | & AC_PINSENSE_PRESENCE; |
| 15807 | bits = present ? HDA_AMP_MUTE : 0; |
| 15808 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0, |
| 15809 | AMP_IN_MUTE(0), bits); |
| 15810 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1, |
| 15811 | AMP_IN_MUTE(0), bits); |
| 15812 | snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 0, |
| 15813 | AMP_IN_MUTE(0), bits); |
| 15814 | snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 1, |
| 15815 | AMP_IN_MUTE(0), bits); |
| 15816 | } |
| 15817 | |
| 15818 | static void alc663_15jd_two_speaker_automute(struct hda_codec *codec) |
| 15819 | { |
| 15820 | unsigned int present; |
| 15821 | unsigned char bits; |
| 15822 | |
| 15823 | present = snd_hda_codec_read(codec, 0x15, 0, |
| 15824 | AC_VERB_GET_PIN_SENSE, 0) |
| 15825 | & AC_PINSENSE_PRESENCE; |
| 15826 | bits = present ? HDA_AMP_MUTE : 0; |
| 15827 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0, |
| 15828 | AMP_IN_MUTE(0), bits); |
| 15829 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1, |
| 15830 | AMP_IN_MUTE(0), bits); |
| 15831 | snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 0, |
| 15832 | AMP_IN_MUTE(0), bits); |
| 15833 | snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 1, |
| 15834 | AMP_IN_MUTE(0), bits); |
| 15835 | } |
| 15836 | |
| 15837 | static void alc662_f5z_speaker_automute(struct hda_codec *codec) |
| 15838 | { |
| 15839 | unsigned int present; |
| 15840 | unsigned char bits; |
| 15841 | |
| 15842 | present = snd_hda_codec_read(codec, 0x1b, 0, |
| 15843 | AC_VERB_GET_PIN_SENSE, 0) |
| 15844 | & AC_PINSENSE_PRESENCE; |
| 15845 | bits = present ? 0 : PIN_OUT; |
| 15846 | snd_hda_codec_write(codec, 0x14, 0, |
| 15847 | AC_VERB_SET_PIN_WIDGET_CONTROL, bits); |
| 15848 | } |
| 15849 | |
| 15850 | static void alc663_two_hp_m1_speaker_automute(struct hda_codec *codec) |
| 15851 | { |
| 15852 | unsigned int present1, present2; |
| 15853 | |
| 15854 | present1 = snd_hda_codec_read(codec, 0x21, 0, |
| 15855 | AC_VERB_GET_PIN_SENSE, 0) |
| 15856 | & AC_PINSENSE_PRESENCE; |
| 15857 | present2 = snd_hda_codec_read(codec, 0x15, 0, |
| 15858 | AC_VERB_GET_PIN_SENSE, 0) |
| 15859 | & AC_PINSENSE_PRESENCE; |
| 15860 | |
| 15861 | if (present1 || present2) { |
| 15862 | snd_hda_codec_write_cache(codec, 0x14, 0, |
| 15863 | AC_VERB_SET_PIN_WIDGET_CONTROL, 0); |
| 15864 | } else { |
| 15865 | snd_hda_codec_write_cache(codec, 0x14, 0, |
| 15866 | AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT); |
| 15867 | } |
| 15868 | } |
| 15869 | |
| 15870 | static void alc663_two_hp_m2_speaker_automute(struct hda_codec *codec) |
| 15871 | { |
| 15872 | unsigned int present1, present2; |
| 15873 | |
| 15874 | present1 = snd_hda_codec_read(codec, 0x1b, 0, |
| 15875 | AC_VERB_GET_PIN_SENSE, 0) |
| 15876 | & AC_PINSENSE_PRESENCE; |
| 15877 | present2 = snd_hda_codec_read(codec, 0x15, 0, |
| 15878 | AC_VERB_GET_PIN_SENSE, 0) |
| 15879 | & AC_PINSENSE_PRESENCE; |
| 15880 | |
| 15881 | if (present1 || present2) { |
| 15882 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0, |
| 15883 | AMP_IN_MUTE(0), AMP_IN_MUTE(0)); |
| 15884 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1, |
| 15885 | AMP_IN_MUTE(0), AMP_IN_MUTE(0)); |
| 15886 | } else { |
| 15887 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0, |
| 15888 | AMP_IN_MUTE(0), 0); |
| 15889 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1, |
| 15890 | AMP_IN_MUTE(0), 0); |
| 15891 | } |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 15892 | } |
| 15893 | |
| 15894 | static void alc663_m51va_mic_automute(struct hda_codec *codec) |
| 15895 | { |
| 15896 | unsigned int present; |
| 15897 | |
| 15898 | present = snd_hda_codec_read(codec, 0x18, 0, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 15899 | AC_VERB_GET_PIN_SENSE, 0) |
| 15900 | & AC_PINSENSE_PRESENCE; |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 15901 | 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] | 15902 | 0x7000 | (0x00 << 8) | (present ? 0 : 0x80)); |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 15903 | 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] | 15904 | 0x7000 | (0x00 << 8) | (present ? 0 : 0x80)); |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 15905 | 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] | 15906 | 0x7000 | (0x09 << 8) | (present ? 0x80 : 0)); |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 15907 | 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] | 15908 | 0x7000 | (0x09 << 8) | (present ? 0x80 : 0)); |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 15909 | } |
| 15910 | |
| 15911 | static void alc663_m51va_unsol_event(struct hda_codec *codec, |
| 15912 | unsigned int res) |
| 15913 | { |
| 15914 | switch (res >> 26) { |
| 15915 | case ALC880_HP_EVENT: |
| 15916 | alc663_m51va_speaker_automute(codec); |
| 15917 | break; |
| 15918 | case ALC880_MIC_EVENT: |
| 15919 | alc663_m51va_mic_automute(codec); |
| 15920 | break; |
| 15921 | } |
| 15922 | } |
| 15923 | |
| 15924 | static void alc663_m51va_inithook(struct hda_codec *codec) |
| 15925 | { |
| 15926 | alc663_m51va_speaker_automute(codec); |
| 15927 | alc663_m51va_mic_automute(codec); |
| 15928 | } |
| 15929 | |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 15930 | /* ***************** Mode1 ******************************/ |
| 15931 | static void alc663_mode1_unsol_event(struct hda_codec *codec, |
| 15932 | unsigned int res) |
| 15933 | { |
| 15934 | switch (res >> 26) { |
| 15935 | case ALC880_HP_EVENT: |
| 15936 | alc663_m51va_speaker_automute(codec); |
| 15937 | break; |
| 15938 | case ALC880_MIC_EVENT: |
| 15939 | alc662_eeepc_mic_automute(codec); |
| 15940 | break; |
| 15941 | } |
| 15942 | } |
| 15943 | |
| 15944 | static void alc663_mode1_inithook(struct hda_codec *codec) |
| 15945 | { |
| 15946 | alc663_m51va_speaker_automute(codec); |
| 15947 | alc662_eeepc_mic_automute(codec); |
| 15948 | } |
| 15949 | /* ***************** Mode2 ******************************/ |
| 15950 | static void alc662_mode2_unsol_event(struct hda_codec *codec, |
| 15951 | unsigned int res) |
| 15952 | { |
| 15953 | switch (res >> 26) { |
| 15954 | case ALC880_HP_EVENT: |
| 15955 | alc662_f5z_speaker_automute(codec); |
| 15956 | break; |
| 15957 | case ALC880_MIC_EVENT: |
| 15958 | alc662_eeepc_mic_automute(codec); |
| 15959 | break; |
| 15960 | } |
| 15961 | } |
| 15962 | |
| 15963 | static void alc662_mode2_inithook(struct hda_codec *codec) |
| 15964 | { |
| 15965 | alc662_f5z_speaker_automute(codec); |
| 15966 | alc662_eeepc_mic_automute(codec); |
| 15967 | } |
| 15968 | /* ***************** Mode3 ******************************/ |
| 15969 | static void alc663_mode3_unsol_event(struct hda_codec *codec, |
| 15970 | unsigned int res) |
| 15971 | { |
| 15972 | switch (res >> 26) { |
| 15973 | case ALC880_HP_EVENT: |
| 15974 | alc663_two_hp_m1_speaker_automute(codec); |
| 15975 | break; |
| 15976 | case ALC880_MIC_EVENT: |
| 15977 | alc662_eeepc_mic_automute(codec); |
| 15978 | break; |
| 15979 | } |
| 15980 | } |
| 15981 | |
| 15982 | static void alc663_mode3_inithook(struct hda_codec *codec) |
| 15983 | { |
| 15984 | alc663_two_hp_m1_speaker_automute(codec); |
| 15985 | alc662_eeepc_mic_automute(codec); |
| 15986 | } |
| 15987 | /* ***************** Mode4 ******************************/ |
| 15988 | static void alc663_mode4_unsol_event(struct hda_codec *codec, |
| 15989 | unsigned int res) |
| 15990 | { |
| 15991 | switch (res >> 26) { |
| 15992 | case ALC880_HP_EVENT: |
| 15993 | alc663_21jd_two_speaker_automute(codec); |
| 15994 | break; |
| 15995 | case ALC880_MIC_EVENT: |
| 15996 | alc662_eeepc_mic_automute(codec); |
| 15997 | break; |
| 15998 | } |
| 15999 | } |
| 16000 | |
| 16001 | static void alc663_mode4_inithook(struct hda_codec *codec) |
| 16002 | { |
| 16003 | alc663_21jd_two_speaker_automute(codec); |
| 16004 | alc662_eeepc_mic_automute(codec); |
| 16005 | } |
| 16006 | /* ***************** Mode5 ******************************/ |
| 16007 | static void alc663_mode5_unsol_event(struct hda_codec *codec, |
| 16008 | unsigned int res) |
| 16009 | { |
| 16010 | switch (res >> 26) { |
| 16011 | case ALC880_HP_EVENT: |
| 16012 | alc663_15jd_two_speaker_automute(codec); |
| 16013 | break; |
| 16014 | case ALC880_MIC_EVENT: |
| 16015 | alc662_eeepc_mic_automute(codec); |
| 16016 | break; |
| 16017 | } |
| 16018 | } |
| 16019 | |
| 16020 | static void alc663_mode5_inithook(struct hda_codec *codec) |
| 16021 | { |
| 16022 | alc663_15jd_two_speaker_automute(codec); |
| 16023 | alc662_eeepc_mic_automute(codec); |
| 16024 | } |
| 16025 | /* ***************** Mode6 ******************************/ |
| 16026 | static void alc663_mode6_unsol_event(struct hda_codec *codec, |
| 16027 | unsigned int res) |
| 16028 | { |
| 16029 | switch (res >> 26) { |
| 16030 | case ALC880_HP_EVENT: |
| 16031 | alc663_two_hp_m2_speaker_automute(codec); |
| 16032 | break; |
| 16033 | case ALC880_MIC_EVENT: |
| 16034 | alc662_eeepc_mic_automute(codec); |
| 16035 | break; |
| 16036 | } |
| 16037 | } |
| 16038 | |
| 16039 | static void alc663_mode6_inithook(struct hda_codec *codec) |
| 16040 | { |
| 16041 | alc663_two_hp_m2_speaker_automute(codec); |
| 16042 | alc662_eeepc_mic_automute(codec); |
| 16043 | } |
| 16044 | |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 16045 | static void alc663_g71v_hp_automute(struct hda_codec *codec) |
| 16046 | { |
| 16047 | unsigned int present; |
| 16048 | unsigned char bits; |
| 16049 | |
| 16050 | present = snd_hda_codec_read(codec, 0x21, 0, |
| 16051 | AC_VERB_GET_PIN_SENSE, 0) |
| 16052 | & AC_PINSENSE_PRESENCE; |
| 16053 | bits = present ? HDA_AMP_MUTE : 0; |
| 16054 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 16055 | HDA_AMP_MUTE, bits); |
| 16056 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 16057 | HDA_AMP_MUTE, bits); |
| 16058 | } |
| 16059 | |
| 16060 | static void alc663_g71v_front_automute(struct hda_codec *codec) |
| 16061 | { |
| 16062 | unsigned int present; |
| 16063 | unsigned char bits; |
| 16064 | |
| 16065 | present = snd_hda_codec_read(codec, 0x15, 0, |
| 16066 | AC_VERB_GET_PIN_SENSE, 0) |
| 16067 | & AC_PINSENSE_PRESENCE; |
| 16068 | bits = present ? HDA_AMP_MUTE : 0; |
| 16069 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 16070 | HDA_AMP_MUTE, bits); |
| 16071 | } |
| 16072 | |
| 16073 | static void alc663_g71v_unsol_event(struct hda_codec *codec, |
| 16074 | unsigned int res) |
| 16075 | { |
| 16076 | switch (res >> 26) { |
| 16077 | case ALC880_HP_EVENT: |
| 16078 | alc663_g71v_hp_automute(codec); |
| 16079 | break; |
| 16080 | case ALC880_FRONT_EVENT: |
| 16081 | alc663_g71v_front_automute(codec); |
| 16082 | break; |
| 16083 | case ALC880_MIC_EVENT: |
| 16084 | alc662_eeepc_mic_automute(codec); |
| 16085 | break; |
| 16086 | } |
| 16087 | } |
| 16088 | |
| 16089 | static void alc663_g71v_inithook(struct hda_codec *codec) |
| 16090 | { |
| 16091 | alc663_g71v_front_automute(codec); |
| 16092 | alc663_g71v_hp_automute(codec); |
| 16093 | alc662_eeepc_mic_automute(codec); |
| 16094 | } |
| 16095 | |
| 16096 | static void alc663_g50v_unsol_event(struct hda_codec *codec, |
| 16097 | unsigned int res) |
| 16098 | { |
| 16099 | switch (res >> 26) { |
| 16100 | case ALC880_HP_EVENT: |
| 16101 | alc663_m51va_speaker_automute(codec); |
| 16102 | break; |
| 16103 | case ALC880_MIC_EVENT: |
| 16104 | alc662_eeepc_mic_automute(codec); |
| 16105 | break; |
| 16106 | } |
| 16107 | } |
| 16108 | |
| 16109 | static void alc663_g50v_inithook(struct hda_codec *codec) |
| 16110 | { |
| 16111 | alc663_m51va_speaker_automute(codec); |
| 16112 | alc662_eeepc_mic_automute(codec); |
| 16113 | } |
| 16114 | |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 16115 | /* bind hp and internal speaker mute (with plug check) */ |
| 16116 | static int alc662_ecs_master_sw_put(struct snd_kcontrol *kcontrol, |
| 16117 | struct snd_ctl_elem_value *ucontrol) |
| 16118 | { |
| 16119 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 16120 | long *valp = ucontrol->value.integer.value; |
| 16121 | int change; |
| 16122 | |
| 16123 | change = snd_hda_codec_amp_update(codec, 0x1b, 0, HDA_OUTPUT, 0, |
| 16124 | HDA_AMP_MUTE, |
| 16125 | valp[0] ? 0 : HDA_AMP_MUTE); |
| 16126 | change |= snd_hda_codec_amp_update(codec, 0x1b, 1, HDA_OUTPUT, 0, |
| 16127 | HDA_AMP_MUTE, |
| 16128 | valp[1] ? 0 : HDA_AMP_MUTE); |
| 16129 | if (change) |
| 16130 | alc262_hippo1_automute(codec); |
| 16131 | return change; |
| 16132 | } |
| 16133 | |
| 16134 | static struct snd_kcontrol_new alc662_ecs_mixer[] = { |
| 16135 | HDA_CODEC_VOLUME("Master Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 16136 | { |
| 16137 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 16138 | .name = "Master Playback Switch", |
| 16139 | .info = snd_hda_mixer_amp_switch_info, |
| 16140 | .get = snd_hda_mixer_amp_switch_get, |
| 16141 | .put = alc662_ecs_master_sw_put, |
| 16142 | .private_value = HDA_COMPOSE_AMP_VAL(0x1b, 3, 0, HDA_OUTPUT), |
| 16143 | }, |
| 16144 | |
| 16145 | HDA_CODEC_VOLUME("e-Mic/LineIn Boost", 0x18, 0, HDA_INPUT), |
| 16146 | HDA_CODEC_VOLUME("e-Mic/LineIn Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 16147 | HDA_CODEC_MUTE("e-Mic/LineIn Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 16148 | |
| 16149 | HDA_CODEC_VOLUME("i-Mic Boost", 0x19, 0, HDA_INPUT), |
| 16150 | HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 16151 | HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 16152 | { } /* end */ |
| 16153 | }; |
| 16154 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 16155 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 16156 | #define alc662_loopbacks alc880_loopbacks |
| 16157 | #endif |
| 16158 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16159 | |
| 16160 | /* pcm configuration: identiacal with ALC880 */ |
| 16161 | #define alc662_pcm_analog_playback alc880_pcm_analog_playback |
| 16162 | #define alc662_pcm_analog_capture alc880_pcm_analog_capture |
| 16163 | #define alc662_pcm_digital_playback alc880_pcm_digital_playback |
| 16164 | #define alc662_pcm_digital_capture alc880_pcm_digital_capture |
| 16165 | |
| 16166 | /* |
| 16167 | * configuration and preset |
| 16168 | */ |
| 16169 | static const char *alc662_models[ALC662_MODEL_LAST] = { |
| 16170 | [ALC662_3ST_2ch_DIG] = "3stack-dig", |
| 16171 | [ALC662_3ST_6ch_DIG] = "3stack-6ch-dig", |
| 16172 | [ALC662_3ST_6ch] = "3stack-6ch", |
| 16173 | [ALC662_5ST_DIG] = "6stack-dig", |
| 16174 | [ALC662_LENOVO_101E] = "lenovo-101e", |
Takashi Iwai | b995d76 | 2007-10-17 10:41:06 +0200 | [diff] [blame] | 16175 | [ALC662_ASUS_EEEPC_P701] = "eeepc-p701", |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 16176 | [ALC662_ASUS_EEEPC_EP20] = "eeepc-ep20", |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 16177 | [ALC662_ECS] = "ecs", |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 16178 | [ALC663_ASUS_M51VA] = "m51va", |
| 16179 | [ALC663_ASUS_G71V] = "g71v", |
| 16180 | [ALC663_ASUS_H13] = "h13", |
| 16181 | [ALC663_ASUS_G50V] = "g50v", |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 16182 | [ALC663_ASUS_MODE1] = "asus-mode1", |
| 16183 | [ALC662_ASUS_MODE2] = "asus-mode2", |
| 16184 | [ALC663_ASUS_MODE3] = "asus-mode3", |
| 16185 | [ALC663_ASUS_MODE4] = "asus-mode4", |
| 16186 | [ALC663_ASUS_MODE5] = "asus-mode5", |
| 16187 | [ALC663_ASUS_MODE6] = "asus-mode6", |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16188 | [ALC662_AUTO] = "auto", |
| 16189 | }; |
| 16190 | |
| 16191 | static struct snd_pci_quirk alc662_cfg_tbl[] = { |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 16192 | SND_PCI_QUIRK(0x1019, 0x9087, "ECS", ALC662_ECS), |
| 16193 | SND_PCI_QUIRK(0x1043, 0x1000, "ASUS N50Vm", ALC663_ASUS_MODE1), |
| 16194 | SND_PCI_QUIRK(0x1043, 0x1092, "ASUS NB", ALC663_ASUS_MODE3), |
| 16195 | SND_PCI_QUIRK(0x1043, 0x11c3, "ASUS M70V", ALC663_ASUS_MODE3), |
| 16196 | SND_PCI_QUIRK(0x1043, 0x11d3, "ASUS NB", ALC663_ASUS_MODE1), |
| 16197 | SND_PCI_QUIRK(0x1043, 0x11f3, "ASUS NB", ALC662_ASUS_MODE2), |
| 16198 | SND_PCI_QUIRK(0x1043, 0x1203, "ASUS NB", ALC663_ASUS_MODE1), |
| 16199 | SND_PCI_QUIRK(0x1043, 0x1339, "ASUS NB", ALC662_ASUS_MODE2), |
| 16200 | SND_PCI_QUIRK(0x1043, 0x16c3, "ASUS NB", ALC662_ASUS_MODE2), |
| 16201 | SND_PCI_QUIRK(0x1043, 0x1753, "ASUS NB", ALC662_ASUS_MODE2), |
| 16202 | SND_PCI_QUIRK(0x1043, 0x1763, "ASUS NB", ALC663_ASUS_MODE6), |
| 16203 | SND_PCI_QUIRK(0x1043, 0x1765, "ASUS NB", ALC663_ASUS_MODE6), |
| 16204 | SND_PCI_QUIRK(0x1043, 0x1783, "ASUS NB", ALC662_ASUS_MODE2), |
| 16205 | SND_PCI_QUIRK(0x1043, 0x1813, "ASUS NB", ALC662_ASUS_MODE2), |
| 16206 | SND_PCI_QUIRK(0x1043, 0x1823, "ASUS NB", ALC663_ASUS_MODE5), |
| 16207 | SND_PCI_QUIRK(0x1043, 0x1833, "ASUS NB", ALC663_ASUS_MODE6), |
| 16208 | SND_PCI_QUIRK(0x1043, 0x1843, "ASUS NB", ALC662_ASUS_MODE2), |
| 16209 | SND_PCI_QUIRK(0x1043, 0x1864, "ASUS NB", ALC662_ASUS_MODE2), |
| 16210 | SND_PCI_QUIRK(0x1043, 0x1876, "ASUS NB", ALC662_ASUS_MODE2), |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 16211 | SND_PCI_QUIRK(0x1043, 0x1878, "ASUS M51VA", ALC663_ASUS_M51VA), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 16212 | /*SND_PCI_QUIRK(0x1043, 0x1878, "ASUS M50Vr", ALC663_ASUS_MODE1),*/ |
| 16213 | SND_PCI_QUIRK(0x1043, 0x1893, "ASUS M50Vm", ALC663_ASUS_MODE3), |
| 16214 | SND_PCI_QUIRK(0x1043, 0x1894, "ASUS X55", ALC663_ASUS_MODE3), |
| 16215 | SND_PCI_QUIRK(0x1043, 0x1903, "ASUS F5GL", ALC663_ASUS_MODE1), |
| 16216 | SND_PCI_QUIRK(0x1043, 0x1913, "ASUS NB", ALC662_ASUS_MODE2), |
| 16217 | SND_PCI_QUIRK(0x1043, 0x1933, "ASUS F80Q", ALC662_ASUS_MODE2), |
| 16218 | SND_PCI_QUIRK(0x1043, 0x1953, "ASUS NB", ALC663_ASUS_MODE1), |
| 16219 | SND_PCI_QUIRK(0x1043, 0x1963, "ASUS X71C", ALC663_ASUS_MODE3), |
| 16220 | SND_PCI_QUIRK(0x1043, 0x1993, "ASUS N20", ALC663_ASUS_MODE1), |
Kailang Yang | 80ffe86 | 2008-10-15 11:23:27 +0200 | [diff] [blame] | 16221 | SND_PCI_QUIRK(0x1043, 0x19a3, "ASUS G50V", ALC663_ASUS_G50V), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 16222 | /*SND_PCI_QUIRK(0x1043, 0x19a3, "ASUS NB", ALC663_ASUS_MODE1),*/ |
| 16223 | SND_PCI_QUIRK(0x1043, 0x19b3, "ASUS F7Z", ALC663_ASUS_MODE1), |
| 16224 | SND_PCI_QUIRK(0x1043, 0x19c3, "ASUS F5Z/F6x", ALC662_ASUS_MODE2), |
| 16225 | SND_PCI_QUIRK(0x1043, 0x19e3, "ASUS NB", ALC663_ASUS_MODE1), |
| 16226 | SND_PCI_QUIRK(0x1043, 0x19f3, "ASUS NB", ALC663_ASUS_MODE4), |
Herton Ronaldo Krzesinski | 3da23ca | 2008-03-14 12:52:59 +0100 | [diff] [blame] | 16227 | SND_PCI_QUIRK(0x1043, 0x8290, "ASUS P5GC-MX", ALC662_3ST_6ch_DIG), |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 16228 | SND_PCI_QUIRK(0x1043, 0x82a1, "ASUS Eeepc", ALC662_ASUS_EEEPC_P701), |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 16229 | SND_PCI_QUIRK(0x1043, 0x82d1, "ASUS Eeepc EP20", ALC662_ASUS_EEEPC_EP20), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 16230 | SND_PCI_QUIRK(0x105b, 0x0cd6, "Foxconn", ALC662_ECS), |
Herton Ronaldo Krzesinski | 95fe5f2 | 2008-09-26 23:48:45 -0300 | [diff] [blame] | 16231 | SND_PCI_QUIRK(0x105b, 0x0d47, "Foxconn 45CMX/45GMX/45CMX-K", |
| 16232 | ALC662_3ST_6ch_DIG), |
Herton Ronaldo Krzesinski | cb55974 | 2008-09-26 23:47:45 -0300 | [diff] [blame] | 16233 | SND_PCI_QUIRK(0x1458, 0xa002, "Gigabyte 945GCM-S2L", |
| 16234 | ALC662_3ST_6ch_DIG), |
Vedran Miletic | 19c009a | 2008-09-29 20:29:25 +0200 | [diff] [blame] | 16235 | SND_PCI_QUIRK(0x1565, 0x820f, "Biostar TA780G M2+", ALC662_3ST_6ch_DIG), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 16236 | SND_PCI_QUIRK(0x17aa, 0x101e, "Lenovo", ALC662_LENOVO_101E), |
Takashi Iwai | 238713d | 2008-10-05 10:57:39 +0200 | [diff] [blame] | 16237 | SND_PCI_QUIRK(0x1849, 0x3662, "ASROCK K10N78FullHD-hSLI R3.0", |
Vedran Miletic | 19c009a | 2008-09-29 20:29:25 +0200 | [diff] [blame] | 16238 | ALC662_3ST_6ch_DIG), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 16239 | SND_PCI_QUIRK_MASK(0x1854, 0xf000, 0x2000, "ASUS H13-200x", |
| 16240 | ALC663_ASUS_H13), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16241 | {} |
| 16242 | }; |
| 16243 | |
| 16244 | static struct alc_config_preset alc662_presets[] = { |
| 16245 | [ALC662_3ST_2ch_DIG] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 16246 | .mixers = { alc662_3ST_2ch_mixer }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16247 | .init_verbs = { alc662_init_verbs }, |
| 16248 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 16249 | .dac_nids = alc662_dac_nids, |
| 16250 | .dig_out_nid = ALC662_DIGOUT_NID, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16251 | .dig_in_nid = ALC662_DIGIN_NID, |
| 16252 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 16253 | .channel_mode = alc662_3ST_2ch_modes, |
| 16254 | .input_mux = &alc662_capture_source, |
| 16255 | }, |
| 16256 | [ALC662_3ST_6ch_DIG] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 16257 | .mixers = { alc662_3ST_6ch_mixer, alc662_chmode_mixer }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16258 | .init_verbs = { alc662_init_verbs }, |
| 16259 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 16260 | .dac_nids = alc662_dac_nids, |
| 16261 | .dig_out_nid = ALC662_DIGOUT_NID, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16262 | .dig_in_nid = ALC662_DIGIN_NID, |
| 16263 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes), |
| 16264 | .channel_mode = alc662_3ST_6ch_modes, |
| 16265 | .need_dac_fix = 1, |
| 16266 | .input_mux = &alc662_capture_source, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 16267 | }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16268 | [ALC662_3ST_6ch] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 16269 | .mixers = { alc662_3ST_6ch_mixer, alc662_chmode_mixer }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16270 | .init_verbs = { alc662_init_verbs }, |
| 16271 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 16272 | .dac_nids = alc662_dac_nids, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16273 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes), |
| 16274 | .channel_mode = alc662_3ST_6ch_modes, |
| 16275 | .need_dac_fix = 1, |
| 16276 | .input_mux = &alc662_capture_source, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 16277 | }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16278 | [ALC662_5ST_DIG] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 16279 | .mixers = { alc662_base_mixer, alc662_chmode_mixer }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16280 | .init_verbs = { alc662_init_verbs }, |
| 16281 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 16282 | .dac_nids = alc662_dac_nids, |
| 16283 | .dig_out_nid = ALC662_DIGOUT_NID, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16284 | .dig_in_nid = ALC662_DIGIN_NID, |
| 16285 | .num_channel_mode = ARRAY_SIZE(alc662_5stack_modes), |
| 16286 | .channel_mode = alc662_5stack_modes, |
| 16287 | .input_mux = &alc662_capture_source, |
| 16288 | }, |
| 16289 | [ALC662_LENOVO_101E] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 16290 | .mixers = { alc662_lenovo_101e_mixer }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16291 | .init_verbs = { alc662_init_verbs, alc662_sue_init_verbs }, |
| 16292 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 16293 | .dac_nids = alc662_dac_nids, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16294 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 16295 | .channel_mode = alc662_3ST_2ch_modes, |
| 16296 | .input_mux = &alc662_lenovo_101e_capture_source, |
| 16297 | .unsol_event = alc662_lenovo_101e_unsol_event, |
| 16298 | .init_hook = alc662_lenovo_101e_all_automute, |
| 16299 | }, |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 16300 | [ALC662_ASUS_EEEPC_P701] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 16301 | .mixers = { alc662_eeepc_p701_mixer }, |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 16302 | .init_verbs = { alc662_init_verbs, |
| 16303 | alc662_eeepc_sue_init_verbs }, |
| 16304 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 16305 | .dac_nids = alc662_dac_nids, |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 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 | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 16312 | [ALC662_ASUS_EEEPC_EP20] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 16313 | .mixers = { alc662_eeepc_ep20_mixer, |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 16314 | alc662_chmode_mixer }, |
| 16315 | .init_verbs = { alc662_init_verbs, |
| 16316 | alc662_eeepc_ep20_sue_init_verbs }, |
| 16317 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 16318 | .dac_nids = alc662_dac_nids, |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 16319 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes), |
| 16320 | .channel_mode = alc662_3ST_6ch_modes, |
| 16321 | .input_mux = &alc662_lenovo_101e_capture_source, |
| 16322 | .unsol_event = alc662_eeepc_ep20_unsol_event, |
| 16323 | .init_hook = alc662_eeepc_ep20_inithook, |
| 16324 | }, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 16325 | [ALC662_ECS] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 16326 | .mixers = { alc662_ecs_mixer }, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 16327 | .init_verbs = { alc662_init_verbs, |
| 16328 | alc662_ecs_init_verbs }, |
| 16329 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 16330 | .dac_nids = alc662_dac_nids, |
| 16331 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 16332 | .channel_mode = alc662_3ST_2ch_modes, |
| 16333 | .input_mux = &alc662_eeepc_capture_source, |
| 16334 | .unsol_event = alc662_eeepc_unsol_event, |
| 16335 | .init_hook = alc662_eeepc_inithook, |
| 16336 | }, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 16337 | [ALC663_ASUS_M51VA] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 16338 | .mixers = { alc663_m51va_mixer }, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 16339 | .init_verbs = { alc662_init_verbs, alc663_m51va_init_verbs }, |
| 16340 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 16341 | .dac_nids = alc662_dac_nids, |
| 16342 | .dig_out_nid = ALC662_DIGOUT_NID, |
| 16343 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 16344 | .channel_mode = alc662_3ST_2ch_modes, |
| 16345 | .input_mux = &alc663_m51va_capture_source, |
| 16346 | .unsol_event = alc663_m51va_unsol_event, |
| 16347 | .init_hook = alc663_m51va_inithook, |
| 16348 | }, |
| 16349 | [ALC663_ASUS_G71V] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 16350 | .mixers = { alc663_g71v_mixer }, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 16351 | .init_verbs = { alc662_init_verbs, alc663_g71v_init_verbs }, |
| 16352 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 16353 | .dac_nids = alc662_dac_nids, |
| 16354 | .dig_out_nid = ALC662_DIGOUT_NID, |
| 16355 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 16356 | .channel_mode = alc662_3ST_2ch_modes, |
| 16357 | .input_mux = &alc662_eeepc_capture_source, |
| 16358 | .unsol_event = alc663_g71v_unsol_event, |
| 16359 | .init_hook = alc663_g71v_inithook, |
| 16360 | }, |
| 16361 | [ALC663_ASUS_H13] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 16362 | .mixers = { alc663_m51va_mixer }, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 16363 | .init_verbs = { alc662_init_verbs, alc663_m51va_init_verbs }, |
| 16364 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 16365 | .dac_nids = alc662_dac_nids, |
| 16366 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 16367 | .channel_mode = alc662_3ST_2ch_modes, |
| 16368 | .input_mux = &alc663_m51va_capture_source, |
| 16369 | .unsol_event = alc663_m51va_unsol_event, |
| 16370 | .init_hook = alc663_m51va_inithook, |
| 16371 | }, |
| 16372 | [ALC663_ASUS_G50V] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 16373 | .mixers = { alc663_g50v_mixer }, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 16374 | .init_verbs = { alc662_init_verbs, alc663_g50v_init_verbs }, |
| 16375 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 16376 | .dac_nids = alc662_dac_nids, |
| 16377 | .dig_out_nid = ALC662_DIGOUT_NID, |
| 16378 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes), |
| 16379 | .channel_mode = alc662_3ST_6ch_modes, |
| 16380 | .input_mux = &alc663_capture_source, |
| 16381 | .unsol_event = alc663_g50v_unsol_event, |
| 16382 | .init_hook = alc663_g50v_inithook, |
| 16383 | }, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 16384 | [ALC663_ASUS_MODE1] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 16385 | .mixers = { alc663_m51va_mixer }, |
| 16386 | .cap_mixer = alc662_auto_capture_mixer, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 16387 | .init_verbs = { alc662_init_verbs, |
| 16388 | alc663_21jd_amic_init_verbs }, |
| 16389 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 16390 | .hp_nid = 0x03, |
| 16391 | .dac_nids = alc662_dac_nids, |
| 16392 | .dig_out_nid = ALC662_DIGOUT_NID, |
| 16393 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 16394 | .channel_mode = alc662_3ST_2ch_modes, |
| 16395 | .input_mux = &alc662_eeepc_capture_source, |
| 16396 | .unsol_event = alc663_mode1_unsol_event, |
| 16397 | .init_hook = alc663_mode1_inithook, |
| 16398 | }, |
| 16399 | [ALC662_ASUS_MODE2] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 16400 | .mixers = { alc662_1bjd_mixer }, |
| 16401 | .cap_mixer = alc662_auto_capture_mixer, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 16402 | .init_verbs = { alc662_init_verbs, |
| 16403 | alc662_1bjd_amic_init_verbs }, |
| 16404 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 16405 | .dac_nids = alc662_dac_nids, |
| 16406 | .dig_out_nid = ALC662_DIGOUT_NID, |
| 16407 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 16408 | .channel_mode = alc662_3ST_2ch_modes, |
| 16409 | .input_mux = &alc662_eeepc_capture_source, |
| 16410 | .unsol_event = alc662_mode2_unsol_event, |
| 16411 | .init_hook = alc662_mode2_inithook, |
| 16412 | }, |
| 16413 | [ALC663_ASUS_MODE3] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 16414 | .mixers = { alc663_two_hp_m1_mixer }, |
| 16415 | .cap_mixer = alc662_auto_capture_mixer, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 16416 | .init_verbs = { alc662_init_verbs, |
| 16417 | alc663_two_hp_amic_m1_init_verbs }, |
| 16418 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 16419 | .hp_nid = 0x03, |
| 16420 | .dac_nids = alc662_dac_nids, |
| 16421 | .dig_out_nid = ALC662_DIGOUT_NID, |
| 16422 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 16423 | .channel_mode = alc662_3ST_2ch_modes, |
| 16424 | .input_mux = &alc662_eeepc_capture_source, |
| 16425 | .unsol_event = alc663_mode3_unsol_event, |
| 16426 | .init_hook = alc663_mode3_inithook, |
| 16427 | }, |
| 16428 | [ALC663_ASUS_MODE4] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 16429 | .mixers = { alc663_asus_21jd_clfe_mixer }, |
| 16430 | .cap_mixer = alc662_auto_capture_mixer, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 16431 | .init_verbs = { alc662_init_verbs, |
| 16432 | alc663_21jd_amic_init_verbs}, |
| 16433 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 16434 | .hp_nid = 0x03, |
| 16435 | .dac_nids = alc662_dac_nids, |
| 16436 | .dig_out_nid = ALC662_DIGOUT_NID, |
| 16437 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 16438 | .channel_mode = alc662_3ST_2ch_modes, |
| 16439 | .input_mux = &alc662_eeepc_capture_source, |
| 16440 | .unsol_event = alc663_mode4_unsol_event, |
| 16441 | .init_hook = alc663_mode4_inithook, |
| 16442 | }, |
| 16443 | [ALC663_ASUS_MODE5] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 16444 | .mixers = { alc663_asus_15jd_clfe_mixer }, |
| 16445 | .cap_mixer = alc662_auto_capture_mixer, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 16446 | .init_verbs = { alc662_init_verbs, |
| 16447 | alc663_15jd_amic_init_verbs }, |
| 16448 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 16449 | .hp_nid = 0x03, |
| 16450 | .dac_nids = alc662_dac_nids, |
| 16451 | .dig_out_nid = ALC662_DIGOUT_NID, |
| 16452 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 16453 | .channel_mode = alc662_3ST_2ch_modes, |
| 16454 | .input_mux = &alc662_eeepc_capture_source, |
| 16455 | .unsol_event = alc663_mode5_unsol_event, |
| 16456 | .init_hook = alc663_mode5_inithook, |
| 16457 | }, |
| 16458 | [ALC663_ASUS_MODE6] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 16459 | .mixers = { alc663_two_hp_m2_mixer }, |
| 16460 | .cap_mixer = alc662_auto_capture_mixer, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 16461 | .init_verbs = { alc662_init_verbs, |
| 16462 | alc663_two_hp_amic_m2_init_verbs }, |
| 16463 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 16464 | .hp_nid = 0x03, |
| 16465 | .dac_nids = alc662_dac_nids, |
| 16466 | .dig_out_nid = ALC662_DIGOUT_NID, |
| 16467 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 16468 | .channel_mode = alc662_3ST_2ch_modes, |
| 16469 | .input_mux = &alc662_eeepc_capture_source, |
| 16470 | .unsol_event = alc663_mode6_unsol_event, |
| 16471 | .init_hook = alc663_mode6_inithook, |
| 16472 | }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16473 | }; |
| 16474 | |
| 16475 | |
| 16476 | /* |
| 16477 | * BIOS auto configuration |
| 16478 | */ |
| 16479 | |
| 16480 | /* add playback controls from the parsed DAC table */ |
| 16481 | static int alc662_auto_create_multi_out_ctls(struct alc_spec *spec, |
| 16482 | const struct auto_pin_cfg *cfg) |
| 16483 | { |
| 16484 | char name[32]; |
| 16485 | static const char *chname[4] = { |
| 16486 | "Front", "Surround", NULL /*CLFE*/, "Side" |
| 16487 | }; |
| 16488 | hda_nid_t nid; |
| 16489 | int i, err; |
| 16490 | |
| 16491 | for (i = 0; i < cfg->line_outs; i++) { |
| 16492 | if (!spec->multiout.dac_nids[i]) |
| 16493 | continue; |
Kailang Yang | b60dd39 | 2007-09-20 12:50:29 +0200 | [diff] [blame] | 16494 | nid = alc880_idx_to_dac(i); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16495 | if (i == 2) { |
| 16496 | /* Center/LFE */ |
| 16497 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 16498 | "Center Playback Volume", |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 16499 | HDA_COMPOSE_AMP_VAL(nid, 1, 0, |
| 16500 | HDA_OUTPUT)); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16501 | if (err < 0) |
| 16502 | return err; |
| 16503 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 16504 | "LFE Playback Volume", |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 16505 | HDA_COMPOSE_AMP_VAL(nid, 2, 0, |
| 16506 | HDA_OUTPUT)); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16507 | if (err < 0) |
| 16508 | return err; |
Herton Ronaldo Krzesinski | b69ce01 | 2008-09-18 16:41:49 -0300 | [diff] [blame] | 16509 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16510 | "Center Playback Switch", |
Herton Ronaldo Krzesinski | b69ce01 | 2008-09-18 16:41:49 -0300 | [diff] [blame] | 16511 | HDA_COMPOSE_AMP_VAL(0x0e, 1, 0, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 16512 | HDA_INPUT)); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16513 | if (err < 0) |
| 16514 | return err; |
Herton Ronaldo Krzesinski | b69ce01 | 2008-09-18 16:41:49 -0300 | [diff] [blame] | 16515 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16516 | "LFE Playback Switch", |
Herton Ronaldo Krzesinski | b69ce01 | 2008-09-18 16:41:49 -0300 | [diff] [blame] | 16517 | HDA_COMPOSE_AMP_VAL(0x0e, 2, 0, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 16518 | HDA_INPUT)); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16519 | if (err < 0) |
| 16520 | return err; |
| 16521 | } else { |
| 16522 | sprintf(name, "%s Playback Volume", chname[i]); |
| 16523 | err = add_control(spec, ALC_CTL_WIDGET_VOL, name, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 16524 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, |
| 16525 | HDA_OUTPUT)); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16526 | if (err < 0) |
| 16527 | return err; |
| 16528 | sprintf(name, "%s Playback Switch", chname[i]); |
Herton Ronaldo Krzesinski | b69ce01 | 2008-09-18 16:41:49 -0300 | [diff] [blame] | 16529 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, name, |
| 16530 | HDA_COMPOSE_AMP_VAL(alc880_idx_to_mixer(i), |
| 16531 | 3, 0, HDA_INPUT)); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16532 | if (err < 0) |
| 16533 | return err; |
| 16534 | } |
| 16535 | } |
| 16536 | return 0; |
| 16537 | } |
| 16538 | |
| 16539 | /* add playback controls for speaker and HP outputs */ |
| 16540 | static int alc662_auto_create_extra_out(struct alc_spec *spec, hda_nid_t pin, |
| 16541 | const char *pfx) |
| 16542 | { |
| 16543 | hda_nid_t nid; |
| 16544 | int err; |
| 16545 | char name[32]; |
| 16546 | |
| 16547 | if (!pin) |
| 16548 | return 0; |
| 16549 | |
Takashi Iwai | 24fb917 | 2008-09-02 14:48:20 +0200 | [diff] [blame] | 16550 | if (pin == 0x17) { |
| 16551 | /* ALC663 has a mono output pin on 0x17 */ |
| 16552 | sprintf(name, "%s Playback Switch", pfx); |
| 16553 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, name, |
| 16554 | HDA_COMPOSE_AMP_VAL(pin, 2, 0, HDA_OUTPUT)); |
| 16555 | return err; |
| 16556 | } |
| 16557 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16558 | if (alc880_is_fixed_pin(pin)) { |
| 16559 | nid = alc880_idx_to_dac(alc880_fixed_pin_idx(pin)); |
Takashi Iwai | 939778a | 2009-02-05 15:57:55 +0100 | [diff] [blame] | 16560 | /* printk(KERN_DEBUG "DAC nid=%x\n",nid); */ |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16561 | /* specify the DAC as the extra output */ |
| 16562 | if (!spec->multiout.hp_nid) |
| 16563 | spec->multiout.hp_nid = nid; |
| 16564 | else |
| 16565 | spec->multiout.extra_out_nid[0] = nid; |
| 16566 | /* control HP volume/switch on the output mixer amp */ |
| 16567 | nid = alc880_idx_to_dac(alc880_fixed_pin_idx(pin)); |
| 16568 | sprintf(name, "%s Playback Volume", pfx); |
| 16569 | err = add_control(spec, ALC_CTL_WIDGET_VOL, name, |
| 16570 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT)); |
| 16571 | if (err < 0) |
| 16572 | return err; |
| 16573 | sprintf(name, "%s Playback Switch", pfx); |
| 16574 | err = add_control(spec, ALC_CTL_BIND_MUTE, name, |
| 16575 | HDA_COMPOSE_AMP_VAL(nid, 3, 2, HDA_INPUT)); |
| 16576 | if (err < 0) |
| 16577 | return err; |
| 16578 | } else if (alc880_is_multi_pin(pin)) { |
| 16579 | /* set manual connection */ |
| 16580 | /* we have only a switch on HP-out PIN */ |
| 16581 | sprintf(name, "%s Playback Switch", pfx); |
| 16582 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, name, |
| 16583 | HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT)); |
| 16584 | if (err < 0) |
| 16585 | return err; |
| 16586 | } |
| 16587 | return 0; |
| 16588 | } |
| 16589 | |
| 16590 | /* create playback/capture controls for input pins */ |
| 16591 | static int alc662_auto_create_analog_input_ctls(struct alc_spec *spec, |
| 16592 | const struct auto_pin_cfg *cfg) |
| 16593 | { |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 16594 | struct hda_input_mux *imux = &spec->private_imux[0]; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16595 | int i, err, idx; |
| 16596 | |
| 16597 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
| 16598 | if (alc880_is_input_pin(cfg->input_pins[i])) { |
| 16599 | idx = alc880_input_pin_idx(cfg->input_pins[i]); |
| 16600 | err = new_analog_input(spec, cfg->input_pins[i], |
| 16601 | auto_pin_cfg_labels[i], |
| 16602 | idx, 0x0b); |
| 16603 | if (err < 0) |
| 16604 | return err; |
| 16605 | imux->items[imux->num_items].label = |
| 16606 | auto_pin_cfg_labels[i]; |
| 16607 | imux->items[imux->num_items].index = |
| 16608 | alc880_input_pin_idx(cfg->input_pins[i]); |
| 16609 | imux->num_items++; |
| 16610 | } |
| 16611 | } |
| 16612 | return 0; |
| 16613 | } |
| 16614 | |
| 16615 | static void alc662_auto_set_output_and_unmute(struct hda_codec *codec, |
| 16616 | hda_nid_t nid, int pin_type, |
| 16617 | int dac_idx) |
| 16618 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 16619 | alc_set_pin_output(codec, nid, pin_type); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16620 | /* need the manual connection? */ |
| 16621 | if (alc880_is_multi_pin(nid)) { |
| 16622 | struct alc_spec *spec = codec->spec; |
| 16623 | int idx = alc880_multi_pin_idx(nid); |
| 16624 | snd_hda_codec_write(codec, alc880_idx_to_selector(idx), 0, |
| 16625 | AC_VERB_SET_CONNECT_SEL, |
| 16626 | alc880_dac_to_idx(spec->multiout.dac_nids[dac_idx])); |
| 16627 | } |
| 16628 | } |
| 16629 | |
| 16630 | static void alc662_auto_init_multi_out(struct hda_codec *codec) |
| 16631 | { |
| 16632 | struct alc_spec *spec = codec->spec; |
| 16633 | int i; |
| 16634 | |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 16635 | alc_subsystem_id(codec, 0x15, 0x1b, 0x14); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16636 | for (i = 0; i <= HDA_SIDE; i++) { |
| 16637 | hda_nid_t nid = spec->autocfg.line_out_pins[i]; |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 16638 | int pin_type = get_pin_type(spec->autocfg.line_out_type); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16639 | if (nid) |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 16640 | alc662_auto_set_output_and_unmute(codec, nid, pin_type, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16641 | i); |
| 16642 | } |
| 16643 | } |
| 16644 | |
| 16645 | static void alc662_auto_init_hp_out(struct hda_codec *codec) |
| 16646 | { |
| 16647 | struct alc_spec *spec = codec->spec; |
| 16648 | hda_nid_t pin; |
| 16649 | |
| 16650 | pin = spec->autocfg.hp_pins[0]; |
| 16651 | if (pin) /* connect to front */ |
| 16652 | /* use dac 0 */ |
| 16653 | alc662_auto_set_output_and_unmute(codec, pin, PIN_HP, 0); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 16654 | pin = spec->autocfg.speaker_pins[0]; |
| 16655 | if (pin) |
| 16656 | alc662_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16657 | } |
| 16658 | |
| 16659 | #define alc662_is_input_pin(nid) alc880_is_input_pin(nid) |
| 16660 | #define ALC662_PIN_CD_NID ALC880_PIN_CD_NID |
| 16661 | |
| 16662 | static void alc662_auto_init_analog_input(struct hda_codec *codec) |
| 16663 | { |
| 16664 | struct alc_spec *spec = codec->spec; |
| 16665 | int i; |
| 16666 | |
| 16667 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
| 16668 | hda_nid_t nid = spec->autocfg.input_pins[i]; |
| 16669 | if (alc662_is_input_pin(nid)) { |
| 16670 | snd_hda_codec_write(codec, nid, 0, |
| 16671 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 16672 | (i <= AUTO_PIN_FRONT_MIC ? |
| 16673 | PIN_VREF80 : PIN_IN)); |
| 16674 | if (nid != ALC662_PIN_CD_NID) |
| 16675 | snd_hda_codec_write(codec, nid, 0, |
| 16676 | AC_VERB_SET_AMP_GAIN_MUTE, |
| 16677 | AMP_OUT_MUTE); |
| 16678 | } |
| 16679 | } |
| 16680 | } |
| 16681 | |
Takashi Iwai | f511b01 | 2008-08-15 16:46:42 +0200 | [diff] [blame] | 16682 | #define alc662_auto_init_input_src alc882_auto_init_input_src |
| 16683 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16684 | static int alc662_parse_auto_config(struct hda_codec *codec) |
| 16685 | { |
| 16686 | struct alc_spec *spec = codec->spec; |
| 16687 | int err; |
| 16688 | static hda_nid_t alc662_ignore[] = { 0x1d, 0 }; |
| 16689 | |
| 16690 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 16691 | alc662_ignore); |
| 16692 | if (err < 0) |
| 16693 | return err; |
| 16694 | if (!spec->autocfg.line_outs) |
| 16695 | return 0; /* can't find valid BIOS pin config */ |
| 16696 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 16697 | err = alc880_auto_fill_dac_nids(spec, &spec->autocfg); |
| 16698 | if (err < 0) |
| 16699 | return err; |
| 16700 | err = alc662_auto_create_multi_out_ctls(spec, &spec->autocfg); |
| 16701 | if (err < 0) |
| 16702 | return err; |
| 16703 | err = alc662_auto_create_extra_out(spec, |
| 16704 | spec->autocfg.speaker_pins[0], |
| 16705 | "Speaker"); |
| 16706 | if (err < 0) |
| 16707 | return err; |
| 16708 | err = alc662_auto_create_extra_out(spec, spec->autocfg.hp_pins[0], |
| 16709 | "Headphone"); |
| 16710 | if (err < 0) |
| 16711 | return err; |
| 16712 | err = alc662_auto_create_analog_input_ctls(spec, &spec->autocfg); |
| 16713 | if (err < 0) |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16714 | return err; |
| 16715 | |
| 16716 | spec->multiout.max_channels = spec->multiout.num_dacs * 2; |
| 16717 | |
Takashi Iwai | 0852d7a | 2009-02-11 11:35:15 +0100 | [diff] [blame] | 16718 | if (spec->autocfg.dig_outs) |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16719 | spec->multiout.dig_out_nid = ALC880_DIGOUT_NID; |
| 16720 | |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 16721 | if (spec->kctls.list) |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 16722 | add_mixer(spec, spec->kctls.list); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16723 | |
| 16724 | spec->num_mux_defs = 1; |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 16725 | spec->input_mux = &spec->private_imux[0]; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 16726 | |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 16727 | add_verb(spec, alc662_auto_init_verbs); |
Takashi Iwai | 24fb917 | 2008-09-02 14:48:20 +0200 | [diff] [blame] | 16728 | if (codec->vendor_id == 0x10ec0663) |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 16729 | add_verb(spec, alc663_auto_init_verbs); |
Takashi Iwai | ee979a14 | 2008-09-02 15:42:20 +0200 | [diff] [blame] | 16730 | |
| 16731 | err = alc_auto_add_mic_boost(codec); |
| 16732 | if (err < 0) |
| 16733 | return err; |
| 16734 | |
Takashi Iwai | e044c39 | 2008-10-27 16:56:24 +0100 | [diff] [blame] | 16735 | store_pin_configs(codec); |
Takashi Iwai | 8c87286 | 2007-06-19 12:11:16 +0200 | [diff] [blame] | 16736 | return 1; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16737 | } |
| 16738 | |
| 16739 | /* additional initialization for auto-configuration model */ |
| 16740 | static void alc662_auto_init(struct hda_codec *codec) |
| 16741 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 16742 | struct alc_spec *spec = codec->spec; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16743 | alc662_auto_init_multi_out(codec); |
| 16744 | alc662_auto_init_hp_out(codec); |
| 16745 | alc662_auto_init_analog_input(codec); |
Takashi Iwai | f511b01 | 2008-08-15 16:46:42 +0200 | [diff] [blame] | 16746 | alc662_auto_init_input_src(codec); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 16747 | if (spec->unsol_event) |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 16748 | alc_inithook(codec); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16749 | } |
| 16750 | |
| 16751 | static int patch_alc662(struct hda_codec *codec) |
| 16752 | { |
| 16753 | struct alc_spec *spec; |
| 16754 | int err, board_config; |
| 16755 | |
| 16756 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
| 16757 | if (!spec) |
| 16758 | return -ENOMEM; |
| 16759 | |
| 16760 | codec->spec = spec; |
| 16761 | |
Takashi Iwai | 2c3bf9a | 2008-06-04 12:39:38 +0200 | [diff] [blame] | 16762 | alc_fix_pll_init(codec, 0x20, 0x04, 15); |
| 16763 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16764 | board_config = snd_hda_check_board_config(codec, ALC662_MODEL_LAST, |
| 16765 | alc662_models, |
| 16766 | alc662_cfg_tbl); |
| 16767 | if (board_config < 0) { |
| 16768 | printk(KERN_INFO "hda_codec: Unknown model for ALC662, " |
| 16769 | "trying auto-probe from BIOS...\n"); |
| 16770 | board_config = ALC662_AUTO; |
| 16771 | } |
| 16772 | |
| 16773 | if (board_config == ALC662_AUTO) { |
| 16774 | /* automatic parse from the BIOS config */ |
| 16775 | err = alc662_parse_auto_config(codec); |
| 16776 | if (err < 0) { |
| 16777 | alc_free(codec); |
| 16778 | return err; |
Takashi Iwai | 8c87286 | 2007-06-19 12:11:16 +0200 | [diff] [blame] | 16779 | } else if (!err) { |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16780 | printk(KERN_INFO |
| 16781 | "hda_codec: Cannot set up configuration " |
| 16782 | "from BIOS. Using base mode...\n"); |
| 16783 | board_config = ALC662_3ST_2ch_DIG; |
| 16784 | } |
| 16785 | } |
| 16786 | |
Kusanagi Kouichi | 680cd53 | 2009-02-05 00:00:58 +0900 | [diff] [blame] | 16787 | err = snd_hda_attach_beep_device(codec, 0x1); |
| 16788 | if (err < 0) { |
| 16789 | alc_free(codec); |
| 16790 | return err; |
| 16791 | } |
| 16792 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16793 | if (board_config != ALC662_AUTO) |
| 16794 | setup_preset(spec, &alc662_presets[board_config]); |
| 16795 | |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 16796 | if (codec->vendor_id == 0x10ec0663) { |
| 16797 | spec->stream_name_analog = "ALC663 Analog"; |
| 16798 | spec->stream_name_digital = "ALC663 Digital"; |
Kailang Yang | 01afd41 | 2008-10-15 11:22:09 +0200 | [diff] [blame] | 16799 | } else if (codec->vendor_id == 0x10ec0272) { |
| 16800 | spec->stream_name_analog = "ALC272 Analog"; |
| 16801 | spec->stream_name_digital = "ALC272 Digital"; |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 16802 | } else { |
| 16803 | spec->stream_name_analog = "ALC662 Analog"; |
| 16804 | spec->stream_name_digital = "ALC662 Digital"; |
| 16805 | } |
| 16806 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16807 | spec->stream_analog_playback = &alc662_pcm_analog_playback; |
| 16808 | spec->stream_analog_capture = &alc662_pcm_analog_capture; |
| 16809 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16810 | spec->stream_digital_playback = &alc662_pcm_digital_playback; |
| 16811 | spec->stream_digital_capture = &alc662_pcm_digital_capture; |
| 16812 | |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 16813 | spec->adc_nids = alc662_adc_nids; |
| 16814 | spec->num_adc_nids = ARRAY_SIZE(alc662_adc_nids); |
| 16815 | spec->capsrc_nids = alc662_capsrc_nids; |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 16816 | spec->capture_style = CAPT_MIX; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16817 | |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 16818 | if (!spec->cap_mixer) |
| 16819 | set_capture_mixer(spec); |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 16820 | set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT); |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 16821 | |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 16822 | spec->vmaster_nid = 0x02; |
| 16823 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16824 | codec->patch_ops = alc_patch_ops; |
| 16825 | if (board_config == ALC662_AUTO) |
| 16826 | spec->init_hook = alc662_auto_init; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 16827 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 16828 | if (!spec->loopback.amplist) |
| 16829 | spec->loopback.amplist = alc662_loopbacks; |
| 16830 | #endif |
Takashi Iwai | daead53 | 2008-11-28 12:55:36 +0100 | [diff] [blame] | 16831 | codec->proc_widget_hook = print_realtek_coef; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16832 | |
| 16833 | return 0; |
| 16834 | } |
| 16835 | |
| 16836 | /* |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 16837 | * patch entries |
| 16838 | */ |
Takashi Iwai | 1289e9e | 2008-11-27 15:47:11 +0100 | [diff] [blame] | 16839 | static struct hda_codec_preset snd_hda_preset_realtek[] = { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 16840 | { .id = 0x10ec0260, .name = "ALC260", .patch = patch_alc260 }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16841 | { .id = 0x10ec0262, .name = "ALC262", .patch = patch_alc262 }, |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 16842 | { .id = 0x10ec0267, .name = "ALC267", .patch = patch_alc268 }, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 16843 | { .id = 0x10ec0268, .name = "ALC268", .patch = patch_alc268 }, |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 16844 | { .id = 0x10ec0269, .name = "ALC269", .patch = patch_alc269 }, |
Kailang Yang | 01afd41 | 2008-10-15 11:22:09 +0200 | [diff] [blame] | 16845 | { .id = 0x10ec0272, .name = "ALC272", .patch = patch_alc662 }, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16846 | { .id = 0x10ec0861, .rev = 0x100340, .name = "ALC660", |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16847 | .patch = patch_alc861 }, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16848 | { .id = 0x10ec0660, .name = "ALC660-VD", .patch = patch_alc861vd }, |
| 16849 | { .id = 0x10ec0861, .name = "ALC861", .patch = patch_alc861 }, |
| 16850 | { .id = 0x10ec0862, .name = "ALC861-VD", .patch = patch_alc861vd }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16851 | { .id = 0x10ec0662, .rev = 0x100002, .name = "ALC662 rev2", |
| 16852 | .patch = patch_alc883 }, |
| 16853 | { .id = 0x10ec0662, .rev = 0x100101, .name = "ALC662 rev1", |
| 16854 | .patch = patch_alc662 }, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 16855 | { .id = 0x10ec0663, .name = "ALC663", .patch = patch_alc662 }, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16856 | { .id = 0x10ec0880, .name = "ALC880", .patch = patch_alc880 }, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 16857 | { .id = 0x10ec0882, .name = "ALC882", .patch = patch_alc882 }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 16858 | { .id = 0x10ec0883, .name = "ALC883", .patch = patch_alc883 }, |
Clive Messer | 669faba | 2008-09-30 15:49:13 +0200 | [diff] [blame] | 16859 | { .id = 0x10ec0885, .rev = 0x100101, .name = "ALC889A", |
| 16860 | .patch = patch_alc882 }, /* should be patch_alc883() in future */ |
Takashi Iwai | cb308f9 | 2008-04-16 14:13:29 +0200 | [diff] [blame] | 16861 | { .id = 0x10ec0885, .rev = 0x100103, .name = "ALC889A", |
Takashi Iwai | 7943a8a | 2008-04-16 17:29:09 +0200 | [diff] [blame] | 16862 | .patch = patch_alc882 }, /* should be patch_alc883() in future */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16863 | { .id = 0x10ec0885, .name = "ALC885", .patch = patch_alc882 }, |
Kailang Yang | a385a52 | 2008-10-15 11:20:21 +0200 | [diff] [blame] | 16864 | { .id = 0x10ec0887, .name = "ALC887", .patch = patch_alc883 }, |
Kailang Yang | 4442608 | 2008-10-15 11:18:05 +0200 | [diff] [blame] | 16865 | { .id = 0x10ec0888, .rev = 0x100101, .name = "ALC1200", |
| 16866 | .patch = patch_alc883 }, |
Wu Fengguang | 3fea2cb | 2008-12-26 12:20:43 +0800 | [diff] [blame] | 16867 | { .id = 0x10ec0888, .name = "ALC888", .patch = patch_alc883 }, |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 16868 | { .id = 0x10ec0889, .name = "ALC889", .patch = patch_alc883 }, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 16869 | {} /* terminator */ |
| 16870 | }; |
Takashi Iwai | 1289e9e | 2008-11-27 15:47:11 +0100 | [diff] [blame] | 16871 | |
| 16872 | MODULE_ALIAS("snd-hda-codec-id:10ec*"); |
| 16873 | |
| 16874 | MODULE_LICENSE("GPL"); |
| 16875 | MODULE_DESCRIPTION("Realtek HD-audio codec"); |
| 16876 | |
| 16877 | static struct hda_codec_preset_list realtek_list = { |
| 16878 | .preset = snd_hda_preset_realtek, |
| 16879 | .owner = THIS_MODULE, |
| 16880 | }; |
| 16881 | |
| 16882 | static int __init patch_realtek_init(void) |
| 16883 | { |
| 16884 | return snd_hda_add_codec_preset(&realtek_list); |
| 16885 | } |
| 16886 | |
| 16887 | static void __exit patch_realtek_exit(void) |
| 16888 | { |
| 16889 | snd_hda_delete_codec_preset(&realtek_list); |
| 16890 | } |
| 16891 | |
| 16892 | module_init(patch_realtek_init) |
| 16893 | module_exit(patch_realtek_exit) |