Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 1 | /* |
| 2 | * Universal Interface for Intel High Definition Audio Codec |
| 3 | * |
| 4 | * HD audio interface patch for SigmaTel STAC92xx |
| 5 | * |
| 6 | * Copyright (c) 2005 Embedded Alley Solutions, Inc. |
Matt Porter | 403d194 | 2005-11-29 15:00:51 +0100 | [diff] [blame] | 7 | * Matt Porter <mporter@embeddedalley.com> |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 8 | * |
| 9 | * Based on patch_cmedia.c and patch_realtek.c |
| 10 | * Copyright (c) 2004 Takashi Iwai <tiwai@suse.de> |
| 11 | * |
| 12 | * This driver is free software; you can redistribute it and/or modify |
| 13 | * it under the terms of the GNU General Public License as published by |
| 14 | * the Free Software Foundation; either version 2 of the License, or |
| 15 | * (at your option) any later version. |
| 16 | * |
| 17 | * This driver is distributed in the hope that it will be useful, |
| 18 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 19 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 20 | * GNU General Public License for more details. |
| 21 | * |
| 22 | * You should have received a copy of the GNU General Public License |
| 23 | * along with this program; if not, write to the Free Software |
| 24 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
| 25 | */ |
| 26 | |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 27 | #include <linux/init.h> |
| 28 | #include <linux/delay.h> |
| 29 | #include <linux/slab.h> |
| 30 | #include <linux/pci.h> |
Vitaliy Kulikov | 5bdaaad | 2009-11-04 07:57:45 +0100 | [diff] [blame] | 31 | #include <linux/dmi.h> |
Paul Gortmaker | da155d5 | 2011-07-15 12:38:28 -0400 | [diff] [blame] | 32 | #include <linux/module.h> |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 33 | #include <sound/core.h> |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 34 | #include <sound/asoundef.h> |
Matthew Ranostay | 45a6ac1 | 2008-10-15 14:45:38 -0400 | [diff] [blame] | 35 | #include <sound/jack.h> |
Clemens Ladisch | a74ccea | 2010-10-22 15:52:34 +0200 | [diff] [blame] | 36 | #include <sound/tlv.h> |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 37 | #include "hda_codec.h" |
| 38 | #include "hda_local.h" |
Takashi Iwai | 128bc4b | 2012-05-07 17:42:31 +0200 | [diff] [blame] | 39 | #include "hda_auto_parser.h" |
Matthew Ranostay | 1cd2224 | 2008-07-18 18:20:52 +0200 | [diff] [blame] | 40 | #include "hda_beep.h" |
Takashi Iwai | 1835a0f | 2011-10-27 22:12:46 +0200 | [diff] [blame] | 41 | #include "hda_jack.h" |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 42 | |
Takashi Iwai | c6e4c66 | 2008-11-25 11:58:19 +0100 | [diff] [blame] | 43 | enum { |
| 44 | STAC_VREF_EVENT = 1, |
| 45 | STAC_INSERT_EVENT, |
| 46 | STAC_PWR_EVENT, |
| 47 | STAC_HP_EVENT, |
Takashi Iwai | fefd67f | 2009-07-30 18:03:05 +0200 | [diff] [blame] | 48 | STAC_LO_EVENT, |
Takashi Iwai | 3d21d3f | 2009-07-29 14:32:56 +0200 | [diff] [blame] | 49 | STAC_MIC_EVENT, |
Takashi Iwai | c6e4c66 | 2008-11-25 11:58:19 +0100 | [diff] [blame] | 50 | }; |
Matt | 4e55096 | 2005-07-04 17:51:39 +0200 | [diff] [blame] | 51 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 52 | enum { |
Takashi Iwai | 1607b8e | 2009-02-26 16:50:43 +0100 | [diff] [blame] | 53 | STAC_AUTO, |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 54 | STAC_REF, |
Tobin Davis | bf27778 | 2008-02-03 20:31:47 +0100 | [diff] [blame] | 55 | STAC_9200_OQO, |
Takashi Iwai | dfe495d | 2007-08-23 19:04:28 +0200 | [diff] [blame] | 56 | STAC_9200_DELL_D21, |
| 57 | STAC_9200_DELL_D22, |
| 58 | STAC_9200_DELL_D23, |
| 59 | STAC_9200_DELL_M21, |
| 60 | STAC_9200_DELL_M22, |
| 61 | STAC_9200_DELL_M23, |
| 62 | STAC_9200_DELL_M24, |
| 63 | STAC_9200_DELL_M25, |
| 64 | STAC_9200_DELL_M26, |
| 65 | STAC_9200_DELL_M27, |
Mauro Carvalho Chehab | 58eec42 | 2008-08-11 10:18:39 +0200 | [diff] [blame] | 66 | STAC_9200_M4, |
| 67 | STAC_9200_M4_2, |
Takashi Iwai | 117f257 | 2008-03-18 09:53:23 +0100 | [diff] [blame] | 68 | STAC_9200_PANASONIC, |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 69 | STAC_9200_MODELS |
| 70 | }; |
| 71 | |
| 72 | enum { |
Takashi Iwai | 1607b8e | 2009-02-26 16:50:43 +0100 | [diff] [blame] | 73 | STAC_9205_AUTO, |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 74 | STAC_9205_REF, |
Takashi Iwai | dfe495d | 2007-08-23 19:04:28 +0200 | [diff] [blame] | 75 | STAC_9205_DELL_M42, |
Tobin Davis | ae0a8ed | 2007-08-13 15:50:29 +0200 | [diff] [blame] | 76 | STAC_9205_DELL_M43, |
| 77 | STAC_9205_DELL_M44, |
Takashi Iwai | d9a4268 | 2009-01-22 17:40:18 +0100 | [diff] [blame] | 78 | STAC_9205_EAPD, |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 79 | STAC_9205_MODELS |
| 80 | }; |
| 81 | |
| 82 | enum { |
Takashi Iwai | 1607b8e | 2009-02-26 16:50:43 +0100 | [diff] [blame] | 83 | STAC_92HD73XX_AUTO, |
Takashi Iwai | 9e43f0d | 2008-12-17 14:51:01 +0100 | [diff] [blame] | 84 | STAC_92HD73XX_NO_JD, /* no jack-detection */ |
Matthew Ranostay | e1f0d66 | 2007-12-13 17:47:21 +0100 | [diff] [blame] | 85 | STAC_92HD73XX_REF, |
Wu Fengguang | ae70944 | 2009-08-19 17:05:11 +0800 | [diff] [blame] | 86 | STAC_92HD73XX_INTEL, |
Takashi Iwai | 661cd8f | 2008-11-25 15:18:29 +0100 | [diff] [blame] | 87 | STAC_DELL_M6_AMIC, |
| 88 | STAC_DELL_M6_DMIC, |
| 89 | STAC_DELL_M6_BOTH, |
Matthew Ranostay | 6b3ab21 | 2008-11-03 08:12:43 -0500 | [diff] [blame] | 90 | STAC_DELL_EQ, |
Takashi Iwai | 842ae63 | 2009-09-02 07:43:08 +0200 | [diff] [blame] | 91 | STAC_ALIENWARE_M17X, |
Matthew Ranostay | e1f0d66 | 2007-12-13 17:47:21 +0100 | [diff] [blame] | 92 | STAC_92HD73XX_MODELS |
| 93 | }; |
| 94 | |
| 95 | enum { |
Takashi Iwai | 1607b8e | 2009-02-26 16:50:43 +0100 | [diff] [blame] | 96 | STAC_92HD83XXX_AUTO, |
Matthew Ranostay | d0513fc | 2008-07-27 10:30:30 +0200 | [diff] [blame] | 97 | STAC_92HD83XXX_REF, |
Matthew Ranostay | 32ed3f4 | 2009-01-22 20:53:29 -0500 | [diff] [blame] | 98 | STAC_92HD83XXX_PWR_REF, |
Matthew Ranostay | 8bb0ac5 | 2009-02-12 16:50:01 -0500 | [diff] [blame] | 99 | STAC_DELL_S14, |
Julian Wollrath | f7f9bdf | 2011-11-09 10:02:40 +0100 | [diff] [blame] | 100 | STAC_DELL_VOSTRO_3500, |
Vitaliy Kulikov | 0c27c18 | 2011-07-22 17:50:37 -0500 | [diff] [blame] | 101 | STAC_92HD83XXX_HP_cNB11_INTQUAD, |
Steven Eastland | 4831559 | 2010-08-06 15:07:35 -0600 | [diff] [blame] | 102 | STAC_HP_DV7_4000, |
Vitaliy Kulikov | 5556e14 | 2012-02-27 16:47:37 -0600 | [diff] [blame] | 103 | STAC_HP_ZEPHYR, |
Matthew Ranostay | d0513fc | 2008-07-27 10:30:30 +0200 | [diff] [blame] | 104 | STAC_92HD83XXX_MODELS |
| 105 | }; |
| 106 | |
| 107 | enum { |
Takashi Iwai | 1607b8e | 2009-02-26 16:50:43 +0100 | [diff] [blame] | 108 | STAC_92HD71BXX_AUTO, |
Matthew Ranostay | e035b84 | 2007-11-06 11:53:55 +0100 | [diff] [blame] | 109 | STAC_92HD71BXX_REF, |
Matthew Ranostay | a766264 | 2008-02-21 07:51:14 +0100 | [diff] [blame] | 110 | STAC_DELL_M4_1, |
| 111 | STAC_DELL_M4_2, |
Matthew Ranostay | 3a7abfd | 2008-11-20 21:21:43 -0500 | [diff] [blame] | 112 | STAC_DELL_M4_3, |
Matthew Ranostay | 6a14f58 | 2008-09-12 12:02:30 -0400 | [diff] [blame] | 113 | STAC_HP_M4, |
Takashi Iwai | 2a6ce6e | 2010-05-12 10:16:20 +0200 | [diff] [blame] | 114 | STAC_HP_DV4, |
Takashi Iwai | 1b0652e | 2009-01-14 08:27:35 +0100 | [diff] [blame] | 115 | STAC_HP_DV5, |
Christoph Plattner | ae6241f | 2009-03-08 23:19:05 +0100 | [diff] [blame] | 116 | STAC_HP_HDX, |
James Gardiner | 514bf54 | 2009-05-03 04:00:44 -0400 | [diff] [blame] | 117 | STAC_HP_DV4_1222NR, |
Matthew Ranostay | e035b84 | 2007-11-06 11:53:55 +0100 | [diff] [blame] | 118 | STAC_92HD71BXX_MODELS |
| 119 | }; |
| 120 | |
| 121 | enum { |
Takashi Iwai | 1607b8e | 2009-02-26 16:50:43 +0100 | [diff] [blame] | 122 | STAC_925x_AUTO, |
Tobin Davis | 8e21c34 | 2007-01-08 11:04:17 +0100 | [diff] [blame] | 123 | STAC_925x_REF, |
Mauro Carvalho Chehab | 9cb36c2 | 2008-08-11 10:18:39 +0200 | [diff] [blame] | 124 | STAC_M1, |
| 125 | STAC_M1_2, |
| 126 | STAC_M2, |
Tobin Davis | 8e21c34 | 2007-01-08 11:04:17 +0100 | [diff] [blame] | 127 | STAC_M2_2, |
Mauro Carvalho Chehab | 9cb36c2 | 2008-08-11 10:18:39 +0200 | [diff] [blame] | 128 | STAC_M3, |
| 129 | STAC_M5, |
| 130 | STAC_M6, |
Tobin Davis | 8e21c34 | 2007-01-08 11:04:17 +0100 | [diff] [blame] | 131 | STAC_925x_MODELS |
| 132 | }; |
| 133 | |
| 134 | enum { |
Takashi Iwai | 1607b8e | 2009-02-26 16:50:43 +0100 | [diff] [blame] | 135 | STAC_922X_AUTO, |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 136 | STAC_D945_REF, |
| 137 | STAC_D945GTP3, |
| 138 | STAC_D945GTP5, |
Ivan N. Zlatev | 5d5d3bc | 2007-05-29 16:03:00 +0200 | [diff] [blame] | 139 | STAC_INTEL_MAC_V1, |
| 140 | STAC_INTEL_MAC_V2, |
| 141 | STAC_INTEL_MAC_V3, |
| 142 | STAC_INTEL_MAC_V4, |
| 143 | STAC_INTEL_MAC_V5, |
Nicolas Boichat | 536319a | 2008-07-21 22:18:01 +0800 | [diff] [blame] | 144 | STAC_INTEL_MAC_AUTO, /* This model is selected if no module parameter |
| 145 | * is given, one of the above models will be |
| 146 | * chosen according to the subsystem id. */ |
Takashi Iwai | dfe495d | 2007-08-23 19:04:28 +0200 | [diff] [blame] | 147 | /* for backward compatibility */ |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 148 | STAC_MACMINI, |
Takashi Iwai | 3fc24d8 | 2007-02-16 13:27:18 +0100 | [diff] [blame] | 149 | STAC_MACBOOK, |
Nicolas Boichat | 6f0778d | 2007-03-15 12:38:15 +0100 | [diff] [blame] | 150 | STAC_MACBOOK_PRO_V1, |
| 151 | STAC_MACBOOK_PRO_V2, |
Sylvain FORET | f16928f | 2007-04-27 14:22:36 +0200 | [diff] [blame] | 152 | STAC_IMAC_INTEL, |
Takashi Iwai | 0dae0f8 | 2007-05-21 12:41:29 +0200 | [diff] [blame] | 153 | STAC_IMAC_INTEL_20, |
Mauro Carvalho Chehab | 8c65008 | 2008-08-04 10:39:59 -0300 | [diff] [blame] | 154 | STAC_ECS_202, |
Takashi Iwai | dfe495d | 2007-08-23 19:04:28 +0200 | [diff] [blame] | 155 | STAC_922X_DELL_D81, |
| 156 | STAC_922X_DELL_D82, |
| 157 | STAC_922X_DELL_M81, |
| 158 | STAC_922X_DELL_M82, |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 159 | STAC_922X_MODELS |
| 160 | }; |
| 161 | |
| 162 | enum { |
Takashi Iwai | 1607b8e | 2009-02-26 16:50:43 +0100 | [diff] [blame] | 163 | STAC_927X_AUTO, |
Takashi Iwai | e28d832 | 2008-12-17 13:48:29 +0100 | [diff] [blame] | 164 | STAC_D965_REF_NO_JD, /* no jack-detection */ |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 165 | STAC_D965_REF, |
| 166 | STAC_D965_3ST, |
| 167 | STAC_D965_5ST, |
Takashi Iwai | 679d92e | 2009-05-24 19:00:08 +0200 | [diff] [blame] | 168 | STAC_D965_5ST_NO_FP, |
Tobin Davis | 4ff076e | 2007-08-07 11:48:12 +0200 | [diff] [blame] | 169 | STAC_DELL_3ST, |
Matthew Ranostay | 8e9068b | 2007-12-17 11:58:13 +0100 | [diff] [blame] | 170 | STAC_DELL_BIOS, |
Takashi Iwai | 5493053 | 2009-10-11 17:38:29 +0200 | [diff] [blame] | 171 | STAC_927X_VOLKNOB, |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 172 | STAC_927X_MODELS |
| 173 | }; |
Matt Porter | 403d194 | 2005-11-29 15:00:51 +0100 | [diff] [blame] | 174 | |
Takashi Iwai | 307282c | 2009-03-12 18:17:58 +0100 | [diff] [blame] | 175 | enum { |
| 176 | STAC_9872_AUTO, |
| 177 | STAC_9872_VAIO, |
| 178 | STAC_9872_MODELS |
| 179 | }; |
| 180 | |
Takashi Iwai | 3d21d3f | 2009-07-29 14:32:56 +0200 | [diff] [blame] | 181 | struct sigmatel_mic_route { |
| 182 | hda_nid_t pin; |
Takashi Iwai | 02d3332 | 2009-10-01 16:38:11 +0200 | [diff] [blame] | 183 | signed char mux_idx; |
| 184 | signed char dmux_idx; |
Takashi Iwai | 3d21d3f | 2009-07-29 14:32:56 +0200 | [diff] [blame] | 185 | }; |
| 186 | |
Vitaliy Kulikov | 699d899 | 2011-03-10 13:43:35 -0600 | [diff] [blame] | 187 | #define MAX_PINS_NUM 16 |
| 188 | #define MAX_ADCS_NUM 4 |
| 189 | #define MAX_DMICS_NUM 4 |
| 190 | |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 191 | struct sigmatel_spec { |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 192 | struct snd_kcontrol_new *mixers[4]; |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 193 | unsigned int num_mixers; |
| 194 | |
Matt Porter | 403d194 | 2005-11-29 15:00:51 +0100 | [diff] [blame] | 195 | int board_config; |
Matthew Ranostay | c0cea0d | 2008-11-16 11:42:34 -0500 | [diff] [blame] | 196 | unsigned int eapd_switch: 1; |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 197 | unsigned int surr_switch: 1; |
Matt Porter | 3cc08dc | 2006-01-23 15:27:49 +0100 | [diff] [blame] | 198 | unsigned int alt_switch: 1; |
Takashi Iwai | 82bc955 | 2006-03-21 11:24:42 +0100 | [diff] [blame] | 199 | unsigned int hp_detect: 1; |
Matthew Ranostay | 00ef50c | 2008-09-27 18:13:47 -0400 | [diff] [blame] | 200 | unsigned int spdif_mute: 1; |
Takashi Iwai | 7c7767e | 2009-01-20 15:28:38 +0100 | [diff] [blame] | 201 | unsigned int check_volume_offset:1; |
Takashi Iwai | 3d21d3f | 2009-07-29 14:32:56 +0200 | [diff] [blame] | 202 | unsigned int auto_mic:1; |
Daniel J Blueman | 1b0e372 | 2010-08-03 11:09:13 +0100 | [diff] [blame] | 203 | unsigned int linear_tone_beep:1; |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 204 | |
Matthew Ranostay | 4fe5195 | 2008-01-29 15:28:44 +0100 | [diff] [blame] | 205 | /* gpio lines */ |
Matthew Ranostay | 0fc9dec | 2008-04-14 13:32:54 +0200 | [diff] [blame] | 206 | unsigned int eapd_mask; |
Matthew Ranostay | 4fe5195 | 2008-01-29 15:28:44 +0100 | [diff] [blame] | 207 | unsigned int gpio_mask; |
| 208 | unsigned int gpio_dir; |
| 209 | unsigned int gpio_data; |
| 210 | unsigned int gpio_mute; |
Takashi Iwai | 86d190e | 2009-05-26 15:18:58 +0200 | [diff] [blame] | 211 | unsigned int gpio_led; |
Vitaliy Kulikov | c357aab | 2009-12-11 07:51:54 +0100 | [diff] [blame] | 212 | unsigned int gpio_led_polarity; |
Takashi Iwai | f1a7374 | 2011-12-04 13:44:06 +0100 | [diff] [blame] | 213 | unsigned int vref_mute_led_nid; /* pin NID for mute-LED vref control */ |
Vitaliy Kulikov | 45eebda | 2011-07-26 16:56:20 -0500 | [diff] [blame] | 214 | unsigned int vref_led; |
Matthew Ranostay | 4fe5195 | 2008-01-29 15:28:44 +0100 | [diff] [blame] | 215 | |
Matthew Ranostay | 8daaaa9 | 2008-08-15 07:45:52 +0200 | [diff] [blame] | 216 | /* stream */ |
| 217 | unsigned int stream_delay; |
| 218 | |
Matthew Ranostay | 4fe5195 | 2008-01-29 15:28:44 +0100 | [diff] [blame] | 219 | /* analog loopback */ |
Takashi Iwai | 2b63536 | 2011-05-02 12:33:43 +0200 | [diff] [blame] | 220 | const struct snd_kcontrol_new *aloopback_ctl; |
Matthew Ranostay | e1f0d66 | 2007-12-13 17:47:21 +0100 | [diff] [blame] | 221 | unsigned char aloopback_mask; |
| 222 | unsigned char aloopback_shift; |
Takashi Iwai | 8259980 | 2007-07-31 15:56:24 +0200 | [diff] [blame] | 223 | |
Matthew Ranostay | a64135a | 2008-01-10 16:55:06 +0100 | [diff] [blame] | 224 | /* power management */ |
Takashi Iwai | c882246 | 2012-05-15 09:11:36 +0200 | [diff] [blame] | 225 | unsigned int power_map_bits; |
Matthew Ranostay | a64135a | 2008-01-10 16:55:06 +0100 | [diff] [blame] | 226 | unsigned int num_pwrs; |
Takashi Iwai | 2b63536 | 2011-05-02 12:33:43 +0200 | [diff] [blame] | 227 | const hda_nid_t *pwr_nids; |
| 228 | const hda_nid_t *dac_list; |
Matthew Ranostay | a64135a | 2008-01-10 16:55:06 +0100 | [diff] [blame] | 229 | |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 230 | /* playback */ |
Matthew Ranostay | b22b482 | 2008-01-22 12:32:30 +0100 | [diff] [blame] | 231 | struct hda_input_mux *mono_mux; |
| 232 | unsigned int cur_mmux; |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 233 | struct hda_multi_out multiout; |
Matt Porter | 3cc08dc | 2006-01-23 15:27:49 +0100 | [diff] [blame] | 234 | hda_nid_t dac_nids[5]; |
Takashi Iwai | c21ca4a | 2008-12-19 09:26:08 +0100 | [diff] [blame] | 235 | hda_nid_t hp_dacs[5]; |
| 236 | hda_nid_t speaker_dacs[5]; |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 237 | |
Takashi Iwai | 7c7767e | 2009-01-20 15:28:38 +0100 | [diff] [blame] | 238 | int volume_offset; |
| 239 | |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 240 | /* capture */ |
Takashi Iwai | 2b63536 | 2011-05-02 12:33:43 +0200 | [diff] [blame] | 241 | const hda_nid_t *adc_nids; |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 242 | unsigned int num_adcs; |
Takashi Iwai | 2b63536 | 2011-05-02 12:33:43 +0200 | [diff] [blame] | 243 | const hda_nid_t *mux_nids; |
Matt | dabbed6 | 2005-06-14 10:19:34 +0200 | [diff] [blame] | 244 | unsigned int num_muxes; |
Takashi Iwai | 2b63536 | 2011-05-02 12:33:43 +0200 | [diff] [blame] | 245 | const hda_nid_t *dmic_nids; |
Matt Porter | 8b65727 | 2006-10-26 17:12:59 +0200 | [diff] [blame] | 246 | unsigned int num_dmics; |
Takashi Iwai | 2b63536 | 2011-05-02 12:33:43 +0200 | [diff] [blame] | 247 | const hda_nid_t *dmux_nids; |
Takashi Iwai | 1697055e | 2007-12-18 18:05:52 +0100 | [diff] [blame] | 248 | unsigned int num_dmuxes; |
Takashi Iwai | 2b63536 | 2011-05-02 12:33:43 +0200 | [diff] [blame] | 249 | const hda_nid_t *smux_nids; |
Matthew Ranostay | d973775 | 2008-09-07 12:03:41 +0200 | [diff] [blame] | 250 | unsigned int num_smuxes; |
Takashi Iwai | 5207e10 | 2009-07-30 13:09:08 +0200 | [diff] [blame] | 251 | unsigned int num_analog_muxes; |
Takashi Iwai | 6479c63 | 2009-07-28 18:20:25 +0200 | [diff] [blame] | 252 | |
Takashi Iwai | 2b63536 | 2011-05-02 12:33:43 +0200 | [diff] [blame] | 253 | const unsigned long *capvols; /* amp-volume attr: HDA_COMPOSE_AMP_VAL() */ |
| 254 | const unsigned long *capsws; /* amp-mute attr: HDA_COMPOSE_AMP_VAL() */ |
Takashi Iwai | 6479c63 | 2009-07-28 18:20:25 +0200 | [diff] [blame] | 255 | unsigned int num_caps; /* number of capture volume/switch elements */ |
| 256 | |
Takashi Iwai | 3d21d3f | 2009-07-29 14:32:56 +0200 | [diff] [blame] | 257 | struct sigmatel_mic_route ext_mic; |
| 258 | struct sigmatel_mic_route int_mic; |
Charles Chin | 9907790 | 2010-09-17 10:22:32 +0200 | [diff] [blame] | 259 | struct sigmatel_mic_route dock_mic; |
Takashi Iwai | 3d21d3f | 2009-07-29 14:32:56 +0200 | [diff] [blame] | 260 | |
Takashi Iwai | ea73496 | 2011-01-17 11:29:34 +0100 | [diff] [blame] | 261 | const char * const *spdif_labels; |
Matthew Ranostay | d973775 | 2008-09-07 12:03:41 +0200 | [diff] [blame] | 262 | |
Matt | dabbed6 | 2005-06-14 10:19:34 +0200 | [diff] [blame] | 263 | hda_nid_t dig_in_nid; |
Matthew Ranostay | b22b482 | 2008-01-22 12:32:30 +0100 | [diff] [blame] | 264 | hda_nid_t mono_nid; |
Matthew Ranostay | 1cd2224 | 2008-07-18 18:20:52 +0200 | [diff] [blame] | 265 | hda_nid_t anabeep_nid; |
| 266 | hda_nid_t digbeep_nid; |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 267 | |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 268 | /* pin widgets */ |
Takashi Iwai | 2b63536 | 2011-05-02 12:33:43 +0200 | [diff] [blame] | 269 | const hda_nid_t *pin_nids; |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 270 | unsigned int num_pins; |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 271 | |
| 272 | /* codec specific stuff */ |
Takashi Iwai | 2b63536 | 2011-05-02 12:33:43 +0200 | [diff] [blame] | 273 | const struct hda_verb *init; |
| 274 | const struct snd_kcontrol_new *mixer; |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 275 | |
| 276 | /* capture source */ |
Matt Porter | 8b65727 | 2006-10-26 17:12:59 +0200 | [diff] [blame] | 277 | struct hda_input_mux *dinput_mux; |
Matthew Ranostay | e1f0d66 | 2007-12-13 17:47:21 +0100 | [diff] [blame] | 278 | unsigned int cur_dmux[2]; |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 279 | struct hda_input_mux *input_mux; |
Matt Porter | 3cc08dc | 2006-01-23 15:27:49 +0100 | [diff] [blame] | 280 | unsigned int cur_mux[3]; |
Matthew Ranostay | d973775 | 2008-09-07 12:03:41 +0200 | [diff] [blame] | 281 | struct hda_input_mux *sinput_mux; |
| 282 | unsigned int cur_smux[2]; |
Matthew Ranostay | 2a9c781 | 2008-09-13 16:45:39 -0400 | [diff] [blame] | 283 | unsigned int cur_amux; |
| 284 | hda_nid_t *amp_nids; |
Matthew Ranostay | 8daaaa9 | 2008-08-15 07:45:52 +0200 | [diff] [blame] | 285 | unsigned int powerdown_adcs; |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 286 | |
Matt Porter | 403d194 | 2005-11-29 15:00:51 +0100 | [diff] [blame] | 287 | /* i/o switches */ |
| 288 | unsigned int io_switch[2]; |
Maxim Levitsky | 0fb87bb | 2007-09-03 15:29:04 +0200 | [diff] [blame] | 289 | unsigned int clfe_swap; |
Takashi Iwai | c21ca4a | 2008-12-19 09:26:08 +0100 | [diff] [blame] | 290 | hda_nid_t line_switch; /* shared line-in for input and output */ |
| 291 | hda_nid_t mic_switch; /* shared mic-in for input and output */ |
| 292 | hda_nid_t hp_switch; /* NID of HP as line-out */ |
Maxim Levitsky | 5f10c4a | 2007-09-03 15:29:37 +0200 | [diff] [blame] | 293 | unsigned int aloopback; |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 294 | |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 295 | struct hda_pcm pcm_rec[2]; /* PCM information */ |
| 296 | |
| 297 | /* dynamic controls and input_mux */ |
| 298 | struct auto_pin_cfg autocfg; |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 299 | struct snd_array kctls; |
Matt Porter | 8b65727 | 2006-10-26 17:12:59 +0200 | [diff] [blame] | 300 | struct hda_input_mux private_dimux; |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 301 | struct hda_input_mux private_imux; |
Matthew Ranostay | d973775 | 2008-09-07 12:03:41 +0200 | [diff] [blame] | 302 | struct hda_input_mux private_smux; |
Matthew Ranostay | b22b482 | 2008-01-22 12:32:30 +0100 | [diff] [blame] | 303 | struct hda_input_mux private_mono_mux; |
Vitaliy Kulikov | 699d899 | 2011-03-10 13:43:35 -0600 | [diff] [blame] | 304 | |
| 305 | /* auto spec */ |
| 306 | unsigned auto_pin_cnt; |
| 307 | hda_nid_t auto_pin_nids[MAX_PINS_NUM]; |
| 308 | unsigned auto_adc_cnt; |
| 309 | hda_nid_t auto_adc_nids[MAX_ADCS_NUM]; |
| 310 | hda_nid_t auto_mux_nids[MAX_ADCS_NUM]; |
| 311 | hda_nid_t auto_dmux_nids[MAX_ADCS_NUM]; |
| 312 | unsigned long auto_capvols[MAX_ADCS_NUM]; |
| 313 | unsigned auto_dmic_cnt; |
| 314 | hda_nid_t auto_dmic_nids[MAX_DMICS_NUM]; |
Takashi Iwai | 2faa3bf | 2012-03-12 12:30:22 +0100 | [diff] [blame] | 315 | |
Takashi Iwai | d2f344b | 2012-03-12 16:59:58 +0100 | [diff] [blame] | 316 | struct hda_vmaster_mute_hook vmaster_mute; |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 317 | }; |
| 318 | |
Takashi Iwai | c882246 | 2012-05-15 09:11:36 +0200 | [diff] [blame] | 319 | #define AC_VERB_IDT_SET_POWER_MAP 0x7ec |
| 320 | #define AC_VERB_IDT_GET_POWER_MAP 0xfec |
| 321 | |
Takashi Iwai | 2b63536 | 2011-05-02 12:33:43 +0200 | [diff] [blame] | 322 | static const hda_nid_t stac9200_adc_nids[1] = { |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 323 | 0x03, |
| 324 | }; |
| 325 | |
Takashi Iwai | 2b63536 | 2011-05-02 12:33:43 +0200 | [diff] [blame] | 326 | static const hda_nid_t stac9200_mux_nids[1] = { |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 327 | 0x0c, |
| 328 | }; |
| 329 | |
Takashi Iwai | 2b63536 | 2011-05-02 12:33:43 +0200 | [diff] [blame] | 330 | static const hda_nid_t stac9200_dac_nids[1] = { |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 331 | 0x02, |
| 332 | }; |
| 333 | |
Takashi Iwai | 2b63536 | 2011-05-02 12:33:43 +0200 | [diff] [blame] | 334 | static const hda_nid_t stac92hd73xx_pwr_nids[8] = { |
Matthew Ranostay | a64135a | 2008-01-10 16:55:06 +0100 | [diff] [blame] | 335 | 0x0a, 0x0b, 0x0c, 0xd, 0x0e, |
| 336 | 0x0f, 0x10, 0x11 |
| 337 | }; |
| 338 | |
Takashi Iwai | 2b63536 | 2011-05-02 12:33:43 +0200 | [diff] [blame] | 339 | static const hda_nid_t stac92hd73xx_slave_dig_outs[2] = { |
Matthew Ranostay | 0ffa980 | 2008-09-08 11:20:05 -0400 | [diff] [blame] | 340 | 0x26, 0, |
| 341 | }; |
| 342 | |
Takashi Iwai | 2b63536 | 2011-05-02 12:33:43 +0200 | [diff] [blame] | 343 | static const hda_nid_t stac92hd73xx_adc_nids[2] = { |
Matthew Ranostay | e1f0d66 | 2007-12-13 17:47:21 +0100 | [diff] [blame] | 344 | 0x1a, 0x1b |
| 345 | }; |
| 346 | |
| 347 | #define STAC92HD73XX_NUM_DMICS 2 |
Takashi Iwai | 2b63536 | 2011-05-02 12:33:43 +0200 | [diff] [blame] | 348 | static const hda_nid_t stac92hd73xx_dmic_nids[STAC92HD73XX_NUM_DMICS + 1] = { |
Matthew Ranostay | e1f0d66 | 2007-12-13 17:47:21 +0100 | [diff] [blame] | 349 | 0x13, 0x14, 0 |
| 350 | }; |
| 351 | |
| 352 | #define STAC92HD73_DAC_COUNT 5 |
Matthew Ranostay | e1f0d66 | 2007-12-13 17:47:21 +0100 | [diff] [blame] | 353 | |
Takashi Iwai | 2b63536 | 2011-05-02 12:33:43 +0200 | [diff] [blame] | 354 | static const hda_nid_t stac92hd73xx_mux_nids[2] = { |
Takashi Iwai | e2aec17 | 2009-09-02 01:00:05 +0200 | [diff] [blame] | 355 | 0x20, 0x21, |
Matthew Ranostay | e1f0d66 | 2007-12-13 17:47:21 +0100 | [diff] [blame] | 356 | }; |
| 357 | |
Takashi Iwai | 2b63536 | 2011-05-02 12:33:43 +0200 | [diff] [blame] | 358 | static const hda_nid_t stac92hd73xx_dmux_nids[2] = { |
Matthew Ranostay | e1f0d66 | 2007-12-13 17:47:21 +0100 | [diff] [blame] | 359 | 0x20, 0x21, |
| 360 | }; |
| 361 | |
Takashi Iwai | 2b63536 | 2011-05-02 12:33:43 +0200 | [diff] [blame] | 362 | static const hda_nid_t stac92hd73xx_smux_nids[2] = { |
Matthew Ranostay | d973775 | 2008-09-07 12:03:41 +0200 | [diff] [blame] | 363 | 0x22, 0x23, |
| 364 | }; |
| 365 | |
Takashi Iwai | 6479c63 | 2009-07-28 18:20:25 +0200 | [diff] [blame] | 366 | #define STAC92HD73XX_NUM_CAPS 2 |
Takashi Iwai | 2b63536 | 2011-05-02 12:33:43 +0200 | [diff] [blame] | 367 | static const unsigned long stac92hd73xx_capvols[] = { |
Takashi Iwai | 6479c63 | 2009-07-28 18:20:25 +0200 | [diff] [blame] | 368 | HDA_COMPOSE_AMP_VAL(0x20, 3, 0, HDA_OUTPUT), |
| 369 | HDA_COMPOSE_AMP_VAL(0x21, 3, 0, HDA_OUTPUT), |
| 370 | }; |
| 371 | #define stac92hd73xx_capsws stac92hd73xx_capvols |
| 372 | |
Matthew Ranostay | d0513fc | 2008-07-27 10:30:30 +0200 | [diff] [blame] | 373 | #define STAC92HD83_DAC_COUNT 3 |
Matthew Ranostay | d0513fc | 2008-07-27 10:30:30 +0200 | [diff] [blame] | 374 | |
Charles Chin | afef2cf | 2011-11-11 08:05:28 +0100 | [diff] [blame] | 375 | static const hda_nid_t stac92hd83xxx_pwr_nids[7] = { |
| 376 | 0x0a, 0x0b, 0x0c, 0xd, 0x0e, |
| 377 | 0x0f, 0x10 |
Matthew Ranostay | d0513fc | 2008-07-27 10:30:30 +0200 | [diff] [blame] | 378 | }; |
| 379 | |
Takashi Iwai | 2b63536 | 2011-05-02 12:33:43 +0200 | [diff] [blame] | 380 | static const hda_nid_t stac92hd83xxx_slave_dig_outs[2] = { |
Matthew Ranostay | 0ffa980 | 2008-09-08 11:20:05 -0400 | [diff] [blame] | 381 | 0x1e, 0, |
| 382 | }; |
| 383 | |
Takashi Iwai | 2b63536 | 2011-05-02 12:33:43 +0200 | [diff] [blame] | 384 | static const hda_nid_t stac92hd83xxx_dmic_nids[] = { |
Vitaliy Kulikov | 699d899 | 2011-03-10 13:43:35 -0600 | [diff] [blame] | 385 | 0x11, 0x20, |
Vitaliy Kulikov | ab5a6eb | 2010-09-08 09:00:17 +0200 | [diff] [blame] | 386 | }; |
| 387 | |
Takashi Iwai | 2b63536 | 2011-05-02 12:33:43 +0200 | [diff] [blame] | 388 | static const hda_nid_t stac92hd71bxx_pwr_nids[3] = { |
Matthew Ranostay | a64135a | 2008-01-10 16:55:06 +0100 | [diff] [blame] | 389 | 0x0a, 0x0d, 0x0f |
| 390 | }; |
| 391 | |
Takashi Iwai | 2b63536 | 2011-05-02 12:33:43 +0200 | [diff] [blame] | 392 | static const hda_nid_t stac92hd71bxx_adc_nids[2] = { |
Matthew Ranostay | e035b84 | 2007-11-06 11:53:55 +0100 | [diff] [blame] | 393 | 0x12, 0x13, |
| 394 | }; |
| 395 | |
Takashi Iwai | 2b63536 | 2011-05-02 12:33:43 +0200 | [diff] [blame] | 396 | static const hda_nid_t stac92hd71bxx_mux_nids[2] = { |
Matthew Ranostay | e035b84 | 2007-11-06 11:53:55 +0100 | [diff] [blame] | 397 | 0x1a, 0x1b |
| 398 | }; |
| 399 | |
Takashi Iwai | 2b63536 | 2011-05-02 12:33:43 +0200 | [diff] [blame] | 400 | static const hda_nid_t stac92hd71bxx_dmux_nids[2] = { |
Matthew Ranostay | 4b33c76 | 2008-10-10 09:07:23 -0400 | [diff] [blame] | 401 | 0x1c, 0x1d, |
Matthew Ranostay | e1f0d66 | 2007-12-13 17:47:21 +0100 | [diff] [blame] | 402 | }; |
| 403 | |
Takashi Iwai | 2b63536 | 2011-05-02 12:33:43 +0200 | [diff] [blame] | 404 | static const hda_nid_t stac92hd71bxx_smux_nids[2] = { |
Matthew Ranostay | d973775 | 2008-09-07 12:03:41 +0200 | [diff] [blame] | 405 | 0x24, 0x25, |
| 406 | }; |
| 407 | |
Matthew Ranostay | e035b84 | 2007-11-06 11:53:55 +0100 | [diff] [blame] | 408 | #define STAC92HD71BXX_NUM_DMICS 2 |
Takashi Iwai | 2b63536 | 2011-05-02 12:33:43 +0200 | [diff] [blame] | 409 | static const hda_nid_t stac92hd71bxx_dmic_nids[STAC92HD71BXX_NUM_DMICS + 1] = { |
Matthew Ranostay | e035b84 | 2007-11-06 11:53:55 +0100 | [diff] [blame] | 410 | 0x18, 0x19, 0 |
| 411 | }; |
| 412 | |
Takashi Iwai | 2b63536 | 2011-05-02 12:33:43 +0200 | [diff] [blame] | 413 | static const hda_nid_t stac92hd71bxx_dmic_5port_nids[STAC92HD71BXX_NUM_DMICS] = { |
| 414 | 0x18, 0 |
| 415 | }; |
| 416 | |
| 417 | static const hda_nid_t stac92hd71bxx_slave_dig_outs[2] = { |
Matthew Ranostay | 0ffa980 | 2008-09-08 11:20:05 -0400 | [diff] [blame] | 418 | 0x22, 0 |
| 419 | }; |
| 420 | |
Takashi Iwai | 6479c63 | 2009-07-28 18:20:25 +0200 | [diff] [blame] | 421 | #define STAC92HD71BXX_NUM_CAPS 2 |
Takashi Iwai | 2b63536 | 2011-05-02 12:33:43 +0200 | [diff] [blame] | 422 | static const unsigned long stac92hd71bxx_capvols[] = { |
Takashi Iwai | 6479c63 | 2009-07-28 18:20:25 +0200 | [diff] [blame] | 423 | HDA_COMPOSE_AMP_VAL(0x1c, 3, 0, HDA_OUTPUT), |
| 424 | HDA_COMPOSE_AMP_VAL(0x1d, 3, 0, HDA_OUTPUT), |
| 425 | }; |
| 426 | #define stac92hd71bxx_capsws stac92hd71bxx_capvols |
| 427 | |
Takashi Iwai | 2b63536 | 2011-05-02 12:33:43 +0200 | [diff] [blame] | 428 | static const hda_nid_t stac925x_adc_nids[1] = { |
Tobin Davis | 8e21c34 | 2007-01-08 11:04:17 +0100 | [diff] [blame] | 429 | 0x03, |
| 430 | }; |
| 431 | |
Takashi Iwai | 2b63536 | 2011-05-02 12:33:43 +0200 | [diff] [blame] | 432 | static const hda_nid_t stac925x_mux_nids[1] = { |
Tobin Davis | 8e21c34 | 2007-01-08 11:04:17 +0100 | [diff] [blame] | 433 | 0x0f, |
| 434 | }; |
| 435 | |
Takashi Iwai | 2b63536 | 2011-05-02 12:33:43 +0200 | [diff] [blame] | 436 | static const hda_nid_t stac925x_dac_nids[1] = { |
Tobin Davis | 8e21c34 | 2007-01-08 11:04:17 +0100 | [diff] [blame] | 437 | 0x02, |
| 438 | }; |
| 439 | |
Takashi Iwai | f6e9852 | 2007-10-16 14:27:04 +0200 | [diff] [blame] | 440 | #define STAC925X_NUM_DMICS 1 |
Takashi Iwai | 2b63536 | 2011-05-02 12:33:43 +0200 | [diff] [blame] | 441 | static const hda_nid_t stac925x_dmic_nids[STAC925X_NUM_DMICS + 1] = { |
Takashi Iwai | f6e9852 | 2007-10-16 14:27:04 +0200 | [diff] [blame] | 442 | 0x15, 0 |
Tobin Davis | 2c11f95 | 2007-05-17 09:36:34 +0200 | [diff] [blame] | 443 | }; |
| 444 | |
Takashi Iwai | 2b63536 | 2011-05-02 12:33:43 +0200 | [diff] [blame] | 445 | static const hda_nid_t stac925x_dmux_nids[1] = { |
Takashi Iwai | 1697055e | 2007-12-18 18:05:52 +0100 | [diff] [blame] | 446 | 0x14, |
| 447 | }; |
| 448 | |
Takashi Iwai | 2b63536 | 2011-05-02 12:33:43 +0200 | [diff] [blame] | 449 | static const unsigned long stac925x_capvols[] = { |
Takashi Iwai | 6479c63 | 2009-07-28 18:20:25 +0200 | [diff] [blame] | 450 | HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_OUTPUT), |
| 451 | }; |
Takashi Iwai | 2b63536 | 2011-05-02 12:33:43 +0200 | [diff] [blame] | 452 | static const unsigned long stac925x_capsws[] = { |
Takashi Iwai | 6479c63 | 2009-07-28 18:20:25 +0200 | [diff] [blame] | 453 | HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), |
| 454 | }; |
| 455 | |
Takashi Iwai | 2b63536 | 2011-05-02 12:33:43 +0200 | [diff] [blame] | 456 | static const hda_nid_t stac922x_adc_nids[2] = { |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 457 | 0x06, 0x07, |
| 458 | }; |
| 459 | |
Takashi Iwai | 2b63536 | 2011-05-02 12:33:43 +0200 | [diff] [blame] | 460 | static const hda_nid_t stac922x_mux_nids[2] = { |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 461 | 0x12, 0x13, |
| 462 | }; |
| 463 | |
Takashi Iwai | 6479c63 | 2009-07-28 18:20:25 +0200 | [diff] [blame] | 464 | #define STAC922X_NUM_CAPS 2 |
Takashi Iwai | 2b63536 | 2011-05-02 12:33:43 +0200 | [diff] [blame] | 465 | static const unsigned long stac922x_capvols[] = { |
Takashi Iwai | 6479c63 | 2009-07-28 18:20:25 +0200 | [diff] [blame] | 466 | HDA_COMPOSE_AMP_VAL(0x17, 3, 0, HDA_INPUT), |
| 467 | HDA_COMPOSE_AMP_VAL(0x18, 3, 0, HDA_INPUT), |
| 468 | }; |
| 469 | #define stac922x_capsws stac922x_capvols |
| 470 | |
Takashi Iwai | 2b63536 | 2011-05-02 12:33:43 +0200 | [diff] [blame] | 471 | static const hda_nid_t stac927x_slave_dig_outs[2] = { |
Matthew Ranostay | 45c1d85 | 2009-02-04 17:49:41 -0500 | [diff] [blame] | 472 | 0x1f, 0, |
| 473 | }; |
| 474 | |
Takashi Iwai | 2b63536 | 2011-05-02 12:33:43 +0200 | [diff] [blame] | 475 | static const hda_nid_t stac927x_adc_nids[3] = { |
Matt Porter | 3cc08dc | 2006-01-23 15:27:49 +0100 | [diff] [blame] | 476 | 0x07, 0x08, 0x09 |
| 477 | }; |
| 478 | |
Takashi Iwai | 2b63536 | 2011-05-02 12:33:43 +0200 | [diff] [blame] | 479 | static const hda_nid_t stac927x_mux_nids[3] = { |
Matt Porter | 3cc08dc | 2006-01-23 15:27:49 +0100 | [diff] [blame] | 480 | 0x15, 0x16, 0x17 |
| 481 | }; |
| 482 | |
Takashi Iwai | 2b63536 | 2011-05-02 12:33:43 +0200 | [diff] [blame] | 483 | static const hda_nid_t stac927x_smux_nids[1] = { |
Matthew Ranostay | d973775 | 2008-09-07 12:03:41 +0200 | [diff] [blame] | 484 | 0x21, |
| 485 | }; |
| 486 | |
Takashi Iwai | 2b63536 | 2011-05-02 12:33:43 +0200 | [diff] [blame] | 487 | static const hda_nid_t stac927x_dac_nids[6] = { |
Matthew Ranostay | b76c850 | 2008-02-06 14:49:44 +0100 | [diff] [blame] | 488 | 0x02, 0x03, 0x04, 0x05, 0x06, 0 |
| 489 | }; |
| 490 | |
Takashi Iwai | 2b63536 | 2011-05-02 12:33:43 +0200 | [diff] [blame] | 491 | static const hda_nid_t stac927x_dmux_nids[1] = { |
Matthew Ranostay | e1f0d66 | 2007-12-13 17:47:21 +0100 | [diff] [blame] | 492 | 0x1b, |
| 493 | }; |
| 494 | |
Matthew Ranostay | 7f16859 | 2007-10-18 17:38:17 +0200 | [diff] [blame] | 495 | #define STAC927X_NUM_DMICS 2 |
Takashi Iwai | 2b63536 | 2011-05-02 12:33:43 +0200 | [diff] [blame] | 496 | static const hda_nid_t stac927x_dmic_nids[STAC927X_NUM_DMICS + 1] = { |
Matthew Ranostay | 7f16859 | 2007-10-18 17:38:17 +0200 | [diff] [blame] | 497 | 0x13, 0x14, 0 |
| 498 | }; |
| 499 | |
Takashi Iwai | 6479c63 | 2009-07-28 18:20:25 +0200 | [diff] [blame] | 500 | #define STAC927X_NUM_CAPS 3 |
Takashi Iwai | 2b63536 | 2011-05-02 12:33:43 +0200 | [diff] [blame] | 501 | static const unsigned long stac927x_capvols[] = { |
Takashi Iwai | 6479c63 | 2009-07-28 18:20:25 +0200 | [diff] [blame] | 502 | HDA_COMPOSE_AMP_VAL(0x18, 3, 0, HDA_INPUT), |
| 503 | HDA_COMPOSE_AMP_VAL(0x19, 3, 0, HDA_INPUT), |
| 504 | HDA_COMPOSE_AMP_VAL(0x1a, 3, 0, HDA_INPUT), |
| 505 | }; |
Takashi Iwai | 2b63536 | 2011-05-02 12:33:43 +0200 | [diff] [blame] | 506 | static const unsigned long stac927x_capsws[] = { |
Takashi Iwai | 6479c63 | 2009-07-28 18:20:25 +0200 | [diff] [blame] | 507 | HDA_COMPOSE_AMP_VAL(0x1b, 3, 0, HDA_OUTPUT), |
| 508 | HDA_COMPOSE_AMP_VAL(0x1c, 3, 0, HDA_OUTPUT), |
| 509 | HDA_COMPOSE_AMP_VAL(0x1d, 3, 0, HDA_OUTPUT), |
| 510 | }; |
| 511 | |
Takashi Iwai | ea73496 | 2011-01-17 11:29:34 +0100 | [diff] [blame] | 512 | static const char * const stac927x_spdif_labels[5] = { |
Matthew Ranostay | 6597363 | 2008-09-16 10:39:37 -0400 | [diff] [blame] | 513 | "Digital Playback", "ADAT", "Analog Mux 1", |
| 514 | "Analog Mux 2", "Analog Mux 3" |
| 515 | }; |
| 516 | |
Takashi Iwai | 2b63536 | 2011-05-02 12:33:43 +0200 | [diff] [blame] | 517 | static const hda_nid_t stac9205_adc_nids[2] = { |
Matt Porter | f3302a5 | 2006-07-31 12:49:34 +0200 | [diff] [blame] | 518 | 0x12, 0x13 |
| 519 | }; |
| 520 | |
Takashi Iwai | 2b63536 | 2011-05-02 12:33:43 +0200 | [diff] [blame] | 521 | static const hda_nid_t stac9205_mux_nids[2] = { |
Matt Porter | f3302a5 | 2006-07-31 12:49:34 +0200 | [diff] [blame] | 522 | 0x19, 0x1a |
| 523 | }; |
| 524 | |
Takashi Iwai | 2b63536 | 2011-05-02 12:33:43 +0200 | [diff] [blame] | 525 | static const hda_nid_t stac9205_dmux_nids[1] = { |
Takashi Iwai | 1697055e | 2007-12-18 18:05:52 +0100 | [diff] [blame] | 526 | 0x1d, |
Matthew Ranostay | e1f0d66 | 2007-12-13 17:47:21 +0100 | [diff] [blame] | 527 | }; |
| 528 | |
Takashi Iwai | 2b63536 | 2011-05-02 12:33:43 +0200 | [diff] [blame] | 529 | static const hda_nid_t stac9205_smux_nids[1] = { |
Matthew Ranostay | d973775 | 2008-09-07 12:03:41 +0200 | [diff] [blame] | 530 | 0x21, |
| 531 | }; |
| 532 | |
Takashi Iwai | f6e9852 | 2007-10-16 14:27:04 +0200 | [diff] [blame] | 533 | #define STAC9205_NUM_DMICS 2 |
Takashi Iwai | 2b63536 | 2011-05-02 12:33:43 +0200 | [diff] [blame] | 534 | static const hda_nid_t stac9205_dmic_nids[STAC9205_NUM_DMICS + 1] = { |
Takashi Iwai | f6e9852 | 2007-10-16 14:27:04 +0200 | [diff] [blame] | 535 | 0x17, 0x18, 0 |
Matt Porter | 8b65727 | 2006-10-26 17:12:59 +0200 | [diff] [blame] | 536 | }; |
| 537 | |
Takashi Iwai | 6479c63 | 2009-07-28 18:20:25 +0200 | [diff] [blame] | 538 | #define STAC9205_NUM_CAPS 2 |
Takashi Iwai | 2b63536 | 2011-05-02 12:33:43 +0200 | [diff] [blame] | 539 | static const unsigned long stac9205_capvols[] = { |
Takashi Iwai | 6479c63 | 2009-07-28 18:20:25 +0200 | [diff] [blame] | 540 | HDA_COMPOSE_AMP_VAL(0x1b, 3, 0, HDA_INPUT), |
| 541 | HDA_COMPOSE_AMP_VAL(0x1c, 3, 0, HDA_INPUT), |
| 542 | }; |
Takashi Iwai | 2b63536 | 2011-05-02 12:33:43 +0200 | [diff] [blame] | 543 | static const unsigned long stac9205_capsws[] = { |
Takashi Iwai | 6479c63 | 2009-07-28 18:20:25 +0200 | [diff] [blame] | 544 | HDA_COMPOSE_AMP_VAL(0x1d, 3, 0, HDA_OUTPUT), |
| 545 | HDA_COMPOSE_AMP_VAL(0x1e, 3, 0, HDA_OUTPUT), |
| 546 | }; |
| 547 | |
Takashi Iwai | 2b63536 | 2011-05-02 12:33:43 +0200 | [diff] [blame] | 548 | static const hda_nid_t stac9200_pin_nids[8] = { |
Tobin Davis | 93ed150 | 2006-09-01 21:03:12 +0200 | [diff] [blame] | 549 | 0x08, 0x09, 0x0d, 0x0e, |
| 550 | 0x0f, 0x10, 0x11, 0x12, |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 551 | }; |
| 552 | |
Takashi Iwai | 2b63536 | 2011-05-02 12:33:43 +0200 | [diff] [blame] | 553 | static const hda_nid_t stac925x_pin_nids[8] = { |
Tobin Davis | 8e21c34 | 2007-01-08 11:04:17 +0100 | [diff] [blame] | 554 | 0x07, 0x08, 0x0a, 0x0b, |
| 555 | 0x0c, 0x0d, 0x10, 0x11, |
| 556 | }; |
| 557 | |
Takashi Iwai | 2b63536 | 2011-05-02 12:33:43 +0200 | [diff] [blame] | 558 | static const hda_nid_t stac922x_pin_nids[10] = { |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 559 | 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, |
| 560 | 0x0f, 0x10, 0x11, 0x15, 0x1b, |
| 561 | }; |
| 562 | |
Takashi Iwai | 2b63536 | 2011-05-02 12:33:43 +0200 | [diff] [blame] | 563 | static const hda_nid_t stac92hd73xx_pin_nids[13] = { |
Matthew Ranostay | e1f0d66 | 2007-12-13 17:47:21 +0100 | [diff] [blame] | 564 | 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, |
| 565 | 0x0f, 0x10, 0x11, 0x12, 0x13, |
Matthew Ranostay | d973775 | 2008-09-07 12:03:41 +0200 | [diff] [blame] | 566 | 0x14, 0x22, 0x23 |
Matthew Ranostay | e1f0d66 | 2007-12-13 17:47:21 +0100 | [diff] [blame] | 567 | }; |
| 568 | |
Herton Ronaldo Krzesinski | 616f89e | 2009-02-04 11:23:19 -0500 | [diff] [blame] | 569 | #define STAC92HD71BXX_NUM_PINS 13 |
Takashi Iwai | 2b63536 | 2011-05-02 12:33:43 +0200 | [diff] [blame] | 570 | static const hda_nid_t stac92hd71bxx_pin_nids_4port[STAC92HD71BXX_NUM_PINS] = { |
Herton Ronaldo Krzesinski | 616f89e | 2009-02-04 11:23:19 -0500 | [diff] [blame] | 571 | 0x0a, 0x0b, 0x0c, 0x0d, 0x00, |
| 572 | 0x00, 0x14, 0x18, 0x19, 0x1e, |
| 573 | 0x1f, 0x20, 0x27 |
| 574 | }; |
Takashi Iwai | 2b63536 | 2011-05-02 12:33:43 +0200 | [diff] [blame] | 575 | static const hda_nid_t stac92hd71bxx_pin_nids_6port[STAC92HD71BXX_NUM_PINS] = { |
Matthew Ranostay | e035b84 | 2007-11-06 11:53:55 +0100 | [diff] [blame] | 576 | 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, |
| 577 | 0x0f, 0x14, 0x18, 0x19, 0x1e, |
Herton Ronaldo Krzesinski | 616f89e | 2009-02-04 11:23:19 -0500 | [diff] [blame] | 578 | 0x1f, 0x20, 0x27 |
Matthew Ranostay | e035b84 | 2007-11-06 11:53:55 +0100 | [diff] [blame] | 579 | }; |
| 580 | |
Takashi Iwai | 2b63536 | 2011-05-02 12:33:43 +0200 | [diff] [blame] | 581 | static const hda_nid_t stac927x_pin_nids[14] = { |
Matt Porter | 3cc08dc | 2006-01-23 15:27:49 +0100 | [diff] [blame] | 582 | 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, |
| 583 | 0x0f, 0x10, 0x11, 0x12, 0x13, |
| 584 | 0x14, 0x21, 0x22, 0x23, |
| 585 | }; |
| 586 | |
Takashi Iwai | 2b63536 | 2011-05-02 12:33:43 +0200 | [diff] [blame] | 587 | static const hda_nid_t stac9205_pin_nids[12] = { |
Matt Porter | f3302a5 | 2006-07-31 12:49:34 +0200 | [diff] [blame] | 588 | 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, |
| 589 | 0x0f, 0x14, 0x16, 0x17, 0x18, |
| 590 | 0x21, 0x22, |
Matt Porter | f3302a5 | 2006-07-31 12:49:34 +0200 | [diff] [blame] | 591 | }; |
| 592 | |
Matt Porter | 8b65727 | 2006-10-26 17:12:59 +0200 | [diff] [blame] | 593 | static int stac92xx_dmux_enum_info(struct snd_kcontrol *kcontrol, |
| 594 | struct snd_ctl_elem_info *uinfo) |
| 595 | { |
| 596 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 597 | struct sigmatel_spec *spec = codec->spec; |
| 598 | return snd_hda_input_mux_info(spec->dinput_mux, uinfo); |
| 599 | } |
| 600 | |
| 601 | static int stac92xx_dmux_enum_get(struct snd_kcontrol *kcontrol, |
| 602 | struct snd_ctl_elem_value *ucontrol) |
| 603 | { |
| 604 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 605 | struct sigmatel_spec *spec = codec->spec; |
Matthew Ranostay | e1f0d66 | 2007-12-13 17:47:21 +0100 | [diff] [blame] | 606 | unsigned int dmux_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id); |
Matt Porter | 8b65727 | 2006-10-26 17:12:59 +0200 | [diff] [blame] | 607 | |
Matthew Ranostay | e1f0d66 | 2007-12-13 17:47:21 +0100 | [diff] [blame] | 608 | ucontrol->value.enumerated.item[0] = spec->cur_dmux[dmux_idx]; |
Matt Porter | 8b65727 | 2006-10-26 17:12:59 +0200 | [diff] [blame] | 609 | return 0; |
| 610 | } |
| 611 | |
| 612 | static int stac92xx_dmux_enum_put(struct snd_kcontrol *kcontrol, |
| 613 | struct snd_ctl_elem_value *ucontrol) |
| 614 | { |
| 615 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 616 | struct sigmatel_spec *spec = codec->spec; |
Matthew Ranostay | e1f0d66 | 2007-12-13 17:47:21 +0100 | [diff] [blame] | 617 | unsigned int dmux_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id); |
Matt Porter | 8b65727 | 2006-10-26 17:12:59 +0200 | [diff] [blame] | 618 | |
| 619 | return snd_hda_input_mux_put(codec, spec->dinput_mux, ucontrol, |
Matthew Ranostay | e1f0d66 | 2007-12-13 17:47:21 +0100 | [diff] [blame] | 620 | spec->dmux_nids[dmux_idx], &spec->cur_dmux[dmux_idx]); |
Matt Porter | 8b65727 | 2006-10-26 17:12:59 +0200 | [diff] [blame] | 621 | } |
| 622 | |
Matthew Ranostay | d973775 | 2008-09-07 12:03:41 +0200 | [diff] [blame] | 623 | static int stac92xx_smux_enum_info(struct snd_kcontrol *kcontrol, |
| 624 | struct snd_ctl_elem_info *uinfo) |
| 625 | { |
| 626 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 627 | struct sigmatel_spec *spec = codec->spec; |
| 628 | return snd_hda_input_mux_info(spec->sinput_mux, uinfo); |
| 629 | } |
| 630 | |
| 631 | static int stac92xx_smux_enum_get(struct snd_kcontrol *kcontrol, |
| 632 | struct snd_ctl_elem_value *ucontrol) |
| 633 | { |
| 634 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 635 | struct sigmatel_spec *spec = codec->spec; |
| 636 | unsigned int smux_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id); |
| 637 | |
| 638 | ucontrol->value.enumerated.item[0] = spec->cur_smux[smux_idx]; |
| 639 | return 0; |
| 640 | } |
| 641 | |
| 642 | static int stac92xx_smux_enum_put(struct snd_kcontrol *kcontrol, |
| 643 | struct snd_ctl_elem_value *ucontrol) |
| 644 | { |
| 645 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 646 | struct sigmatel_spec *spec = codec->spec; |
Matthew Ranostay | 00ef50c | 2008-09-27 18:13:47 -0400 | [diff] [blame] | 647 | struct hda_input_mux *smux = &spec->private_smux; |
Matthew Ranostay | d973775 | 2008-09-07 12:03:41 +0200 | [diff] [blame] | 648 | unsigned int smux_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id); |
Matthew Ranostay | 00ef50c | 2008-09-27 18:13:47 -0400 | [diff] [blame] | 649 | int err, val; |
| 650 | hda_nid_t nid; |
Matthew Ranostay | d973775 | 2008-09-07 12:03:41 +0200 | [diff] [blame] | 651 | |
Matthew Ranostay | 00ef50c | 2008-09-27 18:13:47 -0400 | [diff] [blame] | 652 | err = snd_hda_input_mux_put(codec, spec->sinput_mux, ucontrol, |
Matthew Ranostay | d973775 | 2008-09-07 12:03:41 +0200 | [diff] [blame] | 653 | spec->smux_nids[smux_idx], &spec->cur_smux[smux_idx]); |
Matthew Ranostay | 00ef50c | 2008-09-27 18:13:47 -0400 | [diff] [blame] | 654 | if (err < 0) |
| 655 | return err; |
| 656 | |
| 657 | if (spec->spdif_mute) { |
| 658 | if (smux_idx == 0) |
| 659 | nid = spec->multiout.dig_out_nid; |
| 660 | else |
| 661 | nid = codec->slave_dig_outs[smux_idx - 1]; |
| 662 | if (spec->cur_smux[smux_idx] == smux->num_items - 1) |
Takashi Iwai | c9b46f9 | 2008-12-01 11:42:09 +0100 | [diff] [blame] | 663 | val = HDA_AMP_MUTE; |
Matthew Ranostay | 00ef50c | 2008-09-27 18:13:47 -0400 | [diff] [blame] | 664 | else |
Takashi Iwai | c9b46f9 | 2008-12-01 11:42:09 +0100 | [diff] [blame] | 665 | val = 0; |
Matthew Ranostay | 00ef50c | 2008-09-27 18:13:47 -0400 | [diff] [blame] | 666 | /* un/mute SPDIF out */ |
Takashi Iwai | c9b46f9 | 2008-12-01 11:42:09 +0100 | [diff] [blame] | 667 | snd_hda_codec_amp_stereo(codec, nid, HDA_OUTPUT, 0, |
| 668 | HDA_AMP_MUTE, val); |
Matthew Ranostay | 00ef50c | 2008-09-27 18:13:47 -0400 | [diff] [blame] | 669 | } |
| 670 | return 0; |
Matthew Ranostay | d973775 | 2008-09-07 12:03:41 +0200 | [diff] [blame] | 671 | } |
| 672 | |
Vitaliy Kulikov | 45eebda | 2011-07-26 16:56:20 -0500 | [diff] [blame] | 673 | static int stac_vrefout_set(struct hda_codec *codec, |
| 674 | hda_nid_t nid, unsigned int new_vref) |
| 675 | { |
| 676 | int error, pinctl; |
| 677 | |
| 678 | snd_printdd("%s, nid %x ctl %x\n", __func__, nid, new_vref); |
| 679 | pinctl = snd_hda_codec_read(codec, nid, 0, |
| 680 | AC_VERB_GET_PIN_WIDGET_CONTROL, 0); |
| 681 | |
| 682 | if (pinctl < 0) |
| 683 | return pinctl; |
| 684 | |
| 685 | pinctl &= 0xff; |
| 686 | pinctl &= ~AC_PINCTL_VREFEN; |
| 687 | pinctl |= (new_vref & AC_PINCTL_VREFEN); |
| 688 | |
Takashi Iwai | cdd03ce | 2012-04-20 12:34:50 +0200 | [diff] [blame] | 689 | error = snd_hda_set_pin_ctl_cache(codec, nid, pinctl); |
Vitaliy Kulikov | 45eebda | 2011-07-26 16:56:20 -0500 | [diff] [blame] | 690 | if (error < 0) |
| 691 | return error; |
| 692 | |
| 693 | return 1; |
| 694 | } |
| 695 | |
Nickolas Lloyd | 2fc9989 | 2009-05-15 15:33:30 +0200 | [diff] [blame] | 696 | static unsigned int stac92xx_vref_set(struct hda_codec *codec, |
| 697 | hda_nid_t nid, unsigned int new_vref) |
| 698 | { |
Takashi Iwai | b862151 | 2009-06-22 08:00:10 +0200 | [diff] [blame] | 699 | int error; |
Nickolas Lloyd | 2fc9989 | 2009-05-15 15:33:30 +0200 | [diff] [blame] | 700 | unsigned int pincfg; |
| 701 | pincfg = snd_hda_codec_read(codec, nid, 0, |
| 702 | AC_VERB_GET_PIN_WIDGET_CONTROL, 0); |
| 703 | |
| 704 | pincfg &= 0xff; |
| 705 | pincfg &= ~(AC_PINCTL_VREFEN | AC_PINCTL_IN_EN | AC_PINCTL_OUT_EN); |
| 706 | pincfg |= new_vref; |
| 707 | |
| 708 | if (new_vref == AC_PINCTL_VREF_HIZ) |
| 709 | pincfg |= AC_PINCTL_OUT_EN; |
| 710 | else |
| 711 | pincfg |= AC_PINCTL_IN_EN; |
| 712 | |
Takashi Iwai | cdd03ce | 2012-04-20 12:34:50 +0200 | [diff] [blame] | 713 | error = snd_hda_set_pin_ctl_cache(codec, nid, pincfg); |
Nickolas Lloyd | 2fc9989 | 2009-05-15 15:33:30 +0200 | [diff] [blame] | 714 | if (error < 0) |
| 715 | return error; |
| 716 | else |
| 717 | return 1; |
| 718 | } |
| 719 | |
| 720 | static unsigned int stac92xx_vref_get(struct hda_codec *codec, hda_nid_t nid) |
| 721 | { |
| 722 | unsigned int vref; |
| 723 | vref = snd_hda_codec_read(codec, nid, 0, |
| 724 | AC_VERB_GET_PIN_WIDGET_CONTROL, 0); |
| 725 | vref &= AC_PINCTL_VREFEN; |
| 726 | return vref; |
| 727 | } |
| 728 | |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 729 | static int stac92xx_mux_enum_info(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_info *uinfo) |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 730 | { |
| 731 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 732 | struct sigmatel_spec *spec = codec->spec; |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 733 | return snd_hda_input_mux_info(spec->input_mux, uinfo); |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 734 | } |
| 735 | |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 736 | static int stac92xx_mux_enum_get(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 737 | { |
| 738 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 739 | struct sigmatel_spec *spec = codec->spec; |
| 740 | unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id); |
| 741 | |
| 742 | ucontrol->value.enumerated.item[0] = spec->cur_mux[adc_idx]; |
| 743 | return 0; |
| 744 | } |
| 745 | |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 746 | static int stac92xx_mux_enum_put(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 747 | { |
| 748 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 749 | struct sigmatel_spec *spec = codec->spec; |
| 750 | unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id); |
Takashi Iwai | 5207e10 | 2009-07-30 13:09:08 +0200 | [diff] [blame] | 751 | const struct hda_input_mux *imux = spec->input_mux; |
Vitaliy Kulikov | 094a424 | 2011-03-09 19:47:43 -0600 | [diff] [blame] | 752 | unsigned int idx, prev_idx, didx; |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 753 | |
Takashi Iwai | 5207e10 | 2009-07-30 13:09:08 +0200 | [diff] [blame] | 754 | idx = ucontrol->value.enumerated.item[0]; |
| 755 | if (idx >= imux->num_items) |
| 756 | idx = imux->num_items - 1; |
| 757 | prev_idx = spec->cur_mux[adc_idx]; |
| 758 | if (prev_idx == idx) |
| 759 | return 0; |
| 760 | if (idx < spec->num_analog_muxes) { |
| 761 | snd_hda_codec_write_cache(codec, spec->mux_nids[adc_idx], 0, |
| 762 | AC_VERB_SET_CONNECT_SEL, |
| 763 | imux->items[idx].index); |
Vitaliy Kulikov | 094a424 | 2011-03-09 19:47:43 -0600 | [diff] [blame] | 764 | if (prev_idx >= spec->num_analog_muxes && |
| 765 | spec->mux_nids[adc_idx] != spec->dmux_nids[adc_idx]) { |
Takashi Iwai | 5207e10 | 2009-07-30 13:09:08 +0200 | [diff] [blame] | 766 | imux = spec->dinput_mux; |
| 767 | /* 0 = analog */ |
| 768 | snd_hda_codec_write_cache(codec, |
| 769 | spec->dmux_nids[adc_idx], 0, |
| 770 | AC_VERB_SET_CONNECT_SEL, |
| 771 | imux->items[0].index); |
| 772 | } |
| 773 | } else { |
| 774 | imux = spec->dinput_mux; |
Vitaliy Kulikov | 094a424 | 2011-03-09 19:47:43 -0600 | [diff] [blame] | 775 | /* first dimux item is hardcoded to select analog imux, |
| 776 | * so lets skip it |
| 777 | */ |
| 778 | didx = idx - spec->num_analog_muxes + 1; |
Takashi Iwai | 5207e10 | 2009-07-30 13:09:08 +0200 | [diff] [blame] | 779 | snd_hda_codec_write_cache(codec, spec->dmux_nids[adc_idx], 0, |
| 780 | AC_VERB_SET_CONNECT_SEL, |
Vitaliy Kulikov | 094a424 | 2011-03-09 19:47:43 -0600 | [diff] [blame] | 781 | imux->items[didx].index); |
Takashi Iwai | 5207e10 | 2009-07-30 13:09:08 +0200 | [diff] [blame] | 782 | } |
| 783 | spec->cur_mux[adc_idx] = idx; |
| 784 | return 1; |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 785 | } |
| 786 | |
Matthew Ranostay | b22b482 | 2008-01-22 12:32:30 +0100 | [diff] [blame] | 787 | static int stac92xx_mono_mux_enum_info(struct snd_kcontrol *kcontrol, |
| 788 | struct snd_ctl_elem_info *uinfo) |
| 789 | { |
| 790 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 791 | struct sigmatel_spec *spec = codec->spec; |
| 792 | return snd_hda_input_mux_info(spec->mono_mux, uinfo); |
| 793 | } |
| 794 | |
| 795 | static int stac92xx_mono_mux_enum_get(struct snd_kcontrol *kcontrol, |
| 796 | struct snd_ctl_elem_value *ucontrol) |
| 797 | { |
| 798 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 799 | struct sigmatel_spec *spec = codec->spec; |
| 800 | |
| 801 | ucontrol->value.enumerated.item[0] = spec->cur_mmux; |
| 802 | return 0; |
| 803 | } |
| 804 | |
| 805 | static int stac92xx_mono_mux_enum_put(struct snd_kcontrol *kcontrol, |
| 806 | struct snd_ctl_elem_value *ucontrol) |
| 807 | { |
| 808 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 809 | struct sigmatel_spec *spec = codec->spec; |
| 810 | |
| 811 | return snd_hda_input_mux_put(codec, spec->mono_mux, ucontrol, |
| 812 | spec->mono_nid, &spec->cur_mmux); |
| 813 | } |
| 814 | |
Maxim Levitsky | 5f10c4a | 2007-09-03 15:29:37 +0200 | [diff] [blame] | 815 | #define stac92xx_aloopback_info snd_ctl_boolean_mono_info |
| 816 | |
| 817 | static int stac92xx_aloopback_get(struct snd_kcontrol *kcontrol, |
| 818 | struct snd_ctl_elem_value *ucontrol) |
| 819 | { |
| 820 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
Matthew Ranostay | e1f0d66 | 2007-12-13 17:47:21 +0100 | [diff] [blame] | 821 | unsigned int idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id); |
Maxim Levitsky | 5f10c4a | 2007-09-03 15:29:37 +0200 | [diff] [blame] | 822 | struct sigmatel_spec *spec = codec->spec; |
| 823 | |
Matthew Ranostay | e1f0d66 | 2007-12-13 17:47:21 +0100 | [diff] [blame] | 824 | ucontrol->value.integer.value[0] = !!(spec->aloopback & |
| 825 | (spec->aloopback_mask << idx)); |
Maxim Levitsky | 5f10c4a | 2007-09-03 15:29:37 +0200 | [diff] [blame] | 826 | return 0; |
| 827 | } |
| 828 | |
| 829 | static int stac92xx_aloopback_put(struct snd_kcontrol *kcontrol, |
| 830 | struct snd_ctl_elem_value *ucontrol) |
| 831 | { |
| 832 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 833 | struct sigmatel_spec *spec = codec->spec; |
Matthew Ranostay | e1f0d66 | 2007-12-13 17:47:21 +0100 | [diff] [blame] | 834 | unsigned int idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id); |
Maxim Levitsky | 5f10c4a | 2007-09-03 15:29:37 +0200 | [diff] [blame] | 835 | unsigned int dac_mode; |
Matthew Ranostay | e1f0d66 | 2007-12-13 17:47:21 +0100 | [diff] [blame] | 836 | unsigned int val, idx_val; |
Maxim Levitsky | 5f10c4a | 2007-09-03 15:29:37 +0200 | [diff] [blame] | 837 | |
Matthew Ranostay | e1f0d66 | 2007-12-13 17:47:21 +0100 | [diff] [blame] | 838 | idx_val = spec->aloopback_mask << idx; |
| 839 | if (ucontrol->value.integer.value[0]) |
| 840 | val = spec->aloopback | idx_val; |
| 841 | else |
| 842 | val = spec->aloopback & ~idx_val; |
Takashi Iwai | 68ea7b2 | 2007-11-15 15:54:38 +0100 | [diff] [blame] | 843 | if (spec->aloopback == val) |
Maxim Levitsky | 5f10c4a | 2007-09-03 15:29:37 +0200 | [diff] [blame] | 844 | return 0; |
| 845 | |
Takashi Iwai | 68ea7b2 | 2007-11-15 15:54:38 +0100 | [diff] [blame] | 846 | spec->aloopback = val; |
Maxim Levitsky | 5f10c4a | 2007-09-03 15:29:37 +0200 | [diff] [blame] | 847 | |
Matthew Ranostay | e1f0d66 | 2007-12-13 17:47:21 +0100 | [diff] [blame] | 848 | /* Only return the bits defined by the shift value of the |
| 849 | * first two bytes of the mask |
| 850 | */ |
Maxim Levitsky | 5f10c4a | 2007-09-03 15:29:37 +0200 | [diff] [blame] | 851 | dac_mode = snd_hda_codec_read(codec, codec->afg, 0, |
Matthew Ranostay | e1f0d66 | 2007-12-13 17:47:21 +0100 | [diff] [blame] | 852 | kcontrol->private_value & 0xFFFF, 0x0); |
| 853 | dac_mode >>= spec->aloopback_shift; |
Maxim Levitsky | 5f10c4a | 2007-09-03 15:29:37 +0200 | [diff] [blame] | 854 | |
Matthew Ranostay | e1f0d66 | 2007-12-13 17:47:21 +0100 | [diff] [blame] | 855 | if (spec->aloopback & idx_val) { |
Maxim Levitsky | 5f10c4a | 2007-09-03 15:29:37 +0200 | [diff] [blame] | 856 | snd_hda_power_up(codec); |
Matthew Ranostay | e1f0d66 | 2007-12-13 17:47:21 +0100 | [diff] [blame] | 857 | dac_mode |= idx_val; |
Maxim Levitsky | 5f10c4a | 2007-09-03 15:29:37 +0200 | [diff] [blame] | 858 | } else { |
| 859 | snd_hda_power_down(codec); |
Matthew Ranostay | e1f0d66 | 2007-12-13 17:47:21 +0100 | [diff] [blame] | 860 | dac_mode &= ~idx_val; |
Maxim Levitsky | 5f10c4a | 2007-09-03 15:29:37 +0200 | [diff] [blame] | 861 | } |
| 862 | |
| 863 | snd_hda_codec_write_cache(codec, codec->afg, 0, |
| 864 | kcontrol->private_value >> 16, dac_mode); |
| 865 | |
| 866 | return 1; |
| 867 | } |
| 868 | |
Takashi Iwai | 2b63536 | 2011-05-02 12:33:43 +0200 | [diff] [blame] | 869 | static const struct hda_verb stac9200_core_init[] = { |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 870 | /* set dac0mux for dac converter */ |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 871 | { 0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 872 | {} |
| 873 | }; |
| 874 | |
Takashi Iwai | 2b63536 | 2011-05-02 12:33:43 +0200 | [diff] [blame] | 875 | static const struct hda_verb stac9200_eapd_init[] = { |
Takashi Iwai | 1194b5b | 2007-10-10 10:04:26 +0200 | [diff] [blame] | 876 | /* set dac0mux for dac converter */ |
| 877 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 878 | {0x08, AC_VERB_SET_EAPD_BTLENABLE, 0x02}, |
| 879 | {} |
| 880 | }; |
| 881 | |
Takashi Iwai | 2b63536 | 2011-05-02 12:33:43 +0200 | [diff] [blame] | 882 | static const struct hda_verb dell_eq_core_init[] = { |
Matthew Ranostay | d654a66 | 2008-03-14 08:46:51 +0100 | [diff] [blame] | 883 | /* set master volume to max value without distortion |
| 884 | * and direct control */ |
| 885 | { 0x1f, AC_VERB_SET_VOLUME_KNOB_CONTROL, 0xec}, |
Matthew Ranostay | d654a66 | 2008-03-14 08:46:51 +0100 | [diff] [blame] | 886 | {} |
| 887 | }; |
| 888 | |
Takashi Iwai | 2b63536 | 2011-05-02 12:33:43 +0200 | [diff] [blame] | 889 | static const struct hda_verb stac92hd73xx_core_init[] = { |
Matthew Ranostay | e1f0d66 | 2007-12-13 17:47:21 +0100 | [diff] [blame] | 890 | /* set master volume and direct control */ |
| 891 | { 0x1f, AC_VERB_SET_VOLUME_KNOB_CONTROL, 0xff}, |
Matthew Ranostay | e1f0d66 | 2007-12-13 17:47:21 +0100 | [diff] [blame] | 892 | {} |
| 893 | }; |
| 894 | |
Takashi Iwai | 2b63536 | 2011-05-02 12:33:43 +0200 | [diff] [blame] | 895 | static const struct hda_verb stac92hd83xxx_core_init[] = { |
Matthew Ranostay | d0513fc | 2008-07-27 10:30:30 +0200 | [diff] [blame] | 896 | /* power state controls amps */ |
| 897 | { 0x01, AC_VERB_SET_EAPD, 1 << 2}, |
Herton Ronaldo Krzesinski | 574f3c4 | 2008-12-23 16:53:00 -0200 | [diff] [blame] | 898 | {} |
Matthew Ranostay | d0513fc | 2008-07-27 10:30:30 +0200 | [diff] [blame] | 899 | }; |
| 900 | |
Vitaliy Kulikov | 5556e14 | 2012-02-27 16:47:37 -0600 | [diff] [blame] | 901 | static const struct hda_verb stac92hd83xxx_hp_zephyr_init[] = { |
| 902 | { 0x22, 0x785, 0x43 }, |
| 903 | { 0x22, 0x782, 0xe0 }, |
| 904 | { 0x22, 0x795, 0x00 }, |
| 905 | {} |
| 906 | }; |
| 907 | |
Takashi Iwai | 2b63536 | 2011-05-02 12:33:43 +0200 | [diff] [blame] | 908 | static const struct hda_verb stac92hd71bxx_core_init[] = { |
Matthew Ranostay | e035b84 | 2007-11-06 11:53:55 +0100 | [diff] [blame] | 909 | /* set master volume and direct control */ |
| 910 | { 0x28, AC_VERB_SET_VOLUME_KNOB_CONTROL, 0xff}, |
Herton Ronaldo Krzesinski | 574f3c4 | 2008-12-23 16:53:00 -0200 | [diff] [blame] | 911 | {} |
Matthew Ranostay | 541eee8 | 2007-12-14 12:08:04 +0100 | [diff] [blame] | 912 | }; |
| 913 | |
Takashi Iwai | 2b63536 | 2011-05-02 12:33:43 +0200 | [diff] [blame] | 914 | static const struct hda_verb stac92hd71bxx_unmute_core_init[] = { |
Matthew Ranostay | ca8d33f | 2009-01-26 09:33:52 -0500 | [diff] [blame] | 915 | /* unmute right and left channels for nodes 0x0f, 0xa, 0x0d */ |
| 916 | { 0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Matthew Ranostay | e035b84 | 2007-11-06 11:53:55 +0100 | [diff] [blame] | 917 | { 0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 918 | { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Matthew Ranostay | e035b84 | 2007-11-06 11:53:55 +0100 | [diff] [blame] | 919 | {} |
| 920 | }; |
| 921 | |
Takashi Iwai | 2b63536 | 2011-05-02 12:33:43 +0200 | [diff] [blame] | 922 | static const struct hda_verb stac925x_core_init[] = { |
Tobin Davis | 8e21c34 | 2007-01-08 11:04:17 +0100 | [diff] [blame] | 923 | /* set dac0mux for dac converter */ |
| 924 | { 0x06, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | c9280d6 | 2009-01-15 17:31:00 +0100 | [diff] [blame] | 925 | /* mute the master volume */ |
| 926 | { 0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
Tobin Davis | 8e21c34 | 2007-01-08 11:04:17 +0100 | [diff] [blame] | 927 | {} |
| 928 | }; |
| 929 | |
Takashi Iwai | 2b63536 | 2011-05-02 12:33:43 +0200 | [diff] [blame] | 930 | static const struct hda_verb stac922x_core_init[] = { |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 931 | /* set master volume and direct control */ |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 932 | { 0x16, AC_VERB_SET_VOLUME_KNOB_CONTROL, 0xff}, |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 933 | {} |
| 934 | }; |
| 935 | |
Takashi Iwai | 2b63536 | 2011-05-02 12:33:43 +0200 | [diff] [blame] | 936 | static const struct hda_verb d965_core_init[] = { |
Takashi Iwai | 19039bd | 2006-06-28 15:52:16 +0200 | [diff] [blame] | 937 | /* set master volume and direct control */ |
Tobin Davis | 93ed150 | 2006-09-01 21:03:12 +0200 | [diff] [blame] | 938 | { 0x24, AC_VERB_SET_VOLUME_KNOB_CONTROL, 0xff}, |
Takashi Iwai | 19039bd | 2006-06-28 15:52:16 +0200 | [diff] [blame] | 939 | /* unmute node 0x1b */ |
| 940 | { 0x1b, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000}, |
| 941 | /* select node 0x03 as DAC */ |
| 942 | { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 943 | {} |
| 944 | }; |
| 945 | |
Takashi Iwai | 2b63536 | 2011-05-02 12:33:43 +0200 | [diff] [blame] | 946 | static const struct hda_verb dell_3st_core_init[] = { |
Takashi Iwai | ccca7cd | 2009-10-13 15:32:21 +0200 | [diff] [blame] | 947 | /* don't set delta bit */ |
| 948 | {0x24, AC_VERB_SET_VOLUME_KNOB_CONTROL, 0x7f}, |
| 949 | /* unmute node 0x1b */ |
| 950 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000}, |
| 951 | /* select node 0x03 as DAC */ |
| 952 | {0x0b, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 953 | {} |
| 954 | }; |
| 955 | |
Takashi Iwai | 2b63536 | 2011-05-02 12:33:43 +0200 | [diff] [blame] | 956 | static const struct hda_verb stac927x_core_init[] = { |
Matt Porter | 3cc08dc | 2006-01-23 15:27:49 +0100 | [diff] [blame] | 957 | /* set master volume and direct control */ |
| 958 | { 0x24, AC_VERB_SET_VOLUME_KNOB_CONTROL, 0xff}, |
Matthew Ranostay | 1cd2224 | 2008-07-18 18:20:52 +0200 | [diff] [blame] | 959 | /* enable analog pc beep path */ |
| 960 | { 0x01, AC_VERB_SET_DIGI_CONVERT_2, 1 << 5}, |
Matt Porter | 3cc08dc | 2006-01-23 15:27:49 +0100 | [diff] [blame] | 961 | {} |
| 962 | }; |
| 963 | |
Takashi Iwai | 2b63536 | 2011-05-02 12:33:43 +0200 | [diff] [blame] | 964 | static const struct hda_verb stac927x_volknob_core_init[] = { |
Takashi Iwai | 5493053 | 2009-10-11 17:38:29 +0200 | [diff] [blame] | 965 | /* don't set delta bit */ |
| 966 | {0x24, AC_VERB_SET_VOLUME_KNOB_CONTROL, 0x7f}, |
| 967 | /* enable analog pc beep path */ |
| 968 | {0x01, AC_VERB_SET_DIGI_CONVERT_2, 1 << 5}, |
| 969 | {} |
| 970 | }; |
| 971 | |
Takashi Iwai | 2b63536 | 2011-05-02 12:33:43 +0200 | [diff] [blame] | 972 | static const struct hda_verb stac9205_core_init[] = { |
Matt Porter | f3302a5 | 2006-07-31 12:49:34 +0200 | [diff] [blame] | 973 | /* set master volume and direct control */ |
| 974 | { 0x24, AC_VERB_SET_VOLUME_KNOB_CONTROL, 0xff}, |
Matthew Ranostay | d0513fc | 2008-07-27 10:30:30 +0200 | [diff] [blame] | 975 | /* enable analog pc beep path */ |
| 976 | { 0x01, AC_VERB_SET_DIGI_CONVERT_2, 1 << 5}, |
Matt Porter | f3302a5 | 2006-07-31 12:49:34 +0200 | [diff] [blame] | 977 | {} |
| 978 | }; |
| 979 | |
Matthew Ranostay | b22b482 | 2008-01-22 12:32:30 +0100 | [diff] [blame] | 980 | #define STAC_MONO_MUX \ |
| 981 | { \ |
| 982 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \ |
| 983 | .name = "Mono Mux", \ |
| 984 | .count = 1, \ |
| 985 | .info = stac92xx_mono_mux_enum_info, \ |
| 986 | .get = stac92xx_mono_mux_enum_get, \ |
| 987 | .put = stac92xx_mono_mux_enum_put, \ |
| 988 | } |
| 989 | |
Matthew Ranostay | e1f0d66 | 2007-12-13 17:47:21 +0100 | [diff] [blame] | 990 | #define STAC_ANALOG_LOOPBACK(verb_read, verb_write, cnt) \ |
Maxim Levitsky | 5f10c4a | 2007-09-03 15:29:37 +0200 | [diff] [blame] | 991 | { \ |
| 992 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \ |
| 993 | .name = "Analog Loopback", \ |
Matthew Ranostay | e1f0d66 | 2007-12-13 17:47:21 +0100 | [diff] [blame] | 994 | .count = cnt, \ |
Maxim Levitsky | 5f10c4a | 2007-09-03 15:29:37 +0200 | [diff] [blame] | 995 | .info = stac92xx_aloopback_info, \ |
| 996 | .get = stac92xx_aloopback_get, \ |
| 997 | .put = stac92xx_aloopback_put, \ |
| 998 | .private_value = verb_read | (verb_write << 16), \ |
| 999 | } |
| 1000 | |
Nickolas Lloyd | 2fc9989 | 2009-05-15 15:33:30 +0200 | [diff] [blame] | 1001 | #define DC_BIAS(xname, idx, nid) \ |
| 1002 | { \ |
| 1003 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \ |
| 1004 | .name = xname, \ |
| 1005 | .index = idx, \ |
| 1006 | .info = stac92xx_dc_bias_info, \ |
| 1007 | .get = stac92xx_dc_bias_get, \ |
| 1008 | .put = stac92xx_dc_bias_put, \ |
| 1009 | .private_value = nid, \ |
| 1010 | } |
| 1011 | |
Takashi Iwai | 2b63536 | 2011-05-02 12:33:43 +0200 | [diff] [blame] | 1012 | static const struct snd_kcontrol_new stac9200_mixer[] = { |
Takashi Iwai | 2faa3bf | 2012-03-12 12:30:22 +0100 | [diff] [blame] | 1013 | HDA_CODEC_VOLUME_MIN_MUTE("PCM Playback Volume", 0xb, 0, HDA_OUTPUT), |
| 1014 | HDA_CODEC_MUTE("PCM Playback Switch", 0xb, 0, HDA_OUTPUT), |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 1015 | HDA_CODEC_VOLUME("Capture Volume", 0x0a, 0, HDA_OUTPUT), |
| 1016 | HDA_CODEC_MUTE("Capture Switch", 0x0a, 0, HDA_OUTPUT), |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 1017 | { } /* end */ |
| 1018 | }; |
| 1019 | |
Takashi Iwai | 2b63536 | 2011-05-02 12:33:43 +0200 | [diff] [blame] | 1020 | static const struct snd_kcontrol_new stac92hd73xx_6ch_loopback[] = { |
Takashi Iwai | d78d7a9 | 2009-03-02 14:26:25 +0100 | [diff] [blame] | 1021 | STAC_ANALOG_LOOPBACK(0xFA0, 0x7A1, 3), |
| 1022 | {} |
| 1023 | }; |
Matthew Ranostay | e1f0d66 | 2007-12-13 17:47:21 +0100 | [diff] [blame] | 1024 | |
Takashi Iwai | 2b63536 | 2011-05-02 12:33:43 +0200 | [diff] [blame] | 1025 | static const struct snd_kcontrol_new stac92hd73xx_8ch_loopback[] = { |
Takashi Iwai | d78d7a9 | 2009-03-02 14:26:25 +0100 | [diff] [blame] | 1026 | STAC_ANALOG_LOOPBACK(0xFA0, 0x7A1, 4), |
| 1027 | {} |
| 1028 | }; |
| 1029 | |
Takashi Iwai | 2b63536 | 2011-05-02 12:33:43 +0200 | [diff] [blame] | 1030 | static const struct snd_kcontrol_new stac92hd73xx_10ch_loopback[] = { |
Takashi Iwai | d78d7a9 | 2009-03-02 14:26:25 +0100 | [diff] [blame] | 1031 | STAC_ANALOG_LOOPBACK(0xFA0, 0x7A1, 5), |
| 1032 | {} |
| 1033 | }; |
| 1034 | |
Matthew Ranostay | d0513fc | 2008-07-27 10:30:30 +0200 | [diff] [blame] | 1035 | |
Takashi Iwai | 2b63536 | 2011-05-02 12:33:43 +0200 | [diff] [blame] | 1036 | static const struct snd_kcontrol_new stac92hd71bxx_loopback[] = { |
Takashi Iwai | d78d7a9 | 2009-03-02 14:26:25 +0100 | [diff] [blame] | 1037 | STAC_ANALOG_LOOPBACK(0xFA0, 0x7A0, 2) |
| 1038 | }; |
Matthew Ranostay | 541eee8 | 2007-12-14 12:08:04 +0100 | [diff] [blame] | 1039 | |
Takashi Iwai | 2b63536 | 2011-05-02 12:33:43 +0200 | [diff] [blame] | 1040 | static const struct snd_kcontrol_new stac925x_mixer[] = { |
Takashi Iwai | 2faa3bf | 2012-03-12 12:30:22 +0100 | [diff] [blame] | 1041 | HDA_CODEC_VOLUME_MIN_MUTE("PCM Playback Volume", 0xe, 0, HDA_OUTPUT), |
| 1042 | HDA_CODEC_MUTE("PCM Playback Switch", 0x0e, 0, HDA_OUTPUT), |
Maxim Levitsky | 9e05b7a | 2007-09-03 15:31:02 +0200 | [diff] [blame] | 1043 | { } /* end */ |
| 1044 | }; |
| 1045 | |
Takashi Iwai | 2b63536 | 2011-05-02 12:33:43 +0200 | [diff] [blame] | 1046 | static const struct snd_kcontrol_new stac9205_loopback[] = { |
Takashi Iwai | d78d7a9 | 2009-03-02 14:26:25 +0100 | [diff] [blame] | 1047 | STAC_ANALOG_LOOPBACK(0xFE0, 0x7E0, 1), |
| 1048 | {} |
| 1049 | }; |
| 1050 | |
Takashi Iwai | 2b63536 | 2011-05-02 12:33:43 +0200 | [diff] [blame] | 1051 | static const struct snd_kcontrol_new stac927x_loopback[] = { |
Takashi Iwai | d78d7a9 | 2009-03-02 14:26:25 +0100 | [diff] [blame] | 1052 | STAC_ANALOG_LOOPBACK(0xFEB, 0x7EB, 1), |
| 1053 | {} |
| 1054 | }; |
| 1055 | |
Takashi Iwai | 1697055e | 2007-12-18 18:05:52 +0100 | [diff] [blame] | 1056 | static struct snd_kcontrol_new stac_dmux_mixer = { |
| 1057 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 1058 | .name = "Digital Input Source", |
| 1059 | /* count set later */ |
| 1060 | .info = stac92xx_dmux_enum_info, |
| 1061 | .get = stac92xx_dmux_enum_get, |
| 1062 | .put = stac92xx_dmux_enum_put, |
| 1063 | }; |
| 1064 | |
Matthew Ranostay | d973775 | 2008-09-07 12:03:41 +0200 | [diff] [blame] | 1065 | static struct snd_kcontrol_new stac_smux_mixer = { |
| 1066 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
Matthew Ranostay | e348797 | 2008-09-08 11:36:59 -0400 | [diff] [blame] | 1067 | .name = "IEC958 Playback Source", |
Matthew Ranostay | d973775 | 2008-09-07 12:03:41 +0200 | [diff] [blame] | 1068 | /* count set later */ |
| 1069 | .info = stac92xx_smux_enum_info, |
| 1070 | .get = stac92xx_smux_enum_get, |
| 1071 | .put = stac92xx_smux_enum_put, |
| 1072 | }; |
| 1073 | |
Takashi Iwai | 9322ca5 | 2012-02-03 14:28:01 +0100 | [diff] [blame] | 1074 | static const char * const slave_pfxs[] = { |
| 1075 | "Front", "Surround", "Center", "LFE", "Side", |
| 1076 | "Headphone", "Speaker", "IEC958", |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 1077 | NULL |
| 1078 | }; |
| 1079 | |
Takashi Iwai | 2faa3bf | 2012-03-12 12:30:22 +0100 | [diff] [blame] | 1080 | static void stac92xx_update_led_status(struct hda_codec *codec, int enabled); |
| 1081 | |
| 1082 | static void stac92xx_vmaster_hook(void *private_data, int val) |
| 1083 | { |
| 1084 | stac92xx_update_led_status(private_data, val); |
| 1085 | } |
| 1086 | |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 1087 | static void stac92xx_free_kctls(struct hda_codec *codec); |
| 1088 | |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 1089 | static int stac92xx_build_controls(struct hda_codec *codec) |
| 1090 | { |
| 1091 | struct sigmatel_spec *spec = codec->spec; |
Takashi Iwai | 2faa3bf | 2012-03-12 12:30:22 +0100 | [diff] [blame] | 1092 | unsigned int vmaster_tlv[4]; |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 1093 | int err; |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 1094 | int i; |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 1095 | |
Takashi Iwai | 6479c63 | 2009-07-28 18:20:25 +0200 | [diff] [blame] | 1096 | if (spec->mixer) { |
| 1097 | err = snd_hda_add_new_ctls(codec, spec->mixer); |
| 1098 | if (err < 0) |
| 1099 | return err; |
| 1100 | } |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 1101 | |
| 1102 | for (i = 0; i < spec->num_mixers; i++) { |
| 1103 | err = snd_hda_add_new_ctls(codec, spec->mixers[i]); |
| 1104 | if (err < 0) |
| 1105 | return err; |
| 1106 | } |
Takashi Iwai | 5207e10 | 2009-07-30 13:09:08 +0200 | [diff] [blame] | 1107 | if (!spec->auto_mic && spec->num_dmuxes > 0 && |
| 1108 | snd_hda_get_bool_hint(codec, "separate_dmux") == 1) { |
Takashi Iwai | 1697055e | 2007-12-18 18:05:52 +0100 | [diff] [blame] | 1109 | stac_dmux_mixer.count = spec->num_dmuxes; |
Jaroslav Kysela | 3911a4c | 2009-11-11 13:43:01 +0100 | [diff] [blame] | 1110 | err = snd_hda_ctl_add(codec, 0, |
Takashi Iwai | 1697055e | 2007-12-18 18:05:52 +0100 | [diff] [blame] | 1111 | snd_ctl_new1(&stac_dmux_mixer, codec)); |
| 1112 | if (err < 0) |
| 1113 | return err; |
| 1114 | } |
Matthew Ranostay | d973775 | 2008-09-07 12:03:41 +0200 | [diff] [blame] | 1115 | if (spec->num_smuxes > 0) { |
Matthew Ranostay | 00ef50c | 2008-09-27 18:13:47 -0400 | [diff] [blame] | 1116 | int wcaps = get_wcaps(codec, spec->multiout.dig_out_nid); |
| 1117 | struct hda_input_mux *smux = &spec->private_smux; |
| 1118 | /* check for mute support on SPDIF out */ |
| 1119 | if (wcaps & AC_WCAP_OUT_AMP) { |
Takashi Iwai | 10a20af | 2010-09-09 16:28:02 +0200 | [diff] [blame] | 1120 | snd_hda_add_imux_item(smux, "Off", 0, NULL); |
Matthew Ranostay | 00ef50c | 2008-09-27 18:13:47 -0400 | [diff] [blame] | 1121 | spec->spdif_mute = 1; |
| 1122 | } |
Matthew Ranostay | d973775 | 2008-09-07 12:03:41 +0200 | [diff] [blame] | 1123 | stac_smux_mixer.count = spec->num_smuxes; |
Jaroslav Kysela | 3911a4c | 2009-11-11 13:43:01 +0100 | [diff] [blame] | 1124 | err = snd_hda_ctl_add(codec, 0, |
Matthew Ranostay | d973775 | 2008-09-07 12:03:41 +0200 | [diff] [blame] | 1125 | snd_ctl_new1(&stac_smux_mixer, codec)); |
| 1126 | if (err < 0) |
| 1127 | return err; |
| 1128 | } |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 1129 | |
Matt | dabbed6 | 2005-06-14 10:19:34 +0200 | [diff] [blame] | 1130 | if (spec->multiout.dig_out_nid) { |
Stephen Warren | 74b654c | 2011-06-01 11:14:18 -0600 | [diff] [blame] | 1131 | err = snd_hda_create_spdif_out_ctls(codec, |
| 1132 | spec->multiout.dig_out_nid, |
| 1133 | spec->multiout.dig_out_nid); |
Matt | dabbed6 | 2005-06-14 10:19:34 +0200 | [diff] [blame] | 1134 | if (err < 0) |
| 1135 | return err; |
Takashi Iwai | 9a08160 | 2008-02-12 18:37:26 +0100 | [diff] [blame] | 1136 | err = snd_hda_create_spdif_share_sw(codec, |
| 1137 | &spec->multiout); |
| 1138 | if (err < 0) |
| 1139 | return err; |
| 1140 | spec->multiout.share_spdif = 1; |
Matt | dabbed6 | 2005-06-14 10:19:34 +0200 | [diff] [blame] | 1141 | } |
Harvey Harrison | da74ae3 | 2008-10-21 20:28:04 -0700 | [diff] [blame] | 1142 | if (spec->dig_in_nid && !(spec->gpio_dir & 0x01)) { |
Matt | dabbed6 | 2005-06-14 10:19:34 +0200 | [diff] [blame] | 1143 | err = snd_hda_create_spdif_in_ctls(codec, spec->dig_in_nid); |
| 1144 | if (err < 0) |
| 1145 | return err; |
| 1146 | } |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 1147 | |
| 1148 | /* if we have no master control, let's create it */ |
Takashi Iwai | 2faa3bf | 2012-03-12 12:30:22 +0100 | [diff] [blame] | 1149 | snd_hda_set_vmaster_tlv(codec, spec->multiout.dac_nids[0], |
| 1150 | HDA_OUTPUT, vmaster_tlv); |
| 1151 | /* correct volume offset */ |
| 1152 | vmaster_tlv[2] += vmaster_tlv[3] * spec->volume_offset; |
| 1153 | /* minimum value is actually mute */ |
| 1154 | vmaster_tlv[3] |= TLV_DB_SCALE_MUTE; |
| 1155 | err = snd_hda_add_vmaster(codec, "Master Playback Volume", |
| 1156 | vmaster_tlv, slave_pfxs, |
| 1157 | "Playback Volume"); |
| 1158 | if (err < 0) |
| 1159 | return err; |
| 1160 | |
| 1161 | err = __snd_hda_add_vmaster(codec, "Master Playback Switch", |
| 1162 | NULL, slave_pfxs, |
| 1163 | "Playback Switch", true, |
Takashi Iwai | d2f344b | 2012-03-12 16:59:58 +0100 | [diff] [blame] | 1164 | &spec->vmaster_mute.sw_kctl); |
Takashi Iwai | 2faa3bf | 2012-03-12 12:30:22 +0100 | [diff] [blame] | 1165 | if (err < 0) |
| 1166 | return err; |
| 1167 | |
| 1168 | if (spec->gpio_led) { |
Takashi Iwai | d2f344b | 2012-03-12 16:59:58 +0100 | [diff] [blame] | 1169 | spec->vmaster_mute.hook = stac92xx_vmaster_hook; |
Takashi Iwai | f29735c | 2012-03-13 07:55:10 +0100 | [diff] [blame] | 1170 | err = snd_hda_add_vmaster_hook(codec, &spec->vmaster_mute, true); |
Takashi Iwai | d2f344b | 2012-03-12 16:59:58 +0100 | [diff] [blame] | 1171 | if (err < 0) |
| 1172 | return err; |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 1173 | } |
| 1174 | |
Takashi Iwai | d78d7a9 | 2009-03-02 14:26:25 +0100 | [diff] [blame] | 1175 | if (spec->aloopback_ctl && |
| 1176 | snd_hda_get_bool_hint(codec, "loopback") == 1) { |
| 1177 | err = snd_hda_add_new_ctls(codec, spec->aloopback_ctl); |
| 1178 | if (err < 0) |
| 1179 | return err; |
| 1180 | } |
| 1181 | |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 1182 | stac92xx_free_kctls(codec); /* no longer needed */ |
Takashi Iwai | e4973e1 | 2008-11-18 09:32:42 +0100 | [diff] [blame] | 1183 | |
Takashi Iwai | 01a61e1 | 2011-10-28 00:03:22 +0200 | [diff] [blame] | 1184 | err = snd_hda_jack_add_kctls(codec, &spec->autocfg); |
| 1185 | if (err < 0) |
| 1186 | return err; |
Takashi Iwai | e4973e1 | 2008-11-18 09:32:42 +0100 | [diff] [blame] | 1187 | |
Matt | dabbed6 | 2005-06-14 10:19:34 +0200 | [diff] [blame] | 1188 | return 0; |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 1189 | } |
| 1190 | |
Takashi Iwai | 2b63536 | 2011-05-02 12:33:43 +0200 | [diff] [blame] | 1191 | static const unsigned int ref9200_pin_configs[8] = { |
Matt | dabbed6 | 2005-06-14 10:19:34 +0200 | [diff] [blame] | 1192 | 0x01c47010, 0x01447010, 0x0221401f, 0x01114010, |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 1193 | 0x02a19020, 0x01a19021, 0x90100140, 0x01813122, |
| 1194 | }; |
| 1195 | |
Takashi Iwai | 2b63536 | 2011-05-02 12:33:43 +0200 | [diff] [blame] | 1196 | static const unsigned int gateway9200_m4_pin_configs[8] = { |
Mauro Carvalho Chehab | 58eec42 | 2008-08-11 10:18:39 +0200 | [diff] [blame] | 1197 | 0x400000fe, 0x404500f4, 0x400100f0, 0x90110010, |
| 1198 | 0x400100f1, 0x02a1902e, 0x500000f2, 0x500000f3, |
| 1199 | }; |
Takashi Iwai | 2b63536 | 2011-05-02 12:33:43 +0200 | [diff] [blame] | 1200 | static const unsigned int gateway9200_m4_2_pin_configs[8] = { |
Mauro Carvalho Chehab | 58eec42 | 2008-08-11 10:18:39 +0200 | [diff] [blame] | 1201 | 0x400000fe, 0x404500f4, 0x400100f0, 0x90110010, |
| 1202 | 0x400100f1, 0x02a1902e, 0x500000f2, 0x500000f3, |
| 1203 | }; |
| 1204 | |
| 1205 | /* |
Takashi Iwai | dfe495d | 2007-08-23 19:04:28 +0200 | [diff] [blame] | 1206 | STAC 9200 pin configs for |
| 1207 | 102801A8 |
| 1208 | 102801DE |
| 1209 | 102801E8 |
| 1210 | */ |
Takashi Iwai | 2b63536 | 2011-05-02 12:33:43 +0200 | [diff] [blame] | 1211 | static const unsigned int dell9200_d21_pin_configs[8] = { |
Takashi Iwai | af6c016 | 2007-09-05 23:46:03 +0200 | [diff] [blame] | 1212 | 0x400001f0, 0x400001f1, 0x02214030, 0x01014010, |
| 1213 | 0x02a19020, 0x01a19021, 0x90100140, 0x01813122, |
Takashi Iwai | dfe495d | 2007-08-23 19:04:28 +0200 | [diff] [blame] | 1214 | }; |
| 1215 | |
| 1216 | /* |
| 1217 | STAC 9200 pin configs for |
| 1218 | 102801C0 |
| 1219 | 102801C1 |
| 1220 | */ |
Takashi Iwai | 2b63536 | 2011-05-02 12:33:43 +0200 | [diff] [blame] | 1221 | static const unsigned int dell9200_d22_pin_configs[8] = { |
Takashi Iwai | af6c016 | 2007-09-05 23:46:03 +0200 | [diff] [blame] | 1222 | 0x400001f0, 0x400001f1, 0x0221401f, 0x01014010, |
| 1223 | 0x01813020, 0x02a19021, 0x90100140, 0x400001f2, |
Takashi Iwai | dfe495d | 2007-08-23 19:04:28 +0200 | [diff] [blame] | 1224 | }; |
| 1225 | |
| 1226 | /* |
| 1227 | STAC 9200 pin configs for |
| 1228 | 102801C4 (Dell Dimension E310) |
| 1229 | 102801C5 |
| 1230 | 102801C7 |
| 1231 | 102801D9 |
| 1232 | 102801DA |
| 1233 | 102801E3 |
| 1234 | */ |
Takashi Iwai | 2b63536 | 2011-05-02 12:33:43 +0200 | [diff] [blame] | 1235 | static const unsigned int dell9200_d23_pin_configs[8] = { |
Takashi Iwai | af6c016 | 2007-09-05 23:46:03 +0200 | [diff] [blame] | 1236 | 0x400001f0, 0x400001f1, 0x0221401f, 0x01014010, |
| 1237 | 0x01813020, 0x01a19021, 0x90100140, 0x400001f2, |
Takashi Iwai | dfe495d | 2007-08-23 19:04:28 +0200 | [diff] [blame] | 1238 | }; |
| 1239 | |
| 1240 | |
| 1241 | /* |
| 1242 | STAC 9200-32 pin configs for |
| 1243 | 102801B5 (Dell Inspiron 630m) |
| 1244 | 102801D8 (Dell Inspiron 640m) |
| 1245 | */ |
Takashi Iwai | 2b63536 | 2011-05-02 12:33:43 +0200 | [diff] [blame] | 1246 | static const unsigned int dell9200_m21_pin_configs[8] = { |
Takashi Iwai | af6c016 | 2007-09-05 23:46:03 +0200 | [diff] [blame] | 1247 | 0x40c003fa, 0x03441340, 0x0321121f, 0x90170310, |
| 1248 | 0x408003fb, 0x03a11020, 0x401003fc, 0x403003fd, |
Takashi Iwai | dfe495d | 2007-08-23 19:04:28 +0200 | [diff] [blame] | 1249 | }; |
| 1250 | |
| 1251 | /* |
| 1252 | STAC 9200-32 pin configs for |
| 1253 | 102801C2 (Dell Latitude D620) |
| 1254 | 102801C8 |
| 1255 | 102801CC (Dell Latitude D820) |
| 1256 | 102801D4 |
| 1257 | 102801D6 |
| 1258 | */ |
Takashi Iwai | 2b63536 | 2011-05-02 12:33:43 +0200 | [diff] [blame] | 1259 | static const unsigned int dell9200_m22_pin_configs[8] = { |
Takashi Iwai | af6c016 | 2007-09-05 23:46:03 +0200 | [diff] [blame] | 1260 | 0x40c003fa, 0x0144131f, 0x0321121f, 0x90170310, |
| 1261 | 0x90a70321, 0x03a11020, 0x401003fb, 0x40f000fc, |
Takashi Iwai | dfe495d | 2007-08-23 19:04:28 +0200 | [diff] [blame] | 1262 | }; |
| 1263 | |
| 1264 | /* |
| 1265 | STAC 9200-32 pin configs for |
| 1266 | 102801CE (Dell XPS M1710) |
| 1267 | 102801CF (Dell Precision M90) |
| 1268 | */ |
Takashi Iwai | 2b63536 | 2011-05-02 12:33:43 +0200 | [diff] [blame] | 1269 | static const unsigned int dell9200_m23_pin_configs[8] = { |
Takashi Iwai | dfe495d | 2007-08-23 19:04:28 +0200 | [diff] [blame] | 1270 | 0x40c003fa, 0x01441340, 0x0421421f, 0x90170310, |
| 1271 | 0x408003fb, 0x04a1102e, 0x90170311, 0x403003fc, |
| 1272 | }; |
| 1273 | |
| 1274 | /* |
| 1275 | STAC 9200-32 pin configs for |
| 1276 | 102801C9 |
| 1277 | 102801CA |
| 1278 | 102801CB (Dell Latitude 120L) |
| 1279 | 102801D3 |
| 1280 | */ |
Takashi Iwai | 2b63536 | 2011-05-02 12:33:43 +0200 | [diff] [blame] | 1281 | static const unsigned int dell9200_m24_pin_configs[8] = { |
Takashi Iwai | af6c016 | 2007-09-05 23:46:03 +0200 | [diff] [blame] | 1282 | 0x40c003fa, 0x404003fb, 0x0321121f, 0x90170310, |
| 1283 | 0x408003fc, 0x03a11020, 0x401003fd, 0x403003fe, |
Takashi Iwai | dfe495d | 2007-08-23 19:04:28 +0200 | [diff] [blame] | 1284 | }; |
| 1285 | |
| 1286 | /* |
| 1287 | STAC 9200-32 pin configs for |
| 1288 | 102801BD (Dell Inspiron E1505n) |
| 1289 | 102801EE |
| 1290 | 102801EF |
| 1291 | */ |
Takashi Iwai | 2b63536 | 2011-05-02 12:33:43 +0200 | [diff] [blame] | 1292 | static const unsigned int dell9200_m25_pin_configs[8] = { |
Takashi Iwai | af6c016 | 2007-09-05 23:46:03 +0200 | [diff] [blame] | 1293 | 0x40c003fa, 0x01441340, 0x0421121f, 0x90170310, |
| 1294 | 0x408003fb, 0x04a11020, 0x401003fc, 0x403003fd, |
Takashi Iwai | dfe495d | 2007-08-23 19:04:28 +0200 | [diff] [blame] | 1295 | }; |
| 1296 | |
| 1297 | /* |
| 1298 | STAC 9200-32 pin configs for |
| 1299 | 102801F5 (Dell Inspiron 1501) |
| 1300 | 102801F6 |
| 1301 | */ |
Takashi Iwai | 2b63536 | 2011-05-02 12:33:43 +0200 | [diff] [blame] | 1302 | static const unsigned int dell9200_m26_pin_configs[8] = { |
Takashi Iwai | af6c016 | 2007-09-05 23:46:03 +0200 | [diff] [blame] | 1303 | 0x40c003fa, 0x404003fb, 0x0421121f, 0x90170310, |
| 1304 | 0x408003fc, 0x04a11020, 0x401003fd, 0x403003fe, |
Takashi Iwai | dfe495d | 2007-08-23 19:04:28 +0200 | [diff] [blame] | 1305 | }; |
| 1306 | |
| 1307 | /* |
| 1308 | STAC 9200-32 |
| 1309 | 102801CD (Dell Inspiron E1705/9400) |
| 1310 | */ |
Takashi Iwai | 2b63536 | 2011-05-02 12:33:43 +0200 | [diff] [blame] | 1311 | static const unsigned int dell9200_m27_pin_configs[8] = { |
Takashi Iwai | af6c016 | 2007-09-05 23:46:03 +0200 | [diff] [blame] | 1312 | 0x40c003fa, 0x01441340, 0x0421121f, 0x90170310, |
| 1313 | 0x90170310, 0x04a11020, 0x90170310, 0x40f003fc, |
Takashi Iwai | dfe495d | 2007-08-23 19:04:28 +0200 | [diff] [blame] | 1314 | }; |
| 1315 | |
Takashi Iwai | 2b63536 | 2011-05-02 12:33:43 +0200 | [diff] [blame] | 1316 | static const unsigned int oqo9200_pin_configs[8] = { |
Tobin Davis | bf27778 | 2008-02-03 20:31:47 +0100 | [diff] [blame] | 1317 | 0x40c000f0, 0x404000f1, 0x0221121f, 0x02211210, |
| 1318 | 0x90170111, 0x90a70120, 0x400000f2, 0x400000f3, |
| 1319 | }; |
| 1320 | |
Takashi Iwai | dfe495d | 2007-08-23 19:04:28 +0200 | [diff] [blame] | 1321 | |
Takashi Iwai | 2b63536 | 2011-05-02 12:33:43 +0200 | [diff] [blame] | 1322 | static const unsigned int *stac9200_brd_tbl[STAC_9200_MODELS] = { |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 1323 | [STAC_REF] = ref9200_pin_configs, |
Tobin Davis | bf27778 | 2008-02-03 20:31:47 +0100 | [diff] [blame] | 1324 | [STAC_9200_OQO] = oqo9200_pin_configs, |
Takashi Iwai | dfe495d | 2007-08-23 19:04:28 +0200 | [diff] [blame] | 1325 | [STAC_9200_DELL_D21] = dell9200_d21_pin_configs, |
| 1326 | [STAC_9200_DELL_D22] = dell9200_d22_pin_configs, |
| 1327 | [STAC_9200_DELL_D23] = dell9200_d23_pin_configs, |
| 1328 | [STAC_9200_DELL_M21] = dell9200_m21_pin_configs, |
| 1329 | [STAC_9200_DELL_M22] = dell9200_m22_pin_configs, |
| 1330 | [STAC_9200_DELL_M23] = dell9200_m23_pin_configs, |
| 1331 | [STAC_9200_DELL_M24] = dell9200_m24_pin_configs, |
| 1332 | [STAC_9200_DELL_M25] = dell9200_m25_pin_configs, |
| 1333 | [STAC_9200_DELL_M26] = dell9200_m26_pin_configs, |
| 1334 | [STAC_9200_DELL_M27] = dell9200_m27_pin_configs, |
Mauro Carvalho Chehab | 58eec42 | 2008-08-11 10:18:39 +0200 | [diff] [blame] | 1335 | [STAC_9200_M4] = gateway9200_m4_pin_configs, |
| 1336 | [STAC_9200_M4_2] = gateway9200_m4_2_pin_configs, |
Takashi Iwai | 117f257 | 2008-03-18 09:53:23 +0100 | [diff] [blame] | 1337 | [STAC_9200_PANASONIC] = ref9200_pin_configs, |
Matt Porter | 403d194 | 2005-11-29 15:00:51 +0100 | [diff] [blame] | 1338 | }; |
| 1339 | |
Takashi Iwai | ea73496 | 2011-01-17 11:29:34 +0100 | [diff] [blame] | 1340 | static const char * const stac9200_models[STAC_9200_MODELS] = { |
Takashi Iwai | 1607b8e | 2009-02-26 16:50:43 +0100 | [diff] [blame] | 1341 | [STAC_AUTO] = "auto", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 1342 | [STAC_REF] = "ref", |
Tobin Davis | bf27778 | 2008-02-03 20:31:47 +0100 | [diff] [blame] | 1343 | [STAC_9200_OQO] = "oqo", |
Takashi Iwai | dfe495d | 2007-08-23 19:04:28 +0200 | [diff] [blame] | 1344 | [STAC_9200_DELL_D21] = "dell-d21", |
| 1345 | [STAC_9200_DELL_D22] = "dell-d22", |
| 1346 | [STAC_9200_DELL_D23] = "dell-d23", |
| 1347 | [STAC_9200_DELL_M21] = "dell-m21", |
| 1348 | [STAC_9200_DELL_M22] = "dell-m22", |
| 1349 | [STAC_9200_DELL_M23] = "dell-m23", |
| 1350 | [STAC_9200_DELL_M24] = "dell-m24", |
| 1351 | [STAC_9200_DELL_M25] = "dell-m25", |
| 1352 | [STAC_9200_DELL_M26] = "dell-m26", |
| 1353 | [STAC_9200_DELL_M27] = "dell-m27", |
Mauro Carvalho Chehab | 58eec42 | 2008-08-11 10:18:39 +0200 | [diff] [blame] | 1354 | [STAC_9200_M4] = "gateway-m4", |
| 1355 | [STAC_9200_M4_2] = "gateway-m4-2", |
Takashi Iwai | 117f257 | 2008-03-18 09:53:23 +0100 | [diff] [blame] | 1356 | [STAC_9200_PANASONIC] = "panasonic", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 1357 | }; |
| 1358 | |
Takashi Iwai | 2b63536 | 2011-05-02 12:33:43 +0200 | [diff] [blame] | 1359 | static const struct snd_pci_quirk stac9200_cfg_tbl[] = { |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 1360 | /* SigmaTel reference board */ |
| 1361 | SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2668, |
| 1362 | "DFI LanParty", STAC_REF), |
Matthew Ranostay | 577aa2c | 2009-01-22 22:55:44 -0500 | [diff] [blame] | 1363 | SND_PCI_QUIRK(PCI_VENDOR_ID_DFI, 0x3101, |
| 1364 | "DFI LanParty", STAC_REF), |
Matt Porter | e737707 | 2006-11-06 11:20:38 +0100 | [diff] [blame] | 1365 | /* Dell laptops have BIOS problem */ |
Takashi Iwai | dfe495d | 2007-08-23 19:04:28 +0200 | [diff] [blame] | 1366 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01a8, |
| 1367 | "unknown Dell", STAC_9200_DELL_D21), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 1368 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01b5, |
Takashi Iwai | dfe495d | 2007-08-23 19:04:28 +0200 | [diff] [blame] | 1369 | "Dell Inspiron 630m", STAC_9200_DELL_M21), |
| 1370 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01bd, |
| 1371 | "Dell Inspiron E1505n", STAC_9200_DELL_M25), |
| 1372 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01c0, |
| 1373 | "unknown Dell", STAC_9200_DELL_D22), |
| 1374 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01c1, |
| 1375 | "unknown Dell", STAC_9200_DELL_D22), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 1376 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01c2, |
Takashi Iwai | dfe495d | 2007-08-23 19:04:28 +0200 | [diff] [blame] | 1377 | "Dell Latitude D620", STAC_9200_DELL_M22), |
| 1378 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01c5, |
| 1379 | "unknown Dell", STAC_9200_DELL_D23), |
| 1380 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01c7, |
| 1381 | "unknown Dell", STAC_9200_DELL_D23), |
| 1382 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01c8, |
| 1383 | "unknown Dell", STAC_9200_DELL_M22), |
| 1384 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01c9, |
| 1385 | "unknown Dell", STAC_9200_DELL_M24), |
| 1386 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01ca, |
| 1387 | "unknown Dell", STAC_9200_DELL_M24), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 1388 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01cb, |
Takashi Iwai | dfe495d | 2007-08-23 19:04:28 +0200 | [diff] [blame] | 1389 | "Dell Latitude 120L", STAC_9200_DELL_M24), |
Cory T. Tusar | 877b866 | 2007-01-30 17:30:55 +0100 | [diff] [blame] | 1390 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01cc, |
Takashi Iwai | dfe495d | 2007-08-23 19:04:28 +0200 | [diff] [blame] | 1391 | "Dell Latitude D820", STAC_9200_DELL_M22), |
Mikael Nilsson | 46f02ca | 2007-02-13 12:46:16 +0100 | [diff] [blame] | 1392 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01cd, |
Takashi Iwai | dfe495d | 2007-08-23 19:04:28 +0200 | [diff] [blame] | 1393 | "Dell Inspiron E1705/9400", STAC_9200_DELL_M27), |
Mikael Nilsson | 46f02ca | 2007-02-13 12:46:16 +0100 | [diff] [blame] | 1394 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01ce, |
Takashi Iwai | dfe495d | 2007-08-23 19:04:28 +0200 | [diff] [blame] | 1395 | "Dell XPS M1710", STAC_9200_DELL_M23), |
Takashi Iwai | f0f9674 | 2007-02-14 00:59:17 +0100 | [diff] [blame] | 1396 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01cf, |
Takashi Iwai | dfe495d | 2007-08-23 19:04:28 +0200 | [diff] [blame] | 1397 | "Dell Precision M90", STAC_9200_DELL_M23), |
| 1398 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01d3, |
| 1399 | "unknown Dell", STAC_9200_DELL_M22), |
| 1400 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01d4, |
| 1401 | "unknown Dell", STAC_9200_DELL_M22), |
Daniel T Chen | 8286c53 | 2007-05-15 11:46:23 +0200 | [diff] [blame] | 1402 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01d6, |
Takashi Iwai | dfe495d | 2007-08-23 19:04:28 +0200 | [diff] [blame] | 1403 | "unknown Dell", STAC_9200_DELL_M22), |
Tobin Davis | 49c605d | 2007-05-17 09:38:24 +0200 | [diff] [blame] | 1404 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01d8, |
Takashi Iwai | dfe495d | 2007-08-23 19:04:28 +0200 | [diff] [blame] | 1405 | "Dell Inspiron 640m", STAC_9200_DELL_M21), |
| 1406 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01d9, |
| 1407 | "unknown Dell", STAC_9200_DELL_D23), |
| 1408 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01da, |
| 1409 | "unknown Dell", STAC_9200_DELL_D23), |
| 1410 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01de, |
| 1411 | "unknown Dell", STAC_9200_DELL_D21), |
| 1412 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01e3, |
| 1413 | "unknown Dell", STAC_9200_DELL_D23), |
| 1414 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01e8, |
| 1415 | "unknown Dell", STAC_9200_DELL_D21), |
| 1416 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01ee, |
| 1417 | "unknown Dell", STAC_9200_DELL_M25), |
| 1418 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01ef, |
| 1419 | "unknown Dell", STAC_9200_DELL_M25), |
Tobin Davis | 49c605d | 2007-05-17 09:38:24 +0200 | [diff] [blame] | 1420 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01f5, |
Takashi Iwai | dfe495d | 2007-08-23 19:04:28 +0200 | [diff] [blame] | 1421 | "Dell Inspiron 1501", STAC_9200_DELL_M26), |
| 1422 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01f6, |
| 1423 | "unknown Dell", STAC_9200_DELL_M26), |
Tobin Davis | 49c605d | 2007-05-17 09:38:24 +0200 | [diff] [blame] | 1424 | /* Panasonic */ |
Takashi Iwai | 117f257 | 2008-03-18 09:53:23 +0100 | [diff] [blame] | 1425 | SND_PCI_QUIRK(0x10f7, 0x8338, "Panasonic CF-74", STAC_9200_PANASONIC), |
Takashi Iwai | 1194b5b | 2007-10-10 10:04:26 +0200 | [diff] [blame] | 1426 | /* Gateway machines needs EAPD to be set on resume */ |
Mauro Carvalho Chehab | 58eec42 | 2008-08-11 10:18:39 +0200 | [diff] [blame] | 1427 | SND_PCI_QUIRK(0x107b, 0x0205, "Gateway S-7110M", STAC_9200_M4), |
| 1428 | SND_PCI_QUIRK(0x107b, 0x0317, "Gateway MT3423, MX341*", STAC_9200_M4_2), |
| 1429 | SND_PCI_QUIRK(0x107b, 0x0318, "Gateway ML3019, MT3707", STAC_9200_M4_2), |
Tobin Davis | bf27778 | 2008-02-03 20:31:47 +0100 | [diff] [blame] | 1430 | /* OQO Mobile */ |
| 1431 | SND_PCI_QUIRK(0x1106, 0x3288, "OQO Model 2", STAC_9200_OQO), |
Matt Porter | 403d194 | 2005-11-29 15:00:51 +0100 | [diff] [blame] | 1432 | {} /* terminator */ |
| 1433 | }; |
| 1434 | |
Takashi Iwai | 2b63536 | 2011-05-02 12:33:43 +0200 | [diff] [blame] | 1435 | static const unsigned int ref925x_pin_configs[8] = { |
Tobin Davis | 8e21c34 | 2007-01-08 11:04:17 +0100 | [diff] [blame] | 1436 | 0x40c003f0, 0x424503f2, 0x01813022, 0x02a19021, |
Matthew Ranostay | 09a9995 | 2008-01-24 11:49:21 +0100 | [diff] [blame] | 1437 | 0x90a70320, 0x02214210, 0x01019020, 0x9033032e, |
Tobin Davis | 8e21c34 | 2007-01-08 11:04:17 +0100 | [diff] [blame] | 1438 | }; |
| 1439 | |
Takashi Iwai | 2b63536 | 2011-05-02 12:33:43 +0200 | [diff] [blame] | 1440 | static const unsigned int stac925xM1_pin_configs[8] = { |
Mauro Carvalho Chehab | 9cb36c2 | 2008-08-11 10:18:39 +0200 | [diff] [blame] | 1441 | 0x40c003f4, 0x424503f2, 0x400000f3, 0x02a19020, |
| 1442 | 0x40a000f0, 0x90100210, 0x400003f1, 0x9033032e, |
Tobin Davis | 8e21c34 | 2007-01-08 11:04:17 +0100 | [diff] [blame] | 1443 | }; |
| 1444 | |
Takashi Iwai | 2b63536 | 2011-05-02 12:33:43 +0200 | [diff] [blame] | 1445 | static const unsigned int stac925xM1_2_pin_configs[8] = { |
Mauro Carvalho Chehab | 9cb36c2 | 2008-08-11 10:18:39 +0200 | [diff] [blame] | 1446 | 0x40c003f4, 0x424503f2, 0x400000f3, 0x02a19020, |
| 1447 | 0x40a000f0, 0x90100210, 0x400003f1, 0x9033032e, |
| 1448 | }; |
Mauro Carvalho Chehab | 58eec42 | 2008-08-11 10:18:39 +0200 | [diff] [blame] | 1449 | |
Takashi Iwai | 2b63536 | 2011-05-02 12:33:43 +0200 | [diff] [blame] | 1450 | static const unsigned int stac925xM2_pin_configs[8] = { |
Mauro Carvalho Chehab | 9cb36c2 | 2008-08-11 10:18:39 +0200 | [diff] [blame] | 1451 | 0x40c003f4, 0x424503f2, 0x400000f3, 0x02a19020, |
| 1452 | 0x40a000f0, 0x90100210, 0x400003f1, 0x9033032e, |
Tobin Davis | 2c11f95 | 2007-05-17 09:36:34 +0200 | [diff] [blame] | 1453 | }; |
| 1454 | |
Takashi Iwai | 2b63536 | 2011-05-02 12:33:43 +0200 | [diff] [blame] | 1455 | static const unsigned int stac925xM2_2_pin_configs[8] = { |
Mauro Carvalho Chehab | 58eec42 | 2008-08-11 10:18:39 +0200 | [diff] [blame] | 1456 | 0x40c003f4, 0x424503f2, 0x400000f3, 0x02a19020, |
| 1457 | 0x40a000f0, 0x90100210, 0x400003f1, 0x9033032e, |
| 1458 | }; |
| 1459 | |
Takashi Iwai | 2b63536 | 2011-05-02 12:33:43 +0200 | [diff] [blame] | 1460 | static const unsigned int stac925xM3_pin_configs[8] = { |
Mauro Carvalho Chehab | 9cb36c2 | 2008-08-11 10:18:39 +0200 | [diff] [blame] | 1461 | 0x40c003f4, 0x424503f2, 0x400000f3, 0x02a19020, |
| 1462 | 0x40a000f0, 0x90100210, 0x400003f1, 0x503303f3, |
| 1463 | }; |
Mauro Carvalho Chehab | 58eec42 | 2008-08-11 10:18:39 +0200 | [diff] [blame] | 1464 | |
Takashi Iwai | 2b63536 | 2011-05-02 12:33:43 +0200 | [diff] [blame] | 1465 | static const unsigned int stac925xM5_pin_configs[8] = { |
Mauro Carvalho Chehab | 9cb36c2 | 2008-08-11 10:18:39 +0200 | [diff] [blame] | 1466 | 0x40c003f4, 0x424503f2, 0x400000f3, 0x02a19020, |
| 1467 | 0x40a000f0, 0x90100210, 0x400003f1, 0x9033032e, |
| 1468 | }; |
| 1469 | |
Takashi Iwai | 2b63536 | 2011-05-02 12:33:43 +0200 | [diff] [blame] | 1470 | static const unsigned int stac925xM6_pin_configs[8] = { |
Mauro Carvalho Chehab | 9cb36c2 | 2008-08-11 10:18:39 +0200 | [diff] [blame] | 1471 | 0x40c003f4, 0x424503f2, 0x400000f3, 0x02a19020, |
| 1472 | 0x40a000f0, 0x90100210, 0x400003f1, 0x90330320, |
Tobin Davis | 8e21c34 | 2007-01-08 11:04:17 +0100 | [diff] [blame] | 1473 | }; |
| 1474 | |
Takashi Iwai | 2b63536 | 2011-05-02 12:33:43 +0200 | [diff] [blame] | 1475 | static const unsigned int *stac925x_brd_tbl[STAC_925x_MODELS] = { |
Tobin Davis | 8e21c34 | 2007-01-08 11:04:17 +0100 | [diff] [blame] | 1476 | [STAC_REF] = ref925x_pin_configs, |
Mauro Carvalho Chehab | 9cb36c2 | 2008-08-11 10:18:39 +0200 | [diff] [blame] | 1477 | [STAC_M1] = stac925xM1_pin_configs, |
| 1478 | [STAC_M1_2] = stac925xM1_2_pin_configs, |
| 1479 | [STAC_M2] = stac925xM2_pin_configs, |
Tobin Davis | 8e21c34 | 2007-01-08 11:04:17 +0100 | [diff] [blame] | 1480 | [STAC_M2_2] = stac925xM2_2_pin_configs, |
Mauro Carvalho Chehab | 9cb36c2 | 2008-08-11 10:18:39 +0200 | [diff] [blame] | 1481 | [STAC_M3] = stac925xM3_pin_configs, |
| 1482 | [STAC_M5] = stac925xM5_pin_configs, |
| 1483 | [STAC_M6] = stac925xM6_pin_configs, |
Tobin Davis | 8e21c34 | 2007-01-08 11:04:17 +0100 | [diff] [blame] | 1484 | }; |
| 1485 | |
Takashi Iwai | ea73496 | 2011-01-17 11:29:34 +0100 | [diff] [blame] | 1486 | static const char * const stac925x_models[STAC_925x_MODELS] = { |
Takashi Iwai | 1607b8e | 2009-02-26 16:50:43 +0100 | [diff] [blame] | 1487 | [STAC_925x_AUTO] = "auto", |
Tobin Davis | 8e21c34 | 2007-01-08 11:04:17 +0100 | [diff] [blame] | 1488 | [STAC_REF] = "ref", |
Mauro Carvalho Chehab | 9cb36c2 | 2008-08-11 10:18:39 +0200 | [diff] [blame] | 1489 | [STAC_M1] = "m1", |
| 1490 | [STAC_M1_2] = "m1-2", |
| 1491 | [STAC_M2] = "m2", |
Tobin Davis | 8e21c34 | 2007-01-08 11:04:17 +0100 | [diff] [blame] | 1492 | [STAC_M2_2] = "m2-2", |
Mauro Carvalho Chehab | 9cb36c2 | 2008-08-11 10:18:39 +0200 | [diff] [blame] | 1493 | [STAC_M3] = "m3", |
| 1494 | [STAC_M5] = "m5", |
| 1495 | [STAC_M6] = "m6", |
Tobin Davis | 8e21c34 | 2007-01-08 11:04:17 +0100 | [diff] [blame] | 1496 | }; |
| 1497 | |
Takashi Iwai | 2b63536 | 2011-05-02 12:33:43 +0200 | [diff] [blame] | 1498 | static const struct snd_pci_quirk stac925x_codec_id_cfg_tbl[] = { |
Mauro Carvalho Chehab | 58eec42 | 2008-08-11 10:18:39 +0200 | [diff] [blame] | 1499 | SND_PCI_QUIRK(0x107b, 0x0316, "Gateway M255", STAC_M2), |
| 1500 | SND_PCI_QUIRK(0x107b, 0x0366, "Gateway MP6954", STAC_M5), |
| 1501 | SND_PCI_QUIRK(0x107b, 0x0461, "Gateway NX560XL", STAC_M1), |
| 1502 | SND_PCI_QUIRK(0x107b, 0x0681, "Gateway NX860", STAC_M2), |
Mauro Carvalho Chehab | 9cb36c2 | 2008-08-11 10:18:39 +0200 | [diff] [blame] | 1503 | SND_PCI_QUIRK(0x107b, 0x0367, "Gateway MX6453", STAC_M1_2), |
Mauro Carvalho Chehab | 9cb36c2 | 2008-08-11 10:18:39 +0200 | [diff] [blame] | 1504 | /* Not sure about the brand name for those */ |
| 1505 | SND_PCI_QUIRK(0x107b, 0x0281, "Gateway mobile", STAC_M1), |
| 1506 | SND_PCI_QUIRK(0x107b, 0x0507, "Gateway mobile", STAC_M3), |
| 1507 | SND_PCI_QUIRK(0x107b, 0x0281, "Gateway mobile", STAC_M6), |
| 1508 | SND_PCI_QUIRK(0x107b, 0x0685, "Gateway mobile", STAC_M2_2), |
Mauro Carvalho Chehab | 9cb36c2 | 2008-08-11 10:18:39 +0200 | [diff] [blame] | 1509 | {} /* terminator */ |
Tobin Davis | 8e21c34 | 2007-01-08 11:04:17 +0100 | [diff] [blame] | 1510 | }; |
| 1511 | |
Takashi Iwai | 2b63536 | 2011-05-02 12:33:43 +0200 | [diff] [blame] | 1512 | static const struct snd_pci_quirk stac925x_cfg_tbl[] = { |
Tobin Davis | 8e21c34 | 2007-01-08 11:04:17 +0100 | [diff] [blame] | 1513 | /* SigmaTel reference board */ |
| 1514 | SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2668, "DFI LanParty", STAC_REF), |
Matthew Ranostay | 577aa2c | 2009-01-22 22:55:44 -0500 | [diff] [blame] | 1515 | SND_PCI_QUIRK(PCI_VENDOR_ID_DFI, 0x3101, "DFI LanParty", STAC_REF), |
Tobin Davis | 2c11f95 | 2007-05-17 09:36:34 +0200 | [diff] [blame] | 1516 | SND_PCI_QUIRK(0x8384, 0x7632, "Stac9202 Reference Board", STAC_REF), |
Mauro Carvalho Chehab | 9cb36c2 | 2008-08-11 10:18:39 +0200 | [diff] [blame] | 1517 | |
| 1518 | /* Default table for unknown ID */ |
| 1519 | SND_PCI_QUIRK(0x1002, 0x437b, "Gateway mobile", STAC_M2_2), |
| 1520 | |
Tobin Davis | 8e21c34 | 2007-01-08 11:04:17 +0100 | [diff] [blame] | 1521 | {} /* terminator */ |
| 1522 | }; |
| 1523 | |
Takashi Iwai | 2b63536 | 2011-05-02 12:33:43 +0200 | [diff] [blame] | 1524 | static const unsigned int ref92hd73xx_pin_configs[13] = { |
Matthew Ranostay | e1f0d66 | 2007-12-13 17:47:21 +0100 | [diff] [blame] | 1525 | 0x02214030, 0x02a19040, 0x01a19020, 0x02214030, |
| 1526 | 0x0181302e, 0x01014010, 0x01014020, 0x01014030, |
| 1527 | 0x02319040, 0x90a000f0, 0x90a000f0, 0x01452050, |
Matthew Ranostay | a766264 | 2008-02-21 07:51:14 +0100 | [diff] [blame] | 1528 | 0x01452050, |
| 1529 | }; |
| 1530 | |
Takashi Iwai | 2b63536 | 2011-05-02 12:33:43 +0200 | [diff] [blame] | 1531 | static const unsigned int dell_m6_pin_configs[13] = { |
Matthew Ranostay | a766264 | 2008-02-21 07:51:14 +0100 | [diff] [blame] | 1532 | 0x0321101f, 0x4f00000f, 0x4f0000f0, 0x90170110, |
Matthew Ranostay | 7c2ba97 | 2008-04-16 13:13:59 +0200 | [diff] [blame] | 1533 | 0x03a11020, 0x0321101f, 0x4f0000f0, 0x4f0000f0, |
Matthew Ranostay | a766264 | 2008-02-21 07:51:14 +0100 | [diff] [blame] | 1534 | 0x4f0000f0, 0x90a60160, 0x4f0000f0, 0x4f0000f0, |
| 1535 | 0x4f0000f0, |
Matthew Ranostay | e1f0d66 | 2007-12-13 17:47:21 +0100 | [diff] [blame] | 1536 | }; |
| 1537 | |
Takashi Iwai | 2b63536 | 2011-05-02 12:33:43 +0200 | [diff] [blame] | 1538 | static const unsigned int alienware_m17x_pin_configs[13] = { |
Takashi Iwai | 842ae63 | 2009-09-02 07:43:08 +0200 | [diff] [blame] | 1539 | 0x0321101f, 0x0321101f, 0x03a11020, 0x03014020, |
| 1540 | 0x90170110, 0x4f0000f0, 0x4f0000f0, 0x4f0000f0, |
| 1541 | 0x4f0000f0, 0x90a60160, 0x4f0000f0, 0x4f0000f0, |
| 1542 | 0x904601b0, |
| 1543 | }; |
| 1544 | |
Takashi Iwai | 2b63536 | 2011-05-02 12:33:43 +0200 | [diff] [blame] | 1545 | static const unsigned int intel_dg45id_pin_configs[13] = { |
Alexey Fisher | 52dc438 | 2009-12-12 11:16:41 +0200 | [diff] [blame] | 1546 | 0x02214230, 0x02A19240, 0x01013214, 0x01014210, |
Wu Fengguang | 4d26f44 | 2010-05-07 08:47:54 +0800 | [diff] [blame] | 1547 | 0x01A19250, 0x01011212, 0x01016211 |
Alexey Fisher | 52dc438 | 2009-12-12 11:16:41 +0200 | [diff] [blame] | 1548 | }; |
| 1549 | |
Takashi Iwai | 2b63536 | 2011-05-02 12:33:43 +0200 | [diff] [blame] | 1550 | static const unsigned int *stac92hd73xx_brd_tbl[STAC_92HD73XX_MODELS] = { |
Matthew Ranostay | a766264 | 2008-02-21 07:51:14 +0100 | [diff] [blame] | 1551 | [STAC_92HD73XX_REF] = ref92hd73xx_pin_configs, |
Takashi Iwai | 661cd8f | 2008-11-25 15:18:29 +0100 | [diff] [blame] | 1552 | [STAC_DELL_M6_AMIC] = dell_m6_pin_configs, |
| 1553 | [STAC_DELL_M6_DMIC] = dell_m6_pin_configs, |
| 1554 | [STAC_DELL_M6_BOTH] = dell_m6_pin_configs, |
Matthew Ranostay | 6b3ab21 | 2008-11-03 08:12:43 -0500 | [diff] [blame] | 1555 | [STAC_DELL_EQ] = dell_m6_pin_configs, |
Takashi Iwai | 842ae63 | 2009-09-02 07:43:08 +0200 | [diff] [blame] | 1556 | [STAC_ALIENWARE_M17X] = alienware_m17x_pin_configs, |
Alexey Fisher | 52dc438 | 2009-12-12 11:16:41 +0200 | [diff] [blame] | 1557 | [STAC_92HD73XX_INTEL] = intel_dg45id_pin_configs, |
Matthew Ranostay | e1f0d66 | 2007-12-13 17:47:21 +0100 | [diff] [blame] | 1558 | }; |
| 1559 | |
Takashi Iwai | ea73496 | 2011-01-17 11:29:34 +0100 | [diff] [blame] | 1560 | static const char * const stac92hd73xx_models[STAC_92HD73XX_MODELS] = { |
Takashi Iwai | 1607b8e | 2009-02-26 16:50:43 +0100 | [diff] [blame] | 1561 | [STAC_92HD73XX_AUTO] = "auto", |
Takashi Iwai | 9e43f0d | 2008-12-17 14:51:01 +0100 | [diff] [blame] | 1562 | [STAC_92HD73XX_NO_JD] = "no-jd", |
Matthew Ranostay | e1f0d66 | 2007-12-13 17:47:21 +0100 | [diff] [blame] | 1563 | [STAC_92HD73XX_REF] = "ref", |
Wu Fengguang | ae70944 | 2009-08-19 17:05:11 +0800 | [diff] [blame] | 1564 | [STAC_92HD73XX_INTEL] = "intel", |
Takashi Iwai | 661cd8f | 2008-11-25 15:18:29 +0100 | [diff] [blame] | 1565 | [STAC_DELL_M6_AMIC] = "dell-m6-amic", |
| 1566 | [STAC_DELL_M6_DMIC] = "dell-m6-dmic", |
| 1567 | [STAC_DELL_M6_BOTH] = "dell-m6", |
Matthew Ranostay | 6b3ab21 | 2008-11-03 08:12:43 -0500 | [diff] [blame] | 1568 | [STAC_DELL_EQ] = "dell-eq", |
Takashi Iwai | 842ae63 | 2009-09-02 07:43:08 +0200 | [diff] [blame] | 1569 | [STAC_ALIENWARE_M17X] = "alienware", |
Matthew Ranostay | e1f0d66 | 2007-12-13 17:47:21 +0100 | [diff] [blame] | 1570 | }; |
| 1571 | |
Takashi Iwai | 2b63536 | 2011-05-02 12:33:43 +0200 | [diff] [blame] | 1572 | static const struct snd_pci_quirk stac92hd73xx_cfg_tbl[] = { |
Matthew Ranostay | e1f0d66 | 2007-12-13 17:47:21 +0100 | [diff] [blame] | 1573 | /* SigmaTel reference board */ |
| 1574 | SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2668, |
Matthew Ranostay | a766264 | 2008-02-21 07:51:14 +0100 | [diff] [blame] | 1575 | "DFI LanParty", STAC_92HD73XX_REF), |
Matthew Ranostay | 577aa2c | 2009-01-22 22:55:44 -0500 | [diff] [blame] | 1576 | SND_PCI_QUIRK(PCI_VENDOR_ID_DFI, 0x3101, |
| 1577 | "DFI LanParty", STAC_92HD73XX_REF), |
Wu Fengguang | ae70944 | 2009-08-19 17:05:11 +0800 | [diff] [blame] | 1578 | SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x5002, |
| 1579 | "Intel DG45ID", STAC_92HD73XX_INTEL), |
| 1580 | SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x5003, |
| 1581 | "Intel DG45FC", STAC_92HD73XX_INTEL), |
Matthew Ranostay | a766264 | 2008-02-21 07:51:14 +0100 | [diff] [blame] | 1582 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0254, |
Takashi Iwai | 661cd8f | 2008-11-25 15:18:29 +0100 | [diff] [blame] | 1583 | "Dell Studio 1535", STAC_DELL_M6_DMIC), |
Matthew Ranostay | a766264 | 2008-02-21 07:51:14 +0100 | [diff] [blame] | 1584 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0255, |
Takashi Iwai | 661cd8f | 2008-11-25 15:18:29 +0100 | [diff] [blame] | 1585 | "unknown Dell", STAC_DELL_M6_DMIC), |
Matthew Ranostay | a766264 | 2008-02-21 07:51:14 +0100 | [diff] [blame] | 1586 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0256, |
Takashi Iwai | 661cd8f | 2008-11-25 15:18:29 +0100 | [diff] [blame] | 1587 | "unknown Dell", STAC_DELL_M6_BOTH), |
Matthew Ranostay | a766264 | 2008-02-21 07:51:14 +0100 | [diff] [blame] | 1588 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0257, |
Takashi Iwai | 661cd8f | 2008-11-25 15:18:29 +0100 | [diff] [blame] | 1589 | "unknown Dell", STAC_DELL_M6_BOTH), |
Matthew Ranostay | a766264 | 2008-02-21 07:51:14 +0100 | [diff] [blame] | 1590 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x025e, |
Takashi Iwai | 661cd8f | 2008-11-25 15:18:29 +0100 | [diff] [blame] | 1591 | "unknown Dell", STAC_DELL_M6_AMIC), |
Matthew Ranostay | a766264 | 2008-02-21 07:51:14 +0100 | [diff] [blame] | 1592 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x025f, |
Takashi Iwai | 661cd8f | 2008-11-25 15:18:29 +0100 | [diff] [blame] | 1593 | "unknown Dell", STAC_DELL_M6_AMIC), |
Matthew Ranostay | a766264 | 2008-02-21 07:51:14 +0100 | [diff] [blame] | 1594 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0271, |
Takashi Iwai | 661cd8f | 2008-11-25 15:18:29 +0100 | [diff] [blame] | 1595 | "unknown Dell", STAC_DELL_M6_DMIC), |
| 1596 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0272, |
| 1597 | "unknown Dell", STAC_DELL_M6_DMIC), |
Takashi Iwai | b0fc5e0 | 2008-11-21 08:37:03 +0100 | [diff] [blame] | 1598 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x029f, |
Takashi Iwai | 661cd8f | 2008-11-25 15:18:29 +0100 | [diff] [blame] | 1599 | "Dell Studio 1537", STAC_DELL_M6_DMIC), |
Joerg Schirottke | fa620e9 | 2008-12-19 08:13:49 +0100 | [diff] [blame] | 1600 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x02a0, |
| 1601 | "Dell Studio 17", STAC_DELL_M6_DMIC), |
Takashi Iwai | 626f5ce | 2009-07-28 00:54:39 +0200 | [diff] [blame] | 1602 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x02be, |
| 1603 | "Dell Studio 1555", STAC_DELL_M6_DMIC), |
Daniel J Blueman | 8ef5837 | 2009-11-14 18:20:04 +0000 | [diff] [blame] | 1604 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x02bd, |
| 1605 | "Dell Studio 1557", STAC_DELL_M6_DMIC), |
Daniel T Chen | aac78da | 2010-04-21 20:41:52 -0400 | [diff] [blame] | 1606 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x02fe, |
David Henningsson | ffe535e | 2012-01-16 10:52:20 +0100 | [diff] [blame] | 1607 | "Dell Studio XPS 1645", STAC_DELL_M6_DMIC), |
Daniel T Chen | 5c1bccf | 2010-04-22 17:54:45 -0400 | [diff] [blame] | 1608 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0413, |
David Henningsson | e033ebf | 2011-05-16 12:09:29 +0200 | [diff] [blame] | 1609 | "Dell Studio 1558", STAC_DELL_M6_DMIC), |
Matthew Ranostay | e1f0d66 | 2007-12-13 17:47:21 +0100 | [diff] [blame] | 1610 | {} /* terminator */ |
| 1611 | }; |
| 1612 | |
Takashi Iwai | 2b63536 | 2011-05-02 12:33:43 +0200 | [diff] [blame] | 1613 | static const struct snd_pci_quirk stac92hd73xx_codec_id_cfg_tbl[] = { |
Takashi Iwai | 842ae63 | 2009-09-02 07:43:08 +0200 | [diff] [blame] | 1614 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x02a1, |
| 1615 | "Alienware M17x", STAC_ALIENWARE_M17X), |
Daniel T Chen | 0defe09 | 2010-12-01 19:16:07 -0500 | [diff] [blame] | 1616 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x043a, |
| 1617 | "Alienware M17x", STAC_ALIENWARE_M17X), |
Takashi Iwai | dbd1b54 | 2011-11-19 11:41:30 +0100 | [diff] [blame] | 1618 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0490, |
Albert Pool | b9ecc4e | 2012-01-19 22:08:50 +0100 | [diff] [blame] | 1619 | "Alienware M17x R3", STAC_DELL_EQ), |
Takashi Iwai | 842ae63 | 2009-09-02 07:43:08 +0200 | [diff] [blame] | 1620 | {} /* terminator */ |
| 1621 | }; |
| 1622 | |
Takashi Iwai | 2b63536 | 2011-05-02 12:33:43 +0200 | [diff] [blame] | 1623 | static const unsigned int ref92hd83xxx_pin_configs[10] = { |
Matthew Ranostay | d0513fc | 2008-07-27 10:30:30 +0200 | [diff] [blame] | 1624 | 0x02214030, 0x02211010, 0x02a19020, 0x02170130, |
| 1625 | 0x01014050, 0x01819040, 0x01014020, 0x90a3014e, |
Matthew Ranostay | d0513fc | 2008-07-27 10:30:30 +0200 | [diff] [blame] | 1626 | 0x01451160, 0x98560170, |
| 1627 | }; |
| 1628 | |
Takashi Iwai | 2b63536 | 2011-05-02 12:33:43 +0200 | [diff] [blame] | 1629 | static const unsigned int dell_s14_pin_configs[10] = { |
Takashi Iwai | 69b5655 | 2009-09-15 12:37:42 +0200 | [diff] [blame] | 1630 | 0x0221403f, 0x0221101f, 0x02a19020, 0x90170110, |
| 1631 | 0x40f000f0, 0x40f000f0, 0x40f000f0, 0x90a60160, |
Matthew Ranostay | 8bb0ac5 | 2009-02-12 16:50:01 -0500 | [diff] [blame] | 1632 | 0x40f000f0, 0x40f000f0, |
| 1633 | }; |
| 1634 | |
Julian Wollrath | f7f9bdf | 2011-11-09 10:02:40 +0100 | [diff] [blame] | 1635 | static const unsigned int dell_vostro_3500_pin_configs[10] = { |
| 1636 | 0x02a11020, 0x0221101f, 0x400000f0, 0x90170110, |
| 1637 | 0x400000f1, 0x400000f2, 0x400000f3, 0x90a60160, |
| 1638 | 0x400000f4, 0x400000f5, |
| 1639 | }; |
| 1640 | |
Takashi Iwai | 2b63536 | 2011-05-02 12:33:43 +0200 | [diff] [blame] | 1641 | static const unsigned int hp_dv7_4000_pin_configs[10] = { |
Steven Eastland | 4831559 | 2010-08-06 15:07:35 -0600 | [diff] [blame] | 1642 | 0x03a12050, 0x0321201f, 0x40f000f0, 0x90170110, |
| 1643 | 0x40f000f0, 0x40f000f0, 0x90170110, 0xd5a30140, |
| 1644 | 0x40f000f0, 0x40f000f0, |
| 1645 | }; |
| 1646 | |
Vitaliy Kulikov | 5556e14 | 2012-02-27 16:47:37 -0600 | [diff] [blame] | 1647 | static const unsigned int hp_zephyr_pin_configs[10] = { |
| 1648 | 0x01813050, 0x0421201f, 0x04a1205e, 0x96130310, |
| 1649 | 0x96130310, 0x0101401f, 0x1111611f, 0xd5a30130, |
| 1650 | 0, 0, |
| 1651 | }; |
| 1652 | |
Vitaliy Kulikov | 0c27c18 | 2011-07-22 17:50:37 -0500 | [diff] [blame] | 1653 | static const unsigned int hp_cNB11_intquad_pin_configs[10] = { |
| 1654 | 0x40f000f0, 0x0221101f, 0x02a11020, 0x92170110, |
| 1655 | 0x40f000f0, 0x92170110, 0x40f000f0, 0xd5a30130, |
| 1656 | 0x40f000f0, 0x40f000f0, |
| 1657 | }; |
| 1658 | |
Takashi Iwai | 2b63536 | 2011-05-02 12:33:43 +0200 | [diff] [blame] | 1659 | static const unsigned int *stac92hd83xxx_brd_tbl[STAC_92HD83XXX_MODELS] = { |
Matthew Ranostay | d0513fc | 2008-07-27 10:30:30 +0200 | [diff] [blame] | 1660 | [STAC_92HD83XXX_REF] = ref92hd83xxx_pin_configs, |
Matthew Ranostay | 32ed3f4 | 2009-01-22 20:53:29 -0500 | [diff] [blame] | 1661 | [STAC_92HD83XXX_PWR_REF] = ref92hd83xxx_pin_configs, |
Matthew Ranostay | 8bb0ac5 | 2009-02-12 16:50:01 -0500 | [diff] [blame] | 1662 | [STAC_DELL_S14] = dell_s14_pin_configs, |
Julian Wollrath | f7f9bdf | 2011-11-09 10:02:40 +0100 | [diff] [blame] | 1663 | [STAC_DELL_VOSTRO_3500] = dell_vostro_3500_pin_configs, |
Vitaliy Kulikov | 0c27c18 | 2011-07-22 17:50:37 -0500 | [diff] [blame] | 1664 | [STAC_92HD83XXX_HP_cNB11_INTQUAD] = hp_cNB11_intquad_pin_configs, |
Steven Eastland | 4831559 | 2010-08-06 15:07:35 -0600 | [diff] [blame] | 1665 | [STAC_HP_DV7_4000] = hp_dv7_4000_pin_configs, |
Vitaliy Kulikov | 5556e14 | 2012-02-27 16:47:37 -0600 | [diff] [blame] | 1666 | [STAC_HP_ZEPHYR] = hp_zephyr_pin_configs, |
Matthew Ranostay | d0513fc | 2008-07-27 10:30:30 +0200 | [diff] [blame] | 1667 | }; |
| 1668 | |
Takashi Iwai | ea73496 | 2011-01-17 11:29:34 +0100 | [diff] [blame] | 1669 | static const char * const stac92hd83xxx_models[STAC_92HD83XXX_MODELS] = { |
Takashi Iwai | 1607b8e | 2009-02-26 16:50:43 +0100 | [diff] [blame] | 1670 | [STAC_92HD83XXX_AUTO] = "auto", |
Matthew Ranostay | d0513fc | 2008-07-27 10:30:30 +0200 | [diff] [blame] | 1671 | [STAC_92HD83XXX_REF] = "ref", |
Matthew Ranostay | 32ed3f4 | 2009-01-22 20:53:29 -0500 | [diff] [blame] | 1672 | [STAC_92HD83XXX_PWR_REF] = "mic-ref", |
Matthew Ranostay | 8bb0ac5 | 2009-02-12 16:50:01 -0500 | [diff] [blame] | 1673 | [STAC_DELL_S14] = "dell-s14", |
Julian Wollrath | f7f9bdf | 2011-11-09 10:02:40 +0100 | [diff] [blame] | 1674 | [STAC_DELL_VOSTRO_3500] = "dell-vostro-3500", |
Vitaliy Kulikov | 0c27c18 | 2011-07-22 17:50:37 -0500 | [diff] [blame] | 1675 | [STAC_92HD83XXX_HP_cNB11_INTQUAD] = "hp_cNB11_intquad", |
Steven Eastland | 4831559 | 2010-08-06 15:07:35 -0600 | [diff] [blame] | 1676 | [STAC_HP_DV7_4000] = "hp-dv7-4000", |
Vitaliy Kulikov | 5556e14 | 2012-02-27 16:47:37 -0600 | [diff] [blame] | 1677 | [STAC_HP_ZEPHYR] = "hp-zephyr", |
Matthew Ranostay | d0513fc | 2008-07-27 10:30:30 +0200 | [diff] [blame] | 1678 | }; |
| 1679 | |
Takashi Iwai | 2b63536 | 2011-05-02 12:33:43 +0200 | [diff] [blame] | 1680 | static const struct snd_pci_quirk stac92hd83xxx_cfg_tbl[] = { |
Matthew Ranostay | d0513fc | 2008-07-27 10:30:30 +0200 | [diff] [blame] | 1681 | /* SigmaTel reference board */ |
| 1682 | SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2668, |
Takashi Iwai | f9d088b | 2009-01-13 11:54:49 +0100 | [diff] [blame] | 1683 | "DFI LanParty", STAC_92HD83XXX_REF), |
Matthew Ranostay | 577aa2c | 2009-01-22 22:55:44 -0500 | [diff] [blame] | 1684 | SND_PCI_QUIRK(PCI_VENDOR_ID_DFI, 0x3101, |
| 1685 | "DFI LanParty", STAC_92HD83XXX_REF), |
Matthew Ranostay | 8bb0ac5 | 2009-02-12 16:50:01 -0500 | [diff] [blame] | 1686 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x02ba, |
| 1687 | "unknown Dell", STAC_DELL_S14), |
Julian Wollrath | f7f9bdf | 2011-11-09 10:02:40 +0100 | [diff] [blame] | 1688 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x1028, |
| 1689 | "Dell Vostro 3500", STAC_DELL_VOSTRO_3500), |
Vitaliy Kulikov | 0c27c18 | 2011-07-22 17:50:37 -0500 | [diff] [blame] | 1690 | SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x1656, |
| 1691 | "HP", STAC_92HD83XXX_HP_cNB11_INTQUAD), |
| 1692 | SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x1657, |
| 1693 | "HP", STAC_92HD83XXX_HP_cNB11_INTQUAD), |
| 1694 | SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x1658, |
| 1695 | "HP", STAC_92HD83XXX_HP_cNB11_INTQUAD), |
| 1696 | SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x1659, |
| 1697 | "HP", STAC_92HD83XXX_HP_cNB11_INTQUAD), |
| 1698 | SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x165A, |
| 1699 | "HP", STAC_92HD83XXX_HP_cNB11_INTQUAD), |
| 1700 | SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x165B, |
| 1701 | "HP", STAC_92HD83XXX_HP_cNB11_INTQUAD), |
| 1702 | SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x3388, |
| 1703 | "HP", STAC_92HD83XXX_HP_cNB11_INTQUAD), |
| 1704 | SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x3389, |
| 1705 | "HP", STAC_92HD83XXX_HP_cNB11_INTQUAD), |
| 1706 | SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x355B, |
| 1707 | "HP", STAC_92HD83XXX_HP_cNB11_INTQUAD), |
| 1708 | SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x355C, |
| 1709 | "HP", STAC_92HD83XXX_HP_cNB11_INTQUAD), |
| 1710 | SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x355D, |
| 1711 | "HP", STAC_92HD83XXX_HP_cNB11_INTQUAD), |
| 1712 | SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x355E, |
| 1713 | "HP", STAC_92HD83XXX_HP_cNB11_INTQUAD), |
| 1714 | SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x355F, |
| 1715 | "HP", STAC_92HD83XXX_HP_cNB11_INTQUAD), |
| 1716 | SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x3560, |
| 1717 | "HP", STAC_92HD83XXX_HP_cNB11_INTQUAD), |
| 1718 | SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x358B, |
| 1719 | "HP", STAC_92HD83XXX_HP_cNB11_INTQUAD), |
| 1720 | SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x358C, |
| 1721 | "HP", STAC_92HD83XXX_HP_cNB11_INTQUAD), |
| 1722 | SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x358D, |
| 1723 | "HP", STAC_92HD83XXX_HP_cNB11_INTQUAD), |
| 1724 | SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x3591, |
| 1725 | "HP", STAC_92HD83XXX_HP_cNB11_INTQUAD), |
| 1726 | SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x3592, |
| 1727 | "HP", STAC_92HD83XXX_HP_cNB11_INTQUAD), |
| 1728 | SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x3593, |
| 1729 | "HP", STAC_92HD83XXX_HP_cNB11_INTQUAD), |
Vitaliy Kulikov | 5556e14 | 2012-02-27 16:47:37 -0600 | [diff] [blame] | 1730 | SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x3561, |
| 1731 | "HP", STAC_HP_ZEPHYR), |
| 1732 | {} /* terminator */ |
| 1733 | }; |
| 1734 | |
| 1735 | static const struct snd_pci_quirk stac92hd83xxx_codec_id_cfg_tbl[] = { |
| 1736 | SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x3561, |
| 1737 | "HP", STAC_HP_ZEPHYR), |
Herton Ronaldo Krzesinski | 574f3c4 | 2008-12-23 16:53:00 -0200 | [diff] [blame] | 1738 | {} /* terminator */ |
Matthew Ranostay | d0513fc | 2008-07-27 10:30:30 +0200 | [diff] [blame] | 1739 | }; |
| 1740 | |
Takashi Iwai | 2b63536 | 2011-05-02 12:33:43 +0200 | [diff] [blame] | 1741 | static const unsigned int ref92hd71bxx_pin_configs[STAC92HD71BXX_NUM_PINS] = { |
Matthew Ranostay | e035b84 | 2007-11-06 11:53:55 +0100 | [diff] [blame] | 1742 | 0x02214030, 0x02a19040, 0x01a19020, 0x01014010, |
Matthew Ranostay | 4b33c76 | 2008-10-10 09:07:23 -0400 | [diff] [blame] | 1743 | 0x0181302e, 0x01014010, 0x01019020, 0x90a000f0, |
Herton Ronaldo Krzesinski | 616f89e | 2009-02-04 11:23:19 -0500 | [diff] [blame] | 1744 | 0x90a000f0, 0x01452050, 0x01452050, 0x00000000, |
| 1745 | 0x00000000 |
Matthew Ranostay | e035b84 | 2007-11-06 11:53:55 +0100 | [diff] [blame] | 1746 | }; |
| 1747 | |
Takashi Iwai | 2b63536 | 2011-05-02 12:33:43 +0200 | [diff] [blame] | 1748 | static const unsigned int dell_m4_1_pin_configs[STAC92HD71BXX_NUM_PINS] = { |
Matthew Ranostay | a766264 | 2008-02-21 07:51:14 +0100 | [diff] [blame] | 1749 | 0x0421101f, 0x04a11221, 0x40f000f0, 0x90170110, |
Matthew Ranostay | 07bcb31 | 2008-03-20 12:10:57 +0100 | [diff] [blame] | 1750 | 0x23a1902e, 0x23014250, 0x40f000f0, 0x90a000f0, |
Herton Ronaldo Krzesinski | 616f89e | 2009-02-04 11:23:19 -0500 | [diff] [blame] | 1751 | 0x40f000f0, 0x4f0000f0, 0x4f0000f0, 0x00000000, |
| 1752 | 0x00000000 |
Matthew Ranostay | a766264 | 2008-02-21 07:51:14 +0100 | [diff] [blame] | 1753 | }; |
| 1754 | |
Takashi Iwai | 2b63536 | 2011-05-02 12:33:43 +0200 | [diff] [blame] | 1755 | static const unsigned int dell_m4_2_pin_configs[STAC92HD71BXX_NUM_PINS] = { |
Matthew Ranostay | a766264 | 2008-02-21 07:51:14 +0100 | [diff] [blame] | 1756 | 0x0421101f, 0x04a11221, 0x90a70330, 0x90170110, |
| 1757 | 0x23a1902e, 0x23014250, 0x40f000f0, 0x40f000f0, |
Herton Ronaldo Krzesinski | 616f89e | 2009-02-04 11:23:19 -0500 | [diff] [blame] | 1758 | 0x40f000f0, 0x044413b0, 0x044413b0, 0x00000000, |
| 1759 | 0x00000000 |
Matthew Ranostay | a766264 | 2008-02-21 07:51:14 +0100 | [diff] [blame] | 1760 | }; |
| 1761 | |
Takashi Iwai | 2b63536 | 2011-05-02 12:33:43 +0200 | [diff] [blame] | 1762 | static const unsigned int dell_m4_3_pin_configs[STAC92HD71BXX_NUM_PINS] = { |
Matthew Ranostay | 3a7abfd | 2008-11-20 21:21:43 -0500 | [diff] [blame] | 1763 | 0x0421101f, 0x04a11221, 0x90a70330, 0x90170110, |
| 1764 | 0x40f000f0, 0x40f000f0, 0x40f000f0, 0x90a000f0, |
Herton Ronaldo Krzesinski | 616f89e | 2009-02-04 11:23:19 -0500 | [diff] [blame] | 1765 | 0x40f000f0, 0x044413b0, 0x044413b0, 0x00000000, |
| 1766 | 0x00000000 |
Matthew Ranostay | 3a7abfd | 2008-11-20 21:21:43 -0500 | [diff] [blame] | 1767 | }; |
| 1768 | |
Takashi Iwai | 2b63536 | 2011-05-02 12:33:43 +0200 | [diff] [blame] | 1769 | static const unsigned int *stac92hd71bxx_brd_tbl[STAC_92HD71BXX_MODELS] = { |
Matthew Ranostay | e035b84 | 2007-11-06 11:53:55 +0100 | [diff] [blame] | 1770 | [STAC_92HD71BXX_REF] = ref92hd71bxx_pin_configs, |
Matthew Ranostay | a766264 | 2008-02-21 07:51:14 +0100 | [diff] [blame] | 1771 | [STAC_DELL_M4_1] = dell_m4_1_pin_configs, |
| 1772 | [STAC_DELL_M4_2] = dell_m4_2_pin_configs, |
Matthew Ranostay | 3a7abfd | 2008-11-20 21:21:43 -0500 | [diff] [blame] | 1773 | [STAC_DELL_M4_3] = dell_m4_3_pin_configs, |
Matthew Ranostay | 6a14f58 | 2008-09-12 12:02:30 -0400 | [diff] [blame] | 1774 | [STAC_HP_M4] = NULL, |
Takashi Iwai | 2a6ce6e | 2010-05-12 10:16:20 +0200 | [diff] [blame] | 1775 | [STAC_HP_DV4] = NULL, |
Takashi Iwai | 1b0652e | 2009-01-14 08:27:35 +0100 | [diff] [blame] | 1776 | [STAC_HP_DV5] = NULL, |
Christoph Plattner | ae6241f | 2009-03-08 23:19:05 +0100 | [diff] [blame] | 1777 | [STAC_HP_HDX] = NULL, |
James Gardiner | 514bf54 | 2009-05-03 04:00:44 -0400 | [diff] [blame] | 1778 | [STAC_HP_DV4_1222NR] = NULL, |
Matthew Ranostay | e035b84 | 2007-11-06 11:53:55 +0100 | [diff] [blame] | 1779 | }; |
| 1780 | |
Takashi Iwai | ea73496 | 2011-01-17 11:29:34 +0100 | [diff] [blame] | 1781 | static const char * const stac92hd71bxx_models[STAC_92HD71BXX_MODELS] = { |
Takashi Iwai | 1607b8e | 2009-02-26 16:50:43 +0100 | [diff] [blame] | 1782 | [STAC_92HD71BXX_AUTO] = "auto", |
Matthew Ranostay | e035b84 | 2007-11-06 11:53:55 +0100 | [diff] [blame] | 1783 | [STAC_92HD71BXX_REF] = "ref", |
Matthew Ranostay | a766264 | 2008-02-21 07:51:14 +0100 | [diff] [blame] | 1784 | [STAC_DELL_M4_1] = "dell-m4-1", |
| 1785 | [STAC_DELL_M4_2] = "dell-m4-2", |
Matthew Ranostay | 3a7abfd | 2008-11-20 21:21:43 -0500 | [diff] [blame] | 1786 | [STAC_DELL_M4_3] = "dell-m4-3", |
Matthew Ranostay | 6a14f58 | 2008-09-12 12:02:30 -0400 | [diff] [blame] | 1787 | [STAC_HP_M4] = "hp-m4", |
Takashi Iwai | 2a6ce6e | 2010-05-12 10:16:20 +0200 | [diff] [blame] | 1788 | [STAC_HP_DV4] = "hp-dv4", |
Takashi Iwai | 1b0652e | 2009-01-14 08:27:35 +0100 | [diff] [blame] | 1789 | [STAC_HP_DV5] = "hp-dv5", |
Christoph Plattner | ae6241f | 2009-03-08 23:19:05 +0100 | [diff] [blame] | 1790 | [STAC_HP_HDX] = "hp-hdx", |
James Gardiner | 514bf54 | 2009-05-03 04:00:44 -0400 | [diff] [blame] | 1791 | [STAC_HP_DV4_1222NR] = "hp-dv4-1222nr", |
Matthew Ranostay | e035b84 | 2007-11-06 11:53:55 +0100 | [diff] [blame] | 1792 | }; |
| 1793 | |
Takashi Iwai | 2b63536 | 2011-05-02 12:33:43 +0200 | [diff] [blame] | 1794 | static const struct snd_pci_quirk stac92hd71bxx_cfg_tbl[] = { |
Matthew Ranostay | e035b84 | 2007-11-06 11:53:55 +0100 | [diff] [blame] | 1795 | /* SigmaTel reference board */ |
| 1796 | SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2668, |
| 1797 | "DFI LanParty", STAC_92HD71BXX_REF), |
Matthew Ranostay | 577aa2c | 2009-01-22 22:55:44 -0500 | [diff] [blame] | 1798 | SND_PCI_QUIRK(PCI_VENDOR_ID_DFI, 0x3101, |
| 1799 | "DFI LanParty", STAC_92HD71BXX_REF), |
James Gardiner | 514bf54 | 2009-05-03 04:00:44 -0400 | [diff] [blame] | 1800 | SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x30fb, |
| 1801 | "HP dv4-1222nr", STAC_HP_DV4_1222NR), |
Vitaliy Kulikov | 5bdaaad | 2009-11-04 07:57:45 +0100 | [diff] [blame] | 1802 | SND_PCI_QUIRK_MASK(PCI_VENDOR_ID_HP, 0xfff0, 0x1720, |
| 1803 | "HP", STAC_HP_DV5), |
Takashi Iwai | 58d8395 | 2009-03-13 17:04:34 +0100 | [diff] [blame] | 1804 | SND_PCI_QUIRK_MASK(PCI_VENDOR_ID_HP, 0xfff0, 0x3080, |
| 1805 | "HP", STAC_HP_DV5), |
Takashi Iwai | 2ae466f | 2009-02-16 14:16:36 +0100 | [diff] [blame] | 1806 | SND_PCI_QUIRK_MASK(PCI_VENDOR_ID_HP, 0xfff0, 0x30f0, |
Takashi Iwai | 2a6ce6e | 2010-05-12 10:16:20 +0200 | [diff] [blame] | 1807 | "HP dv4-7", STAC_HP_DV4), |
Takashi Iwai | 2ae466f | 2009-02-16 14:16:36 +0100 | [diff] [blame] | 1808 | SND_PCI_QUIRK_MASK(PCI_VENDOR_ID_HP, 0xfff0, 0x3600, |
| 1809 | "HP dv4-7", STAC_HP_DV5), |
Takashi Iwai | 6fce61a | 2009-03-10 07:48:57 +0100 | [diff] [blame] | 1810 | SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x3610, |
| 1811 | "HP HDX", STAC_HP_HDX), /* HDX18 */ |
Matthew Ranostay | 9a9e235 | 2008-09-26 10:37:03 -0400 | [diff] [blame] | 1812 | SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x361a, |
Takashi Iwai | 2ae466f | 2009-02-16 14:16:36 +0100 | [diff] [blame] | 1813 | "HP mini 1000", STAC_HP_M4), |
Christoph Plattner | ae6241f | 2009-03-08 23:19:05 +0100 | [diff] [blame] | 1814 | SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x361b, |
Takashi Iwai | 6fce61a | 2009-03-10 07:48:57 +0100 | [diff] [blame] | 1815 | "HP HDX", STAC_HP_HDX), /* HDX16 */ |
Takashi Iwai | 6e34c03 | 2009-09-14 15:42:18 +0200 | [diff] [blame] | 1816 | SND_PCI_QUIRK_MASK(PCI_VENDOR_ID_HP, 0xfff0, 0x3620, |
| 1817 | "HP dv6", STAC_HP_DV5), |
Kunal Gangakhedkar | e3d2530 | 2010-03-20 23:08:01 +0530 | [diff] [blame] | 1818 | SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x3061, |
| 1819 | "HP dv6", STAC_HP_DV5), /* HP dv6-1110ax */ |
Luke Yelavich | 9b2167d | 2010-10-06 15:45:46 +1100 | [diff] [blame] | 1820 | SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x363e, |
| 1821 | "HP DV6", STAC_HP_DV5), |
Takashi Iwai | 1972d02 | 2009-08-06 08:44:43 +0200 | [diff] [blame] | 1822 | SND_PCI_QUIRK_MASK(PCI_VENDOR_ID_HP, 0xfff0, 0x7010, |
| 1823 | "HP", STAC_HP_DV5), |
Matthew Ranostay | a766264 | 2008-02-21 07:51:14 +0100 | [diff] [blame] | 1824 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0233, |
| 1825 | "unknown Dell", STAC_DELL_M4_1), |
| 1826 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0234, |
| 1827 | "unknown Dell", STAC_DELL_M4_1), |
| 1828 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0250, |
| 1829 | "unknown Dell", STAC_DELL_M4_1), |
| 1830 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x024f, |
| 1831 | "unknown Dell", STAC_DELL_M4_1), |
| 1832 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x024d, |
| 1833 | "unknown Dell", STAC_DELL_M4_1), |
| 1834 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0251, |
| 1835 | "unknown Dell", STAC_DELL_M4_1), |
| 1836 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0277, |
| 1837 | "unknown Dell", STAC_DELL_M4_1), |
| 1838 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0263, |
| 1839 | "unknown Dell", STAC_DELL_M4_2), |
| 1840 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0265, |
| 1841 | "unknown Dell", STAC_DELL_M4_2), |
| 1842 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0262, |
| 1843 | "unknown Dell", STAC_DELL_M4_2), |
| 1844 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0264, |
| 1845 | "unknown Dell", STAC_DELL_M4_2), |
Matthew Ranostay | 3a7abfd | 2008-11-20 21:21:43 -0500 | [diff] [blame] | 1846 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x02aa, |
| 1847 | "unknown Dell", STAC_DELL_M4_3), |
Matthew Ranostay | e035b84 | 2007-11-06 11:53:55 +0100 | [diff] [blame] | 1848 | {} /* terminator */ |
| 1849 | }; |
| 1850 | |
Takashi Iwai | 2b63536 | 2011-05-02 12:33:43 +0200 | [diff] [blame] | 1851 | static const unsigned int ref922x_pin_configs[10] = { |
Matt Porter | 403d194 | 2005-11-29 15:00:51 +0100 | [diff] [blame] | 1852 | 0x01014010, 0x01016011, 0x01012012, 0x0221401f, |
| 1853 | 0x01813122, 0x01011014, 0x01441030, 0x01c41030, |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 1854 | 0x40000100, 0x40000100, |
| 1855 | }; |
| 1856 | |
Takashi Iwai | dfe495d | 2007-08-23 19:04:28 +0200 | [diff] [blame] | 1857 | /* |
| 1858 | STAC 922X pin configs for |
| 1859 | 102801A7 |
| 1860 | 102801AB |
| 1861 | 102801A9 |
| 1862 | 102801D1 |
| 1863 | 102801D2 |
| 1864 | */ |
Takashi Iwai | 2b63536 | 2011-05-02 12:33:43 +0200 | [diff] [blame] | 1865 | static const unsigned int dell_922x_d81_pin_configs[10] = { |
Takashi Iwai | dfe495d | 2007-08-23 19:04:28 +0200 | [diff] [blame] | 1866 | 0x02214030, 0x01a19021, 0x01111012, 0x01114010, |
| 1867 | 0x02a19020, 0x01117011, 0x400001f0, 0x400001f1, |
| 1868 | 0x01813122, 0x400001f2, |
| 1869 | }; |
| 1870 | |
| 1871 | /* |
| 1872 | STAC 922X pin configs for |
| 1873 | 102801AC |
| 1874 | 102801D0 |
| 1875 | */ |
Takashi Iwai | 2b63536 | 2011-05-02 12:33:43 +0200 | [diff] [blame] | 1876 | static const unsigned int dell_922x_d82_pin_configs[10] = { |
Takashi Iwai | dfe495d | 2007-08-23 19:04:28 +0200 | [diff] [blame] | 1877 | 0x02214030, 0x01a19021, 0x01111012, 0x01114010, |
| 1878 | 0x02a19020, 0x01117011, 0x01451140, 0x400001f0, |
| 1879 | 0x01813122, 0x400001f1, |
| 1880 | }; |
| 1881 | |
| 1882 | /* |
| 1883 | STAC 922X pin configs for |
| 1884 | 102801BF |
| 1885 | */ |
Takashi Iwai | 2b63536 | 2011-05-02 12:33:43 +0200 | [diff] [blame] | 1886 | static const unsigned int dell_922x_m81_pin_configs[10] = { |
Takashi Iwai | dfe495d | 2007-08-23 19:04:28 +0200 | [diff] [blame] | 1887 | 0x0321101f, 0x01112024, 0x01111222, 0x91174220, |
| 1888 | 0x03a11050, 0x01116221, 0x90a70330, 0x01452340, |
| 1889 | 0x40C003f1, 0x405003f0, |
| 1890 | }; |
| 1891 | |
| 1892 | /* |
| 1893 | STAC 9221 A1 pin configs for |
| 1894 | 102801D7 (Dell XPS M1210) |
| 1895 | */ |
Takashi Iwai | 2b63536 | 2011-05-02 12:33:43 +0200 | [diff] [blame] | 1896 | static const unsigned int dell_922x_m82_pin_configs[10] = { |
Jiang Zhe | 7f9310c | 2007-11-12 12:43:37 +0100 | [diff] [blame] | 1897 | 0x02211211, 0x408103ff, 0x02a1123e, 0x90100310, |
| 1898 | 0x408003f1, 0x0221121f, 0x03451340, 0x40c003f2, |
Takashi Iwai | dfe495d | 2007-08-23 19:04:28 +0200 | [diff] [blame] | 1899 | 0x508003f3, 0x405003f4, |
| 1900 | }; |
| 1901 | |
Takashi Iwai | 2b63536 | 2011-05-02 12:33:43 +0200 | [diff] [blame] | 1902 | static const unsigned int d945gtp3_pin_configs[10] = { |
Matt Porter | 869264c | 2006-01-25 19:20:50 +0100 | [diff] [blame] | 1903 | 0x0221401f, 0x01a19022, 0x01813021, 0x01014010, |
Matt Porter | 403d194 | 2005-11-29 15:00:51 +0100 | [diff] [blame] | 1904 | 0x40000100, 0x40000100, 0x40000100, 0x40000100, |
| 1905 | 0x02a19120, 0x40000100, |
| 1906 | }; |
| 1907 | |
Takashi Iwai | 2b63536 | 2011-05-02 12:33:43 +0200 | [diff] [blame] | 1908 | static const unsigned int d945gtp5_pin_configs[10] = { |
Matt Porter | 869264c | 2006-01-25 19:20:50 +0100 | [diff] [blame] | 1909 | 0x0221401f, 0x01011012, 0x01813024, 0x01014010, |
| 1910 | 0x01a19021, 0x01016011, 0x01452130, 0x40000100, |
Matt Porter | 403d194 | 2005-11-29 15:00:51 +0100 | [diff] [blame] | 1911 | 0x02a19320, 0x40000100, |
| 1912 | }; |
| 1913 | |
Takashi Iwai | 2b63536 | 2011-05-02 12:33:43 +0200 | [diff] [blame] | 1914 | static const unsigned int intel_mac_v1_pin_configs[10] = { |
Ivan N. Zlatev | 5d5d3bc | 2007-05-29 16:03:00 +0200 | [diff] [blame] | 1915 | 0x0121e21f, 0x400000ff, 0x9017e110, 0x400000fd, |
| 1916 | 0x400000fe, 0x0181e020, 0x1145e030, 0x11c5e240, |
Takashi Iwai | 3fc24d8 | 2007-02-16 13:27:18 +0100 | [diff] [blame] | 1917 | 0x400000fc, 0x400000fb, |
| 1918 | }; |
| 1919 | |
Takashi Iwai | 2b63536 | 2011-05-02 12:33:43 +0200 | [diff] [blame] | 1920 | static const unsigned int intel_mac_v2_pin_configs[10] = { |
Ivan N. Zlatev | 5d5d3bc | 2007-05-29 16:03:00 +0200 | [diff] [blame] | 1921 | 0x0121e21f, 0x90a7012e, 0x9017e110, 0x400000fd, |
| 1922 | 0x400000fe, 0x0181e020, 0x1145e230, 0x500000fa, |
Sylvain FORET | f16928f | 2007-04-27 14:22:36 +0200 | [diff] [blame] | 1923 | 0x400000fc, 0x400000fb, |
| 1924 | }; |
| 1925 | |
Takashi Iwai | 2b63536 | 2011-05-02 12:33:43 +0200 | [diff] [blame] | 1926 | static const unsigned int intel_mac_v3_pin_configs[10] = { |
Ivan N. Zlatev | 5d5d3bc | 2007-05-29 16:03:00 +0200 | [diff] [blame] | 1927 | 0x0121e21f, 0x90a7012e, 0x9017e110, 0x400000fd, |
| 1928 | 0x400000fe, 0x0181e020, 0x1145e230, 0x11c5e240, |
| 1929 | 0x400000fc, 0x400000fb, |
| 1930 | }; |
| 1931 | |
Takashi Iwai | 2b63536 | 2011-05-02 12:33:43 +0200 | [diff] [blame] | 1932 | static const unsigned int intel_mac_v4_pin_configs[10] = { |
Ivan N. Zlatev | 5d5d3bc | 2007-05-29 16:03:00 +0200 | [diff] [blame] | 1933 | 0x0321e21f, 0x03a1e02e, 0x9017e110, 0x9017e11f, |
| 1934 | 0x400000fe, 0x0381e020, 0x1345e230, 0x13c5e240, |
| 1935 | 0x400000fc, 0x400000fb, |
| 1936 | }; |
| 1937 | |
Takashi Iwai | 2b63536 | 2011-05-02 12:33:43 +0200 | [diff] [blame] | 1938 | static const unsigned int intel_mac_v5_pin_configs[10] = { |
Ivan N. Zlatev | 5d5d3bc | 2007-05-29 16:03:00 +0200 | [diff] [blame] | 1939 | 0x0321e21f, 0x03a1e02e, 0x9017e110, 0x9017e11f, |
| 1940 | 0x400000fe, 0x0381e020, 0x1345e230, 0x13c5e240, |
| 1941 | 0x400000fc, 0x400000fb, |
Takashi Iwai | 0dae0f8 | 2007-05-21 12:41:29 +0200 | [diff] [blame] | 1942 | }; |
| 1943 | |
Takashi Iwai | 2b63536 | 2011-05-02 12:33:43 +0200 | [diff] [blame] | 1944 | static const unsigned int ecs202_pin_configs[10] = { |
Mauro Carvalho Chehab | 8c65008 | 2008-08-04 10:39:59 -0300 | [diff] [blame] | 1945 | 0x0221401f, 0x02a19020, 0x01a19020, 0x01114010, |
| 1946 | 0x408000f0, 0x01813022, 0x074510a0, 0x40c400f1, |
| 1947 | 0x9037012e, 0x40e000f2, |
| 1948 | }; |
Takashi Iwai | 76c0882 | 2007-06-19 12:17:42 +0200 | [diff] [blame] | 1949 | |
Takashi Iwai | 2b63536 | 2011-05-02 12:33:43 +0200 | [diff] [blame] | 1950 | static const unsigned int *stac922x_brd_tbl[STAC_922X_MODELS] = { |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 1951 | [STAC_D945_REF] = ref922x_pin_configs, |
Takashi Iwai | 19039bd | 2006-06-28 15:52:16 +0200 | [diff] [blame] | 1952 | [STAC_D945GTP3] = d945gtp3_pin_configs, |
| 1953 | [STAC_D945GTP5] = d945gtp5_pin_configs, |
Ivan N. Zlatev | 5d5d3bc | 2007-05-29 16:03:00 +0200 | [diff] [blame] | 1954 | [STAC_INTEL_MAC_V1] = intel_mac_v1_pin_configs, |
| 1955 | [STAC_INTEL_MAC_V2] = intel_mac_v2_pin_configs, |
| 1956 | [STAC_INTEL_MAC_V3] = intel_mac_v3_pin_configs, |
| 1957 | [STAC_INTEL_MAC_V4] = intel_mac_v4_pin_configs, |
| 1958 | [STAC_INTEL_MAC_V5] = intel_mac_v5_pin_configs, |
Nicolas Boichat | 536319a | 2008-07-21 22:18:01 +0800 | [diff] [blame] | 1959 | [STAC_INTEL_MAC_AUTO] = intel_mac_v3_pin_configs, |
Takashi Iwai | dfe495d | 2007-08-23 19:04:28 +0200 | [diff] [blame] | 1960 | /* for backward compatibility */ |
Ivan N. Zlatev | 5d5d3bc | 2007-05-29 16:03:00 +0200 | [diff] [blame] | 1961 | [STAC_MACMINI] = intel_mac_v3_pin_configs, |
| 1962 | [STAC_MACBOOK] = intel_mac_v5_pin_configs, |
| 1963 | [STAC_MACBOOK_PRO_V1] = intel_mac_v3_pin_configs, |
| 1964 | [STAC_MACBOOK_PRO_V2] = intel_mac_v3_pin_configs, |
| 1965 | [STAC_IMAC_INTEL] = intel_mac_v2_pin_configs, |
| 1966 | [STAC_IMAC_INTEL_20] = intel_mac_v3_pin_configs, |
Mauro Carvalho Chehab | 8c65008 | 2008-08-04 10:39:59 -0300 | [diff] [blame] | 1967 | [STAC_ECS_202] = ecs202_pin_configs, |
Takashi Iwai | dfe495d | 2007-08-23 19:04:28 +0200 | [diff] [blame] | 1968 | [STAC_922X_DELL_D81] = dell_922x_d81_pin_configs, |
| 1969 | [STAC_922X_DELL_D82] = dell_922x_d82_pin_configs, |
| 1970 | [STAC_922X_DELL_M81] = dell_922x_m81_pin_configs, |
| 1971 | [STAC_922X_DELL_M82] = dell_922x_m82_pin_configs, |
Matt Porter | 403d194 | 2005-11-29 15:00:51 +0100 | [diff] [blame] | 1972 | }; |
| 1973 | |
Takashi Iwai | ea73496 | 2011-01-17 11:29:34 +0100 | [diff] [blame] | 1974 | static const char * const stac922x_models[STAC_922X_MODELS] = { |
Takashi Iwai | 1607b8e | 2009-02-26 16:50:43 +0100 | [diff] [blame] | 1975 | [STAC_922X_AUTO] = "auto", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 1976 | [STAC_D945_REF] = "ref", |
| 1977 | [STAC_D945GTP5] = "5stack", |
| 1978 | [STAC_D945GTP3] = "3stack", |
Ivan N. Zlatev | 5d5d3bc | 2007-05-29 16:03:00 +0200 | [diff] [blame] | 1979 | [STAC_INTEL_MAC_V1] = "intel-mac-v1", |
| 1980 | [STAC_INTEL_MAC_V2] = "intel-mac-v2", |
| 1981 | [STAC_INTEL_MAC_V3] = "intel-mac-v3", |
| 1982 | [STAC_INTEL_MAC_V4] = "intel-mac-v4", |
| 1983 | [STAC_INTEL_MAC_V5] = "intel-mac-v5", |
Nicolas Boichat | 536319a | 2008-07-21 22:18:01 +0800 | [diff] [blame] | 1984 | [STAC_INTEL_MAC_AUTO] = "intel-mac-auto", |
Takashi Iwai | dfe495d | 2007-08-23 19:04:28 +0200 | [diff] [blame] | 1985 | /* for backward compatibility */ |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 1986 | [STAC_MACMINI] = "macmini", |
Takashi Iwai | 3fc24d8 | 2007-02-16 13:27:18 +0100 | [diff] [blame] | 1987 | [STAC_MACBOOK] = "macbook", |
Nicolas Boichat | 6f0778d | 2007-03-15 12:38:15 +0100 | [diff] [blame] | 1988 | [STAC_MACBOOK_PRO_V1] = "macbook-pro-v1", |
| 1989 | [STAC_MACBOOK_PRO_V2] = "macbook-pro", |
Sylvain FORET | f16928f | 2007-04-27 14:22:36 +0200 | [diff] [blame] | 1990 | [STAC_IMAC_INTEL] = "imac-intel", |
Takashi Iwai | 0dae0f8 | 2007-05-21 12:41:29 +0200 | [diff] [blame] | 1991 | [STAC_IMAC_INTEL_20] = "imac-intel-20", |
Mauro Carvalho Chehab | 8c65008 | 2008-08-04 10:39:59 -0300 | [diff] [blame] | 1992 | [STAC_ECS_202] = "ecs202", |
Takashi Iwai | dfe495d | 2007-08-23 19:04:28 +0200 | [diff] [blame] | 1993 | [STAC_922X_DELL_D81] = "dell-d81", |
| 1994 | [STAC_922X_DELL_D82] = "dell-d82", |
| 1995 | [STAC_922X_DELL_M81] = "dell-m81", |
| 1996 | [STAC_922X_DELL_M82] = "dell-m82", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 1997 | }; |
| 1998 | |
Takashi Iwai | 2b63536 | 2011-05-02 12:33:43 +0200 | [diff] [blame] | 1999 | static const struct snd_pci_quirk stac922x_cfg_tbl[] = { |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 2000 | /* SigmaTel reference board */ |
| 2001 | SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2668, |
| 2002 | "DFI LanParty", STAC_D945_REF), |
Matthew Ranostay | 577aa2c | 2009-01-22 22:55:44 -0500 | [diff] [blame] | 2003 | SND_PCI_QUIRK(PCI_VENDOR_ID_DFI, 0x3101, |
| 2004 | "DFI LanParty", STAC_D945_REF), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 2005 | /* Intel 945G based systems */ |
| 2006 | SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x0101, |
| 2007 | "Intel D945G", STAC_D945GTP3), |
| 2008 | SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x0202, |
| 2009 | "Intel D945G", STAC_D945GTP3), |
| 2010 | SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x0606, |
| 2011 | "Intel D945G", STAC_D945GTP3), |
| 2012 | SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x0601, |
| 2013 | "Intel D945G", STAC_D945GTP3), |
| 2014 | SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x0111, |
| 2015 | "Intel D945G", STAC_D945GTP3), |
| 2016 | SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x1115, |
| 2017 | "Intel D945G", STAC_D945GTP3), |
| 2018 | SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x1116, |
| 2019 | "Intel D945G", STAC_D945GTP3), |
| 2020 | SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x1117, |
| 2021 | "Intel D945G", STAC_D945GTP3), |
| 2022 | SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x1118, |
| 2023 | "Intel D945G", STAC_D945GTP3), |
| 2024 | SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x1119, |
| 2025 | "Intel D945G", STAC_D945GTP3), |
| 2026 | SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x8826, |
| 2027 | "Intel D945G", STAC_D945GTP3), |
| 2028 | SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x5049, |
| 2029 | "Intel D945G", STAC_D945GTP3), |
| 2030 | SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x5055, |
| 2031 | "Intel D945G", STAC_D945GTP3), |
| 2032 | SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x5048, |
| 2033 | "Intel D945G", STAC_D945GTP3), |
| 2034 | SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x0110, |
| 2035 | "Intel D945G", STAC_D945GTP3), |
| 2036 | /* Intel D945G 5-stack systems */ |
| 2037 | SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x0404, |
| 2038 | "Intel D945G", STAC_D945GTP5), |
| 2039 | SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x0303, |
| 2040 | "Intel D945G", STAC_D945GTP5), |
| 2041 | SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x0013, |
| 2042 | "Intel D945G", STAC_D945GTP5), |
| 2043 | SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x0417, |
| 2044 | "Intel D945G", STAC_D945GTP5), |
| 2045 | /* Intel 945P based systems */ |
| 2046 | SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x0b0b, |
| 2047 | "Intel D945P", STAC_D945GTP3), |
| 2048 | SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x0112, |
| 2049 | "Intel D945P", STAC_D945GTP3), |
| 2050 | SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x0d0d, |
| 2051 | "Intel D945P", STAC_D945GTP3), |
| 2052 | SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x0909, |
| 2053 | "Intel D945P", STAC_D945GTP3), |
| 2054 | SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x0505, |
| 2055 | "Intel D945P", STAC_D945GTP3), |
| 2056 | SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x0707, |
| 2057 | "Intel D945P", STAC_D945GTP5), |
Takashi Iwai | 8056d47 | 2009-01-23 09:09:43 +0100 | [diff] [blame] | 2058 | /* other intel */ |
| 2059 | SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x0204, |
| 2060 | "Intel D945", STAC_D945_REF), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 2061 | /* other systems */ |
Nicolas Boichat | 536319a | 2008-07-21 22:18:01 +0800 | [diff] [blame] | 2062 | /* Apple Intel Mac (Mac Mini, MacBook, MacBook Pro...) */ |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 2063 | SND_PCI_QUIRK(0x8384, 0x7680, |
Nicolas Boichat | 536319a | 2008-07-21 22:18:01 +0800 | [diff] [blame] | 2064 | "Mac", STAC_INTEL_MAC_AUTO), |
Takashi Iwai | dfe495d | 2007-08-23 19:04:28 +0200 | [diff] [blame] | 2065 | /* Dell systems */ |
| 2066 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01a7, |
| 2067 | "unknown Dell", STAC_922X_DELL_D81), |
| 2068 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01a9, |
| 2069 | "unknown Dell", STAC_922X_DELL_D81), |
| 2070 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01ab, |
| 2071 | "unknown Dell", STAC_922X_DELL_D81), |
| 2072 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01ac, |
| 2073 | "unknown Dell", STAC_922X_DELL_D82), |
| 2074 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01bf, |
| 2075 | "unknown Dell", STAC_922X_DELL_M81), |
| 2076 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01d0, |
| 2077 | "unknown Dell", STAC_922X_DELL_D82), |
| 2078 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01d1, |
| 2079 | "unknown Dell", STAC_922X_DELL_D81), |
| 2080 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01d2, |
| 2081 | "unknown Dell", STAC_922X_DELL_D81), |
| 2082 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01d7, |
| 2083 | "Dell XPS M1210", STAC_922X_DELL_M82), |
Mauro Carvalho Chehab | 8c65008 | 2008-08-04 10:39:59 -0300 | [diff] [blame] | 2084 | /* ECS/PC Chips boards */ |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 2085 | SND_PCI_QUIRK_MASK(0x1019, 0xf000, 0x2000, |
Herton Ronaldo Krzesinski | 8663ae5 | 2009-02-08 19:50:34 -0200 | [diff] [blame] | 2086 | "ECS/PC chips", STAC_ECS_202), |
Matt Porter | 403d194 | 2005-11-29 15:00:51 +0100 | [diff] [blame] | 2087 | {} /* terminator */ |
| 2088 | }; |
| 2089 | |
Takashi Iwai | 2b63536 | 2011-05-02 12:33:43 +0200 | [diff] [blame] | 2090 | static const unsigned int ref927x_pin_configs[14] = { |
Tobin Davis | 93ed150 | 2006-09-01 21:03:12 +0200 | [diff] [blame] | 2091 | 0x02214020, 0x02a19080, 0x0181304e, 0x01014010, |
| 2092 | 0x01a19040, 0x01011012, 0x01016011, 0x0101201f, |
| 2093 | 0x183301f0, 0x18a001f0, 0x18a001f0, 0x01442070, |
| 2094 | 0x01c42190, 0x40000100, |
Matt Porter | 3cc08dc | 2006-01-23 15:27:49 +0100 | [diff] [blame] | 2095 | }; |
| 2096 | |
Takashi Iwai | 2b63536 | 2011-05-02 12:33:43 +0200 | [diff] [blame] | 2097 | static const unsigned int d965_3st_pin_configs[14] = { |
Tobin Davis | 81d3dbd | 2006-08-22 19:44:45 +0200 | [diff] [blame] | 2098 | 0x0221401f, 0x02a19120, 0x40000100, 0x01014011, |
| 2099 | 0x01a19021, 0x01813024, 0x40000100, 0x40000100, |
| 2100 | 0x40000100, 0x40000100, 0x40000100, 0x40000100, |
| 2101 | 0x40000100, 0x40000100 |
| 2102 | }; |
| 2103 | |
Takashi Iwai | 2b63536 | 2011-05-02 12:33:43 +0200 | [diff] [blame] | 2104 | static const unsigned int d965_5st_pin_configs[14] = { |
Tobin Davis | 93ed150 | 2006-09-01 21:03:12 +0200 | [diff] [blame] | 2105 | 0x02214020, 0x02a19080, 0x0181304e, 0x01014010, |
| 2106 | 0x01a19040, 0x01011012, 0x01016011, 0x40000100, |
| 2107 | 0x40000100, 0x40000100, 0x40000100, 0x01442070, |
| 2108 | 0x40000100, 0x40000100 |
| 2109 | }; |
| 2110 | |
Takashi Iwai | 2b63536 | 2011-05-02 12:33:43 +0200 | [diff] [blame] | 2111 | static const unsigned int d965_5st_no_fp_pin_configs[14] = { |
Takashi Iwai | 679d92e | 2009-05-24 19:00:08 +0200 | [diff] [blame] | 2112 | 0x40000100, 0x40000100, 0x0181304e, 0x01014010, |
| 2113 | 0x01a19040, 0x01011012, 0x01016011, 0x40000100, |
| 2114 | 0x40000100, 0x40000100, 0x40000100, 0x01442070, |
| 2115 | 0x40000100, 0x40000100 |
| 2116 | }; |
| 2117 | |
Takashi Iwai | 2b63536 | 2011-05-02 12:33:43 +0200 | [diff] [blame] | 2118 | static const unsigned int dell_3st_pin_configs[14] = { |
Tobin Davis | 4ff076e | 2007-08-07 11:48:12 +0200 | [diff] [blame] | 2119 | 0x02211230, 0x02a11220, 0x01a19040, 0x01114210, |
| 2120 | 0x01111212, 0x01116211, 0x01813050, 0x01112214, |
Matthew Ranostay | 8e9068b | 2007-12-17 11:58:13 +0100 | [diff] [blame] | 2121 | 0x403003fa, 0x90a60040, 0x90a60040, 0x404003fb, |
Tobin Davis | 4ff076e | 2007-08-07 11:48:12 +0200 | [diff] [blame] | 2122 | 0x40c003fc, 0x40000100 |
| 2123 | }; |
| 2124 | |
Takashi Iwai | 2b63536 | 2011-05-02 12:33:43 +0200 | [diff] [blame] | 2125 | static const unsigned int *stac927x_brd_tbl[STAC_927X_MODELS] = { |
Takashi Iwai | e28d832 | 2008-12-17 13:48:29 +0100 | [diff] [blame] | 2126 | [STAC_D965_REF_NO_JD] = ref927x_pin_configs, |
Matthew Ranostay | 8e9068b | 2007-12-17 11:58:13 +0100 | [diff] [blame] | 2127 | [STAC_D965_REF] = ref927x_pin_configs, |
| 2128 | [STAC_D965_3ST] = d965_3st_pin_configs, |
| 2129 | [STAC_D965_5ST] = d965_5st_pin_configs, |
Takashi Iwai | 679d92e | 2009-05-24 19:00:08 +0200 | [diff] [blame] | 2130 | [STAC_D965_5ST_NO_FP] = d965_5st_no_fp_pin_configs, |
Matthew Ranostay | 8e9068b | 2007-12-17 11:58:13 +0100 | [diff] [blame] | 2131 | [STAC_DELL_3ST] = dell_3st_pin_configs, |
| 2132 | [STAC_DELL_BIOS] = NULL, |
Takashi Iwai | 5493053 | 2009-10-11 17:38:29 +0200 | [diff] [blame] | 2133 | [STAC_927X_VOLKNOB] = NULL, |
Matt Porter | 3cc08dc | 2006-01-23 15:27:49 +0100 | [diff] [blame] | 2134 | }; |
| 2135 | |
Takashi Iwai | ea73496 | 2011-01-17 11:29:34 +0100 | [diff] [blame] | 2136 | static const char * const stac927x_models[STAC_927X_MODELS] = { |
Takashi Iwai | 1607b8e | 2009-02-26 16:50:43 +0100 | [diff] [blame] | 2137 | [STAC_927X_AUTO] = "auto", |
Takashi Iwai | e28d832 | 2008-12-17 13:48:29 +0100 | [diff] [blame] | 2138 | [STAC_D965_REF_NO_JD] = "ref-no-jd", |
Matthew Ranostay | 8e9068b | 2007-12-17 11:58:13 +0100 | [diff] [blame] | 2139 | [STAC_D965_REF] = "ref", |
| 2140 | [STAC_D965_3ST] = "3stack", |
| 2141 | [STAC_D965_5ST] = "5stack", |
Takashi Iwai | 679d92e | 2009-05-24 19:00:08 +0200 | [diff] [blame] | 2142 | [STAC_D965_5ST_NO_FP] = "5stack-no-fp", |
Matthew Ranostay | 8e9068b | 2007-12-17 11:58:13 +0100 | [diff] [blame] | 2143 | [STAC_DELL_3ST] = "dell-3stack", |
| 2144 | [STAC_DELL_BIOS] = "dell-bios", |
Takashi Iwai | 5493053 | 2009-10-11 17:38:29 +0200 | [diff] [blame] | 2145 | [STAC_927X_VOLKNOB] = "volknob", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 2146 | }; |
| 2147 | |
Takashi Iwai | 2b63536 | 2011-05-02 12:33:43 +0200 | [diff] [blame] | 2148 | static const struct snd_pci_quirk stac927x_cfg_tbl[] = { |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 2149 | /* SigmaTel reference board */ |
| 2150 | SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2668, |
| 2151 | "DFI LanParty", STAC_D965_REF), |
Matthew Ranostay | 577aa2c | 2009-01-22 22:55:44 -0500 | [diff] [blame] | 2152 | SND_PCI_QUIRK(PCI_VENDOR_ID_DFI, 0x3101, |
| 2153 | "DFI LanParty", STAC_D965_REF), |
Tobin Davis | 81d3dbd | 2006-08-22 19:44:45 +0200 | [diff] [blame] | 2154 | /* Intel 946 based systems */ |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 2155 | SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x3d01, "Intel D946", STAC_D965_3ST), |
| 2156 | SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0xa301, "Intel D946", STAC_D965_3ST), |
Tobin Davis | 93ed150 | 2006-09-01 21:03:12 +0200 | [diff] [blame] | 2157 | /* 965 based 3 stack systems */ |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 2158 | SND_PCI_QUIRK_MASK(PCI_VENDOR_ID_INTEL, 0xff00, 0x2100, |
| 2159 | "Intel D965", STAC_D965_3ST), |
| 2160 | SND_PCI_QUIRK_MASK(PCI_VENDOR_ID_INTEL, 0xff00, 0x2000, |
| 2161 | "Intel D965", STAC_D965_3ST), |
Tobin Davis | 4ff076e | 2007-08-07 11:48:12 +0200 | [diff] [blame] | 2162 | /* Dell 3 stack systems */ |
Takashi Iwai | dfe495d | 2007-08-23 19:04:28 +0200 | [diff] [blame] | 2163 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01dd, "Dell Dimension E520", STAC_DELL_3ST), |
Tobin Davis | 4ff076e | 2007-08-07 11:48:12 +0200 | [diff] [blame] | 2164 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01ed, "Dell ", STAC_DELL_3ST), |
| 2165 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01f4, "Dell ", STAC_DELL_3ST), |
Matthew Ranostay | 8e9068b | 2007-12-17 11:58:13 +0100 | [diff] [blame] | 2166 | /* Dell 3 stack systems with verb table in BIOS */ |
Matthew Ranostay | 2f32d90 | 2008-01-10 13:06:26 +0100 | [diff] [blame] | 2167 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01f3, "Dell Inspiron 1420", STAC_DELL_BIOS), |
Daniel T Chen | 66668b6 | 2010-05-23 20:47:45 -0400 | [diff] [blame] | 2168 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01f7, "Dell XPS M1730", STAC_DELL_BIOS), |
Matthew Ranostay | 2f32d90 | 2008-01-10 13:06:26 +0100 | [diff] [blame] | 2169 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0227, "Dell Vostro 1400 ", STAC_DELL_BIOS), |
Matthew Ranostay | 8e9068b | 2007-12-17 11:58:13 +0100 | [diff] [blame] | 2170 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x022e, "Dell ", STAC_DELL_BIOS), |
Chengu Wang | 84d3dc2 | 2009-07-30 19:43:55 +0800 | [diff] [blame] | 2171 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x022f, "Dell Inspiron 1525", STAC_DELL_BIOS), |
Matthew Ranostay | 8e9068b | 2007-12-17 11:58:13 +0100 | [diff] [blame] | 2172 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0242, "Dell ", STAC_DELL_BIOS), |
| 2173 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0243, "Dell ", STAC_DELL_BIOS), |
| 2174 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x02ff, "Dell ", STAC_DELL_BIOS), |
| 2175 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0209, "Dell XPS 1330", STAC_DELL_BIOS), |
Tobin Davis | 93ed150 | 2006-09-01 21:03:12 +0200 | [diff] [blame] | 2176 | /* 965 based 5 stack systems */ |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 2177 | SND_PCI_QUIRK_MASK(PCI_VENDOR_ID_INTEL, 0xff00, 0x2300, |
| 2178 | "Intel D965", STAC_D965_5ST), |
| 2179 | SND_PCI_QUIRK_MASK(PCI_VENDOR_ID_INTEL, 0xff00, 0x2500, |
| 2180 | "Intel D965", STAC_D965_5ST), |
Takashi Iwai | 5493053 | 2009-10-11 17:38:29 +0200 | [diff] [blame] | 2181 | /* volume-knob fixes */ |
| 2182 | SND_PCI_QUIRK_VENDOR(0x10cf, "FSC", STAC_927X_VOLKNOB), |
Matt Porter | 3cc08dc | 2006-01-23 15:27:49 +0100 | [diff] [blame] | 2183 | {} /* terminator */ |
| 2184 | }; |
| 2185 | |
Takashi Iwai | 2b63536 | 2011-05-02 12:33:43 +0200 | [diff] [blame] | 2186 | static const unsigned int ref9205_pin_configs[12] = { |
Matt Porter | f3302a5 | 2006-07-31 12:49:34 +0200 | [diff] [blame] | 2187 | 0x40000100, 0x40000100, 0x01016011, 0x01014010, |
Matthew Ranostay | 09a9995 | 2008-01-24 11:49:21 +0100 | [diff] [blame] | 2188 | 0x01813122, 0x01a19021, 0x01019020, 0x40000100, |
Matt Porter | 8b65727 | 2006-10-26 17:12:59 +0200 | [diff] [blame] | 2189 | 0x90a000f0, 0x90a000f0, 0x01441030, 0x01c41030 |
Matt Porter | f3302a5 | 2006-07-31 12:49:34 +0200 | [diff] [blame] | 2190 | }; |
| 2191 | |
Takashi Iwai | dfe495d | 2007-08-23 19:04:28 +0200 | [diff] [blame] | 2192 | /* |
| 2193 | STAC 9205 pin configs for |
| 2194 | 102801F1 |
| 2195 | 102801F2 |
| 2196 | 102801FC |
| 2197 | 102801FD |
| 2198 | 10280204 |
| 2199 | 1028021F |
Matthew Ranostay | 3fa2ef7 | 2008-01-11 11:39:06 +0100 | [diff] [blame] | 2200 | 10280228 (Dell Vostro 1500) |
Anisse Astier | 95e70e8 | 2009-12-23 17:28:45 +0100 | [diff] [blame] | 2201 | 10280229 (Dell Vostro 1700) |
Takashi Iwai | dfe495d | 2007-08-23 19:04:28 +0200 | [diff] [blame] | 2202 | */ |
Takashi Iwai | 2b63536 | 2011-05-02 12:33:43 +0200 | [diff] [blame] | 2203 | static const unsigned int dell_9205_m42_pin_configs[12] = { |
Takashi Iwai | dfe495d | 2007-08-23 19:04:28 +0200 | [diff] [blame] | 2204 | 0x0321101F, 0x03A11020, 0x400003FA, 0x90170310, |
| 2205 | 0x400003FB, 0x400003FC, 0x400003FD, 0x40F000F9, |
| 2206 | 0x90A60330, 0x400003FF, 0x0144131F, 0x40C003FE, |
| 2207 | }; |
| 2208 | |
| 2209 | /* |
| 2210 | STAC 9205 pin configs for |
| 2211 | 102801F9 |
| 2212 | 102801FA |
| 2213 | 102801FE |
| 2214 | 102801FF (Dell Precision M4300) |
| 2215 | 10280206 |
| 2216 | 10280200 |
| 2217 | 10280201 |
| 2218 | */ |
Takashi Iwai | 2b63536 | 2011-05-02 12:33:43 +0200 | [diff] [blame] | 2219 | static const unsigned int dell_9205_m43_pin_configs[12] = { |
Tobin Davis | ae0a8ed | 2007-08-13 15:50:29 +0200 | [diff] [blame] | 2220 | 0x0321101f, 0x03a11020, 0x90a70330, 0x90170310, |
| 2221 | 0x400000fe, 0x400000ff, 0x400000fd, 0x40f000f9, |
| 2222 | 0x400000fa, 0x400000fc, 0x0144131f, 0x40c003f8, |
| 2223 | }; |
| 2224 | |
Takashi Iwai | 2b63536 | 2011-05-02 12:33:43 +0200 | [diff] [blame] | 2225 | static const unsigned int dell_9205_m44_pin_configs[12] = { |
Tobin Davis | ae0a8ed | 2007-08-13 15:50:29 +0200 | [diff] [blame] | 2226 | 0x0421101f, 0x04a11020, 0x400003fa, 0x90170310, |
| 2227 | 0x400003fb, 0x400003fc, 0x400003fd, 0x400003f9, |
| 2228 | 0x90a60330, 0x400003ff, 0x01441340, 0x40c003fe, |
| 2229 | }; |
| 2230 | |
Takashi Iwai | 2b63536 | 2011-05-02 12:33:43 +0200 | [diff] [blame] | 2231 | static const unsigned int *stac9205_brd_tbl[STAC_9205_MODELS] = { |
Tobin Davis | ae0a8ed | 2007-08-13 15:50:29 +0200 | [diff] [blame] | 2232 | [STAC_9205_REF] = ref9205_pin_configs, |
Takashi Iwai | dfe495d | 2007-08-23 19:04:28 +0200 | [diff] [blame] | 2233 | [STAC_9205_DELL_M42] = dell_9205_m42_pin_configs, |
| 2234 | [STAC_9205_DELL_M43] = dell_9205_m43_pin_configs, |
| 2235 | [STAC_9205_DELL_M44] = dell_9205_m44_pin_configs, |
Takashi Iwai | d9a4268 | 2009-01-22 17:40:18 +0100 | [diff] [blame] | 2236 | [STAC_9205_EAPD] = NULL, |
Matt Porter | f3302a5 | 2006-07-31 12:49:34 +0200 | [diff] [blame] | 2237 | }; |
| 2238 | |
Takashi Iwai | ea73496 | 2011-01-17 11:29:34 +0100 | [diff] [blame] | 2239 | static const char * const stac9205_models[STAC_9205_MODELS] = { |
Takashi Iwai | 1607b8e | 2009-02-26 16:50:43 +0100 | [diff] [blame] | 2240 | [STAC_9205_AUTO] = "auto", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 2241 | [STAC_9205_REF] = "ref", |
Takashi Iwai | dfe495d | 2007-08-23 19:04:28 +0200 | [diff] [blame] | 2242 | [STAC_9205_DELL_M42] = "dell-m42", |
Tobin Davis | ae0a8ed | 2007-08-13 15:50:29 +0200 | [diff] [blame] | 2243 | [STAC_9205_DELL_M43] = "dell-m43", |
| 2244 | [STAC_9205_DELL_M44] = "dell-m44", |
Takashi Iwai | d9a4268 | 2009-01-22 17:40:18 +0100 | [diff] [blame] | 2245 | [STAC_9205_EAPD] = "eapd", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 2246 | }; |
| 2247 | |
Takashi Iwai | 2b63536 | 2011-05-02 12:33:43 +0200 | [diff] [blame] | 2248 | static const struct snd_pci_quirk stac9205_cfg_tbl[] = { |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 2249 | /* SigmaTel reference board */ |
| 2250 | SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2668, |
| 2251 | "DFI LanParty", STAC_9205_REF), |
Herton Ronaldo Krzesinski | 02358fc | 2009-07-04 01:44:59 -0300 | [diff] [blame] | 2252 | SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0xfb30, |
| 2253 | "SigmaTel", STAC_9205_REF), |
Matthew Ranostay | 577aa2c | 2009-01-22 22:55:44 -0500 | [diff] [blame] | 2254 | SND_PCI_QUIRK(PCI_VENDOR_ID_DFI, 0x3101, |
| 2255 | "DFI LanParty", STAC_9205_REF), |
Takashi Iwai | d9a4268 | 2009-01-22 17:40:18 +0100 | [diff] [blame] | 2256 | /* Dell */ |
Takashi Iwai | dfe495d | 2007-08-23 19:04:28 +0200 | [diff] [blame] | 2257 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01f1, |
| 2258 | "unknown Dell", STAC_9205_DELL_M42), |
| 2259 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01f2, |
| 2260 | "unknown Dell", STAC_9205_DELL_M42), |
Tobin Davis | ae0a8ed | 2007-08-13 15:50:29 +0200 | [diff] [blame] | 2261 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01f8, |
Matthew Ranostay | b44ef2f | 2007-09-18 00:52:38 +0200 | [diff] [blame] | 2262 | "Dell Precision", STAC_9205_DELL_M43), |
Tobin Davis | ae0a8ed | 2007-08-13 15:50:29 +0200 | [diff] [blame] | 2263 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01f9, |
| 2264 | "Dell Precision", STAC_9205_DELL_M43), |
| 2265 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01fa, |
| 2266 | "Dell Precision", STAC_9205_DELL_M43), |
Takashi Iwai | dfe495d | 2007-08-23 19:04:28 +0200 | [diff] [blame] | 2267 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01fc, |
| 2268 | "unknown Dell", STAC_9205_DELL_M42), |
| 2269 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01fd, |
| 2270 | "unknown Dell", STAC_9205_DELL_M42), |
Tobin Davis | ae0a8ed | 2007-08-13 15:50:29 +0200 | [diff] [blame] | 2271 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01fe, |
| 2272 | "Dell Precision", STAC_9205_DELL_M43), |
| 2273 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01ff, |
Takashi Iwai | dfe495d | 2007-08-23 19:04:28 +0200 | [diff] [blame] | 2274 | "Dell Precision M4300", STAC_9205_DELL_M43), |
Takashi Iwai | dfe495d | 2007-08-23 19:04:28 +0200 | [diff] [blame] | 2275 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0204, |
| 2276 | "unknown Dell", STAC_9205_DELL_M42), |
Takashi Iwai | 4549915 | 2008-06-12 16:27:24 +0200 | [diff] [blame] | 2277 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0206, |
| 2278 | "Dell Precision", STAC_9205_DELL_M43), |
| 2279 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x021b, |
| 2280 | "Dell Precision", STAC_9205_DELL_M43), |
| 2281 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x021c, |
| 2282 | "Dell Precision", STAC_9205_DELL_M43), |
Tobin Davis | ae0a8ed | 2007-08-13 15:50:29 +0200 | [diff] [blame] | 2283 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x021f, |
| 2284 | "Dell Inspiron", STAC_9205_DELL_M44), |
Matthew Ranostay | 3fa2ef7 | 2008-01-11 11:39:06 +0100 | [diff] [blame] | 2285 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0228, |
| 2286 | "Dell Vostro 1500", STAC_9205_DELL_M42), |
Anisse Astier | 95e70e8 | 2009-12-23 17:28:45 +0100 | [diff] [blame] | 2287 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0229, |
| 2288 | "Dell Vostro 1700", STAC_9205_DELL_M42), |
Takashi Iwai | d9a4268 | 2009-01-22 17:40:18 +0100 | [diff] [blame] | 2289 | /* Gateway */ |
Hao Song | 42b95f0 | 2009-07-20 15:01:16 +0800 | [diff] [blame] | 2290 | SND_PCI_QUIRK(0x107b, 0x0560, "Gateway T6834c", STAC_9205_EAPD), |
Takashi Iwai | d9a4268 | 2009-01-22 17:40:18 +0100 | [diff] [blame] | 2291 | SND_PCI_QUIRK(0x107b, 0x0565, "Gateway T1616", STAC_9205_EAPD), |
Matt Porter | f3302a5 | 2006-07-31 12:49:34 +0200 | [diff] [blame] | 2292 | {} /* terminator */ |
| 2293 | }; |
| 2294 | |
Takashi Iwai | 330ee99 | 2009-02-20 14:33:36 +0100 | [diff] [blame] | 2295 | static void stac92xx_set_config_regs(struct hda_codec *codec, |
Takashi Iwai | 2b63536 | 2011-05-02 12:33:43 +0200 | [diff] [blame] | 2296 | const unsigned int *pincfgs) |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 2297 | { |
| 2298 | int i; |
| 2299 | struct sigmatel_spec *spec = codec->spec; |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 2300 | |
Takashi Iwai | 330ee99 | 2009-02-20 14:33:36 +0100 | [diff] [blame] | 2301 | if (!pincfgs) |
| 2302 | return; |
Richard Fish | 11b44bb | 2006-08-23 18:31:34 +0200 | [diff] [blame] | 2303 | |
Matthew Ranostay | 87d4836 | 2007-07-17 11:52:24 +0200 | [diff] [blame] | 2304 | for (i = 0; i < spec->num_pins; i++) |
Takashi Iwai | 330ee99 | 2009-02-20 14:33:36 +0100 | [diff] [blame] | 2305 | if (spec->pin_nids[i] && pincfgs[i]) |
| 2306 | snd_hda_codec_set_pincfg(codec, spec->pin_nids[i], |
| 2307 | pincfgs[i]); |
Takashi Iwai | af9f341 | 2008-11-18 10:38:56 +0100 | [diff] [blame] | 2308 | } |
| 2309 | |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 2310 | /* |
| 2311 | * Analog playback callbacks |
| 2312 | */ |
| 2313 | static int stac92xx_playback_pcm_open(struct hda_pcm_stream *hinfo, |
| 2314 | struct hda_codec *codec, |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 2315 | struct snd_pcm_substream *substream) |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 2316 | { |
| 2317 | struct sigmatel_spec *spec = codec->spec; |
Matthew Ranostay | 8daaaa9 | 2008-08-15 07:45:52 +0200 | [diff] [blame] | 2318 | if (spec->stream_delay) |
| 2319 | msleep(spec->stream_delay); |
Takashi Iwai | 9a08160 | 2008-02-12 18:37:26 +0100 | [diff] [blame] | 2320 | return snd_hda_multi_out_analog_open(codec, &spec->multiout, substream, |
| 2321 | hinfo); |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 2322 | } |
| 2323 | |
| 2324 | static int stac92xx_playback_pcm_prepare(struct hda_pcm_stream *hinfo, |
| 2325 | struct hda_codec *codec, |
| 2326 | unsigned int stream_tag, |
| 2327 | unsigned int format, |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 2328 | struct snd_pcm_substream *substream) |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 2329 | { |
| 2330 | struct sigmatel_spec *spec = codec->spec; |
Matt Porter | 403d194 | 2005-11-29 15:00:51 +0100 | [diff] [blame] | 2331 | return snd_hda_multi_out_analog_prepare(codec, &spec->multiout, stream_tag, format, substream); |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 2332 | } |
| 2333 | |
| 2334 | static int stac92xx_playback_pcm_cleanup(struct hda_pcm_stream *hinfo, |
| 2335 | struct hda_codec *codec, |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 2336 | struct snd_pcm_substream *substream) |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 2337 | { |
| 2338 | struct sigmatel_spec *spec = codec->spec; |
| 2339 | return snd_hda_multi_out_analog_cleanup(codec, &spec->multiout); |
| 2340 | } |
| 2341 | |
| 2342 | /* |
Matt | dabbed6 | 2005-06-14 10:19:34 +0200 | [diff] [blame] | 2343 | * Digital playback callbacks |
| 2344 | */ |
| 2345 | static int stac92xx_dig_playback_pcm_open(struct hda_pcm_stream *hinfo, |
| 2346 | struct hda_codec *codec, |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 2347 | struct snd_pcm_substream *substream) |
Matt | dabbed6 | 2005-06-14 10:19:34 +0200 | [diff] [blame] | 2348 | { |
| 2349 | struct sigmatel_spec *spec = codec->spec; |
| 2350 | return snd_hda_multi_out_dig_open(codec, &spec->multiout); |
| 2351 | } |
| 2352 | |
| 2353 | static int stac92xx_dig_playback_pcm_close(struct hda_pcm_stream *hinfo, |
| 2354 | struct hda_codec *codec, |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 2355 | struct snd_pcm_substream *substream) |
Matt | dabbed6 | 2005-06-14 10:19:34 +0200 | [diff] [blame] | 2356 | { |
| 2357 | struct sigmatel_spec *spec = codec->spec; |
| 2358 | return snd_hda_multi_out_dig_close(codec, &spec->multiout); |
| 2359 | } |
| 2360 | |
Takashi Iwai | 6b97eb4 | 2007-04-05 14:51:48 +0200 | [diff] [blame] | 2361 | static int stac92xx_dig_playback_pcm_prepare(struct hda_pcm_stream *hinfo, |
| 2362 | struct hda_codec *codec, |
| 2363 | unsigned int stream_tag, |
| 2364 | unsigned int format, |
| 2365 | struct snd_pcm_substream *substream) |
| 2366 | { |
| 2367 | struct sigmatel_spec *spec = codec->spec; |
| 2368 | return snd_hda_multi_out_dig_prepare(codec, &spec->multiout, |
| 2369 | stream_tag, format, substream); |
| 2370 | } |
| 2371 | |
Takashi Iwai | 9411e21 | 2009-02-13 11:32:28 +0100 | [diff] [blame] | 2372 | static int stac92xx_dig_playback_pcm_cleanup(struct hda_pcm_stream *hinfo, |
| 2373 | struct hda_codec *codec, |
| 2374 | struct snd_pcm_substream *substream) |
| 2375 | { |
| 2376 | struct sigmatel_spec *spec = codec->spec; |
| 2377 | return snd_hda_multi_out_dig_cleanup(codec, &spec->multiout); |
| 2378 | } |
| 2379 | |
Matt | dabbed6 | 2005-06-14 10:19:34 +0200 | [diff] [blame] | 2380 | |
| 2381 | /* |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 2382 | * Analog capture callbacks |
| 2383 | */ |
| 2384 | static int stac92xx_capture_pcm_prepare(struct hda_pcm_stream *hinfo, |
| 2385 | struct hda_codec *codec, |
| 2386 | unsigned int stream_tag, |
| 2387 | unsigned int format, |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 2388 | struct snd_pcm_substream *substream) |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 2389 | { |
| 2390 | struct sigmatel_spec *spec = codec->spec; |
Matthew Ranostay | 8daaaa9 | 2008-08-15 07:45:52 +0200 | [diff] [blame] | 2391 | hda_nid_t nid = spec->adc_nids[substream->number]; |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 2392 | |
Matthew Ranostay | 8daaaa9 | 2008-08-15 07:45:52 +0200 | [diff] [blame] | 2393 | if (spec->powerdown_adcs) { |
| 2394 | msleep(40); |
Takashi Iwai | 8c2f767 | 2008-12-01 11:54:35 +0100 | [diff] [blame] | 2395 | snd_hda_codec_write(codec, nid, 0, |
Matthew Ranostay | 8daaaa9 | 2008-08-15 07:45:52 +0200 | [diff] [blame] | 2396 | AC_VERB_SET_POWER_STATE, AC_PWRST_D0); |
| 2397 | } |
| 2398 | snd_hda_codec_setup_stream(codec, nid, stream_tag, 0, format); |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 2399 | return 0; |
| 2400 | } |
| 2401 | |
| 2402 | static int stac92xx_capture_pcm_cleanup(struct hda_pcm_stream *hinfo, |
| 2403 | struct hda_codec *codec, |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 2404 | struct snd_pcm_substream *substream) |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 2405 | { |
| 2406 | struct sigmatel_spec *spec = codec->spec; |
Matthew Ranostay | 8daaaa9 | 2008-08-15 07:45:52 +0200 | [diff] [blame] | 2407 | hda_nid_t nid = spec->adc_nids[substream->number]; |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 2408 | |
Matthew Ranostay | 8daaaa9 | 2008-08-15 07:45:52 +0200 | [diff] [blame] | 2409 | snd_hda_codec_cleanup_stream(codec, nid); |
| 2410 | if (spec->powerdown_adcs) |
Takashi Iwai | 8c2f767 | 2008-12-01 11:54:35 +0100 | [diff] [blame] | 2411 | snd_hda_codec_write(codec, nid, 0, |
Matthew Ranostay | 8daaaa9 | 2008-08-15 07:45:52 +0200 | [diff] [blame] | 2412 | AC_VERB_SET_POWER_STATE, AC_PWRST_D3); |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 2413 | return 0; |
| 2414 | } |
| 2415 | |
Takashi Iwai | 2b63536 | 2011-05-02 12:33:43 +0200 | [diff] [blame] | 2416 | static const struct hda_pcm_stream stac92xx_pcm_digital_playback = { |
Matt | dabbed6 | 2005-06-14 10:19:34 +0200 | [diff] [blame] | 2417 | .substreams = 1, |
| 2418 | .channels_min = 2, |
| 2419 | .channels_max = 2, |
| 2420 | /* NID is set in stac92xx_build_pcms */ |
| 2421 | .ops = { |
| 2422 | .open = stac92xx_dig_playback_pcm_open, |
Takashi Iwai | 6b97eb4 | 2007-04-05 14:51:48 +0200 | [diff] [blame] | 2423 | .close = stac92xx_dig_playback_pcm_close, |
Takashi Iwai | 9411e21 | 2009-02-13 11:32:28 +0100 | [diff] [blame] | 2424 | .prepare = stac92xx_dig_playback_pcm_prepare, |
| 2425 | .cleanup = stac92xx_dig_playback_pcm_cleanup |
Matt | dabbed6 | 2005-06-14 10:19:34 +0200 | [diff] [blame] | 2426 | }, |
| 2427 | }; |
| 2428 | |
Takashi Iwai | 2b63536 | 2011-05-02 12:33:43 +0200 | [diff] [blame] | 2429 | static const struct hda_pcm_stream stac92xx_pcm_digital_capture = { |
Matt | dabbed6 | 2005-06-14 10:19:34 +0200 | [diff] [blame] | 2430 | .substreams = 1, |
| 2431 | .channels_min = 2, |
| 2432 | .channels_max = 2, |
| 2433 | /* NID is set in stac92xx_build_pcms */ |
| 2434 | }; |
| 2435 | |
Takashi Iwai | 2b63536 | 2011-05-02 12:33:43 +0200 | [diff] [blame] | 2436 | static const struct hda_pcm_stream stac92xx_pcm_analog_playback = { |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 2437 | .substreams = 1, |
| 2438 | .channels_min = 2, |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 2439 | .channels_max = 8, |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 2440 | .nid = 0x02, /* NID to query formats and rates */ |
| 2441 | .ops = { |
| 2442 | .open = stac92xx_playback_pcm_open, |
| 2443 | .prepare = stac92xx_playback_pcm_prepare, |
| 2444 | .cleanup = stac92xx_playback_pcm_cleanup |
| 2445 | }, |
| 2446 | }; |
| 2447 | |
Takashi Iwai | 2b63536 | 2011-05-02 12:33:43 +0200 | [diff] [blame] | 2448 | static const struct hda_pcm_stream stac92xx_pcm_analog_alt_playback = { |
Matt Porter | 3cc08dc | 2006-01-23 15:27:49 +0100 | [diff] [blame] | 2449 | .substreams = 1, |
| 2450 | .channels_min = 2, |
| 2451 | .channels_max = 2, |
| 2452 | .nid = 0x06, /* NID to query formats and rates */ |
| 2453 | .ops = { |
| 2454 | .open = stac92xx_playback_pcm_open, |
| 2455 | .prepare = stac92xx_playback_pcm_prepare, |
| 2456 | .cleanup = stac92xx_playback_pcm_cleanup |
| 2457 | }, |
| 2458 | }; |
| 2459 | |
Takashi Iwai | 2b63536 | 2011-05-02 12:33:43 +0200 | [diff] [blame] | 2460 | static const struct hda_pcm_stream stac92xx_pcm_analog_capture = { |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 2461 | .channels_min = 2, |
| 2462 | .channels_max = 2, |
Maxim Levitsky | 9e05b7a | 2007-09-03 15:31:02 +0200 | [diff] [blame] | 2463 | /* NID + .substreams is set in stac92xx_build_pcms */ |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 2464 | .ops = { |
| 2465 | .prepare = stac92xx_capture_pcm_prepare, |
| 2466 | .cleanup = stac92xx_capture_pcm_cleanup |
| 2467 | }, |
| 2468 | }; |
| 2469 | |
| 2470 | static int stac92xx_build_pcms(struct hda_codec *codec) |
| 2471 | { |
| 2472 | struct sigmatel_spec *spec = codec->spec; |
| 2473 | struct hda_pcm *info = spec->pcm_rec; |
| 2474 | |
| 2475 | codec->num_pcms = 1; |
| 2476 | codec->pcm_info = info; |
| 2477 | |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 2478 | info->name = "STAC92xx Analog"; |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 2479 | info->stream[SNDRV_PCM_STREAM_PLAYBACK] = stac92xx_pcm_analog_playback; |
Takashi Iwai | 00a602d | 2009-01-23 11:55:42 +0100 | [diff] [blame] | 2480 | info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = |
| 2481 | spec->multiout.dac_nids[0]; |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 2482 | info->stream[SNDRV_PCM_STREAM_CAPTURE] = stac92xx_pcm_analog_capture; |
Matt Porter | 3cc08dc | 2006-01-23 15:27:49 +0100 | [diff] [blame] | 2483 | info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = spec->adc_nids[0]; |
Maxim Levitsky | 9e05b7a | 2007-09-03 15:31:02 +0200 | [diff] [blame] | 2484 | info->stream[SNDRV_PCM_STREAM_CAPTURE].substreams = spec->num_adcs; |
Matt Porter | 3cc08dc | 2006-01-23 15:27:49 +0100 | [diff] [blame] | 2485 | |
| 2486 | if (spec->alt_switch) { |
| 2487 | codec->num_pcms++; |
| 2488 | info++; |
| 2489 | info->name = "STAC92xx Analog Alt"; |
| 2490 | info->stream[SNDRV_PCM_STREAM_PLAYBACK] = stac92xx_pcm_analog_alt_playback; |
| 2491 | } |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 2492 | |
Matt | dabbed6 | 2005-06-14 10:19:34 +0200 | [diff] [blame] | 2493 | if (spec->multiout.dig_out_nid || spec->dig_in_nid) { |
| 2494 | codec->num_pcms++; |
| 2495 | info++; |
| 2496 | info->name = "STAC92xx Digital"; |
Takashi Iwai | 0852d7a | 2009-02-11 11:35:15 +0100 | [diff] [blame] | 2497 | info->pcm_type = spec->autocfg.dig_out_type[0]; |
Matt | dabbed6 | 2005-06-14 10:19:34 +0200 | [diff] [blame] | 2498 | if (spec->multiout.dig_out_nid) { |
| 2499 | info->stream[SNDRV_PCM_STREAM_PLAYBACK] = stac92xx_pcm_digital_playback; |
| 2500 | info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = spec->multiout.dig_out_nid; |
| 2501 | } |
| 2502 | if (spec->dig_in_nid) { |
| 2503 | info->stream[SNDRV_PCM_STREAM_CAPTURE] = stac92xx_pcm_digital_capture; |
| 2504 | info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = spec->dig_in_nid; |
| 2505 | } |
| 2506 | } |
| 2507 | |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 2508 | return 0; |
| 2509 | } |
| 2510 | |
Matt Porter | 403d194 | 2005-11-29 15:00:51 +0100 | [diff] [blame] | 2511 | static void stac92xx_auto_set_pinctl(struct hda_codec *codec, hda_nid_t nid, int pin_type) |
| 2512 | |
| 2513 | { |
Takashi Iwai | cdd03ce | 2012-04-20 12:34:50 +0200 | [diff] [blame] | 2514 | snd_hda_set_pin_ctl_cache(codec, nid, pin_type); |
Matt Porter | 403d194 | 2005-11-29 15:00:51 +0100 | [diff] [blame] | 2515 | } |
| 2516 | |
Matthew Ranostay | 7c2ba97 | 2008-04-16 13:13:59 +0200 | [diff] [blame] | 2517 | #define stac92xx_hp_switch_info snd_ctl_boolean_mono_info |
| 2518 | |
| 2519 | static int stac92xx_hp_switch_get(struct snd_kcontrol *kcontrol, |
| 2520 | struct snd_ctl_elem_value *ucontrol) |
| 2521 | { |
| 2522 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 2523 | struct sigmatel_spec *spec = codec->spec; |
| 2524 | |
Takashi Iwai | d7a8943 | 2008-11-12 09:48:04 +0100 | [diff] [blame] | 2525 | ucontrol->value.integer.value[0] = !!spec->hp_switch; |
Matthew Ranostay | 7c2ba97 | 2008-04-16 13:13:59 +0200 | [diff] [blame] | 2526 | return 0; |
| 2527 | } |
| 2528 | |
Takashi Iwai | 62558ce | 2009-07-29 14:23:09 +0200 | [diff] [blame] | 2529 | static void stac_issue_unsol_event(struct hda_codec *codec, hda_nid_t nid); |
Takashi Iwai | c6e4c66 | 2008-11-25 11:58:19 +0100 | [diff] [blame] | 2530 | |
Matthew Ranostay | 7c2ba97 | 2008-04-16 13:13:59 +0200 | [diff] [blame] | 2531 | static int stac92xx_hp_switch_put(struct snd_kcontrol *kcontrol, |
| 2532 | struct snd_ctl_elem_value *ucontrol) |
| 2533 | { |
| 2534 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 2535 | struct sigmatel_spec *spec = codec->spec; |
Takashi Iwai | d7a8943 | 2008-11-12 09:48:04 +0100 | [diff] [blame] | 2536 | int nid = kcontrol->private_value; |
| 2537 | |
| 2538 | spec->hp_switch = ucontrol->value.integer.value[0] ? nid : 0; |
Matthew Ranostay | 7c2ba97 | 2008-04-16 13:13:59 +0200 | [diff] [blame] | 2539 | |
Lucas De Marchi | 25985ed | 2011-03-30 22:57:33 -0300 | [diff] [blame] | 2540 | /* check to be sure that the ports are up to date with |
Matthew Ranostay | 7c2ba97 | 2008-04-16 13:13:59 +0200 | [diff] [blame] | 2541 | * switch changes |
| 2542 | */ |
Takashi Iwai | 62558ce | 2009-07-29 14:23:09 +0200 | [diff] [blame] | 2543 | stac_issue_unsol_event(codec, nid); |
Matthew Ranostay | 7c2ba97 | 2008-04-16 13:13:59 +0200 | [diff] [blame] | 2544 | |
| 2545 | return 1; |
| 2546 | } |
| 2547 | |
Nickolas Lloyd | 7c922de | 2009-06-01 11:12:29 +0200 | [diff] [blame] | 2548 | static int stac92xx_dc_bias_info(struct snd_kcontrol *kcontrol, |
| 2549 | struct snd_ctl_elem_info *uinfo) |
| 2550 | { |
| 2551 | int i; |
Takashi Iwai | 2b63536 | 2011-05-02 12:33:43 +0200 | [diff] [blame] | 2552 | static const char * const texts[] = { |
Nickolas Lloyd | 7c922de | 2009-06-01 11:12:29 +0200 | [diff] [blame] | 2553 | "Mic In", "Line In", "Line Out" |
| 2554 | }; |
| 2555 | |
| 2556 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 2557 | struct sigmatel_spec *spec = codec->spec; |
| 2558 | hda_nid_t nid = kcontrol->private_value; |
| 2559 | |
| 2560 | if (nid == spec->mic_switch || nid == spec->line_switch) |
| 2561 | i = 3; |
| 2562 | else |
| 2563 | i = 2; |
| 2564 | |
| 2565 | uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED; |
| 2566 | uinfo->value.enumerated.items = i; |
| 2567 | uinfo->count = 1; |
| 2568 | if (uinfo->value.enumerated.item >= i) |
| 2569 | uinfo->value.enumerated.item = i-1; |
| 2570 | strcpy(uinfo->value.enumerated.name, |
| 2571 | texts[uinfo->value.enumerated.item]); |
| 2572 | |
| 2573 | return 0; |
| 2574 | } |
| 2575 | |
| 2576 | static int stac92xx_dc_bias_get(struct snd_kcontrol *kcontrol, |
| 2577 | struct snd_ctl_elem_value *ucontrol) |
| 2578 | { |
| 2579 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 2580 | hda_nid_t nid = kcontrol->private_value; |
| 2581 | unsigned int vref = stac92xx_vref_get(codec, nid); |
| 2582 | |
Takashi Iwai | 4740860 | 2012-04-20 13:06:53 +0200 | [diff] [blame] | 2583 | if (vref == snd_hda_get_default_vref(codec, nid)) |
Nickolas Lloyd | 7c922de | 2009-06-01 11:12:29 +0200 | [diff] [blame] | 2584 | ucontrol->value.enumerated.item[0] = 0; |
| 2585 | else if (vref == AC_PINCTL_VREF_GRD) |
| 2586 | ucontrol->value.enumerated.item[0] = 1; |
| 2587 | else if (vref == AC_PINCTL_VREF_HIZ) |
| 2588 | ucontrol->value.enumerated.item[0] = 2; |
| 2589 | |
| 2590 | return 0; |
| 2591 | } |
| 2592 | |
| 2593 | static int stac92xx_dc_bias_put(struct snd_kcontrol *kcontrol, |
| 2594 | struct snd_ctl_elem_value *ucontrol) |
| 2595 | { |
| 2596 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 2597 | unsigned int new_vref = 0; |
Takashi Iwai | b862151 | 2009-06-22 08:00:10 +0200 | [diff] [blame] | 2598 | int error; |
Nickolas Lloyd | 7c922de | 2009-06-01 11:12:29 +0200 | [diff] [blame] | 2599 | hda_nid_t nid = kcontrol->private_value; |
| 2600 | |
| 2601 | if (ucontrol->value.enumerated.item[0] == 0) |
Takashi Iwai | 4740860 | 2012-04-20 13:06:53 +0200 | [diff] [blame] | 2602 | new_vref = snd_hda_get_default_vref(codec, nid); |
Nickolas Lloyd | 7c922de | 2009-06-01 11:12:29 +0200 | [diff] [blame] | 2603 | else if (ucontrol->value.enumerated.item[0] == 1) |
| 2604 | new_vref = AC_PINCTL_VREF_GRD; |
| 2605 | else if (ucontrol->value.enumerated.item[0] == 2) |
| 2606 | new_vref = AC_PINCTL_VREF_HIZ; |
| 2607 | else |
| 2608 | return 0; |
| 2609 | |
| 2610 | if (new_vref != stac92xx_vref_get(codec, nid)) { |
| 2611 | error = stac92xx_vref_set(codec, nid, new_vref); |
| 2612 | return error; |
| 2613 | } |
| 2614 | |
| 2615 | return 0; |
| 2616 | } |
| 2617 | |
| 2618 | static int stac92xx_io_switch_info(struct snd_kcontrol *kcontrol, |
| 2619 | struct snd_ctl_elem_info *uinfo) |
| 2620 | { |
Takashi Iwai | 2b63536 | 2011-05-02 12:33:43 +0200 | [diff] [blame] | 2621 | char *texts[2]; |
Nickolas Lloyd | 7c922de | 2009-06-01 11:12:29 +0200 | [diff] [blame] | 2622 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 2623 | struct sigmatel_spec *spec = codec->spec; |
| 2624 | |
| 2625 | if (kcontrol->private_value == spec->line_switch) |
| 2626 | texts[0] = "Line In"; |
| 2627 | else |
| 2628 | texts[0] = "Mic In"; |
| 2629 | texts[1] = "Line Out"; |
| 2630 | uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED; |
| 2631 | uinfo->value.enumerated.items = 2; |
| 2632 | uinfo->count = 1; |
| 2633 | |
| 2634 | if (uinfo->value.enumerated.item >= 2) |
| 2635 | uinfo->value.enumerated.item = 1; |
| 2636 | strcpy(uinfo->value.enumerated.name, |
| 2637 | texts[uinfo->value.enumerated.item]); |
| 2638 | |
| 2639 | return 0; |
| 2640 | } |
Matt Porter | 403d194 | 2005-11-29 15:00:51 +0100 | [diff] [blame] | 2641 | |
| 2642 | static int stac92xx_io_switch_get(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) |
| 2643 | { |
| 2644 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 2645 | struct sigmatel_spec *spec = codec->spec; |
Nickolas Lloyd | 7c922de | 2009-06-01 11:12:29 +0200 | [diff] [blame] | 2646 | hda_nid_t nid = kcontrol->private_value; |
| 2647 | int io_idx = (nid == spec->mic_switch) ? 1 : 0; |
Matt Porter | 403d194 | 2005-11-29 15:00:51 +0100 | [diff] [blame] | 2648 | |
Nickolas Lloyd | 7c922de | 2009-06-01 11:12:29 +0200 | [diff] [blame] | 2649 | ucontrol->value.enumerated.item[0] = spec->io_switch[io_idx]; |
Matt Porter | 403d194 | 2005-11-29 15:00:51 +0100 | [diff] [blame] | 2650 | return 0; |
| 2651 | } |
| 2652 | |
| 2653 | static int stac92xx_io_switch_put(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) |
| 2654 | { |
| 2655 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 2656 | struct sigmatel_spec *spec = codec->spec; |
Nickolas Lloyd | 7c922de | 2009-06-01 11:12:29 +0200 | [diff] [blame] | 2657 | hda_nid_t nid = kcontrol->private_value; |
| 2658 | int io_idx = (nid == spec->mic_switch) ? 1 : 0; |
| 2659 | unsigned short val = !!ucontrol->value.enumerated.item[0]; |
Matt Porter | 403d194 | 2005-11-29 15:00:51 +0100 | [diff] [blame] | 2660 | |
| 2661 | spec->io_switch[io_idx] = val; |
| 2662 | |
| 2663 | if (val) |
| 2664 | stac92xx_auto_set_pinctl(codec, nid, AC_PINCTL_OUT_EN); |
Takashi Iwai | c960a03 | 2006-03-23 17:06:28 +0100 | [diff] [blame] | 2665 | else { |
| 2666 | unsigned int pinctl = AC_PINCTL_IN_EN; |
| 2667 | if (io_idx) /* set VREF for mic */ |
Takashi Iwai | 4740860 | 2012-04-20 13:06:53 +0200 | [diff] [blame] | 2668 | pinctl |= snd_hda_get_default_vref(codec, nid); |
Takashi Iwai | c960a03 | 2006-03-23 17:06:28 +0100 | [diff] [blame] | 2669 | stac92xx_auto_set_pinctl(codec, nid, pinctl); |
| 2670 | } |
Jiang Zhe | 40c1d30 | 2007-11-12 13:05:16 +0100 | [diff] [blame] | 2671 | |
| 2672 | /* check the auto-mute again: we need to mute/unmute the speaker |
| 2673 | * appropriately according to the pin direction |
| 2674 | */ |
| 2675 | if (spec->hp_detect) |
Takashi Iwai | 62558ce | 2009-07-29 14:23:09 +0200 | [diff] [blame] | 2676 | stac_issue_unsol_event(codec, nid); |
Jiang Zhe | 40c1d30 | 2007-11-12 13:05:16 +0100 | [diff] [blame] | 2677 | |
Matt Porter | 403d194 | 2005-11-29 15:00:51 +0100 | [diff] [blame] | 2678 | return 1; |
| 2679 | } |
| 2680 | |
Maxim Levitsky | 0fb87bb | 2007-09-03 15:29:04 +0200 | [diff] [blame] | 2681 | #define stac92xx_clfe_switch_info snd_ctl_boolean_mono_info |
| 2682 | |
| 2683 | static int stac92xx_clfe_switch_get(struct snd_kcontrol *kcontrol, |
| 2684 | struct snd_ctl_elem_value *ucontrol) |
| 2685 | { |
| 2686 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 2687 | struct sigmatel_spec *spec = codec->spec; |
| 2688 | |
| 2689 | ucontrol->value.integer.value[0] = spec->clfe_swap; |
| 2690 | return 0; |
| 2691 | } |
| 2692 | |
| 2693 | static int stac92xx_clfe_switch_put(struct snd_kcontrol *kcontrol, |
| 2694 | struct snd_ctl_elem_value *ucontrol) |
| 2695 | { |
| 2696 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 2697 | struct sigmatel_spec *spec = codec->spec; |
| 2698 | hda_nid_t nid = kcontrol->private_value & 0xff; |
Takashi Iwai | 68ea7b2 | 2007-11-15 15:54:38 +0100 | [diff] [blame] | 2699 | unsigned int val = !!ucontrol->value.integer.value[0]; |
Maxim Levitsky | 0fb87bb | 2007-09-03 15:29:04 +0200 | [diff] [blame] | 2700 | |
Takashi Iwai | 68ea7b2 | 2007-11-15 15:54:38 +0100 | [diff] [blame] | 2701 | if (spec->clfe_swap == val) |
Maxim Levitsky | 0fb87bb | 2007-09-03 15:29:04 +0200 | [diff] [blame] | 2702 | return 0; |
| 2703 | |
Takashi Iwai | 68ea7b2 | 2007-11-15 15:54:38 +0100 | [diff] [blame] | 2704 | spec->clfe_swap = val; |
Maxim Levitsky | 0fb87bb | 2007-09-03 15:29:04 +0200 | [diff] [blame] | 2705 | |
| 2706 | snd_hda_codec_write_cache(codec, nid, 0, AC_VERB_SET_EAPD_BTLENABLE, |
| 2707 | spec->clfe_swap ? 0x4 : 0x0); |
| 2708 | |
| 2709 | return 1; |
| 2710 | } |
| 2711 | |
Matthew Ranostay | 7c2ba97 | 2008-04-16 13:13:59 +0200 | [diff] [blame] | 2712 | #define STAC_CODEC_HP_SWITCH(xname) \ |
| 2713 | { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \ |
| 2714 | .name = xname, \ |
| 2715 | .index = 0, \ |
| 2716 | .info = stac92xx_hp_switch_info, \ |
| 2717 | .get = stac92xx_hp_switch_get, \ |
| 2718 | .put = stac92xx_hp_switch_put, \ |
| 2719 | } |
| 2720 | |
Matt Porter | 403d194 | 2005-11-29 15:00:51 +0100 | [diff] [blame] | 2721 | #define STAC_CODEC_IO_SWITCH(xname, xpval) \ |
| 2722 | { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \ |
| 2723 | .name = xname, \ |
| 2724 | .index = 0, \ |
| 2725 | .info = stac92xx_io_switch_info, \ |
| 2726 | .get = stac92xx_io_switch_get, \ |
| 2727 | .put = stac92xx_io_switch_put, \ |
| 2728 | .private_value = xpval, \ |
| 2729 | } |
| 2730 | |
Maxim Levitsky | 0fb87bb | 2007-09-03 15:29:04 +0200 | [diff] [blame] | 2731 | #define STAC_CODEC_CLFE_SWITCH(xname, xpval) \ |
| 2732 | { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \ |
| 2733 | .name = xname, \ |
| 2734 | .index = 0, \ |
| 2735 | .info = stac92xx_clfe_switch_info, \ |
| 2736 | .get = stac92xx_clfe_switch_get, \ |
| 2737 | .put = stac92xx_clfe_switch_put, \ |
| 2738 | .private_value = xpval, \ |
| 2739 | } |
Matt Porter | 403d194 | 2005-11-29 15:00:51 +0100 | [diff] [blame] | 2740 | |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 2741 | enum { |
| 2742 | STAC_CTL_WIDGET_VOL, |
| 2743 | STAC_CTL_WIDGET_MUTE, |
Jaroslav Kysela | 123c07a | 2009-10-21 14:48:23 +0200 | [diff] [blame] | 2744 | STAC_CTL_WIDGET_MUTE_BEEP, |
Matthew Ranostay | 09a9995 | 2008-01-24 11:49:21 +0100 | [diff] [blame] | 2745 | STAC_CTL_WIDGET_MONO_MUX, |
Matthew Ranostay | 7c2ba97 | 2008-04-16 13:13:59 +0200 | [diff] [blame] | 2746 | STAC_CTL_WIDGET_HP_SWITCH, |
Matt Porter | 403d194 | 2005-11-29 15:00:51 +0100 | [diff] [blame] | 2747 | STAC_CTL_WIDGET_IO_SWITCH, |
Nickolas Lloyd | 2fc9989 | 2009-05-15 15:33:30 +0200 | [diff] [blame] | 2748 | STAC_CTL_WIDGET_CLFE_SWITCH, |
| 2749 | STAC_CTL_WIDGET_DC_BIAS |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 2750 | }; |
| 2751 | |
Takashi Iwai | 2b63536 | 2011-05-02 12:33:43 +0200 | [diff] [blame] | 2752 | static const struct snd_kcontrol_new stac92xx_control_templates[] = { |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 2753 | HDA_CODEC_VOLUME(NULL, 0, 0, 0), |
| 2754 | HDA_CODEC_MUTE(NULL, 0, 0, 0), |
Jaroslav Kysela | 123c07a | 2009-10-21 14:48:23 +0200 | [diff] [blame] | 2755 | HDA_CODEC_MUTE_BEEP(NULL, 0, 0, 0), |
Matthew Ranostay | 09a9995 | 2008-01-24 11:49:21 +0100 | [diff] [blame] | 2756 | STAC_MONO_MUX, |
Matthew Ranostay | 7c2ba97 | 2008-04-16 13:13:59 +0200 | [diff] [blame] | 2757 | STAC_CODEC_HP_SWITCH(NULL), |
Matt Porter | 403d194 | 2005-11-29 15:00:51 +0100 | [diff] [blame] | 2758 | STAC_CODEC_IO_SWITCH(NULL, 0), |
Maxim Levitsky | 0fb87bb | 2007-09-03 15:29:04 +0200 | [diff] [blame] | 2759 | STAC_CODEC_CLFE_SWITCH(NULL, 0), |
Nickolas Lloyd | 2fc9989 | 2009-05-15 15:33:30 +0200 | [diff] [blame] | 2760 | DC_BIAS(NULL, 0, 0), |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 2761 | }; |
| 2762 | |
| 2763 | /* add dynamic controls */ |
Takashi Iwai | e3c7596 | 2009-01-23 11:57:22 +0100 | [diff] [blame] | 2764 | static struct snd_kcontrol_new * |
| 2765 | stac_control_new(struct sigmatel_spec *spec, |
Takashi Iwai | 2b63536 | 2011-05-02 12:33:43 +0200 | [diff] [blame] | 2766 | const struct snd_kcontrol_new *ktemp, |
Jaroslav Kysela | 4d02d1b | 2009-11-12 10:15:48 +0100 | [diff] [blame] | 2767 | const char *name, |
Jaroslav Kysela | 5e26dfd | 2009-12-10 13:57:01 +0100 | [diff] [blame] | 2768 | unsigned int subdev) |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 2769 | { |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 2770 | struct snd_kcontrol_new *knew; |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 2771 | |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 2772 | snd_array_init(&spec->kctls, sizeof(*knew), 32); |
| 2773 | knew = snd_array_new(&spec->kctls); |
| 2774 | if (!knew) |
Takashi Iwai | e3c7596 | 2009-01-23 11:57:22 +0100 | [diff] [blame] | 2775 | return NULL; |
Takashi Iwai | 4d4e9bb | 2008-11-12 16:45:04 +0100 | [diff] [blame] | 2776 | *knew = *ktemp; |
Takashi Iwai | 82fe0c5 | 2005-06-30 10:54:33 +0200 | [diff] [blame] | 2777 | knew->name = kstrdup(name, GFP_KERNEL); |
Takashi Iwai | e3c7596 | 2009-01-23 11:57:22 +0100 | [diff] [blame] | 2778 | if (!knew->name) { |
| 2779 | /* roolback */ |
| 2780 | memset(knew, 0, sizeof(*knew)); |
| 2781 | spec->kctls.alloced--; |
| 2782 | return NULL; |
| 2783 | } |
Jaroslav Kysela | 5e26dfd | 2009-12-10 13:57:01 +0100 | [diff] [blame] | 2784 | knew->subdevice = subdev; |
Takashi Iwai | e3c7596 | 2009-01-23 11:57:22 +0100 | [diff] [blame] | 2785 | return knew; |
| 2786 | } |
| 2787 | |
| 2788 | static int stac92xx_add_control_temp(struct sigmatel_spec *spec, |
Takashi Iwai | 2b63536 | 2011-05-02 12:33:43 +0200 | [diff] [blame] | 2789 | const struct snd_kcontrol_new *ktemp, |
Takashi Iwai | e3c7596 | 2009-01-23 11:57:22 +0100 | [diff] [blame] | 2790 | int idx, const char *name, |
| 2791 | unsigned long val) |
| 2792 | { |
Jaroslav Kysela | 4d02d1b | 2009-11-12 10:15:48 +0100 | [diff] [blame] | 2793 | struct snd_kcontrol_new *knew = stac_control_new(spec, ktemp, name, |
Jaroslav Kysela | 5e26dfd | 2009-12-10 13:57:01 +0100 | [diff] [blame] | 2794 | HDA_SUBDEV_AMP_FLAG); |
Takashi Iwai | e3c7596 | 2009-01-23 11:57:22 +0100 | [diff] [blame] | 2795 | if (!knew) |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 2796 | return -ENOMEM; |
Takashi Iwai | e3c7596 | 2009-01-23 11:57:22 +0100 | [diff] [blame] | 2797 | knew->index = idx; |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 2798 | knew->private_value = val; |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 2799 | return 0; |
| 2800 | } |
| 2801 | |
Takashi Iwai | 4d4e9bb | 2008-11-12 16:45:04 +0100 | [diff] [blame] | 2802 | static inline int stac92xx_add_control_idx(struct sigmatel_spec *spec, |
| 2803 | int type, int idx, const char *name, |
| 2804 | unsigned long val) |
| 2805 | { |
| 2806 | return stac92xx_add_control_temp(spec, |
| 2807 | &stac92xx_control_templates[type], |
| 2808 | idx, name, val); |
| 2809 | } |
| 2810 | |
Matthew Ranostay | 4682eee | 2008-08-15 07:43:24 +0200 | [diff] [blame] | 2811 | |
| 2812 | /* add dynamic controls */ |
Takashi Iwai | 4d4e9bb | 2008-11-12 16:45:04 +0100 | [diff] [blame] | 2813 | static inline int stac92xx_add_control(struct sigmatel_spec *spec, int type, |
| 2814 | const char *name, unsigned long val) |
Matthew Ranostay | 4682eee | 2008-08-15 07:43:24 +0200 | [diff] [blame] | 2815 | { |
| 2816 | return stac92xx_add_control_idx(spec, type, 0, name, val); |
| 2817 | } |
| 2818 | |
Takashi Iwai | 2b63536 | 2011-05-02 12:33:43 +0200 | [diff] [blame] | 2819 | static const struct snd_kcontrol_new stac_input_src_temp = { |
Takashi Iwai | e3c7596 | 2009-01-23 11:57:22 +0100 | [diff] [blame] | 2820 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 2821 | .name = "Input Source", |
| 2822 | .info = stac92xx_mux_enum_info, |
| 2823 | .get = stac92xx_mux_enum_get, |
| 2824 | .put = stac92xx_mux_enum_put, |
| 2825 | }; |
| 2826 | |
Nickolas Lloyd | 7c922de | 2009-06-01 11:12:29 +0200 | [diff] [blame] | 2827 | static inline int stac92xx_add_jack_mode_control(struct hda_codec *codec, |
| 2828 | hda_nid_t nid, int idx) |
| 2829 | { |
| 2830 | int def_conf = snd_hda_codec_get_pincfg(codec, nid); |
| 2831 | int control = 0; |
| 2832 | struct sigmatel_spec *spec = codec->spec; |
| 2833 | char name[22]; |
| 2834 | |
Takashi Iwai | 99ae28b | 2010-09-17 14:42:34 +0200 | [diff] [blame] | 2835 | if (snd_hda_get_input_pin_attr(def_conf) != INPUT_PIN_ATTR_INT) { |
Takashi Iwai | 4740860 | 2012-04-20 13:06:53 +0200 | [diff] [blame] | 2836 | if (snd_hda_get_default_vref(codec, nid) == AC_PINCTL_VREF_GRD |
Nickolas Lloyd | 7c922de | 2009-06-01 11:12:29 +0200 | [diff] [blame] | 2837 | && nid == spec->line_switch) |
| 2838 | control = STAC_CTL_WIDGET_IO_SWITCH; |
| 2839 | else if (snd_hda_query_pin_caps(codec, nid) |
| 2840 | & (AC_PINCAP_VREF_GRD << AC_PINCAP_VREF_SHIFT)) |
| 2841 | control = STAC_CTL_WIDGET_DC_BIAS; |
| 2842 | else if (nid == spec->mic_switch) |
| 2843 | control = STAC_CTL_WIDGET_IO_SWITCH; |
| 2844 | } |
| 2845 | |
| 2846 | if (control) { |
Takashi Iwai | 201e06f | 2011-11-16 15:33:26 +0100 | [diff] [blame] | 2847 | snd_hda_get_pin_label(codec, nid, &spec->autocfg, |
| 2848 | name, sizeof(name), NULL); |
Nickolas Lloyd | 7c922de | 2009-06-01 11:12:29 +0200 | [diff] [blame] | 2849 | return stac92xx_add_control(codec->spec, control, |
| 2850 | strcat(name, " Jack Mode"), nid); |
| 2851 | } |
| 2852 | |
| 2853 | return 0; |
| 2854 | } |
| 2855 | |
Takashi Iwai | e3c7596 | 2009-01-23 11:57:22 +0100 | [diff] [blame] | 2856 | static int stac92xx_add_input_source(struct sigmatel_spec *spec) |
| 2857 | { |
| 2858 | struct snd_kcontrol_new *knew; |
| 2859 | struct hda_input_mux *imux = &spec->private_imux; |
| 2860 | |
Takashi Iwai | 3d21d3f | 2009-07-29 14:32:56 +0200 | [diff] [blame] | 2861 | if (spec->auto_mic) |
| 2862 | return 0; /* no need for input source */ |
Takashi Iwai | e3c7596 | 2009-01-23 11:57:22 +0100 | [diff] [blame] | 2863 | if (!spec->num_adcs || imux->num_items <= 1) |
| 2864 | return 0; /* no need for input source control */ |
| 2865 | knew = stac_control_new(spec, &stac_input_src_temp, |
Jaroslav Kysela | 4d02d1b | 2009-11-12 10:15:48 +0100 | [diff] [blame] | 2866 | stac_input_src_temp.name, 0); |
Takashi Iwai | e3c7596 | 2009-01-23 11:57:22 +0100 | [diff] [blame] | 2867 | if (!knew) |
| 2868 | return -ENOMEM; |
| 2869 | knew->count = spec->num_adcs; |
| 2870 | return 0; |
| 2871 | } |
| 2872 | |
Takashi Iwai | c21ca4a | 2008-12-19 09:26:08 +0100 | [diff] [blame] | 2873 | /* check whether the line-input can be used as line-out */ |
| 2874 | static hda_nid_t check_line_out_switch(struct hda_codec *codec) |
Matt Porter | 403d194 | 2005-11-29 15:00:51 +0100 | [diff] [blame] | 2875 | { |
| 2876 | struct sigmatel_spec *spec = codec->spec; |
Takashi Iwai | c21ca4a | 2008-12-19 09:26:08 +0100 | [diff] [blame] | 2877 | struct auto_pin_cfg *cfg = &spec->autocfg; |
| 2878 | hda_nid_t nid; |
| 2879 | unsigned int pincap; |
Takashi Iwai | eea7dc9 | 2010-08-30 13:06:15 +0200 | [diff] [blame] | 2880 | int i; |
Matthew Ranostay | 8e9068b | 2007-12-17 11:58:13 +0100 | [diff] [blame] | 2881 | |
Takashi Iwai | c21ca4a | 2008-12-19 09:26:08 +0100 | [diff] [blame] | 2882 | if (cfg->line_out_type != AUTO_PIN_LINE_OUT) |
| 2883 | return 0; |
Takashi Iwai | eea7dc9 | 2010-08-30 13:06:15 +0200 | [diff] [blame] | 2884 | for (i = 0; i < cfg->num_inputs; i++) { |
Takashi Iwai | 86e2959 | 2010-09-09 14:50:17 +0200 | [diff] [blame] | 2885 | if (cfg->inputs[i].type == AUTO_PIN_LINE_IN) { |
Takashi Iwai | eea7dc9 | 2010-08-30 13:06:15 +0200 | [diff] [blame] | 2886 | nid = cfg->inputs[i].pin; |
Takashi Iwai | 1327a32 | 2009-03-23 13:07:47 +0100 | [diff] [blame] | 2887 | pincap = snd_hda_query_pin_caps(codec, nid); |
Takashi Iwai | c21ca4a | 2008-12-19 09:26:08 +0100 | [diff] [blame] | 2888 | if (pincap & AC_PINCAP_OUT) |
| 2889 | return nid; |
| 2890 | } |
Takashi Iwai | eea7dc9 | 2010-08-30 13:06:15 +0200 | [diff] [blame] | 2891 | } |
Matt Porter | 403d194 | 2005-11-29 15:00:51 +0100 | [diff] [blame] | 2892 | return 0; |
| 2893 | } |
| 2894 | |
Takashi Iwai | eea7dc9 | 2010-08-30 13:06:15 +0200 | [diff] [blame] | 2895 | static hda_nid_t get_unassigned_dac(struct hda_codec *codec, hda_nid_t nid); |
| 2896 | |
Takashi Iwai | c21ca4a | 2008-12-19 09:26:08 +0100 | [diff] [blame] | 2897 | /* check whether the mic-input can be used as line-out */ |
Takashi Iwai | eea7dc9 | 2010-08-30 13:06:15 +0200 | [diff] [blame] | 2898 | static hda_nid_t check_mic_out_switch(struct hda_codec *codec, hda_nid_t *dac) |
Takashi Iwai | c21ca4a | 2008-12-19 09:26:08 +0100 | [diff] [blame] | 2899 | { |
| 2900 | struct sigmatel_spec *spec = codec->spec; |
| 2901 | struct auto_pin_cfg *cfg = &spec->autocfg; |
| 2902 | unsigned int def_conf, pincap; |
Takashi Iwai | 86e2959 | 2010-09-09 14:50:17 +0200 | [diff] [blame] | 2903 | int i; |
Takashi Iwai | c21ca4a | 2008-12-19 09:26:08 +0100 | [diff] [blame] | 2904 | |
Takashi Iwai | eea7dc9 | 2010-08-30 13:06:15 +0200 | [diff] [blame] | 2905 | *dac = 0; |
Takashi Iwai | c21ca4a | 2008-12-19 09:26:08 +0100 | [diff] [blame] | 2906 | if (cfg->line_out_type != AUTO_PIN_LINE_OUT) |
| 2907 | return 0; |
Takashi Iwai | eea7dc9 | 2010-08-30 13:06:15 +0200 | [diff] [blame] | 2908 | for (i = 0; i < cfg->num_inputs; i++) { |
| 2909 | hda_nid_t nid = cfg->inputs[i].pin; |
Takashi Iwai | 86e2959 | 2010-09-09 14:50:17 +0200 | [diff] [blame] | 2910 | if (cfg->inputs[i].type != AUTO_PIN_MIC) |
Takashi Iwai | eea7dc9 | 2010-08-30 13:06:15 +0200 | [diff] [blame] | 2911 | continue; |
Takashi Iwai | c21ca4a | 2008-12-19 09:26:08 +0100 | [diff] [blame] | 2912 | def_conf = snd_hda_codec_get_pincfg(codec, nid); |
| 2913 | /* some laptops have an internal analog microphone |
| 2914 | * which can't be used as a output */ |
Takashi Iwai | 99ae28b | 2010-09-17 14:42:34 +0200 | [diff] [blame] | 2915 | if (snd_hda_get_input_pin_attr(def_conf) != INPUT_PIN_ATTR_INT) { |
Takashi Iwai | c21ca4a | 2008-12-19 09:26:08 +0100 | [diff] [blame] | 2916 | pincap = snd_hda_query_pin_caps(codec, nid); |
Takashi Iwai | eea7dc9 | 2010-08-30 13:06:15 +0200 | [diff] [blame] | 2917 | if (pincap & AC_PINCAP_OUT) { |
| 2918 | *dac = get_unassigned_dac(codec, nid); |
| 2919 | if (*dac) |
| 2920 | return nid; |
| 2921 | } |
Takashi Iwai | c21ca4a | 2008-12-19 09:26:08 +0100 | [diff] [blame] | 2922 | } |
Takashi Iwai | c21ca4a | 2008-12-19 09:26:08 +0100 | [diff] [blame] | 2923 | } |
| 2924 | return 0; |
| 2925 | } |
Steve Longerbeam | 7b04389 | 2007-05-03 20:50:03 +0200 | [diff] [blame] | 2926 | |
| 2927 | static int is_in_dac_nids(struct sigmatel_spec *spec, hda_nid_t nid) |
| 2928 | { |
| 2929 | int i; |
| 2930 | |
| 2931 | for (i = 0; i < spec->multiout.num_dacs; i++) { |
| 2932 | if (spec->multiout.dac_nids[i] == nid) |
| 2933 | return 1; |
| 2934 | } |
| 2935 | |
| 2936 | return 0; |
| 2937 | } |
| 2938 | |
Takashi Iwai | c21ca4a | 2008-12-19 09:26:08 +0100 | [diff] [blame] | 2939 | static int check_all_dac_nids(struct sigmatel_spec *spec, hda_nid_t nid) |
| 2940 | { |
| 2941 | int i; |
| 2942 | if (is_in_dac_nids(spec, nid)) |
| 2943 | return 1; |
| 2944 | for (i = 0; i < spec->autocfg.hp_outs; i++) |
| 2945 | if (spec->hp_dacs[i] == nid) |
| 2946 | return 1; |
| 2947 | for (i = 0; i < spec->autocfg.speaker_outs; i++) |
| 2948 | if (spec->speaker_dacs[i] == nid) |
| 2949 | return 1; |
| 2950 | return 0; |
| 2951 | } |
| 2952 | |
| 2953 | static hda_nid_t get_unassigned_dac(struct hda_codec *codec, hda_nid_t nid) |
| 2954 | { |
| 2955 | struct sigmatel_spec *spec = codec->spec; |
David Henningsson | 48718ea | 2011-10-05 09:49:05 +0200 | [diff] [blame] | 2956 | struct auto_pin_cfg *cfg = &spec->autocfg; |
Takashi Iwai | c21ca4a | 2008-12-19 09:26:08 +0100 | [diff] [blame] | 2957 | int j, conn_len; |
David Henningsson | 48718ea | 2011-10-05 09:49:05 +0200 | [diff] [blame] | 2958 | hda_nid_t conn[HDA_MAX_CONNECTIONS], fallback_dac; |
Takashi Iwai | c21ca4a | 2008-12-19 09:26:08 +0100 | [diff] [blame] | 2959 | unsigned int wcaps, wtype; |
| 2960 | |
| 2961 | conn_len = snd_hda_get_connections(codec, nid, conn, |
| 2962 | HDA_MAX_CONNECTIONS); |
Charles Chin | 3670600 | 2010-01-29 12:05:51 +0100 | [diff] [blame] | 2963 | /* 92HD88: trace back up the link of nids to find the DAC */ |
| 2964 | while (conn_len == 1 && (get_wcaps_type(get_wcaps(codec, conn[0])) |
| 2965 | != AC_WID_AUD_OUT)) { |
| 2966 | nid = conn[0]; |
| 2967 | conn_len = snd_hda_get_connections(codec, nid, conn, |
| 2968 | HDA_MAX_CONNECTIONS); |
| 2969 | } |
Takashi Iwai | c21ca4a | 2008-12-19 09:26:08 +0100 | [diff] [blame] | 2970 | for (j = 0; j < conn_len; j++) { |
Takashi Iwai | 14bafe3 | 2009-03-23 16:35:39 +0100 | [diff] [blame] | 2971 | wcaps = get_wcaps(codec, conn[j]); |
Takashi Iwai | a22d543 | 2009-07-27 12:54:26 +0200 | [diff] [blame] | 2972 | wtype = get_wcaps_type(wcaps); |
Takashi Iwai | c21ca4a | 2008-12-19 09:26:08 +0100 | [diff] [blame] | 2973 | /* we check only analog outputs */ |
| 2974 | if (wtype != AC_WID_AUD_OUT || (wcaps & AC_WCAP_DIGITAL)) |
| 2975 | continue; |
| 2976 | /* if this route has a free DAC, assign it */ |
| 2977 | if (!check_all_dac_nids(spec, conn[j])) { |
| 2978 | if (conn_len > 1) { |
| 2979 | /* select this DAC in the pin's input mux */ |
| 2980 | snd_hda_codec_write_cache(codec, nid, 0, |
| 2981 | AC_VERB_SET_CONNECT_SEL, j); |
| 2982 | } |
| 2983 | return conn[j]; |
| 2984 | } |
| 2985 | } |
David Henningsson | 48718ea | 2011-10-05 09:49:05 +0200 | [diff] [blame] | 2986 | |
| 2987 | /* if all DACs are already assigned, connect to the primary DAC, |
| 2988 | unless we're assigning a secondary headphone */ |
| 2989 | fallback_dac = spec->multiout.dac_nids[0]; |
| 2990 | if (spec->multiout.hp_nid) { |
| 2991 | for (j = 0; j < cfg->hp_outs; j++) |
| 2992 | if (cfg->hp_pins[j] == nid) { |
| 2993 | fallback_dac = spec->multiout.hp_nid; |
| 2994 | break; |
| 2995 | } |
| 2996 | } |
| 2997 | |
Takashi Iwai | ee58a7c | 2009-03-06 12:00:24 +0100 | [diff] [blame] | 2998 | if (conn_len > 1) { |
| 2999 | for (j = 0; j < conn_len; j++) { |
David Henningsson | 48718ea | 2011-10-05 09:49:05 +0200 | [diff] [blame] | 3000 | if (conn[j] == fallback_dac) { |
Takashi Iwai | ee58a7c | 2009-03-06 12:00:24 +0100 | [diff] [blame] | 3001 | snd_hda_codec_write_cache(codec, nid, 0, |
| 3002 | AC_VERB_SET_CONNECT_SEL, j); |
| 3003 | break; |
| 3004 | } |
| 3005 | } |
| 3006 | } |
Takashi Iwai | c21ca4a | 2008-12-19 09:26:08 +0100 | [diff] [blame] | 3007 | return 0; |
| 3008 | } |
| 3009 | |
| 3010 | static int add_spec_dacs(struct sigmatel_spec *spec, hda_nid_t nid); |
| 3011 | static int add_spec_extra_dacs(struct sigmatel_spec *spec, hda_nid_t nid); |
| 3012 | |
Matt Porter | 3cc08dc | 2006-01-23 15:27:49 +0100 | [diff] [blame] | 3013 | /* |
Steve Longerbeam | 7b04389 | 2007-05-03 20:50:03 +0200 | [diff] [blame] | 3014 | * Fill in the dac_nids table from the parsed pin configuration |
| 3015 | * This function only works when every pin in line_out_pins[] |
| 3016 | * contains atleast one DAC in its connection list. Some 92xx |
| 3017 | * codecs are not connected directly to a DAC, such as the 9200 |
| 3018 | * and 9202/925x. For those, dac_nids[] must be hard-coded. |
Matt Porter | 3cc08dc | 2006-01-23 15:27:49 +0100 | [diff] [blame] | 3019 | */ |
Takashi Iwai | c21ca4a | 2008-12-19 09:26:08 +0100 | [diff] [blame] | 3020 | static int stac92xx_auto_fill_dac_nids(struct hda_codec *codec) |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 3021 | { |
| 3022 | struct sigmatel_spec *spec = codec->spec; |
Takashi Iwai | c21ca4a | 2008-12-19 09:26:08 +0100 | [diff] [blame] | 3023 | struct auto_pin_cfg *cfg = &spec->autocfg; |
| 3024 | int i; |
| 3025 | hda_nid_t nid, dac; |
Steve Longerbeam | 7b04389 | 2007-05-03 20:50:03 +0200 | [diff] [blame] | 3026 | |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 3027 | for (i = 0; i < cfg->line_outs; i++) { |
| 3028 | nid = cfg->line_out_pins[i]; |
Takashi Iwai | c21ca4a | 2008-12-19 09:26:08 +0100 | [diff] [blame] | 3029 | dac = get_unassigned_dac(codec, nid); |
| 3030 | if (!dac) { |
Takashi Iwai | df80295 | 2007-07-02 19:18:00 +0200 | [diff] [blame] | 3031 | if (spec->multiout.num_dacs > 0) { |
| 3032 | /* we have already working output pins, |
| 3033 | * so let's drop the broken ones again |
| 3034 | */ |
| 3035 | cfg->line_outs = spec->multiout.num_dacs; |
| 3036 | break; |
| 3037 | } |
Steve Longerbeam | 7b04389 | 2007-05-03 20:50:03 +0200 | [diff] [blame] | 3038 | /* error out, no available DAC found */ |
| 3039 | snd_printk(KERN_ERR |
| 3040 | "%s: No available DAC for pin 0x%x\n", |
| 3041 | __func__, nid); |
| 3042 | return -ENODEV; |
| 3043 | } |
Takashi Iwai | c21ca4a | 2008-12-19 09:26:08 +0100 | [diff] [blame] | 3044 | add_spec_dacs(spec, dac); |
| 3045 | } |
Steve Longerbeam | 7b04389 | 2007-05-03 20:50:03 +0200 | [diff] [blame] | 3046 | |
Takashi Iwai | 139e071 | 2009-03-06 12:10:41 +0100 | [diff] [blame] | 3047 | for (i = 0; i < cfg->hp_outs; i++) { |
| 3048 | nid = cfg->hp_pins[i]; |
| 3049 | dac = get_unassigned_dac(codec, nid); |
| 3050 | if (dac) { |
| 3051 | if (!spec->multiout.hp_nid) |
| 3052 | spec->multiout.hp_nid = dac; |
| 3053 | else |
| 3054 | add_spec_extra_dacs(spec, dac); |
| 3055 | } |
| 3056 | spec->hp_dacs[i] = dac; |
| 3057 | } |
| 3058 | |
| 3059 | for (i = 0; i < cfg->speaker_outs; i++) { |
| 3060 | nid = cfg->speaker_pins[i]; |
| 3061 | dac = get_unassigned_dac(codec, nid); |
| 3062 | if (dac) |
| 3063 | add_spec_extra_dacs(spec, dac); |
| 3064 | spec->speaker_dacs[i] = dac; |
| 3065 | } |
| 3066 | |
Takashi Iwai | c21ca4a | 2008-12-19 09:26:08 +0100 | [diff] [blame] | 3067 | /* add line-in as output */ |
| 3068 | nid = check_line_out_switch(codec); |
| 3069 | if (nid) { |
| 3070 | dac = get_unassigned_dac(codec, nid); |
| 3071 | if (dac) { |
| 3072 | snd_printdd("STAC: Add line-in 0x%x as output %d\n", |
| 3073 | nid, cfg->line_outs); |
| 3074 | cfg->line_out_pins[cfg->line_outs] = nid; |
| 3075 | cfg->line_outs++; |
| 3076 | spec->line_switch = nid; |
| 3077 | add_spec_dacs(spec, dac); |
| 3078 | } |
| 3079 | } |
| 3080 | /* add mic as output */ |
Takashi Iwai | eea7dc9 | 2010-08-30 13:06:15 +0200 | [diff] [blame] | 3081 | nid = check_mic_out_switch(codec, &dac); |
| 3082 | if (nid && dac) { |
| 3083 | snd_printdd("STAC: Add mic-in 0x%x as output %d\n", |
| 3084 | nid, cfg->line_outs); |
| 3085 | cfg->line_out_pins[cfg->line_outs] = nid; |
| 3086 | cfg->line_outs++; |
| 3087 | spec->mic_switch = nid; |
| 3088 | add_spec_dacs(spec, dac); |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 3089 | } |
| 3090 | |
Takashi Iwai | c21ca4a | 2008-12-19 09:26:08 +0100 | [diff] [blame] | 3091 | snd_printd("stac92xx: dac_nids=%d (0x%x/0x%x/0x%x/0x%x/0x%x)\n", |
Steve Longerbeam | 7b04389 | 2007-05-03 20:50:03 +0200 | [diff] [blame] | 3092 | spec->multiout.num_dacs, |
| 3093 | spec->multiout.dac_nids[0], |
| 3094 | spec->multiout.dac_nids[1], |
| 3095 | spec->multiout.dac_nids[2], |
| 3096 | spec->multiout.dac_nids[3], |
| 3097 | spec->multiout.dac_nids[4]); |
Takashi Iwai | c21ca4a | 2008-12-19 09:26:08 +0100 | [diff] [blame] | 3098 | |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 3099 | return 0; |
| 3100 | } |
| 3101 | |
Takashi Iwai | eb06ed8 | 2006-09-20 17:10:27 +0200 | [diff] [blame] | 3102 | /* create volume control/switch for the given prefx type */ |
Takashi Iwai | 668b965 | 2009-03-06 10:13:24 +0100 | [diff] [blame] | 3103 | static int create_controls_idx(struct hda_codec *codec, const char *pfx, |
| 3104 | int idx, hda_nid_t nid, int chs) |
Takashi Iwai | eb06ed8 | 2006-09-20 17:10:27 +0200 | [diff] [blame] | 3105 | { |
Takashi Iwai | 7c7767e | 2009-01-20 15:28:38 +0100 | [diff] [blame] | 3106 | struct sigmatel_spec *spec = codec->spec; |
Takashi Iwai | eb06ed8 | 2006-09-20 17:10:27 +0200 | [diff] [blame] | 3107 | char name[32]; |
| 3108 | int err; |
| 3109 | |
Takashi Iwai | 7c7767e | 2009-01-20 15:28:38 +0100 | [diff] [blame] | 3110 | if (!spec->check_volume_offset) { |
| 3111 | unsigned int caps, step, nums, db_scale; |
| 3112 | caps = query_amp_caps(codec, nid, HDA_OUTPUT); |
| 3113 | step = (caps & AC_AMPCAP_STEP_SIZE) >> |
| 3114 | AC_AMPCAP_STEP_SIZE_SHIFT; |
| 3115 | step = (step + 1) * 25; /* in .01dB unit */ |
| 3116 | nums = (caps & AC_AMPCAP_NUM_STEPS) >> |
| 3117 | AC_AMPCAP_NUM_STEPS_SHIFT; |
| 3118 | db_scale = nums * step; |
| 3119 | /* if dB scale is over -64dB, and finer enough, |
| 3120 | * let's reduce it to half |
| 3121 | */ |
| 3122 | if (db_scale > 6400 && nums >= 0x1f) |
| 3123 | spec->volume_offset = nums / 2; |
| 3124 | spec->check_volume_offset = 1; |
| 3125 | } |
| 3126 | |
Takashi Iwai | eb06ed8 | 2006-09-20 17:10:27 +0200 | [diff] [blame] | 3127 | sprintf(name, "%s Playback Volume", pfx); |
Takashi Iwai | 668b965 | 2009-03-06 10:13:24 +0100 | [diff] [blame] | 3128 | err = stac92xx_add_control_idx(spec, STAC_CTL_WIDGET_VOL, idx, name, |
Takashi Iwai | 7c7767e | 2009-01-20 15:28:38 +0100 | [diff] [blame] | 3129 | HDA_COMPOSE_AMP_VAL_OFS(nid, chs, 0, HDA_OUTPUT, |
| 3130 | spec->volume_offset)); |
Takashi Iwai | eb06ed8 | 2006-09-20 17:10:27 +0200 | [diff] [blame] | 3131 | if (err < 0) |
| 3132 | return err; |
| 3133 | sprintf(name, "%s Playback Switch", pfx); |
Takashi Iwai | 668b965 | 2009-03-06 10:13:24 +0100 | [diff] [blame] | 3134 | err = stac92xx_add_control_idx(spec, STAC_CTL_WIDGET_MUTE, idx, name, |
Takashi Iwai | eb06ed8 | 2006-09-20 17:10:27 +0200 | [diff] [blame] | 3135 | HDA_COMPOSE_AMP_VAL(nid, chs, 0, HDA_OUTPUT)); |
| 3136 | if (err < 0) |
| 3137 | return err; |
| 3138 | return 0; |
| 3139 | } |
| 3140 | |
Takashi Iwai | 668b965 | 2009-03-06 10:13:24 +0100 | [diff] [blame] | 3141 | #define create_controls(codec, pfx, nid, chs) \ |
| 3142 | create_controls_idx(codec, pfx, 0, nid, chs) |
| 3143 | |
Matthew Ranostay | ae0afd8 | 2008-02-22 17:55:05 +0100 | [diff] [blame] | 3144 | static int add_spec_dacs(struct sigmatel_spec *spec, hda_nid_t nid) |
| 3145 | { |
Takashi Iwai | c21ca4a | 2008-12-19 09:26:08 +0100 | [diff] [blame] | 3146 | if (spec->multiout.num_dacs > 4) { |
Matthew Ranostay | ae0afd8 | 2008-02-22 17:55:05 +0100 | [diff] [blame] | 3147 | printk(KERN_WARNING "stac92xx: No space for DAC 0x%x\n", nid); |
| 3148 | return 1; |
| 3149 | } else { |
Takashi Iwai | dda1441 | 2011-05-02 11:29:30 +0200 | [diff] [blame] | 3150 | snd_BUG_ON(spec->multiout.dac_nids != spec->dac_nids); |
| 3151 | spec->dac_nids[spec->multiout.num_dacs] = nid; |
Matthew Ranostay | ae0afd8 | 2008-02-22 17:55:05 +0100 | [diff] [blame] | 3152 | spec->multiout.num_dacs++; |
| 3153 | } |
| 3154 | return 0; |
| 3155 | } |
| 3156 | |
Takashi Iwai | c21ca4a | 2008-12-19 09:26:08 +0100 | [diff] [blame] | 3157 | static int add_spec_extra_dacs(struct sigmatel_spec *spec, hda_nid_t nid) |
Matthew Ranostay | ae0afd8 | 2008-02-22 17:55:05 +0100 | [diff] [blame] | 3158 | { |
Takashi Iwai | c21ca4a | 2008-12-19 09:26:08 +0100 | [diff] [blame] | 3159 | int i; |
| 3160 | for (i = 0; i < ARRAY_SIZE(spec->multiout.extra_out_nid); i++) { |
| 3161 | if (!spec->multiout.extra_out_nid[i]) { |
| 3162 | spec->multiout.extra_out_nid[i] = nid; |
| 3163 | return 0; |
| 3164 | } |
| 3165 | } |
| 3166 | printk(KERN_WARNING "stac92xx: No space for extra DAC 0x%x\n", nid); |
| 3167 | return 1; |
Matthew Ranostay | ae0afd8 | 2008-02-22 17:55:05 +0100 | [diff] [blame] | 3168 | } |
| 3169 | |
Takashi Iwai | dc04d1b | 2009-03-06 10:00:05 +0100 | [diff] [blame] | 3170 | /* Create output controls |
| 3171 | * The mixer elements are named depending on the given type (AUTO_PIN_XXX_OUT) |
| 3172 | */ |
| 3173 | static int create_multi_out_ctls(struct hda_codec *codec, int num_outs, |
| 3174 | const hda_nid_t *pins, |
| 3175 | const hda_nid_t *dac_nids, |
| 3176 | int type) |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 3177 | { |
Takashi Iwai | 7662453 | 2008-12-19 10:09:47 +0100 | [diff] [blame] | 3178 | struct sigmatel_spec *spec = codec->spec; |
Takashi Iwai | ea73496 | 2011-01-17 11:29:34 +0100 | [diff] [blame] | 3179 | static const char * const chname[4] = { |
Takashi Iwai | 19039bd | 2006-06-28 15:52:16 +0200 | [diff] [blame] | 3180 | "Front", "Surround", NULL /*CLFE*/, "Side" |
| 3181 | }; |
Takashi Iwai | dc04d1b | 2009-03-06 10:00:05 +0100 | [diff] [blame] | 3182 | hda_nid_t nid; |
Takashi Iwai | 9158923 | 2008-12-19 15:59:40 +0100 | [diff] [blame] | 3183 | int i, err; |
| 3184 | unsigned int wid_caps; |
Maxim Levitsky | 0fb87bb | 2007-09-03 15:29:04 +0200 | [diff] [blame] | 3185 | |
Takashi Iwai | dc04d1b | 2009-03-06 10:00:05 +0100 | [diff] [blame] | 3186 | for (i = 0; i < num_outs && i < ARRAY_SIZE(chname); i++) { |
Takashi Iwai | ffd0e56 | 2009-04-16 12:20:24 +0200 | [diff] [blame] | 3187 | if (type == AUTO_PIN_HP_OUT && !spec->hp_detect) { |
Takashi Iwai | e35d9d6 | 2011-05-17 11:28:16 +0200 | [diff] [blame] | 3188 | if (is_jack_detectable(codec, pins[i])) |
Takashi Iwai | ffd0e56 | 2009-04-16 12:20:24 +0200 | [diff] [blame] | 3189 | spec->hp_detect = 1; |
| 3190 | } |
Takashi Iwai | dc04d1b | 2009-03-06 10:00:05 +0100 | [diff] [blame] | 3191 | nid = dac_nids[i]; |
| 3192 | if (!nid) |
| 3193 | continue; |
| 3194 | if (type != AUTO_PIN_HP_OUT && i == 2) { |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 3195 | /* Center/LFE */ |
Takashi Iwai | 7c7767e | 2009-01-20 15:28:38 +0100 | [diff] [blame] | 3196 | err = create_controls(codec, "Center", nid, 1); |
Takashi Iwai | eb06ed8 | 2006-09-20 17:10:27 +0200 | [diff] [blame] | 3197 | if (err < 0) |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 3198 | return err; |
Takashi Iwai | 7c7767e | 2009-01-20 15:28:38 +0100 | [diff] [blame] | 3199 | err = create_controls(codec, "LFE", nid, 2); |
Takashi Iwai | eb06ed8 | 2006-09-20 17:10:27 +0200 | [diff] [blame] | 3200 | if (err < 0) |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 3201 | return err; |
Maxim Levitsky | 0fb87bb | 2007-09-03 15:29:04 +0200 | [diff] [blame] | 3202 | |
| 3203 | wid_caps = get_wcaps(codec, nid); |
| 3204 | |
| 3205 | if (wid_caps & AC_WCAP_LR_SWAP) { |
| 3206 | err = stac92xx_add_control(spec, |
| 3207 | STAC_CTL_WIDGET_CLFE_SWITCH, |
| 3208 | "Swap Center/LFE Playback Switch", nid); |
| 3209 | |
| 3210 | if (err < 0) |
| 3211 | return err; |
| 3212 | } |
| 3213 | |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 3214 | } else { |
Takashi Iwai | dc04d1b | 2009-03-06 10:00:05 +0100 | [diff] [blame] | 3215 | const char *name; |
Takashi Iwai | 668b965 | 2009-03-06 10:13:24 +0100 | [diff] [blame] | 3216 | int idx; |
Takashi Iwai | dc04d1b | 2009-03-06 10:00:05 +0100 | [diff] [blame] | 3217 | switch (type) { |
| 3218 | case AUTO_PIN_HP_OUT: |
Takashi Iwai | 668b965 | 2009-03-06 10:13:24 +0100 | [diff] [blame] | 3219 | name = "Headphone"; |
| 3220 | idx = i; |
Takashi Iwai | dc04d1b | 2009-03-06 10:00:05 +0100 | [diff] [blame] | 3221 | break; |
| 3222 | case AUTO_PIN_SPEAKER_OUT: |
Takashi Iwai | 668b965 | 2009-03-06 10:13:24 +0100 | [diff] [blame] | 3223 | name = "Speaker"; |
| 3224 | idx = i; |
Takashi Iwai | dc04d1b | 2009-03-06 10:00:05 +0100 | [diff] [blame] | 3225 | break; |
| 3226 | default: |
| 3227 | name = chname[i]; |
Takashi Iwai | 668b965 | 2009-03-06 10:13:24 +0100 | [diff] [blame] | 3228 | idx = 0; |
Takashi Iwai | dc04d1b | 2009-03-06 10:00:05 +0100 | [diff] [blame] | 3229 | break; |
Takashi Iwai | 7662453 | 2008-12-19 10:09:47 +0100 | [diff] [blame] | 3230 | } |
Takashi Iwai | 668b965 | 2009-03-06 10:13:24 +0100 | [diff] [blame] | 3231 | err = create_controls_idx(codec, name, idx, nid, 3); |
Takashi Iwai | eb06ed8 | 2006-09-20 17:10:27 +0200 | [diff] [blame] | 3232 | if (err < 0) |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 3233 | return err; |
| 3234 | } |
| 3235 | } |
Takashi Iwai | dc04d1b | 2009-03-06 10:00:05 +0100 | [diff] [blame] | 3236 | return 0; |
| 3237 | } |
| 3238 | |
Takashi Iwai | 6479c63 | 2009-07-28 18:20:25 +0200 | [diff] [blame] | 3239 | static int stac92xx_add_capvol_ctls(struct hda_codec *codec, unsigned long vol, |
| 3240 | unsigned long sw, int idx) |
| 3241 | { |
| 3242 | int err; |
| 3243 | err = stac92xx_add_control_idx(codec->spec, STAC_CTL_WIDGET_VOL, idx, |
Takashi Iwai | bf677bd | 2009-07-30 09:24:29 +0200 | [diff] [blame] | 3244 | "Capture Volume", vol); |
Takashi Iwai | 6479c63 | 2009-07-28 18:20:25 +0200 | [diff] [blame] | 3245 | if (err < 0) |
| 3246 | return err; |
| 3247 | err = stac92xx_add_control_idx(codec->spec, STAC_CTL_WIDGET_MUTE, idx, |
Takashi Iwai | bf677bd | 2009-07-30 09:24:29 +0200 | [diff] [blame] | 3248 | "Capture Switch", sw); |
Takashi Iwai | 6479c63 | 2009-07-28 18:20:25 +0200 | [diff] [blame] | 3249 | if (err < 0) |
| 3250 | return err; |
| 3251 | return 0; |
| 3252 | } |
| 3253 | |
Takashi Iwai | dc04d1b | 2009-03-06 10:00:05 +0100 | [diff] [blame] | 3254 | /* add playback controls from the parsed DAC table */ |
| 3255 | static int stac92xx_auto_create_multi_out_ctls(struct hda_codec *codec, |
| 3256 | const struct auto_pin_cfg *cfg) |
| 3257 | { |
| 3258 | struct sigmatel_spec *spec = codec->spec; |
Nickolas Lloyd | 7c922de | 2009-06-01 11:12:29 +0200 | [diff] [blame] | 3259 | hda_nid_t nid; |
Takashi Iwai | dc04d1b | 2009-03-06 10:00:05 +0100 | [diff] [blame] | 3260 | int err; |
Nickolas Lloyd | 7c922de | 2009-06-01 11:12:29 +0200 | [diff] [blame] | 3261 | int idx; |
Takashi Iwai | dc04d1b | 2009-03-06 10:00:05 +0100 | [diff] [blame] | 3262 | |
| 3263 | err = create_multi_out_ctls(codec, cfg->line_outs, cfg->line_out_pins, |
| 3264 | spec->multiout.dac_nids, |
| 3265 | cfg->line_out_type); |
| 3266 | if (err < 0) |
| 3267 | return err; |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 3268 | |
Takashi Iwai | a9cb5c9 | 2008-11-24 07:51:11 +0100 | [diff] [blame] | 3269 | if (cfg->hp_outs > 1 && cfg->line_out_type == AUTO_PIN_LINE_OUT) { |
Matthew Ranostay | 7c2ba97 | 2008-04-16 13:13:59 +0200 | [diff] [blame] | 3270 | err = stac92xx_add_control(spec, |
| 3271 | STAC_CTL_WIDGET_HP_SWITCH, |
Takashi Iwai | d7a8943 | 2008-11-12 09:48:04 +0100 | [diff] [blame] | 3272 | "Headphone as Line Out Switch", |
| 3273 | cfg->hp_pins[cfg->hp_outs - 1]); |
Matthew Ranostay | 7c2ba97 | 2008-04-16 13:13:59 +0200 | [diff] [blame] | 3274 | if (err < 0) |
| 3275 | return err; |
| 3276 | } |
| 3277 | |
Takashi Iwai | eea7dc9 | 2010-08-30 13:06:15 +0200 | [diff] [blame] | 3278 | for (idx = 0; idx < cfg->num_inputs; idx++) { |
Takashi Iwai | 86e2959 | 2010-09-09 14:50:17 +0200 | [diff] [blame] | 3279 | if (cfg->inputs[idx].type > AUTO_PIN_LINE_IN) |
Takashi Iwai | eea7dc9 | 2010-08-30 13:06:15 +0200 | [diff] [blame] | 3280 | break; |
| 3281 | nid = cfg->inputs[idx].pin; |
| 3282 | err = stac92xx_add_jack_mode_control(codec, nid, idx); |
| 3283 | if (err < 0) |
| 3284 | return err; |
Matthew Ranostay | b5895dc | 2008-01-25 15:24:50 +0100 | [diff] [blame] | 3285 | } |
Matt Porter | 403d194 | 2005-11-29 15:00:51 +0100 | [diff] [blame] | 3286 | |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 3287 | return 0; |
| 3288 | } |
| 3289 | |
Takashi Iwai | eb06ed8 | 2006-09-20 17:10:27 +0200 | [diff] [blame] | 3290 | /* add playback controls for Speaker and HP outputs */ |
| 3291 | static int stac92xx_auto_create_hp_ctls(struct hda_codec *codec, |
| 3292 | struct auto_pin_cfg *cfg) |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 3293 | { |
| 3294 | struct sigmatel_spec *spec = codec->spec; |
Takashi Iwai | dc04d1b | 2009-03-06 10:00:05 +0100 | [diff] [blame] | 3295 | int err; |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 3296 | |
Takashi Iwai | dc04d1b | 2009-03-06 10:00:05 +0100 | [diff] [blame] | 3297 | err = create_multi_out_ctls(codec, cfg->hp_outs, cfg->hp_pins, |
| 3298 | spec->hp_dacs, AUTO_PIN_HP_OUT); |
| 3299 | if (err < 0) |
| 3300 | return err; |
| 3301 | |
| 3302 | err = create_multi_out_ctls(codec, cfg->speaker_outs, cfg->speaker_pins, |
| 3303 | spec->speaker_dacs, AUTO_PIN_SPEAKER_OUT); |
| 3304 | if (err < 0) |
| 3305 | return err; |
| 3306 | |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 3307 | return 0; |
| 3308 | } |
| 3309 | |
Matthew Ranostay | b22b482 | 2008-01-22 12:32:30 +0100 | [diff] [blame] | 3310 | /* labels for mono mux outputs */ |
Takashi Iwai | ea73496 | 2011-01-17 11:29:34 +0100 | [diff] [blame] | 3311 | static const char * const stac92xx_mono_labels[4] = { |
Matthew Ranostay | d0513fc | 2008-07-27 10:30:30 +0200 | [diff] [blame] | 3312 | "DAC0", "DAC1", "Mixer", "DAC2" |
Matthew Ranostay | b22b482 | 2008-01-22 12:32:30 +0100 | [diff] [blame] | 3313 | }; |
| 3314 | |
| 3315 | /* create mono mux for mono out on capable codecs */ |
| 3316 | static int stac92xx_auto_create_mono_output_ctls(struct hda_codec *codec) |
| 3317 | { |
| 3318 | struct sigmatel_spec *spec = codec->spec; |
| 3319 | struct hda_input_mux *mono_mux = &spec->private_mono_mux; |
| 3320 | int i, num_cons; |
| 3321 | hda_nid_t con_lst[ARRAY_SIZE(stac92xx_mono_labels)]; |
| 3322 | |
| 3323 | num_cons = snd_hda_get_connections(codec, |
| 3324 | spec->mono_nid, |
| 3325 | con_lst, |
| 3326 | HDA_MAX_NUM_INPUTS); |
Jaroslav Kysela | 16a433d | 2009-07-22 16:20:40 +0200 | [diff] [blame] | 3327 | if (num_cons <= 0 || num_cons > ARRAY_SIZE(stac92xx_mono_labels)) |
Matthew Ranostay | b22b482 | 2008-01-22 12:32:30 +0100 | [diff] [blame] | 3328 | return -EINVAL; |
| 3329 | |
Takashi Iwai | 10a20af | 2010-09-09 16:28:02 +0200 | [diff] [blame] | 3330 | for (i = 0; i < num_cons; i++) |
| 3331 | snd_hda_add_imux_item(mono_mux, stac92xx_mono_labels[i], i, |
| 3332 | NULL); |
Matthew Ranostay | 09a9995 | 2008-01-24 11:49:21 +0100 | [diff] [blame] | 3333 | |
| 3334 | return stac92xx_add_control(spec, STAC_CTL_WIDGET_MONO_MUX, |
| 3335 | "Mono Mux", spec->mono_nid); |
Matthew Ranostay | b22b482 | 2008-01-22 12:32:30 +0100 | [diff] [blame] | 3336 | } |
| 3337 | |
Matthew Ranostay | 1cd2224 | 2008-07-18 18:20:52 +0200 | [diff] [blame] | 3338 | /* create PC beep volume controls */ |
| 3339 | static int stac92xx_auto_create_beep_ctls(struct hda_codec *codec, |
| 3340 | hda_nid_t nid) |
| 3341 | { |
| 3342 | struct sigmatel_spec *spec = codec->spec; |
| 3343 | u32 caps = query_amp_caps(codec, nid, HDA_OUTPUT); |
Jaroslav Kysela | 123c07a | 2009-10-21 14:48:23 +0200 | [diff] [blame] | 3344 | int err, type = STAC_CTL_WIDGET_MUTE_BEEP; |
| 3345 | |
| 3346 | if (spec->anabeep_nid == nid) |
| 3347 | type = STAC_CTL_WIDGET_MUTE; |
Matthew Ranostay | 1cd2224 | 2008-07-18 18:20:52 +0200 | [diff] [blame] | 3348 | |
| 3349 | /* check for mute support for the the amp */ |
| 3350 | if ((caps & AC_AMPCAP_MUTE) >> AC_AMPCAP_MUTE_SHIFT) { |
Jaroslav Kysela | 123c07a | 2009-10-21 14:48:23 +0200 | [diff] [blame] | 3351 | err = stac92xx_add_control(spec, type, |
Jaroslav Kysela | d355c82a | 2009-11-03 15:47:25 +0100 | [diff] [blame] | 3352 | "Beep Playback Switch", |
Matthew Ranostay | 1cd2224 | 2008-07-18 18:20:52 +0200 | [diff] [blame] | 3353 | HDA_COMPOSE_AMP_VAL(nid, 1, 0, HDA_OUTPUT)); |
| 3354 | if (err < 0) |
| 3355 | return err; |
| 3356 | } |
| 3357 | |
| 3358 | /* check to see if there is volume support for the amp */ |
| 3359 | if ((caps & AC_AMPCAP_NUM_STEPS) >> AC_AMPCAP_NUM_STEPS_SHIFT) { |
| 3360 | err = stac92xx_add_control(spec, STAC_CTL_WIDGET_VOL, |
Jaroslav Kysela | d355c82a | 2009-11-03 15:47:25 +0100 | [diff] [blame] | 3361 | "Beep Playback Volume", |
Matthew Ranostay | 1cd2224 | 2008-07-18 18:20:52 +0200 | [diff] [blame] | 3362 | HDA_COMPOSE_AMP_VAL(nid, 1, 0, HDA_OUTPUT)); |
| 3363 | if (err < 0) |
| 3364 | return err; |
| 3365 | } |
| 3366 | return 0; |
| 3367 | } |
| 3368 | |
Takashi Iwai | 4d4e9bb | 2008-11-12 16:45:04 +0100 | [diff] [blame] | 3369 | #ifdef CONFIG_SND_HDA_INPUT_BEEP |
| 3370 | #define stac92xx_dig_beep_switch_info snd_ctl_boolean_mono_info |
| 3371 | |
| 3372 | static int stac92xx_dig_beep_switch_get(struct snd_kcontrol *kcontrol, |
| 3373 | struct snd_ctl_elem_value *ucontrol) |
| 3374 | { |
| 3375 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 3376 | ucontrol->value.integer.value[0] = codec->beep->enabled; |
| 3377 | return 0; |
| 3378 | } |
| 3379 | |
| 3380 | static int stac92xx_dig_beep_switch_put(struct snd_kcontrol *kcontrol, |
| 3381 | struct snd_ctl_elem_value *ucontrol) |
| 3382 | { |
| 3383 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
Jaroslav Kysela | 123c07a | 2009-10-21 14:48:23 +0200 | [diff] [blame] | 3384 | return snd_hda_enable_beep_device(codec, ucontrol->value.integer.value[0]); |
Takashi Iwai | 4d4e9bb | 2008-11-12 16:45:04 +0100 | [diff] [blame] | 3385 | } |
| 3386 | |
Takashi Iwai | 2b63536 | 2011-05-02 12:33:43 +0200 | [diff] [blame] | 3387 | static const struct snd_kcontrol_new stac92xx_dig_beep_ctrl = { |
Takashi Iwai | 4d4e9bb | 2008-11-12 16:45:04 +0100 | [diff] [blame] | 3388 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 3389 | .info = stac92xx_dig_beep_switch_info, |
| 3390 | .get = stac92xx_dig_beep_switch_get, |
| 3391 | .put = stac92xx_dig_beep_switch_put, |
| 3392 | }; |
| 3393 | |
| 3394 | static int stac92xx_beep_switch_ctl(struct hda_codec *codec) |
| 3395 | { |
| 3396 | return stac92xx_add_control_temp(codec->spec, &stac92xx_dig_beep_ctrl, |
Jaroslav Kysela | d355c82a | 2009-11-03 15:47:25 +0100 | [diff] [blame] | 3397 | 0, "Beep Playback Switch", 0); |
Takashi Iwai | 4d4e9bb | 2008-11-12 16:45:04 +0100 | [diff] [blame] | 3398 | } |
| 3399 | #endif |
| 3400 | |
Matthew Ranostay | 4682eee | 2008-08-15 07:43:24 +0200 | [diff] [blame] | 3401 | static int stac92xx_auto_create_mux_input_ctls(struct hda_codec *codec) |
| 3402 | { |
| 3403 | struct sigmatel_spec *spec = codec->spec; |
Takashi Iwai | 667067d | 2009-08-13 18:14:42 +0200 | [diff] [blame] | 3404 | int i, j, err = 0; |
Matthew Ranostay | 4682eee | 2008-08-15 07:43:24 +0200 | [diff] [blame] | 3405 | |
| 3406 | for (i = 0; i < spec->num_muxes; i++) { |
Takashi Iwai | 667067d | 2009-08-13 18:14:42 +0200 | [diff] [blame] | 3407 | hda_nid_t nid; |
| 3408 | unsigned int wcaps; |
| 3409 | unsigned long val; |
| 3410 | |
Matthew Ranostay | 4682eee | 2008-08-15 07:43:24 +0200 | [diff] [blame] | 3411 | nid = spec->mux_nids[i]; |
| 3412 | wcaps = get_wcaps(codec, nid); |
Takashi Iwai | 667067d | 2009-08-13 18:14:42 +0200 | [diff] [blame] | 3413 | if (!(wcaps & AC_WCAP_OUT_AMP)) |
| 3414 | continue; |
Matthew Ranostay | 4682eee | 2008-08-15 07:43:24 +0200 | [diff] [blame] | 3415 | |
Takashi Iwai | 667067d | 2009-08-13 18:14:42 +0200 | [diff] [blame] | 3416 | /* check whether already the same control was created as |
| 3417 | * normal Capture Volume. |
| 3418 | */ |
| 3419 | val = HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT); |
| 3420 | for (j = 0; j < spec->num_caps; j++) { |
| 3421 | if (spec->capvols[j] == val) |
| 3422 | break; |
Matthew Ranostay | 4682eee | 2008-08-15 07:43:24 +0200 | [diff] [blame] | 3423 | } |
Takashi Iwai | 667067d | 2009-08-13 18:14:42 +0200 | [diff] [blame] | 3424 | if (j < spec->num_caps) |
| 3425 | continue; |
| 3426 | |
| 3427 | err = stac92xx_add_control_idx(spec, STAC_CTL_WIDGET_VOL, i, |
| 3428 | "Mux Capture Volume", val); |
| 3429 | if (err < 0) |
| 3430 | return err; |
Matthew Ranostay | 4682eee | 2008-08-15 07:43:24 +0200 | [diff] [blame] | 3431 | } |
| 3432 | return 0; |
| 3433 | }; |
| 3434 | |
Takashi Iwai | ea73496 | 2011-01-17 11:29:34 +0100 | [diff] [blame] | 3435 | static const char * const stac92xx_spdif_labels[3] = { |
Matthew Ranostay | 6597363 | 2008-09-16 10:39:37 -0400 | [diff] [blame] | 3436 | "Digital Playback", "Analog Mux 1", "Analog Mux 2", |
Matthew Ranostay | d973775 | 2008-09-07 12:03:41 +0200 | [diff] [blame] | 3437 | }; |
| 3438 | |
| 3439 | static int stac92xx_auto_create_spdif_mux_ctls(struct hda_codec *codec) |
| 3440 | { |
| 3441 | struct sigmatel_spec *spec = codec->spec; |
| 3442 | struct hda_input_mux *spdif_mux = &spec->private_smux; |
Takashi Iwai | ea73496 | 2011-01-17 11:29:34 +0100 | [diff] [blame] | 3443 | const char * const *labels = spec->spdif_labels; |
Matthew Ranostay | d973775 | 2008-09-07 12:03:41 +0200 | [diff] [blame] | 3444 | int i, num_cons; |
Matthew Ranostay | 6597363 | 2008-09-16 10:39:37 -0400 | [diff] [blame] | 3445 | hda_nid_t con_lst[HDA_MAX_NUM_INPUTS]; |
Matthew Ranostay | d973775 | 2008-09-07 12:03:41 +0200 | [diff] [blame] | 3446 | |
| 3447 | num_cons = snd_hda_get_connections(codec, |
| 3448 | spec->smux_nids[0], |
| 3449 | con_lst, |
| 3450 | HDA_MAX_NUM_INPUTS); |
Jaroslav Kysela | 16a433d | 2009-07-22 16:20:40 +0200 | [diff] [blame] | 3451 | if (num_cons <= 0) |
Matthew Ranostay | d973775 | 2008-09-07 12:03:41 +0200 | [diff] [blame] | 3452 | return -EINVAL; |
| 3453 | |
Matthew Ranostay | 6597363 | 2008-09-16 10:39:37 -0400 | [diff] [blame] | 3454 | if (!labels) |
| 3455 | labels = stac92xx_spdif_labels; |
| 3456 | |
Takashi Iwai | 10a20af | 2010-09-09 16:28:02 +0200 | [diff] [blame] | 3457 | for (i = 0; i < num_cons; i++) |
| 3458 | snd_hda_add_imux_item(spdif_mux, labels[i], i, NULL); |
Matthew Ranostay | d973775 | 2008-09-07 12:03:41 +0200 | [diff] [blame] | 3459 | |
| 3460 | return 0; |
| 3461 | } |
| 3462 | |
Matt Porter | 8b65727 | 2006-10-26 17:12:59 +0200 | [diff] [blame] | 3463 | /* labels for dmic mux inputs */ |
Takashi Iwai | ea73496 | 2011-01-17 11:29:34 +0100 | [diff] [blame] | 3464 | static const char * const stac92xx_dmic_labels[5] = { |
Matt Porter | 8b65727 | 2006-10-26 17:12:59 +0200 | [diff] [blame] | 3465 | "Analog Inputs", "Digital Mic 1", "Digital Mic 2", |
| 3466 | "Digital Mic 3", "Digital Mic 4" |
| 3467 | }; |
| 3468 | |
Vitaliy Kulikov | 699d899 | 2011-03-10 13:43:35 -0600 | [diff] [blame] | 3469 | static hda_nid_t get_connected_node(struct hda_codec *codec, hda_nid_t mux, |
| 3470 | int idx) |
| 3471 | { |
| 3472 | hda_nid_t conn[HDA_MAX_NUM_INPUTS]; |
| 3473 | int nums; |
| 3474 | nums = snd_hda_get_connections(codec, mux, conn, ARRAY_SIZE(conn)); |
| 3475 | if (idx >= 0 && idx < nums) |
| 3476 | return conn[idx]; |
| 3477 | return 0; |
| 3478 | } |
| 3479 | |
Takashi Iwai | 8d087c7 | 2011-06-28 12:45:47 +0200 | [diff] [blame] | 3480 | /* look for NID recursively */ |
| 3481 | #define get_connection_index(codec, mux, nid) \ |
| 3482 | snd_hda_get_conn_index(codec, mux, nid, 1) |
Takashi Iwai | 3d21d3f | 2009-07-29 14:32:56 +0200 | [diff] [blame] | 3483 | |
Takashi Iwai | 667067d | 2009-08-13 18:14:42 +0200 | [diff] [blame] | 3484 | /* create a volume assigned to the given pin (only if supported) */ |
Takashi Iwai | 96f845d | 2009-08-29 00:49:36 +0200 | [diff] [blame] | 3485 | /* return 1 if the volume control is created */ |
Takashi Iwai | 667067d | 2009-08-13 18:14:42 +0200 | [diff] [blame] | 3486 | static int create_elem_capture_vol(struct hda_codec *codec, hda_nid_t nid, |
Takashi Iwai | eea7dc9 | 2010-08-30 13:06:15 +0200 | [diff] [blame] | 3487 | const char *label, int idx, int direction) |
Takashi Iwai | 667067d | 2009-08-13 18:14:42 +0200 | [diff] [blame] | 3488 | { |
| 3489 | unsigned int caps, nums; |
| 3490 | char name[32]; |
Takashi Iwai | 96f845d | 2009-08-29 00:49:36 +0200 | [diff] [blame] | 3491 | int err; |
Takashi Iwai | 667067d | 2009-08-13 18:14:42 +0200 | [diff] [blame] | 3492 | |
Takashi Iwai | 96f845d | 2009-08-29 00:49:36 +0200 | [diff] [blame] | 3493 | if (direction == HDA_OUTPUT) |
| 3494 | caps = AC_WCAP_OUT_AMP; |
| 3495 | else |
| 3496 | caps = AC_WCAP_IN_AMP; |
| 3497 | if (!(get_wcaps(codec, nid) & caps)) |
Takashi Iwai | 667067d | 2009-08-13 18:14:42 +0200 | [diff] [blame] | 3498 | return 0; |
Takashi Iwai | 96f845d | 2009-08-29 00:49:36 +0200 | [diff] [blame] | 3499 | caps = query_amp_caps(codec, nid, direction); |
Takashi Iwai | 667067d | 2009-08-13 18:14:42 +0200 | [diff] [blame] | 3500 | nums = (caps & AC_AMPCAP_NUM_STEPS) >> AC_AMPCAP_NUM_STEPS_SHIFT; |
| 3501 | if (!nums) |
| 3502 | return 0; |
| 3503 | snprintf(name, sizeof(name), "%s Capture Volume", label); |
Takashi Iwai | eea7dc9 | 2010-08-30 13:06:15 +0200 | [diff] [blame] | 3504 | err = stac92xx_add_control_idx(codec->spec, STAC_CTL_WIDGET_VOL, idx, name, |
| 3505 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, direction)); |
Takashi Iwai | 96f845d | 2009-08-29 00:49:36 +0200 | [diff] [blame] | 3506 | if (err < 0) |
| 3507 | return err; |
| 3508 | return 1; |
Takashi Iwai | 667067d | 2009-08-13 18:14:42 +0200 | [diff] [blame] | 3509 | } |
| 3510 | |
Matt Porter | 8b65727 | 2006-10-26 17:12:59 +0200 | [diff] [blame] | 3511 | /* create playback/capture controls for input pins on dmic capable codecs */ |
| 3512 | static int stac92xx_auto_create_dmic_input_ctls(struct hda_codec *codec, |
| 3513 | const struct auto_pin_cfg *cfg) |
| 3514 | { |
| 3515 | struct sigmatel_spec *spec = codec->spec; |
Takashi Iwai | 5207e10 | 2009-07-30 13:09:08 +0200 | [diff] [blame] | 3516 | struct hda_input_mux *imux = &spec->private_imux; |
Matt Porter | 8b65727 | 2006-10-26 17:12:59 +0200 | [diff] [blame] | 3517 | struct hda_input_mux *dimux = &spec->private_dimux; |
Vitaliy Kulikov | 263d032 | 2010-09-08 08:56:03 +0200 | [diff] [blame] | 3518 | int err, i; |
Takashi Iwai | 5207e10 | 2009-07-30 13:09:08 +0200 | [diff] [blame] | 3519 | unsigned int def_conf; |
Matt Porter | 8b65727 | 2006-10-26 17:12:59 +0200 | [diff] [blame] | 3520 | |
Takashi Iwai | 10a20af | 2010-09-09 16:28:02 +0200 | [diff] [blame] | 3521 | snd_hda_add_imux_item(dimux, stac92xx_dmic_labels[0], 0, NULL); |
Takashi Iwai | 5207e10 | 2009-07-30 13:09:08 +0200 | [diff] [blame] | 3522 | |
Matt Porter | 8b65727 | 2006-10-26 17:12:59 +0200 | [diff] [blame] | 3523 | for (i = 0; i < spec->num_dmics; i++) { |
Matthew Ranostay | 0678acc | 2008-01-08 12:10:50 +0100 | [diff] [blame] | 3524 | hda_nid_t nid; |
Takashi Iwai | 10a20af | 2010-09-09 16:28:02 +0200 | [diff] [blame] | 3525 | int index, type_idx; |
Takashi Iwai | 201e06f | 2011-11-16 15:33:26 +0100 | [diff] [blame] | 3526 | char label[32]; |
Matt Porter | 8b65727 | 2006-10-26 17:12:59 +0200 | [diff] [blame] | 3527 | |
Takashi Iwai | 667067d | 2009-08-13 18:14:42 +0200 | [diff] [blame] | 3528 | nid = spec->dmic_nids[i]; |
| 3529 | if (get_wcaps_type(get_wcaps(codec, nid)) != AC_WID_PIN) |
| 3530 | continue; |
| 3531 | def_conf = snd_hda_codec_get_pincfg(codec, nid); |
Matt Porter | 8b65727 | 2006-10-26 17:12:59 +0200 | [diff] [blame] | 3532 | if (get_defcfg_connect(def_conf) == AC_JACK_PORT_NONE) |
| 3533 | continue; |
| 3534 | |
Takashi Iwai | 3d21d3f | 2009-07-29 14:32:56 +0200 | [diff] [blame] | 3535 | index = get_connection_index(codec, spec->dmux_nids[0], nid); |
| 3536 | if (index < 0) |
| 3537 | continue; |
| 3538 | |
Takashi Iwai | 201e06f | 2011-11-16 15:33:26 +0100 | [diff] [blame] | 3539 | snd_hda_get_pin_label(codec, nid, &spec->autocfg, |
| 3540 | label, sizeof(label), NULL); |
Takashi Iwai | 10a20af | 2010-09-09 16:28:02 +0200 | [diff] [blame] | 3541 | snd_hda_add_imux_item(dimux, label, index, &type_idx); |
Takashi Iwai | 2d7ec12 | 2010-12-23 10:16:05 +0100 | [diff] [blame] | 3542 | if (snd_hda_get_bool_hint(codec, "separate_dmux") != 1) |
| 3543 | snd_hda_add_imux_item(imux, label, index, &type_idx); |
Takashi Iwai | 5207e10 | 2009-07-30 13:09:08 +0200 | [diff] [blame] | 3544 | |
Takashi Iwai | 10a20af | 2010-09-09 16:28:02 +0200 | [diff] [blame] | 3545 | err = create_elem_capture_vol(codec, nid, label, type_idx, |
| 3546 | HDA_INPUT); |
Takashi Iwai | 667067d | 2009-08-13 18:14:42 +0200 | [diff] [blame] | 3547 | if (err < 0) |
| 3548 | return err; |
Takashi Iwai | 96f845d | 2009-08-29 00:49:36 +0200 | [diff] [blame] | 3549 | if (!err) { |
| 3550 | err = create_elem_capture_vol(codec, nid, label, |
Takashi Iwai | 10a20af | 2010-09-09 16:28:02 +0200 | [diff] [blame] | 3551 | type_idx, HDA_OUTPUT); |
Takashi Iwai | 96f845d | 2009-08-29 00:49:36 +0200 | [diff] [blame] | 3552 | if (err < 0) |
| 3553 | return err; |
Vitaliy Kulikov | 699d899 | 2011-03-10 13:43:35 -0600 | [diff] [blame] | 3554 | if (!err) { |
| 3555 | nid = get_connected_node(codec, |
| 3556 | spec->dmux_nids[0], index); |
| 3557 | if (nid) |
| 3558 | err = create_elem_capture_vol(codec, |
| 3559 | nid, label, |
| 3560 | type_idx, HDA_INPUT); |
| 3561 | if (err < 0) |
| 3562 | return err; |
| 3563 | } |
Takashi Iwai | 96f845d | 2009-08-29 00:49:36 +0200 | [diff] [blame] | 3564 | } |
Matt Porter | 8b65727 | 2006-10-26 17:12:59 +0200 | [diff] [blame] | 3565 | } |
| 3566 | |
| 3567 | return 0; |
| 3568 | } |
| 3569 | |
Takashi Iwai | 3d21d3f | 2009-07-29 14:32:56 +0200 | [diff] [blame] | 3570 | static int check_mic_pin(struct hda_codec *codec, hda_nid_t nid, |
Charles Chin | 9907790 | 2010-09-17 10:22:32 +0200 | [diff] [blame] | 3571 | hda_nid_t *fixed, hda_nid_t *ext, hda_nid_t *dock) |
Takashi Iwai | 3d21d3f | 2009-07-29 14:32:56 +0200 | [diff] [blame] | 3572 | { |
| 3573 | unsigned int cfg; |
Takashi Iwai | 1f83ac5 | 2011-05-17 12:29:09 +0200 | [diff] [blame] | 3574 | unsigned int type; |
Takashi Iwai | 3d21d3f | 2009-07-29 14:32:56 +0200 | [diff] [blame] | 3575 | |
| 3576 | if (!nid) |
| 3577 | return 0; |
| 3578 | cfg = snd_hda_codec_get_pincfg(codec, nid); |
Takashi Iwai | 1f83ac5 | 2011-05-17 12:29:09 +0200 | [diff] [blame] | 3579 | type = get_defcfg_device(cfg); |
Takashi Iwai | 99ae28b | 2010-09-17 14:42:34 +0200 | [diff] [blame] | 3580 | switch (snd_hda_get_input_pin_attr(cfg)) { |
| 3581 | case INPUT_PIN_ATTR_INT: |
Takashi Iwai | 3d21d3f | 2009-07-29 14:32:56 +0200 | [diff] [blame] | 3582 | if (*fixed) |
| 3583 | return 1; /* already occupied */ |
Takashi Iwai | 1f83ac5 | 2011-05-17 12:29:09 +0200 | [diff] [blame] | 3584 | if (type != AC_JACK_MIC_IN) |
| 3585 | return 1; /* invalid type */ |
Takashi Iwai | 3d21d3f | 2009-07-29 14:32:56 +0200 | [diff] [blame] | 3586 | *fixed = nid; |
| 3587 | break; |
Takashi Iwai | 99ae28b | 2010-09-17 14:42:34 +0200 | [diff] [blame] | 3588 | case INPUT_PIN_ATTR_UNUSED: |
| 3589 | break; |
| 3590 | case INPUT_PIN_ATTR_DOCK: |
| 3591 | if (*dock) |
| 3592 | return 1; /* already occupied */ |
Takashi Iwai | 1f83ac5 | 2011-05-17 12:29:09 +0200 | [diff] [blame] | 3593 | if (type != AC_JACK_MIC_IN && type != AC_JACK_LINE_IN) |
| 3594 | return 1; /* invalid type */ |
Takashi Iwai | 99ae28b | 2010-09-17 14:42:34 +0200 | [diff] [blame] | 3595 | *dock = nid; |
| 3596 | break; |
| 3597 | default: |
Takashi Iwai | 3d21d3f | 2009-07-29 14:32:56 +0200 | [diff] [blame] | 3598 | if (*ext) |
| 3599 | return 1; /* already occupied */ |
Takashi Iwai | 1f83ac5 | 2011-05-17 12:29:09 +0200 | [diff] [blame] | 3600 | if (type != AC_JACK_MIC_IN) |
| 3601 | return 1; /* invalid type */ |
Takashi Iwai | 3d21d3f | 2009-07-29 14:32:56 +0200 | [diff] [blame] | 3602 | *ext = nid; |
| 3603 | break; |
| 3604 | } |
| 3605 | return 0; |
| 3606 | } |
| 3607 | |
| 3608 | static int set_mic_route(struct hda_codec *codec, |
| 3609 | struct sigmatel_mic_route *mic, |
| 3610 | hda_nid_t pin) |
| 3611 | { |
| 3612 | struct sigmatel_spec *spec = codec->spec; |
| 3613 | struct auto_pin_cfg *cfg = &spec->autocfg; |
| 3614 | int i; |
| 3615 | |
| 3616 | mic->pin = pin; |
Charles Chin | 9907790 | 2010-09-17 10:22:32 +0200 | [diff] [blame] | 3617 | if (pin == 0) |
| 3618 | return 0; |
Takashi Iwai | eea7dc9 | 2010-08-30 13:06:15 +0200 | [diff] [blame] | 3619 | for (i = 0; i < cfg->num_inputs; i++) { |
| 3620 | if (pin == cfg->inputs[i].pin) |
Takashi Iwai | 3d21d3f | 2009-07-29 14:32:56 +0200 | [diff] [blame] | 3621 | break; |
Takashi Iwai | eea7dc9 | 2010-08-30 13:06:15 +0200 | [diff] [blame] | 3622 | } |
Takashi Iwai | 86e2959 | 2010-09-09 14:50:17 +0200 | [diff] [blame] | 3623 | if (i < cfg->num_inputs && cfg->inputs[i].type == AUTO_PIN_MIC) { |
Takashi Iwai | 3d21d3f | 2009-07-29 14:32:56 +0200 | [diff] [blame] | 3624 | /* analog pin */ |
Takashi Iwai | 3d21d3f | 2009-07-29 14:32:56 +0200 | [diff] [blame] | 3625 | i = get_connection_index(codec, spec->mux_nids[0], pin); |
| 3626 | if (i < 0) |
| 3627 | return -1; |
| 3628 | mic->mux_idx = i; |
Takashi Iwai | 02d3332 | 2009-10-01 16:38:11 +0200 | [diff] [blame] | 3629 | mic->dmux_idx = -1; |
| 3630 | if (spec->dmux_nids) |
| 3631 | mic->dmux_idx = get_connection_index(codec, |
| 3632 | spec->dmux_nids[0], |
| 3633 | spec->mux_nids[0]); |
Takashi Iwai | da2a2aa | 2009-08-10 07:44:09 +0200 | [diff] [blame] | 3634 | } else if (spec->dmux_nids) { |
Takashi Iwai | 3d21d3f | 2009-07-29 14:32:56 +0200 | [diff] [blame] | 3635 | /* digital pin */ |
Takashi Iwai | 3d21d3f | 2009-07-29 14:32:56 +0200 | [diff] [blame] | 3636 | i = get_connection_index(codec, spec->dmux_nids[0], pin); |
| 3637 | if (i < 0) |
| 3638 | return -1; |
| 3639 | mic->dmux_idx = i; |
Takashi Iwai | 02d3332 | 2009-10-01 16:38:11 +0200 | [diff] [blame] | 3640 | mic->mux_idx = -1; |
| 3641 | if (spec->mux_nids) |
| 3642 | mic->mux_idx = get_connection_index(codec, |
| 3643 | spec->mux_nids[0], |
| 3644 | spec->dmux_nids[0]); |
Takashi Iwai | 3d21d3f | 2009-07-29 14:32:56 +0200 | [diff] [blame] | 3645 | } |
| 3646 | return 0; |
| 3647 | } |
| 3648 | |
| 3649 | /* return non-zero if the device is for automatic mic switch */ |
| 3650 | static int stac_check_auto_mic(struct hda_codec *codec) |
| 3651 | { |
| 3652 | struct sigmatel_spec *spec = codec->spec; |
| 3653 | struct auto_pin_cfg *cfg = &spec->autocfg; |
Charles Chin | 9907790 | 2010-09-17 10:22:32 +0200 | [diff] [blame] | 3654 | hda_nid_t fixed, ext, dock; |
Takashi Iwai | 3d21d3f | 2009-07-29 14:32:56 +0200 | [diff] [blame] | 3655 | int i; |
| 3656 | |
Charles Chin | 9907790 | 2010-09-17 10:22:32 +0200 | [diff] [blame] | 3657 | fixed = ext = dock = 0; |
Takashi Iwai | eea7dc9 | 2010-08-30 13:06:15 +0200 | [diff] [blame] | 3658 | for (i = 0; i < cfg->num_inputs; i++) |
Charles Chin | 9907790 | 2010-09-17 10:22:32 +0200 | [diff] [blame] | 3659 | if (check_mic_pin(codec, cfg->inputs[i].pin, |
| 3660 | &fixed, &ext, &dock)) |
Takashi Iwai | 3d21d3f | 2009-07-29 14:32:56 +0200 | [diff] [blame] | 3661 | return 0; |
| 3662 | for (i = 0; i < spec->num_dmics; i++) |
Charles Chin | 9907790 | 2010-09-17 10:22:32 +0200 | [diff] [blame] | 3663 | if (check_mic_pin(codec, spec->dmic_nids[i], |
| 3664 | &fixed, &ext, &dock)) |
Takashi Iwai | 3d21d3f | 2009-07-29 14:32:56 +0200 | [diff] [blame] | 3665 | return 0; |
Takashi Iwai | 80c6785 | 2011-01-13 08:08:08 +0100 | [diff] [blame] | 3666 | if (!fixed || (!ext && !dock)) |
Charles Chin | 9907790 | 2010-09-17 10:22:32 +0200 | [diff] [blame] | 3667 | return 0; /* no input to switch */ |
Takashi Iwai | e35d9d6 | 2011-05-17 11:28:16 +0200 | [diff] [blame] | 3668 | if (!is_jack_detectable(codec, ext)) |
Takashi Iwai | 3d21d3f | 2009-07-29 14:32:56 +0200 | [diff] [blame] | 3669 | return 0; /* no unsol support */ |
| 3670 | if (set_mic_route(codec, &spec->ext_mic, ext) || |
Charles Chin | 9907790 | 2010-09-17 10:22:32 +0200 | [diff] [blame] | 3671 | set_mic_route(codec, &spec->int_mic, fixed) || |
| 3672 | set_mic_route(codec, &spec->dock_mic, dock)) |
Takashi Iwai | 3d21d3f | 2009-07-29 14:32:56 +0200 | [diff] [blame] | 3673 | return 0; /* something is wrong */ |
| 3674 | return 1; |
| 3675 | } |
| 3676 | |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 3677 | /* create playback/capture controls for input pins */ |
| 3678 | static int stac92xx_auto_create_analog_input_ctls(struct hda_codec *codec, const struct auto_pin_cfg *cfg) |
| 3679 | { |
| 3680 | struct sigmatel_spec *spec = codec->spec; |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 3681 | struct hda_input_mux *imux = &spec->private_imux; |
Takashi Iwai | 667067d | 2009-08-13 18:14:42 +0200 | [diff] [blame] | 3682 | int i, j; |
Vitaliy Kulikov | 263d032 | 2010-09-08 08:56:03 +0200 | [diff] [blame] | 3683 | const char *label; |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 3684 | |
Takashi Iwai | eea7dc9 | 2010-08-30 13:06:15 +0200 | [diff] [blame] | 3685 | for (i = 0; i < cfg->num_inputs; i++) { |
| 3686 | hda_nid_t nid = cfg->inputs[i].pin; |
Takashi Iwai | 10a20af | 2010-09-09 16:28:02 +0200 | [diff] [blame] | 3687 | int index, err, type_idx; |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 3688 | |
Takashi Iwai | 314634b | 2006-09-21 11:56:18 +0200 | [diff] [blame] | 3689 | index = -1; |
| 3690 | for (j = 0; j < spec->num_muxes; j++) { |
Takashi Iwai | 667067d | 2009-08-13 18:14:42 +0200 | [diff] [blame] | 3691 | index = get_connection_index(codec, spec->mux_nids[j], |
| 3692 | nid); |
| 3693 | if (index >= 0) |
| 3694 | break; |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 3695 | } |
Takashi Iwai | 667067d | 2009-08-13 18:14:42 +0200 | [diff] [blame] | 3696 | if (index < 0) |
| 3697 | continue; |
| 3698 | |
Takashi Iwai | 10a20af | 2010-09-09 16:28:02 +0200 | [diff] [blame] | 3699 | label = hda_get_autocfg_input_label(codec, cfg, i); |
| 3700 | snd_hda_add_imux_item(imux, label, index, &type_idx); |
Vitaliy Kulikov | 263d032 | 2010-09-08 08:56:03 +0200 | [diff] [blame] | 3701 | |
Takashi Iwai | 667067d | 2009-08-13 18:14:42 +0200 | [diff] [blame] | 3702 | err = create_elem_capture_vol(codec, nid, |
Vitaliy Kulikov | 263d032 | 2010-09-08 08:56:03 +0200 | [diff] [blame] | 3703 | label, type_idx, |
Takashi Iwai | 96f845d | 2009-08-29 00:49:36 +0200 | [diff] [blame] | 3704 | HDA_INPUT); |
Takashi Iwai | 667067d | 2009-08-13 18:14:42 +0200 | [diff] [blame] | 3705 | if (err < 0) |
| 3706 | return err; |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 3707 | } |
Takashi Iwai | 5207e10 | 2009-07-30 13:09:08 +0200 | [diff] [blame] | 3708 | spec->num_analog_muxes = imux->num_items; |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 3709 | |
Steve Longerbeam | 7b04389 | 2007-05-03 20:50:03 +0200 | [diff] [blame] | 3710 | if (imux->num_items) { |
Sam Revitch | 62fe78e | 2006-05-10 15:09:17 +0200 | [diff] [blame] | 3711 | /* |
| 3712 | * Set the current input for the muxes. |
| 3713 | * The STAC9221 has two input muxes with identical source |
| 3714 | * NID lists. Hopefully this won't get confused. |
| 3715 | */ |
| 3716 | for (i = 0; i < spec->num_muxes; i++) { |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 3717 | snd_hda_codec_write_cache(codec, spec->mux_nids[i], 0, |
| 3718 | AC_VERB_SET_CONNECT_SEL, |
| 3719 | imux->items[0].index); |
Sam Revitch | 62fe78e | 2006-05-10 15:09:17 +0200 | [diff] [blame] | 3720 | } |
| 3721 | } |
| 3722 | |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 3723 | return 0; |
| 3724 | } |
| 3725 | |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 3726 | static void stac92xx_auto_init_multi_out(struct hda_codec *codec) |
| 3727 | { |
| 3728 | struct sigmatel_spec *spec = codec->spec; |
| 3729 | int i; |
| 3730 | |
| 3731 | for (i = 0; i < spec->autocfg.line_outs; i++) { |
| 3732 | hda_nid_t nid = spec->autocfg.line_out_pins[i]; |
| 3733 | stac92xx_auto_set_pinctl(codec, nid, AC_PINCTL_OUT_EN); |
| 3734 | } |
| 3735 | } |
| 3736 | |
| 3737 | static void stac92xx_auto_init_hp_out(struct hda_codec *codec) |
| 3738 | { |
| 3739 | struct sigmatel_spec *spec = codec->spec; |
Takashi Iwai | eb06ed8 | 2006-09-20 17:10:27 +0200 | [diff] [blame] | 3740 | int i; |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 3741 | |
Takashi Iwai | eb06ed8 | 2006-09-20 17:10:27 +0200 | [diff] [blame] | 3742 | for (i = 0; i < spec->autocfg.hp_outs; i++) { |
| 3743 | hda_nid_t pin; |
| 3744 | pin = spec->autocfg.hp_pins[i]; |
| 3745 | if (pin) /* connect to front */ |
| 3746 | stac92xx_auto_set_pinctl(codec, pin, AC_PINCTL_OUT_EN | AC_PINCTL_HP_EN); |
| 3747 | } |
| 3748 | for (i = 0; i < spec->autocfg.speaker_outs; i++) { |
| 3749 | hda_nid_t pin; |
| 3750 | pin = spec->autocfg.speaker_pins[i]; |
| 3751 | if (pin) /* connect to front */ |
| 3752 | stac92xx_auto_set_pinctl(codec, pin, AC_PINCTL_OUT_EN); |
| 3753 | } |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 3754 | } |
| 3755 | |
Takashi Iwai | 8af3aeb | 2009-11-18 14:23:37 +0100 | [diff] [blame] | 3756 | static int is_dual_headphones(struct hda_codec *codec) |
| 3757 | { |
| 3758 | struct sigmatel_spec *spec = codec->spec; |
| 3759 | int i, valid_hps; |
| 3760 | |
| 3761 | if (spec->autocfg.line_out_type != AUTO_PIN_SPEAKER_OUT || |
| 3762 | spec->autocfg.hp_outs <= 1) |
| 3763 | return 0; |
| 3764 | valid_hps = 0; |
| 3765 | for (i = 0; i < spec->autocfg.hp_outs; i++) { |
| 3766 | hda_nid_t nid = spec->autocfg.hp_pins[i]; |
| 3767 | unsigned int cfg = snd_hda_codec_get_pincfg(codec, nid); |
| 3768 | if (get_defcfg_location(cfg) & AC_JACK_LOC_SEPARATE) |
| 3769 | continue; |
| 3770 | valid_hps++; |
| 3771 | } |
| 3772 | return (valid_hps > 1); |
| 3773 | } |
| 3774 | |
| 3775 | |
Charles Chin | 9009b0e | 2011-11-03 10:27:27 +0100 | [diff] [blame] | 3776 | static int stac92xx_parse_auto_config(struct hda_codec *codec) |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 3777 | { |
| 3778 | struct sigmatel_spec *spec = codec->spec; |
Charles Chin | 9009b0e | 2011-11-03 10:27:27 +0100 | [diff] [blame] | 3779 | hda_nid_t dig_out = 0, dig_in = 0; |
Takashi Iwai | dc04d1b | 2009-03-06 10:00:05 +0100 | [diff] [blame] | 3780 | int hp_swap = 0; |
Takashi Iwai | 6479c63 | 2009-07-28 18:20:25 +0200 | [diff] [blame] | 3781 | int i, err; |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 3782 | |
Matt Porter | 8b65727 | 2006-10-26 17:12:59 +0200 | [diff] [blame] | 3783 | if ((err = snd_hda_parse_pin_def_config(codec, |
| 3784 | &spec->autocfg, |
| 3785 | spec->dmic_nids)) < 0) |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 3786 | return err; |
Takashi Iwai | 82bc955 | 2006-03-21 11:24:42 +0100 | [diff] [blame] | 3787 | if (! spec->autocfg.line_outs) |
Matt Porter | 869264c | 2006-01-25 19:20:50 +0100 | [diff] [blame] | 3788 | return 0; /* can't find valid pin config */ |
Takashi Iwai | 19039bd | 2006-06-28 15:52:16 +0200 | [diff] [blame] | 3789 | |
Jiang Zhe | bcecd9b | 2007-11-12 12:57:03 +0100 | [diff] [blame] | 3790 | /* If we have no real line-out pin and multiple hp-outs, HPs should |
| 3791 | * be set up as multi-channel outputs. |
| 3792 | */ |
Takashi Iwai | 8af3aeb | 2009-11-18 14:23:37 +0100 | [diff] [blame] | 3793 | if (is_dual_headphones(codec)) { |
Jiang Zhe | bcecd9b | 2007-11-12 12:57:03 +0100 | [diff] [blame] | 3794 | /* Copy hp_outs to line_outs, backup line_outs in |
| 3795 | * speaker_outs so that the following routines can handle |
| 3796 | * HP pins as primary outputs. |
| 3797 | */ |
Takashi Iwai | c21ca4a | 2008-12-19 09:26:08 +0100 | [diff] [blame] | 3798 | snd_printdd("stac92xx: Enabling multi-HPs workaround\n"); |
Jiang Zhe | bcecd9b | 2007-11-12 12:57:03 +0100 | [diff] [blame] | 3799 | memcpy(spec->autocfg.speaker_pins, spec->autocfg.line_out_pins, |
| 3800 | sizeof(spec->autocfg.line_out_pins)); |
| 3801 | spec->autocfg.speaker_outs = spec->autocfg.line_outs; |
| 3802 | memcpy(spec->autocfg.line_out_pins, spec->autocfg.hp_pins, |
| 3803 | sizeof(spec->autocfg.hp_pins)); |
| 3804 | spec->autocfg.line_outs = spec->autocfg.hp_outs; |
Takashi Iwai | c21ca4a | 2008-12-19 09:26:08 +0100 | [diff] [blame] | 3805 | spec->autocfg.line_out_type = AUTO_PIN_HP_OUT; |
| 3806 | spec->autocfg.hp_outs = 0; |
Takashi Iwai | dc04d1b | 2009-03-06 10:00:05 +0100 | [diff] [blame] | 3807 | hp_swap = 1; |
Jiang Zhe | bcecd9b | 2007-11-12 12:57:03 +0100 | [diff] [blame] | 3808 | } |
Matthew Ranostay | 09a9995 | 2008-01-24 11:49:21 +0100 | [diff] [blame] | 3809 | if (spec->autocfg.mono_out_pin) { |
Matthew Ranostay | d0513fc | 2008-07-27 10:30:30 +0200 | [diff] [blame] | 3810 | int dir = get_wcaps(codec, spec->autocfg.mono_out_pin) & |
| 3811 | (AC_WCAP_OUT_AMP | AC_WCAP_IN_AMP); |
Matthew Ranostay | 09a9995 | 2008-01-24 11:49:21 +0100 | [diff] [blame] | 3812 | u32 caps = query_amp_caps(codec, |
| 3813 | spec->autocfg.mono_out_pin, dir); |
| 3814 | hda_nid_t conn_list[1]; |
| 3815 | |
| 3816 | /* get the mixer node and then the mono mux if it exists */ |
| 3817 | if (snd_hda_get_connections(codec, |
| 3818 | spec->autocfg.mono_out_pin, conn_list, 1) && |
| 3819 | snd_hda_get_connections(codec, conn_list[0], |
Jaroslav Kysela | 16a433d | 2009-07-22 16:20:40 +0200 | [diff] [blame] | 3820 | conn_list, 1) > 0) { |
Matthew Ranostay | 09a9995 | 2008-01-24 11:49:21 +0100 | [diff] [blame] | 3821 | |
| 3822 | int wcaps = get_wcaps(codec, conn_list[0]); |
Takashi Iwai | a22d543 | 2009-07-27 12:54:26 +0200 | [diff] [blame] | 3823 | int wid_type = get_wcaps_type(wcaps); |
Matthew Ranostay | 09a9995 | 2008-01-24 11:49:21 +0100 | [diff] [blame] | 3824 | /* LR swap check, some stac925x have a mux that |
| 3825 | * changes the DACs output path instead of the |
| 3826 | * mono-mux path. |
| 3827 | */ |
| 3828 | if (wid_type == AC_WID_AUD_SEL && |
| 3829 | !(wcaps & AC_WCAP_LR_SWAP)) |
| 3830 | spec->mono_nid = conn_list[0]; |
| 3831 | } |
Matthew Ranostay | d0513fc | 2008-07-27 10:30:30 +0200 | [diff] [blame] | 3832 | if (dir) { |
| 3833 | hda_nid_t nid = spec->autocfg.mono_out_pin; |
| 3834 | |
| 3835 | /* most mono outs have a least a mute/unmute switch */ |
| 3836 | dir = (dir & AC_WCAP_OUT_AMP) ? HDA_OUTPUT : HDA_INPUT; |
| 3837 | err = stac92xx_add_control(spec, STAC_CTL_WIDGET_MUTE, |
| 3838 | "Mono Playback Switch", |
| 3839 | HDA_COMPOSE_AMP_VAL(nid, 1, 0, dir)); |
Matthew Ranostay | 09a9995 | 2008-01-24 11:49:21 +0100 | [diff] [blame] | 3840 | if (err < 0) |
| 3841 | return err; |
Matthew Ranostay | d0513fc | 2008-07-27 10:30:30 +0200 | [diff] [blame] | 3842 | /* check for volume support for the amp */ |
| 3843 | if ((caps & AC_AMPCAP_NUM_STEPS) |
| 3844 | >> AC_AMPCAP_NUM_STEPS_SHIFT) { |
| 3845 | err = stac92xx_add_control(spec, |
| 3846 | STAC_CTL_WIDGET_VOL, |
| 3847 | "Mono Playback Volume", |
| 3848 | HDA_COMPOSE_AMP_VAL(nid, 1, 0, dir)); |
| 3849 | if (err < 0) |
| 3850 | return err; |
| 3851 | } |
Matthew Ranostay | 09a9995 | 2008-01-24 11:49:21 +0100 | [diff] [blame] | 3852 | } |
| 3853 | |
| 3854 | stac92xx_auto_set_pinctl(codec, spec->autocfg.mono_out_pin, |
| 3855 | AC_PINCTL_OUT_EN); |
| 3856 | } |
Jiang Zhe | bcecd9b | 2007-11-12 12:57:03 +0100 | [diff] [blame] | 3857 | |
Takashi Iwai | c21ca4a | 2008-12-19 09:26:08 +0100 | [diff] [blame] | 3858 | if (!spec->multiout.num_dacs) { |
| 3859 | err = stac92xx_auto_fill_dac_nids(codec); |
| 3860 | if (err < 0) |
Takashi Iwai | 19039bd | 2006-06-28 15:52:16 +0200 | [diff] [blame] | 3861 | return err; |
Takashi Iwai | c9280d6 | 2009-01-15 17:31:00 +0100 | [diff] [blame] | 3862 | err = stac92xx_auto_create_multi_out_ctls(codec, |
| 3863 | &spec->autocfg); |
| 3864 | if (err < 0) |
| 3865 | return err; |
Takashi Iwai | c21ca4a | 2008-12-19 09:26:08 +0100 | [diff] [blame] | 3866 | } |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 3867 | |
Matthew Ranostay | 1cd2224 | 2008-07-18 18:20:52 +0200 | [diff] [blame] | 3868 | /* setup analog beep controls */ |
| 3869 | if (spec->anabeep_nid > 0) { |
| 3870 | err = stac92xx_auto_create_beep_ctls(codec, |
| 3871 | spec->anabeep_nid); |
| 3872 | if (err < 0) |
| 3873 | return err; |
| 3874 | } |
| 3875 | |
| 3876 | /* setup digital beep controls and input device */ |
| 3877 | #ifdef CONFIG_SND_HDA_INPUT_BEEP |
| 3878 | if (spec->digbeep_nid > 0) { |
| 3879 | hda_nid_t nid = spec->digbeep_nid; |
Takashi Iwai | 4d4e9bb | 2008-11-12 16:45:04 +0100 | [diff] [blame] | 3880 | unsigned int caps; |
Matthew Ranostay | 1cd2224 | 2008-07-18 18:20:52 +0200 | [diff] [blame] | 3881 | |
| 3882 | err = stac92xx_auto_create_beep_ctls(codec, nid); |
| 3883 | if (err < 0) |
| 3884 | return err; |
| 3885 | err = snd_hda_attach_beep_device(codec, nid); |
| 3886 | if (err < 0) |
| 3887 | return err; |
Takashi Iwai | d8d881d | 2009-12-22 07:52:49 +0100 | [diff] [blame] | 3888 | if (codec->beep) { |
| 3889 | /* IDT/STAC codecs have linear beep tone parameter */ |
Daniel J Blueman | 1b0e372 | 2010-08-03 11:09:13 +0100 | [diff] [blame] | 3890 | codec->beep->linear_tone = spec->linear_tone_beep; |
Takashi Iwai | d8d881d | 2009-12-22 07:52:49 +0100 | [diff] [blame] | 3891 | /* if no beep switch is available, make its own one */ |
| 3892 | caps = query_amp_caps(codec, nid, HDA_OUTPUT); |
| 3893 | if (!(caps & AC_AMPCAP_MUTE)) { |
| 3894 | err = stac92xx_beep_switch_ctl(codec); |
| 3895 | if (err < 0) |
| 3896 | return err; |
| 3897 | } |
Takashi Iwai | 4d4e9bb | 2008-11-12 16:45:04 +0100 | [diff] [blame] | 3898 | } |
Matthew Ranostay | 1cd2224 | 2008-07-18 18:20:52 +0200 | [diff] [blame] | 3899 | } |
| 3900 | #endif |
| 3901 | |
Maxim Levitsky | 0fb87bb | 2007-09-03 15:29:04 +0200 | [diff] [blame] | 3902 | err = stac92xx_auto_create_hp_ctls(codec, &spec->autocfg); |
Maxim Levitsky | 0fb87bb | 2007-09-03 15:29:04 +0200 | [diff] [blame] | 3903 | if (err < 0) |
| 3904 | return err; |
| 3905 | |
Takashi Iwai | dc04d1b | 2009-03-06 10:00:05 +0100 | [diff] [blame] | 3906 | /* All output parsing done, now restore the swapped hp pins */ |
| 3907 | if (hp_swap) { |
| 3908 | memcpy(spec->autocfg.hp_pins, spec->autocfg.line_out_pins, |
| 3909 | sizeof(spec->autocfg.hp_pins)); |
| 3910 | spec->autocfg.hp_outs = spec->autocfg.line_outs; |
| 3911 | spec->autocfg.line_out_type = AUTO_PIN_HP_OUT; |
| 3912 | spec->autocfg.line_outs = 0; |
| 3913 | } |
Maxim Levitsky | 0fb87bb | 2007-09-03 15:29:04 +0200 | [diff] [blame] | 3914 | |
Takashi Iwai | 3d21d3f | 2009-07-29 14:32:56 +0200 | [diff] [blame] | 3915 | if (stac_check_auto_mic(codec)) { |
| 3916 | spec->auto_mic = 1; |
| 3917 | /* only one capture for auto-mic */ |
| 3918 | spec->num_adcs = 1; |
| 3919 | spec->num_caps = 1; |
| 3920 | spec->num_muxes = 1; |
| 3921 | } |
| 3922 | |
Takashi Iwai | 6479c63 | 2009-07-28 18:20:25 +0200 | [diff] [blame] | 3923 | for (i = 0; i < spec->num_caps; i++) { |
| 3924 | err = stac92xx_add_capvol_ctls(codec, spec->capvols[i], |
| 3925 | spec->capsws[i], i); |
| 3926 | if (err < 0) |
| 3927 | return err; |
| 3928 | } |
| 3929 | |
Takashi Iwai | dc04d1b | 2009-03-06 10:00:05 +0100 | [diff] [blame] | 3930 | err = stac92xx_auto_create_analog_input_ctls(codec, &spec->autocfg); |
Maxim Levitsky | 0fb87bb | 2007-09-03 15:29:04 +0200 | [diff] [blame] | 3931 | if (err < 0) |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 3932 | return err; |
| 3933 | |
Matthew Ranostay | b22b482 | 2008-01-22 12:32:30 +0100 | [diff] [blame] | 3934 | if (spec->mono_nid > 0) { |
| 3935 | err = stac92xx_auto_create_mono_output_ctls(codec); |
| 3936 | if (err < 0) |
| 3937 | return err; |
| 3938 | } |
Matthew Ranostay | 2a9c781 | 2008-09-13 16:45:39 -0400 | [diff] [blame] | 3939 | if (spec->num_dmics > 0 && !spec->dinput_mux) |
Matt Porter | 8b65727 | 2006-10-26 17:12:59 +0200 | [diff] [blame] | 3940 | if ((err = stac92xx_auto_create_dmic_input_ctls(codec, |
| 3941 | &spec->autocfg)) < 0) |
| 3942 | return err; |
Matthew Ranostay | 4682eee | 2008-08-15 07:43:24 +0200 | [diff] [blame] | 3943 | if (spec->num_muxes > 0) { |
| 3944 | err = stac92xx_auto_create_mux_input_ctls(codec); |
| 3945 | if (err < 0) |
| 3946 | return err; |
| 3947 | } |
Matthew Ranostay | d973775 | 2008-09-07 12:03:41 +0200 | [diff] [blame] | 3948 | if (spec->num_smuxes > 0) { |
| 3949 | err = stac92xx_auto_create_spdif_mux_ctls(codec); |
| 3950 | if (err < 0) |
| 3951 | return err; |
| 3952 | } |
Matt Porter | 8b65727 | 2006-10-26 17:12:59 +0200 | [diff] [blame] | 3953 | |
Takashi Iwai | e3c7596 | 2009-01-23 11:57:22 +0100 | [diff] [blame] | 3954 | err = stac92xx_add_input_source(spec); |
| 3955 | if (err < 0) |
| 3956 | return err; |
| 3957 | |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 3958 | spec->multiout.max_channels = spec->multiout.num_dacs * 2; |
Matt Porter | 403d194 | 2005-11-29 15:00:51 +0100 | [diff] [blame] | 3959 | if (spec->multiout.max_channels > 2) |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 3960 | spec->surr_switch = 1; |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 3961 | |
Charles Chin | 9009b0e | 2011-11-03 10:27:27 +0100 | [diff] [blame] | 3962 | /* find digital out and in converters */ |
| 3963 | for (i = codec->start_nid; i < codec->start_nid + codec->num_nodes; i++) { |
| 3964 | unsigned int wid_caps = get_wcaps(codec, i); |
| 3965 | if (wid_caps & AC_WCAP_DIGITAL) { |
| 3966 | switch (get_wcaps_type(wid_caps)) { |
| 3967 | case AC_WID_AUD_OUT: |
| 3968 | if (!dig_out) |
| 3969 | dig_out = i; |
| 3970 | break; |
| 3971 | case AC_WID_AUD_IN: |
| 3972 | if (!dig_in) |
| 3973 | dig_in = i; |
| 3974 | break; |
| 3975 | } |
| 3976 | } |
| 3977 | } |
Takashi Iwai | 0852d7a | 2009-02-11 11:35:15 +0100 | [diff] [blame] | 3978 | if (spec->autocfg.dig_outs) |
Matt Porter | 3cc08dc | 2006-01-23 15:27:49 +0100 | [diff] [blame] | 3979 | spec->multiout.dig_out_nid = dig_out; |
Matthew Ranostay | d0513fc | 2008-07-27 10:30:30 +0200 | [diff] [blame] | 3980 | if (dig_in && spec->autocfg.dig_in_pin) |
Matt Porter | 3cc08dc | 2006-01-23 15:27:49 +0100 | [diff] [blame] | 3981 | spec->dig_in_nid = dig_in; |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 3982 | |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 3983 | if (spec->kctls.list) |
| 3984 | spec->mixers[spec->num_mixers++] = spec->kctls.list; |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 3985 | |
| 3986 | spec->input_mux = &spec->private_imux; |
Matthew Ranostay | f8ccbf6 | 2008-12-20 17:36:28 -0500 | [diff] [blame] | 3987 | if (!spec->dinput_mux) |
| 3988 | spec->dinput_mux = &spec->private_dimux; |
Matthew Ranostay | d973775 | 2008-09-07 12:03:41 +0200 | [diff] [blame] | 3989 | spec->sinput_mux = &spec->private_smux; |
Matthew Ranostay | b22b482 | 2008-01-22 12:32:30 +0100 | [diff] [blame] | 3990 | spec->mono_mux = &spec->private_mono_mux; |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 3991 | return 1; |
| 3992 | } |
| 3993 | |
Takashi Iwai | 82bc955 | 2006-03-21 11:24:42 +0100 | [diff] [blame] | 3994 | /* add playback controls for HP output */ |
| 3995 | static int stac9200_auto_create_hp_ctls(struct hda_codec *codec, |
| 3996 | struct auto_pin_cfg *cfg) |
| 3997 | { |
| 3998 | struct sigmatel_spec *spec = codec->spec; |
Takashi Iwai | eb06ed8 | 2006-09-20 17:10:27 +0200 | [diff] [blame] | 3999 | hda_nid_t pin = cfg->hp_pins[0]; |
Takashi Iwai | 82bc955 | 2006-03-21 11:24:42 +0100 | [diff] [blame] | 4000 | |
| 4001 | if (! pin) |
| 4002 | return 0; |
| 4003 | |
Takashi Iwai | e35d9d6 | 2011-05-17 11:28:16 +0200 | [diff] [blame] | 4004 | if (is_jack_detectable(codec, pin)) |
Takashi Iwai | 82bc955 | 2006-03-21 11:24:42 +0100 | [diff] [blame] | 4005 | spec->hp_detect = 1; |
Takashi Iwai | 82bc955 | 2006-03-21 11:24:42 +0100 | [diff] [blame] | 4006 | |
| 4007 | return 0; |
| 4008 | } |
| 4009 | |
Richard Fish | 160ea0d | 2006-09-06 13:58:25 +0200 | [diff] [blame] | 4010 | /* add playback controls for LFE output */ |
| 4011 | static int stac9200_auto_create_lfe_ctls(struct hda_codec *codec, |
| 4012 | struct auto_pin_cfg *cfg) |
| 4013 | { |
| 4014 | struct sigmatel_spec *spec = codec->spec; |
| 4015 | int err; |
| 4016 | hda_nid_t lfe_pin = 0x0; |
| 4017 | int i; |
| 4018 | |
| 4019 | /* |
| 4020 | * search speaker outs and line outs for a mono speaker pin |
| 4021 | * with an amp. If one is found, add LFE controls |
| 4022 | * for it. |
| 4023 | */ |
| 4024 | for (i = 0; i < spec->autocfg.speaker_outs && lfe_pin == 0x0; i++) { |
| 4025 | hda_nid_t pin = spec->autocfg.speaker_pins[i]; |
Takashi Iwai | 64ed0df | 2008-02-29 11:57:53 +0100 | [diff] [blame] | 4026 | unsigned int wcaps = get_wcaps(codec, pin); |
Richard Fish | 160ea0d | 2006-09-06 13:58:25 +0200 | [diff] [blame] | 4027 | wcaps &= (AC_WCAP_STEREO | AC_WCAP_OUT_AMP); |
| 4028 | if (wcaps == AC_WCAP_OUT_AMP) |
| 4029 | /* found a mono speaker with an amp, must be lfe */ |
| 4030 | lfe_pin = pin; |
| 4031 | } |
| 4032 | |
| 4033 | /* if speaker_outs is 0, then speakers may be in line_outs */ |
| 4034 | if (lfe_pin == 0 && spec->autocfg.speaker_outs == 0) { |
| 4035 | for (i = 0; i < spec->autocfg.line_outs && lfe_pin == 0x0; i++) { |
| 4036 | hda_nid_t pin = spec->autocfg.line_out_pins[i]; |
Takashi Iwai | 64ed0df | 2008-02-29 11:57:53 +0100 | [diff] [blame] | 4037 | unsigned int defcfg; |
Takashi Iwai | 330ee99 | 2009-02-20 14:33:36 +0100 | [diff] [blame] | 4038 | defcfg = snd_hda_codec_get_pincfg(codec, pin); |
Harvey Harrison | 8b55178 | 2008-02-29 11:56:48 +0100 | [diff] [blame] | 4039 | if (get_defcfg_device(defcfg) == AC_JACK_SPEAKER) { |
Takashi Iwai | 64ed0df | 2008-02-29 11:57:53 +0100 | [diff] [blame] | 4040 | unsigned int wcaps = get_wcaps(codec, pin); |
Richard Fish | 160ea0d | 2006-09-06 13:58:25 +0200 | [diff] [blame] | 4041 | wcaps &= (AC_WCAP_STEREO | AC_WCAP_OUT_AMP); |
| 4042 | if (wcaps == AC_WCAP_OUT_AMP) |
| 4043 | /* found a mono speaker with an amp, |
| 4044 | must be lfe */ |
| 4045 | lfe_pin = pin; |
| 4046 | } |
| 4047 | } |
| 4048 | } |
| 4049 | |
| 4050 | if (lfe_pin) { |
Takashi Iwai | 7c7767e | 2009-01-20 15:28:38 +0100 | [diff] [blame] | 4051 | err = create_controls(codec, "LFE", lfe_pin, 1); |
Richard Fish | 160ea0d | 2006-09-06 13:58:25 +0200 | [diff] [blame] | 4052 | if (err < 0) |
| 4053 | return err; |
| 4054 | } |
| 4055 | |
| 4056 | return 0; |
| 4057 | } |
| 4058 | |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 4059 | static int stac9200_parse_auto_config(struct hda_codec *codec) |
| 4060 | { |
| 4061 | struct sigmatel_spec *spec = codec->spec; |
| 4062 | int err; |
| 4063 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4064 | if ((err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, NULL)) < 0) |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 4065 | return err; |
| 4066 | |
| 4067 | if ((err = stac92xx_auto_create_analog_input_ctls(codec, &spec->autocfg)) < 0) |
| 4068 | return err; |
| 4069 | |
Takashi Iwai | 82bc955 | 2006-03-21 11:24:42 +0100 | [diff] [blame] | 4070 | if ((err = stac9200_auto_create_hp_ctls(codec, &spec->autocfg)) < 0) |
| 4071 | return err; |
| 4072 | |
Richard Fish | 160ea0d | 2006-09-06 13:58:25 +0200 | [diff] [blame] | 4073 | if ((err = stac9200_auto_create_lfe_ctls(codec, &spec->autocfg)) < 0) |
| 4074 | return err; |
| 4075 | |
Takashi Iwai | 355a0ec | 2008-11-11 16:46:19 +0100 | [diff] [blame] | 4076 | if (spec->num_muxes > 0) { |
| 4077 | err = stac92xx_auto_create_mux_input_ctls(codec); |
| 4078 | if (err < 0) |
| 4079 | return err; |
| 4080 | } |
| 4081 | |
Takashi Iwai | e3c7596 | 2009-01-23 11:57:22 +0100 | [diff] [blame] | 4082 | err = stac92xx_add_input_source(spec); |
| 4083 | if (err < 0) |
| 4084 | return err; |
| 4085 | |
Takashi Iwai | 0852d7a | 2009-02-11 11:35:15 +0100 | [diff] [blame] | 4086 | if (spec->autocfg.dig_outs) |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 4087 | spec->multiout.dig_out_nid = 0x05; |
Takashi Iwai | 82bc955 | 2006-03-21 11:24:42 +0100 | [diff] [blame] | 4088 | if (spec->autocfg.dig_in_pin) |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 4089 | spec->dig_in_nid = 0x04; |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 4090 | |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 4091 | if (spec->kctls.list) |
| 4092 | spec->mixers[spec->num_mixers++] = spec->kctls.list; |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 4093 | |
| 4094 | spec->input_mux = &spec->private_imux; |
Matt Porter | 8b65727 | 2006-10-26 17:12:59 +0200 | [diff] [blame] | 4095 | spec->dinput_mux = &spec->private_dimux; |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 4096 | |
| 4097 | return 1; |
| 4098 | } |
| 4099 | |
Sam Revitch | 62fe78e | 2006-05-10 15:09:17 +0200 | [diff] [blame] | 4100 | /* |
| 4101 | * Early 2006 Intel Macintoshes with STAC9220X5 codecs seem to have a |
| 4102 | * funky external mute control using GPIO pins. |
| 4103 | */ |
| 4104 | |
Takashi Iwai | 76e1ddf | 2008-01-15 11:39:08 +0100 | [diff] [blame] | 4105 | static void stac_gpio_set(struct hda_codec *codec, unsigned int mask, |
Matthew Ranostay | 4fe5195 | 2008-01-29 15:28:44 +0100 | [diff] [blame] | 4106 | unsigned int dir_mask, unsigned int data) |
Sam Revitch | 62fe78e | 2006-05-10 15:09:17 +0200 | [diff] [blame] | 4107 | { |
| 4108 | unsigned int gpiostate, gpiomask, gpiodir; |
| 4109 | |
Vitaliy Kulikov | 45eebda | 2011-07-26 16:56:20 -0500 | [diff] [blame] | 4110 | snd_printdd("%s msk %x dir %x gpio %x\n", __func__, mask, dir_mask, data); |
| 4111 | |
Sam Revitch | 62fe78e | 2006-05-10 15:09:17 +0200 | [diff] [blame] | 4112 | gpiostate = snd_hda_codec_read(codec, codec->afg, 0, |
| 4113 | AC_VERB_GET_GPIO_DATA, 0); |
Matthew Ranostay | 4fe5195 | 2008-01-29 15:28:44 +0100 | [diff] [blame] | 4114 | gpiostate = (gpiostate & ~dir_mask) | (data & dir_mask); |
Sam Revitch | 62fe78e | 2006-05-10 15:09:17 +0200 | [diff] [blame] | 4115 | |
| 4116 | gpiomask = snd_hda_codec_read(codec, codec->afg, 0, |
| 4117 | AC_VERB_GET_GPIO_MASK, 0); |
Takashi Iwai | 76e1ddf | 2008-01-15 11:39:08 +0100 | [diff] [blame] | 4118 | gpiomask |= mask; |
Sam Revitch | 62fe78e | 2006-05-10 15:09:17 +0200 | [diff] [blame] | 4119 | |
| 4120 | gpiodir = snd_hda_codec_read(codec, codec->afg, 0, |
| 4121 | AC_VERB_GET_GPIO_DIRECTION, 0); |
Matthew Ranostay | 4fe5195 | 2008-01-29 15:28:44 +0100 | [diff] [blame] | 4122 | gpiodir |= dir_mask; |
Sam Revitch | 62fe78e | 2006-05-10 15:09:17 +0200 | [diff] [blame] | 4123 | |
Takashi Iwai | 76e1ddf | 2008-01-15 11:39:08 +0100 | [diff] [blame] | 4124 | /* Configure GPIOx as CMOS */ |
Sam Revitch | 62fe78e | 2006-05-10 15:09:17 +0200 | [diff] [blame] | 4125 | snd_hda_codec_write(codec, codec->afg, 0, 0x7e7, 0); |
| 4126 | |
| 4127 | snd_hda_codec_write(codec, codec->afg, 0, |
| 4128 | AC_VERB_SET_GPIO_MASK, gpiomask); |
Takashi Iwai | 76e1ddf | 2008-01-15 11:39:08 +0100 | [diff] [blame] | 4129 | snd_hda_codec_read(codec, codec->afg, 0, |
| 4130 | AC_VERB_SET_GPIO_DIRECTION, gpiodir); /* sync */ |
Sam Revitch | 62fe78e | 2006-05-10 15:09:17 +0200 | [diff] [blame] | 4131 | |
| 4132 | msleep(1); |
| 4133 | |
Takashi Iwai | 76e1ddf | 2008-01-15 11:39:08 +0100 | [diff] [blame] | 4134 | snd_hda_codec_read(codec, codec->afg, 0, |
| 4135 | AC_VERB_SET_GPIO_DATA, gpiostate); /* sync */ |
Sam Revitch | 62fe78e | 2006-05-10 15:09:17 +0200 | [diff] [blame] | 4136 | } |
| 4137 | |
Takashi Iwai | 3a93897 | 2011-10-28 01:16:55 +0200 | [diff] [blame] | 4138 | static int stac_add_event(struct hda_codec *codec, hda_nid_t nid, |
Takashi Iwai | c6e4c66 | 2008-11-25 11:58:19 +0100 | [diff] [blame] | 4139 | unsigned char type, int data) |
Matthew Ranostay | 74aeaab | 2008-10-25 01:06:04 -0400 | [diff] [blame] | 4140 | { |
Takashi Iwai | 3a93897 | 2011-10-28 01:16:55 +0200 | [diff] [blame] | 4141 | struct hda_jack_tbl *event; |
Matthew Ranostay | 74aeaab | 2008-10-25 01:06:04 -0400 | [diff] [blame] | 4142 | |
Takashi Iwai | 3a93897 | 2011-10-28 01:16:55 +0200 | [diff] [blame] | 4143 | event = snd_hda_jack_tbl_new(codec, nid); |
Matthew Ranostay | 74aeaab | 2008-10-25 01:06:04 -0400 | [diff] [blame] | 4144 | if (!event) |
| 4145 | return -ENOMEM; |
Takashi Iwai | 3a93897 | 2011-10-28 01:16:55 +0200 | [diff] [blame] | 4146 | event->action = type; |
| 4147 | event->private_data = data; |
Matthew Ranostay | 74aeaab | 2008-10-25 01:06:04 -0400 | [diff] [blame] | 4148 | |
Takashi Iwai | 3a93897 | 2011-10-28 01:16:55 +0200 | [diff] [blame] | 4149 | return 0; |
Matthew Ranostay | 74aeaab | 2008-10-25 01:06:04 -0400 | [diff] [blame] | 4150 | } |
| 4151 | |
Takashi Iwai | 62558ce | 2009-07-29 14:23:09 +0200 | [diff] [blame] | 4152 | /* check if given nid is a valid pin and no other events are assigned |
| 4153 | * to it. If OK, assign the event, set the unsol flag, and returns 1. |
| 4154 | * Otherwise, returns zero. |
| 4155 | */ |
| 4156 | static int enable_pin_detect(struct hda_codec *codec, hda_nid_t nid, |
| 4157 | unsigned int type) |
Takashi Iwai | 314634b | 2006-09-21 11:56:18 +0200 | [diff] [blame] | 4158 | { |
Takashi Iwai | 3a93897 | 2011-10-28 01:16:55 +0200 | [diff] [blame] | 4159 | struct hda_jack_tbl *event; |
Takashi Iwai | c6e4c66 | 2008-11-25 11:58:19 +0100 | [diff] [blame] | 4160 | |
Takashi Iwai | e35d9d6 | 2011-05-17 11:28:16 +0200 | [diff] [blame] | 4161 | if (!is_jack_detectable(codec, nid)) |
Takashi Iwai | 62558ce | 2009-07-29 14:23:09 +0200 | [diff] [blame] | 4162 | return 0; |
Takashi Iwai | 3a93897 | 2011-10-28 01:16:55 +0200 | [diff] [blame] | 4163 | event = snd_hda_jack_tbl_new(codec, nid); |
| 4164 | if (!event) |
| 4165 | return -ENOMEM; |
| 4166 | if (event->action && event->action != type) |
| 4167 | return 0; |
| 4168 | event->action = type; |
| 4169 | snd_hda_jack_detect_enable(codec, nid, 0); |
Takashi Iwai | 62558ce | 2009-07-29 14:23:09 +0200 | [diff] [blame] | 4170 | return 1; |
Takashi Iwai | 314634b | 2006-09-21 11:56:18 +0200 | [diff] [blame] | 4171 | } |
| 4172 | |
Takashi Iwai | b4ead01 | 2012-01-23 18:23:36 +0100 | [diff] [blame] | 4173 | static int is_nid_out_jack_pin(struct auto_pin_cfg *cfg, hda_nid_t nid) |
Matthew Ranostay | a64135a | 2008-01-10 16:55:06 +0100 | [diff] [blame] | 4174 | { |
| 4175 | int i; |
| 4176 | for (i = 0; i < cfg->hp_outs; i++) |
| 4177 | if (cfg->hp_pins[i] == nid) |
| 4178 | return 1; /* nid is a HP-Out */ |
Takashi Iwai | b4ead01 | 2012-01-23 18:23:36 +0100 | [diff] [blame] | 4179 | for (i = 0; i < cfg->line_outs; i++) |
| 4180 | if (cfg->line_out_pins[i] == nid) |
| 4181 | return 1; /* nid is a line-Out */ |
Matthew Ranostay | a64135a | 2008-01-10 16:55:06 +0100 | [diff] [blame] | 4182 | return 0; /* nid is not a HP-Out */ |
| 4183 | }; |
| 4184 | |
Matthew Ranostay | b76c850 | 2008-02-06 14:49:44 +0100 | [diff] [blame] | 4185 | static void stac92xx_power_down(struct hda_codec *codec) |
| 4186 | { |
| 4187 | struct sigmatel_spec *spec = codec->spec; |
| 4188 | |
| 4189 | /* power down inactive DACs */ |
Takashi Iwai | 2b63536 | 2011-05-02 12:33:43 +0200 | [diff] [blame] | 4190 | const hda_nid_t *dac; |
Matthew Ranostay | b76c850 | 2008-02-06 14:49:44 +0100 | [diff] [blame] | 4191 | for (dac = spec->dac_list; *dac; dac++) |
Takashi Iwai | c21ca4a | 2008-12-19 09:26:08 +0100 | [diff] [blame] | 4192 | if (!check_all_dac_nids(spec, *dac)) |
Takashi Iwai | 8c2f767 | 2008-12-01 11:54:35 +0100 | [diff] [blame] | 4193 | snd_hda_codec_write(codec, *dac, 0, |
Matthew Ranostay | b76c850 | 2008-02-06 14:49:44 +0100 | [diff] [blame] | 4194 | AC_VERB_SET_POWER_STATE, AC_PWRST_D3); |
| 4195 | } |
| 4196 | |
Takashi Iwai | f73d358 | 2008-11-25 08:21:51 +0100 | [diff] [blame] | 4197 | static void stac_toggle_power_map(struct hda_codec *codec, hda_nid_t nid, |
| 4198 | int enable); |
| 4199 | |
Takashi Iwai | 014c41f | 2009-12-27 13:53:24 +0100 | [diff] [blame] | 4200 | static inline int get_int_hint(struct hda_codec *codec, const char *key, |
| 4201 | int *valp) |
| 4202 | { |
| 4203 | const char *p; |
| 4204 | p = snd_hda_get_hint(codec, key); |
| 4205 | if (p) { |
| 4206 | unsigned long val; |
| 4207 | if (!strict_strtoul(p, 0, &val)) { |
| 4208 | *valp = val; |
| 4209 | return 1; |
| 4210 | } |
| 4211 | } |
| 4212 | return 0; |
| 4213 | } |
| 4214 | |
Takashi Iwai | 6565e4f | 2009-03-02 14:38:35 +0100 | [diff] [blame] | 4215 | /* override some hints from the hwdep entry */ |
| 4216 | static void stac_store_hints(struct hda_codec *codec) |
| 4217 | { |
| 4218 | struct sigmatel_spec *spec = codec->spec; |
Takashi Iwai | 6565e4f | 2009-03-02 14:38:35 +0100 | [diff] [blame] | 4219 | int val; |
| 4220 | |
| 4221 | val = snd_hda_get_bool_hint(codec, "hp_detect"); |
| 4222 | if (val >= 0) |
| 4223 | spec->hp_detect = val; |
Takashi Iwai | 014c41f | 2009-12-27 13:53:24 +0100 | [diff] [blame] | 4224 | if (get_int_hint(codec, "gpio_mask", &spec->gpio_mask)) { |
Takashi Iwai | 6565e4f | 2009-03-02 14:38:35 +0100 | [diff] [blame] | 4225 | spec->eapd_mask = spec->gpio_dir = spec->gpio_data = |
| 4226 | spec->gpio_mask; |
| 4227 | } |
Takashi Iwai | 014c41f | 2009-12-27 13:53:24 +0100 | [diff] [blame] | 4228 | if (get_int_hint(codec, "gpio_dir", &spec->gpio_dir)) |
| 4229 | spec->gpio_mask &= spec->gpio_mask; |
| 4230 | if (get_int_hint(codec, "gpio_data", &spec->gpio_data)) |
| 4231 | spec->gpio_dir &= spec->gpio_mask; |
| 4232 | if (get_int_hint(codec, "eapd_mask", &spec->eapd_mask)) |
| 4233 | spec->eapd_mask &= spec->gpio_mask; |
| 4234 | if (get_int_hint(codec, "gpio_mute", &spec->gpio_mute)) |
| 4235 | spec->gpio_mute &= spec->gpio_mask; |
Takashi Iwai | 6565e4f | 2009-03-02 14:38:35 +0100 | [diff] [blame] | 4236 | val = snd_hda_get_bool_hint(codec, "eapd_switch"); |
| 4237 | if (val >= 0) |
| 4238 | spec->eapd_switch = val; |
| 4239 | } |
| 4240 | |
Takashi Iwai | f2cbba7 | 2012-01-11 12:34:11 +0100 | [diff] [blame] | 4241 | static void stac_issue_unsol_events(struct hda_codec *codec, int num_pins, |
| 4242 | const hda_nid_t *pins) |
| 4243 | { |
| 4244 | while (num_pins--) |
| 4245 | stac_issue_unsol_event(codec, *pins++); |
| 4246 | } |
| 4247 | |
| 4248 | /* fake event to set up pins */ |
| 4249 | static void stac_fake_hp_events(struct hda_codec *codec) |
| 4250 | { |
| 4251 | struct sigmatel_spec *spec = codec->spec; |
| 4252 | |
| 4253 | if (spec->autocfg.hp_outs) |
| 4254 | stac_issue_unsol_events(codec, spec->autocfg.hp_outs, |
| 4255 | spec->autocfg.hp_pins); |
| 4256 | if (spec->autocfg.line_outs && |
| 4257 | spec->autocfg.line_out_pins[0] != spec->autocfg.hp_pins[0]) |
| 4258 | stac_issue_unsol_events(codec, spec->autocfg.line_outs, |
| 4259 | spec->autocfg.line_out_pins); |
| 4260 | } |
| 4261 | |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 4262 | static int stac92xx_init(struct hda_codec *codec) |
| 4263 | { |
| 4264 | struct sigmatel_spec *spec = codec->spec; |
Takashi Iwai | 82bc955 | 2006-03-21 11:24:42 +0100 | [diff] [blame] | 4265 | struct auto_pin_cfg *cfg = &spec->autocfg; |
Takashi Iwai | f73d358 | 2008-11-25 08:21:51 +0100 | [diff] [blame] | 4266 | unsigned int gpio; |
Takashi Iwai | e4973e1 | 2008-11-18 09:32:42 +0100 | [diff] [blame] | 4267 | int i; |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 4268 | |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 4269 | snd_hda_sequence_write(codec, spec->init); |
| 4270 | |
Matthew Ranostay | 8daaaa9 | 2008-08-15 07:45:52 +0200 | [diff] [blame] | 4271 | /* power down adcs initially */ |
| 4272 | if (spec->powerdown_adcs) |
| 4273 | for (i = 0; i < spec->num_adcs; i++) |
Takashi Iwai | 8c2f767 | 2008-12-01 11:54:35 +0100 | [diff] [blame] | 4274 | snd_hda_codec_write(codec, |
Matthew Ranostay | 8daaaa9 | 2008-08-15 07:45:52 +0200 | [diff] [blame] | 4275 | spec->adc_nids[i], 0, |
| 4276 | AC_VERB_SET_POWER_STATE, AC_PWRST_D3); |
Takashi Iwai | f73d358 | 2008-11-25 08:21:51 +0100 | [diff] [blame] | 4277 | |
Takashi Iwai | 6565e4f | 2009-03-02 14:38:35 +0100 | [diff] [blame] | 4278 | /* override some hints */ |
| 4279 | stac_store_hints(codec); |
| 4280 | |
Takashi Iwai | f73d358 | 2008-11-25 08:21:51 +0100 | [diff] [blame] | 4281 | /* set up GPIO */ |
| 4282 | gpio = spec->gpio_data; |
| 4283 | /* turn on EAPD statically when spec->eapd_switch isn't set. |
| 4284 | * otherwise, unsol event will turn it on/off dynamically |
| 4285 | */ |
| 4286 | if (!spec->eapd_switch) |
| 4287 | gpio |= spec->eapd_mask; |
| 4288 | stac_gpio_set(codec, spec->gpio_mask, spec->gpio_dir, gpio); |
| 4289 | |
Takashi Iwai | 82bc955 | 2006-03-21 11:24:42 +0100 | [diff] [blame] | 4290 | /* set up pins */ |
| 4291 | if (spec->hp_detect) { |
Takashi Iwai | 505cb34 | 2006-03-27 12:51:52 +0200 | [diff] [blame] | 4292 | /* Enable unsolicited responses on the HP widget */ |
Matthew Ranostay | 74aeaab | 2008-10-25 01:06:04 -0400 | [diff] [blame] | 4293 | for (i = 0; i < cfg->hp_outs; i++) { |
Matthew Ranostay | 74aeaab | 2008-10-25 01:06:04 -0400 | [diff] [blame] | 4294 | hda_nid_t nid = cfg->hp_pins[i]; |
Takashi Iwai | c6e4c66 | 2008-11-25 11:58:19 +0100 | [diff] [blame] | 4295 | enable_pin_detect(codec, nid, STAC_HP_EVENT); |
Matthew Ranostay | 74aeaab | 2008-10-25 01:06:04 -0400 | [diff] [blame] | 4296 | } |
Takashi Iwai | 1c4bdf9 | 2009-08-13 08:23:24 +0200 | [diff] [blame] | 4297 | if (cfg->line_out_type == AUTO_PIN_LINE_OUT && |
| 4298 | cfg->speaker_outs > 0) { |
Takashi Iwai | fefd67f | 2009-07-30 18:03:05 +0200 | [diff] [blame] | 4299 | /* enable pin-detect for line-outs as well */ |
Takashi Iwai | 15cfa2b | 2009-08-03 14:23:33 +0200 | [diff] [blame] | 4300 | for (i = 0; i < cfg->line_outs; i++) { |
| 4301 | hda_nid_t nid = cfg->line_out_pins[i]; |
Takashi Iwai | fefd67f | 2009-07-30 18:03:05 +0200 | [diff] [blame] | 4302 | enable_pin_detect(codec, nid, STAC_LO_EVENT); |
| 4303 | } |
| 4304 | } |
| 4305 | |
Takashi Iwai | 0a07acaf | 2007-03-13 10:40:23 +0100 | [diff] [blame] | 4306 | /* force to enable the first line-out; the others are set up |
| 4307 | * in unsol_event |
| 4308 | */ |
| 4309 | stac92xx_auto_set_pinctl(codec, spec->autocfg.line_out_pins[0], |
Matthew Ranostay | 74aeaab | 2008-10-25 01:06:04 -0400 | [diff] [blame] | 4310 | AC_PINCTL_OUT_EN); |
Takashi Iwai | 82bc955 | 2006-03-21 11:24:42 +0100 | [diff] [blame] | 4311 | /* fake event to set up pins */ |
Takashi Iwai | f2cbba7 | 2012-01-11 12:34:11 +0100 | [diff] [blame] | 4312 | stac_fake_hp_events(codec); |
Takashi Iwai | 82bc955 | 2006-03-21 11:24:42 +0100 | [diff] [blame] | 4313 | } else { |
| 4314 | stac92xx_auto_init_multi_out(codec); |
| 4315 | stac92xx_auto_init_hp_out(codec); |
Takashi Iwai | 12dde4c | 2008-12-05 13:09:27 +0100 | [diff] [blame] | 4316 | for (i = 0; i < cfg->hp_outs; i++) |
| 4317 | stac_toggle_power_map(codec, cfg->hp_pins[i], 1); |
Takashi Iwai | 82bc955 | 2006-03-21 11:24:42 +0100 | [diff] [blame] | 4318 | } |
Takashi Iwai | 3d21d3f | 2009-07-29 14:32:56 +0200 | [diff] [blame] | 4319 | if (spec->auto_mic) { |
Takashi Iwai | 15b4f29 | 2009-07-29 16:32:55 +0200 | [diff] [blame] | 4320 | /* initialize connection to analog input */ |
Takashi Iwai | da2a2aa | 2009-08-10 07:44:09 +0200 | [diff] [blame] | 4321 | if (spec->dmux_nids) |
| 4322 | snd_hda_codec_write_cache(codec, spec->dmux_nids[0], 0, |
Takashi Iwai | 15b4f29 | 2009-07-29 16:32:55 +0200 | [diff] [blame] | 4323 | AC_VERB_SET_CONNECT_SEL, 0); |
Takashi Iwai | 3d21d3f | 2009-07-29 14:32:56 +0200 | [diff] [blame] | 4324 | if (enable_pin_detect(codec, spec->ext_mic.pin, STAC_MIC_EVENT)) |
| 4325 | stac_issue_unsol_event(codec, spec->ext_mic.pin); |
Charles Chin | 9907790 | 2010-09-17 10:22:32 +0200 | [diff] [blame] | 4326 | if (enable_pin_detect(codec, spec->dock_mic.pin, |
| 4327 | STAC_MIC_EVENT)) |
| 4328 | stac_issue_unsol_event(codec, spec->dock_mic.pin); |
Takashi Iwai | 3d21d3f | 2009-07-29 14:32:56 +0200 | [diff] [blame] | 4329 | } |
Takashi Iwai | eea7dc9 | 2010-08-30 13:06:15 +0200 | [diff] [blame] | 4330 | for (i = 0; i < cfg->num_inputs; i++) { |
| 4331 | hda_nid_t nid = cfg->inputs[i].pin; |
| 4332 | int type = cfg->inputs[i].type; |
| 4333 | unsigned int pinctl, conf; |
Takashi Iwai | 86e2959 | 2010-09-09 14:50:17 +0200 | [diff] [blame] | 4334 | if (type == AUTO_PIN_MIC) { |
Takashi Iwai | eea7dc9 | 2010-08-30 13:06:15 +0200 | [diff] [blame] | 4335 | /* for mic pins, force to initialize */ |
Takashi Iwai | 4740860 | 2012-04-20 13:06:53 +0200 | [diff] [blame] | 4336 | pinctl = snd_hda_get_default_vref(codec, nid); |
Takashi Iwai | eea7dc9 | 2010-08-30 13:06:15 +0200 | [diff] [blame] | 4337 | pinctl |= AC_PINCTL_IN_EN; |
| 4338 | stac92xx_auto_set_pinctl(codec, nid, pinctl); |
| 4339 | } else { |
| 4340 | pinctl = snd_hda_codec_read(codec, nid, 0, |
| 4341 | AC_VERB_GET_PIN_WIDGET_CONTROL, 0); |
| 4342 | /* if PINCTL already set then skip */ |
| 4343 | /* Also, if both INPUT and OUTPUT are set, |
| 4344 | * it must be a BIOS bug; need to override, too |
| 4345 | */ |
| 4346 | if (!(pinctl & AC_PINCTL_IN_EN) || |
| 4347 | (pinctl & AC_PINCTL_OUT_EN)) { |
| 4348 | pinctl &= ~AC_PINCTL_OUT_EN; |
Takashi Iwai | 12dde4c | 2008-12-05 13:09:27 +0100 | [diff] [blame] | 4349 | pinctl |= AC_PINCTL_IN_EN; |
| 4350 | stac92xx_auto_set_pinctl(codec, nid, pinctl); |
Takashi Iwai | 4f1e6bc | 2008-11-11 16:47:24 +0100 | [diff] [blame] | 4351 | } |
Takashi Iwai | eea7dc9 | 2010-08-30 13:06:15 +0200 | [diff] [blame] | 4352 | } |
| 4353 | conf = snd_hda_codec_get_pincfg(codec, nid); |
| 4354 | if (get_defcfg_connect(conf) != AC_JACK_PORT_FIXED) { |
| 4355 | if (enable_pin_detect(codec, nid, STAC_INSERT_EVENT)) |
| 4356 | stac_issue_unsol_event(codec, nid); |
Takashi Iwai | c960a03 | 2006-03-23 17:06:28 +0100 | [diff] [blame] | 4357 | } |
Takashi Iwai | 82bc955 | 2006-03-21 11:24:42 +0100 | [diff] [blame] | 4358 | } |
Matthew Ranostay | a64135a | 2008-01-10 16:55:06 +0100 | [diff] [blame] | 4359 | for (i = 0; i < spec->num_dmics; i++) |
| 4360 | stac92xx_auto_set_pinctl(codec, spec->dmic_nids[i], |
| 4361 | AC_PINCTL_IN_EN); |
Takashi Iwai | 0852d7a | 2009-02-11 11:35:15 +0100 | [diff] [blame] | 4362 | if (cfg->dig_out_pins[0]) |
| 4363 | stac92xx_auto_set_pinctl(codec, cfg->dig_out_pins[0], |
Takashi Iwai | 82bc955 | 2006-03-21 11:24:42 +0100 | [diff] [blame] | 4364 | AC_PINCTL_OUT_EN); |
| 4365 | if (cfg->dig_in_pin) |
| 4366 | stac92xx_auto_set_pinctl(codec, cfg->dig_in_pin, |
| 4367 | AC_PINCTL_IN_EN); |
Takashi Iwai | f73d358 | 2008-11-25 08:21:51 +0100 | [diff] [blame] | 4368 | for (i = 0; i < spec->num_pwrs; i++) { |
| 4369 | hda_nid_t nid = spec->pwr_nids[i]; |
Takashi Iwai | 6e1c39c | 2012-06-26 17:35:10 +0200 | [diff] [blame] | 4370 | unsigned int pinctl, def_conf; |
Takashi Iwai | 82bc955 | 2006-03-21 11:24:42 +0100 | [diff] [blame] | 4371 | |
Takashi Iwai | bfc89de | 2012-05-15 09:02:26 +0200 | [diff] [blame] | 4372 | def_conf = snd_hda_codec_get_pincfg(codec, nid); |
| 4373 | def_conf = get_defcfg_connect(def_conf); |
| 4374 | if (def_conf == AC_JACK_PORT_NONE) { |
| 4375 | /* power off unused ports */ |
| 4376 | stac_toggle_power_map(codec, nid, 0); |
| 4377 | continue; |
| 4378 | } |
Takashi Iwai | 6e1c39c | 2012-06-26 17:35:10 +0200 | [diff] [blame] | 4379 | if (def_conf == AC_JACK_PORT_FIXED) { |
| 4380 | /* no need for jack detection for fixed pins */ |
| 4381 | stac_toggle_power_map(codec, nid, 1); |
| 4382 | continue; |
| 4383 | } |
Takashi Iwai | eb63212 | 2008-12-19 16:39:48 +0100 | [diff] [blame] | 4384 | /* power on when no jack detection is available */ |
Takashi Iwai | 542c9a0 | 2011-11-29 13:01:30 +0100 | [diff] [blame] | 4385 | /* or when the VREF is used for controlling LED */ |
| 4386 | if (!spec->hp_detect || |
Takashi Iwai | bfc89de | 2012-05-15 09:02:26 +0200 | [diff] [blame] | 4387 | spec->vref_mute_led_nid == nid || |
| 4388 | !is_jack_detectable(codec, nid)) { |
Takashi Iwai | eb63212 | 2008-12-19 16:39:48 +0100 | [diff] [blame] | 4389 | stac_toggle_power_map(codec, nid, 1); |
| 4390 | continue; |
| 4391 | } |
| 4392 | |
Takashi Iwai | b4ead01 | 2012-01-23 18:23:36 +0100 | [diff] [blame] | 4393 | if (is_nid_out_jack_pin(cfg, nid)) |
Takashi Iwai | f73d358 | 2008-11-25 08:21:51 +0100 | [diff] [blame] | 4394 | continue; /* already has an unsol event */ |
Sam Revitch | 62fe78e | 2006-05-10 15:09:17 +0200 | [diff] [blame] | 4395 | |
Takashi Iwai | f73d358 | 2008-11-25 08:21:51 +0100 | [diff] [blame] | 4396 | pinctl = snd_hda_codec_read(codec, nid, 0, |
| 4397 | AC_VERB_GET_PIN_WIDGET_CONTROL, 0); |
| 4398 | /* outputs are only ports capable of power management |
| 4399 | * any attempts on powering down a input port cause the |
| 4400 | * referenced VREF to act quirky. |
| 4401 | */ |
Takashi Iwai | eb63212 | 2008-12-19 16:39:48 +0100 | [diff] [blame] | 4402 | if (pinctl & AC_PINCTL_IN_EN) { |
| 4403 | stac_toggle_power_map(codec, nid, 1); |
Takashi Iwai | f73d358 | 2008-11-25 08:21:51 +0100 | [diff] [blame] | 4404 | continue; |
Takashi Iwai | eb63212 | 2008-12-19 16:39:48 +0100 | [diff] [blame] | 4405 | } |
Charles Chin | afef2cf | 2011-11-11 08:05:28 +0100 | [diff] [blame] | 4406 | if (enable_pin_detect(codec, nid, STAC_PWR_EVENT)) { |
Takashi Iwai | 62558ce | 2009-07-29 14:23:09 +0200 | [diff] [blame] | 4407 | stac_issue_unsol_event(codec, nid); |
Charles Chin | afef2cf | 2011-11-11 08:05:28 +0100 | [diff] [blame] | 4408 | continue; |
| 4409 | } |
| 4410 | /* none of the above, turn the port OFF */ |
| 4411 | stac_toggle_power_map(codec, nid, 0); |
Takashi Iwai | f73d358 | 2008-11-25 08:21:51 +0100 | [diff] [blame] | 4412 | } |
Takashi Iwai | c21bd02 | 2010-02-08 15:16:08 +0100 | [diff] [blame] | 4413 | |
Takashi Iwai | 01a61e1 | 2011-10-28 00:03:22 +0200 | [diff] [blame] | 4414 | snd_hda_jack_report_sync(codec); |
| 4415 | |
Takashi Iwai | c21bd02 | 2010-02-08 15:16:08 +0100 | [diff] [blame] | 4416 | /* sync mute LED */ |
Takashi Iwai | d2f344b | 2012-03-12 16:59:58 +0100 | [diff] [blame] | 4417 | snd_hda_sync_vmaster_hook(&spec->vmaster_mute); |
Takashi Iwai | c882246 | 2012-05-15 09:11:36 +0200 | [diff] [blame] | 4418 | |
| 4419 | /* sync the power-map */ |
| 4420 | if (spec->num_pwrs) |
| 4421 | snd_hda_codec_write(codec, codec->afg, 0, |
| 4422 | AC_VERB_IDT_SET_POWER_MAP, |
| 4423 | spec->power_map_bits); |
Takashi Iwai | f73d358 | 2008-11-25 08:21:51 +0100 | [diff] [blame] | 4424 | if (spec->dac_list) |
| 4425 | stac92xx_power_down(codec); |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 4426 | return 0; |
| 4427 | } |
| 4428 | |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 4429 | static void stac92xx_free_kctls(struct hda_codec *codec) |
| 4430 | { |
| 4431 | struct sigmatel_spec *spec = codec->spec; |
| 4432 | |
| 4433 | if (spec->kctls.list) { |
| 4434 | struct snd_kcontrol_new *kctl = spec->kctls.list; |
| 4435 | int i; |
| 4436 | for (i = 0; i < spec->kctls.used; i++) |
| 4437 | kfree(kctl[i].name); |
| 4438 | } |
| 4439 | snd_array_free(&spec->kctls); |
| 4440 | } |
| 4441 | |
Vitaliy Kulikov | 45eebda | 2011-07-26 16:56:20 -0500 | [diff] [blame] | 4442 | static void stac92xx_shutup_pins(struct hda_codec *codec) |
| 4443 | { |
| 4444 | unsigned int i, def_conf; |
| 4445 | |
| 4446 | if (codec->bus->shutdown) |
| 4447 | return; |
| 4448 | for (i = 0; i < codec->init_pins.used; i++) { |
| 4449 | struct hda_pincfg *pin = snd_array_elem(&codec->init_pins, i); |
| 4450 | def_conf = snd_hda_codec_get_pincfg(codec, pin->nid); |
| 4451 | if (get_defcfg_connect(def_conf) != AC_JACK_PORT_NONE) |
Takashi Iwai | cdd03ce | 2012-04-20 12:34:50 +0200 | [diff] [blame] | 4452 | snd_hda_set_pin_ctl(codec, pin->nid, 0); |
Vitaliy Kulikov | 45eebda | 2011-07-26 16:56:20 -0500 | [diff] [blame] | 4453 | } |
| 4454 | } |
| 4455 | |
Takashi Iwai | 167eae5 | 2009-11-06 15:47:50 +0100 | [diff] [blame] | 4456 | static void stac92xx_shutup(struct hda_codec *codec) |
| 4457 | { |
| 4458 | struct sigmatel_spec *spec = codec->spec; |
Takashi Iwai | 167eae5 | 2009-11-06 15:47:50 +0100 | [diff] [blame] | 4459 | |
Vitaliy Kulikov | 45eebda | 2011-07-26 16:56:20 -0500 | [diff] [blame] | 4460 | stac92xx_shutup_pins(codec); |
Takashi Iwai | 167eae5 | 2009-11-06 15:47:50 +0100 | [diff] [blame] | 4461 | |
| 4462 | if (spec->eapd_mask) |
| 4463 | stac_gpio_set(codec, spec->gpio_mask, |
| 4464 | spec->gpio_dir, spec->gpio_data & |
| 4465 | ~spec->eapd_mask); |
| 4466 | } |
| 4467 | |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 4468 | static void stac92xx_free(struct hda_codec *codec) |
| 4469 | { |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 4470 | struct sigmatel_spec *spec = codec->spec; |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 4471 | |
| 4472 | if (! spec) |
| 4473 | return; |
| 4474 | |
Takashi Iwai | 167eae5 | 2009-11-06 15:47:50 +0100 | [diff] [blame] | 4475 | stac92xx_shutup(codec); |
Richard Fish | 11b44bb | 2006-08-23 18:31:34 +0200 | [diff] [blame] | 4476 | |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 4477 | kfree(spec); |
Matthew Ranostay | 1cd2224 | 2008-07-18 18:20:52 +0200 | [diff] [blame] | 4478 | snd_hda_detach_beep_device(codec); |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 4479 | } |
| 4480 | |
Matt | 4e55096 | 2005-07-04 17:51:39 +0200 | [diff] [blame] | 4481 | static void stac92xx_set_pinctl(struct hda_codec *codec, hda_nid_t nid, |
| 4482 | unsigned int flag) |
| 4483 | { |
Takashi Iwai | 8ce8419 | 2009-01-22 16:59:20 +0100 | [diff] [blame] | 4484 | unsigned int old_ctl, pin_ctl; |
| 4485 | |
| 4486 | pin_ctl = snd_hda_codec_read(codec, nid, |
Matt | 4e55096 | 2005-07-04 17:51:39 +0200 | [diff] [blame] | 4487 | 0, AC_VERB_GET_PIN_WIDGET_CONTROL, 0x00); |
Steve Longerbeam | 7b04389 | 2007-05-03 20:50:03 +0200 | [diff] [blame] | 4488 | |
Takashi Iwai | f9acba4 | 2007-05-29 18:01:06 +0200 | [diff] [blame] | 4489 | if (pin_ctl & AC_PINCTL_IN_EN) { |
| 4490 | /* |
| 4491 | * we need to check the current set-up direction of |
| 4492 | * shared input pins since they can be switched via |
| 4493 | * "xxx as Output" mixer switch |
| 4494 | */ |
| 4495 | struct sigmatel_spec *spec = codec->spec; |
Takashi Iwai | c21ca4a | 2008-12-19 09:26:08 +0100 | [diff] [blame] | 4496 | if (nid == spec->line_switch || nid == spec->mic_switch) |
Takashi Iwai | f9acba4 | 2007-05-29 18:01:06 +0200 | [diff] [blame] | 4497 | return; |
| 4498 | } |
| 4499 | |
Takashi Iwai | 8ce8419 | 2009-01-22 16:59:20 +0100 | [diff] [blame] | 4500 | old_ctl = pin_ctl; |
Steve Longerbeam | 7b04389 | 2007-05-03 20:50:03 +0200 | [diff] [blame] | 4501 | /* if setting pin direction bits, clear the current |
| 4502 | direction bits first */ |
| 4503 | if (flag & (AC_PINCTL_IN_EN | AC_PINCTL_OUT_EN)) |
| 4504 | pin_ctl &= ~(AC_PINCTL_IN_EN | AC_PINCTL_OUT_EN); |
| 4505 | |
Takashi Iwai | 8ce8419 | 2009-01-22 16:59:20 +0100 | [diff] [blame] | 4506 | pin_ctl |= flag; |
| 4507 | if (old_ctl != pin_ctl) |
Takashi Iwai | cdd03ce | 2012-04-20 12:34:50 +0200 | [diff] [blame] | 4508 | snd_hda_set_pin_ctl_cache(codec, nid, pin_ctl); |
Matt | 4e55096 | 2005-07-04 17:51:39 +0200 | [diff] [blame] | 4509 | } |
| 4510 | |
| 4511 | static void stac92xx_reset_pinctl(struct hda_codec *codec, hda_nid_t nid, |
| 4512 | unsigned int flag) |
| 4513 | { |
| 4514 | unsigned int pin_ctl = snd_hda_codec_read(codec, nid, |
| 4515 | 0, AC_VERB_GET_PIN_WIDGET_CONTROL, 0x00); |
Takashi Iwai | 8ce8419 | 2009-01-22 16:59:20 +0100 | [diff] [blame] | 4516 | if (pin_ctl & flag) |
Takashi Iwai | cdd03ce | 2012-04-20 12:34:50 +0200 | [diff] [blame] | 4517 | snd_hda_set_pin_ctl_cache(codec, nid, pin_ctl & ~flag); |
Matt | 4e55096 | 2005-07-04 17:51:39 +0200 | [diff] [blame] | 4518 | } |
| 4519 | |
Takashi Iwai | d56757a | 2009-11-18 08:00:14 +0100 | [diff] [blame] | 4520 | static inline int get_pin_presence(struct hda_codec *codec, hda_nid_t nid) |
Takashi Iwai | 314634b | 2006-09-21 11:56:18 +0200 | [diff] [blame] | 4521 | { |
| 4522 | if (!nid) |
| 4523 | return 0; |
Takashi Iwai | a252c81 | 2009-12-25 22:56:20 +0100 | [diff] [blame] | 4524 | return snd_hda_jack_detect(codec, nid); |
Takashi Iwai | 314634b | 2006-09-21 11:56:18 +0200 | [diff] [blame] | 4525 | } |
| 4526 | |
Takashi Iwai | fefd67f | 2009-07-30 18:03:05 +0200 | [diff] [blame] | 4527 | static void stac92xx_line_out_detect(struct hda_codec *codec, |
| 4528 | int presence) |
| 4529 | { |
| 4530 | struct sigmatel_spec *spec = codec->spec; |
| 4531 | struct auto_pin_cfg *cfg = &spec->autocfg; |
| 4532 | int i; |
| 4533 | |
| 4534 | for (i = 0; i < cfg->line_outs; i++) { |
| 4535 | if (presence) |
| 4536 | break; |
| 4537 | presence = get_pin_presence(codec, cfg->line_out_pins[i]); |
| 4538 | if (presence) { |
| 4539 | unsigned int pinctl; |
| 4540 | pinctl = snd_hda_codec_read(codec, |
| 4541 | cfg->line_out_pins[i], 0, |
| 4542 | AC_VERB_GET_PIN_WIDGET_CONTROL, 0); |
| 4543 | if (pinctl & AC_PINCTL_IN_EN) |
| 4544 | presence = 0; /* mic- or line-input */ |
| 4545 | } |
| 4546 | } |
| 4547 | |
| 4548 | if (presence) { |
| 4549 | /* disable speakers */ |
| 4550 | for (i = 0; i < cfg->speaker_outs; i++) |
| 4551 | stac92xx_reset_pinctl(codec, cfg->speaker_pins[i], |
| 4552 | AC_PINCTL_OUT_EN); |
| 4553 | if (spec->eapd_mask && spec->eapd_switch) |
| 4554 | stac_gpio_set(codec, spec->gpio_mask, |
| 4555 | spec->gpio_dir, spec->gpio_data & |
| 4556 | ~spec->eapd_mask); |
| 4557 | } else { |
| 4558 | /* enable speakers */ |
| 4559 | for (i = 0; i < cfg->speaker_outs; i++) |
| 4560 | stac92xx_set_pinctl(codec, cfg->speaker_pins[i], |
| 4561 | AC_PINCTL_OUT_EN); |
| 4562 | if (spec->eapd_mask && spec->eapd_switch) |
| 4563 | stac_gpio_set(codec, spec->gpio_mask, |
| 4564 | spec->gpio_dir, spec->gpio_data | |
| 4565 | spec->eapd_mask); |
| 4566 | } |
| 4567 | } |
| 4568 | |
Takashi Iwai | d7a8943 | 2008-11-12 09:48:04 +0100 | [diff] [blame] | 4569 | /* return non-zero if the hp-pin of the given array index isn't |
| 4570 | * a jack-detection target |
| 4571 | */ |
| 4572 | static int no_hp_sensing(struct sigmatel_spec *spec, int i) |
| 4573 | { |
| 4574 | struct auto_pin_cfg *cfg = &spec->autocfg; |
| 4575 | |
| 4576 | /* ignore sensing of shared line and mic jacks */ |
Takashi Iwai | c21ca4a | 2008-12-19 09:26:08 +0100 | [diff] [blame] | 4577 | if (cfg->hp_pins[i] == spec->line_switch) |
Takashi Iwai | d7a8943 | 2008-11-12 09:48:04 +0100 | [diff] [blame] | 4578 | return 1; |
Takashi Iwai | c21ca4a | 2008-12-19 09:26:08 +0100 | [diff] [blame] | 4579 | if (cfg->hp_pins[i] == spec->mic_switch) |
Takashi Iwai | d7a8943 | 2008-11-12 09:48:04 +0100 | [diff] [blame] | 4580 | return 1; |
| 4581 | /* ignore if the pin is set as line-out */ |
| 4582 | if (cfg->hp_pins[i] == spec->hp_switch) |
| 4583 | return 1; |
| 4584 | return 0; |
| 4585 | } |
| 4586 | |
Takashi Iwai | c6e4c66 | 2008-11-25 11:58:19 +0100 | [diff] [blame] | 4587 | static void stac92xx_hp_detect(struct hda_codec *codec) |
Matt | 4e55096 | 2005-07-04 17:51:39 +0200 | [diff] [blame] | 4588 | { |
| 4589 | struct sigmatel_spec *spec = codec->spec; |
| 4590 | struct auto_pin_cfg *cfg = &spec->autocfg; |
| 4591 | int i, presence; |
| 4592 | |
Takashi Iwai | eb06ed8 | 2006-09-20 17:10:27 +0200 | [diff] [blame] | 4593 | presence = 0; |
Matthew Ranostay | 4fe5195 | 2008-01-29 15:28:44 +0100 | [diff] [blame] | 4594 | if (spec->gpio_mute) |
| 4595 | presence = !(snd_hda_codec_read(codec, codec->afg, 0, |
| 4596 | AC_VERB_GET_GPIO_DATA, 0) & spec->gpio_mute); |
| 4597 | |
Takashi Iwai | eb06ed8 | 2006-09-20 17:10:27 +0200 | [diff] [blame] | 4598 | for (i = 0; i < cfg->hp_outs; i++) { |
Takashi Iwai | 314634b | 2006-09-21 11:56:18 +0200 | [diff] [blame] | 4599 | if (presence) |
| 4600 | break; |
Takashi Iwai | d7a8943 | 2008-11-12 09:48:04 +0100 | [diff] [blame] | 4601 | if (no_hp_sensing(spec, i)) |
| 4602 | continue; |
Takashi Iwai | e6e3ea2 | 2008-12-05 12:54:56 +0100 | [diff] [blame] | 4603 | presence = get_pin_presence(codec, cfg->hp_pins[i]); |
| 4604 | if (presence) { |
| 4605 | unsigned int pinctl; |
| 4606 | pinctl = snd_hda_codec_read(codec, cfg->hp_pins[i], 0, |
| 4607 | AC_VERB_GET_PIN_WIDGET_CONTROL, 0); |
| 4608 | if (pinctl & AC_PINCTL_IN_EN) |
| 4609 | presence = 0; /* mic- or line-input */ |
| 4610 | } |
Takashi Iwai | eb06ed8 | 2006-09-20 17:10:27 +0200 | [diff] [blame] | 4611 | } |
Matt | 4e55096 | 2005-07-04 17:51:39 +0200 | [diff] [blame] | 4612 | |
| 4613 | if (presence) { |
Takashi Iwai | d7a8943 | 2008-11-12 09:48:04 +0100 | [diff] [blame] | 4614 | /* disable lineouts */ |
Matthew Ranostay | 7c2ba97 | 2008-04-16 13:13:59 +0200 | [diff] [blame] | 4615 | if (spec->hp_switch) |
Takashi Iwai | d7a8943 | 2008-11-12 09:48:04 +0100 | [diff] [blame] | 4616 | stac92xx_reset_pinctl(codec, spec->hp_switch, |
| 4617 | AC_PINCTL_OUT_EN); |
Matt | 4e55096 | 2005-07-04 17:51:39 +0200 | [diff] [blame] | 4618 | for (i = 0; i < cfg->line_outs; i++) |
| 4619 | stac92xx_reset_pinctl(codec, cfg->line_out_pins[i], |
| 4620 | AC_PINCTL_OUT_EN); |
Matt | 4e55096 | 2005-07-04 17:51:39 +0200 | [diff] [blame] | 4621 | } else { |
Takashi Iwai | d7a8943 | 2008-11-12 09:48:04 +0100 | [diff] [blame] | 4622 | /* enable lineouts */ |
Matthew Ranostay | 7c2ba97 | 2008-04-16 13:13:59 +0200 | [diff] [blame] | 4623 | if (spec->hp_switch) |
Takashi Iwai | d7a8943 | 2008-11-12 09:48:04 +0100 | [diff] [blame] | 4624 | stac92xx_set_pinctl(codec, spec->hp_switch, |
| 4625 | AC_PINCTL_OUT_EN); |
Matt | 4e55096 | 2005-07-04 17:51:39 +0200 | [diff] [blame] | 4626 | for (i = 0; i < cfg->line_outs; i++) |
| 4627 | stac92xx_set_pinctl(codec, cfg->line_out_pins[i], |
| 4628 | AC_PINCTL_OUT_EN); |
Matt | 4e55096 | 2005-07-04 17:51:39 +0200 | [diff] [blame] | 4629 | } |
Takashi Iwai | fefd67f | 2009-07-30 18:03:05 +0200 | [diff] [blame] | 4630 | stac92xx_line_out_detect(codec, presence); |
Takashi Iwai | d7a8943 | 2008-11-12 09:48:04 +0100 | [diff] [blame] | 4631 | /* toggle hp outs */ |
| 4632 | for (i = 0; i < cfg->hp_outs; i++) { |
| 4633 | unsigned int val = AC_PINCTL_OUT_EN | AC_PINCTL_HP_EN; |
| 4634 | if (no_hp_sensing(spec, i)) |
| 4635 | continue; |
Takashi Iwai | 7bff172 | 2012-02-29 09:41:17 +0100 | [diff] [blame] | 4636 | if (1 /*presence*/) |
Takashi Iwai | d7a8943 | 2008-11-12 09:48:04 +0100 | [diff] [blame] | 4637 | stac92xx_set_pinctl(codec, cfg->hp_pins[i], val); |
Takashi Iwai | 8317e0b | 2009-01-14 07:56:51 +0100 | [diff] [blame] | 4638 | #if 0 /* FIXME */ |
| 4639 | /* Resetting the pinctl like below may lead to (a sort of) regressions |
| 4640 | * on some devices since they use the HP pin actually for line/speaker |
| 4641 | * outs although the default pin config shows a different pin (that is |
| 4642 | * wrong and useless). |
| 4643 | * |
| 4644 | * So, it's basically a problem of default pin configs, likely a BIOS issue. |
| 4645 | * But, disabling the code below just works around it, and I'm too tired of |
| 4646 | * bug reports with such devices... |
| 4647 | */ |
Takashi Iwai | d7a8943 | 2008-11-12 09:48:04 +0100 | [diff] [blame] | 4648 | else |
| 4649 | stac92xx_reset_pinctl(codec, cfg->hp_pins[i], val); |
Takashi Iwai | 8317e0b | 2009-01-14 07:56:51 +0100 | [diff] [blame] | 4650 | #endif /* FIXME */ |
Takashi Iwai | d7a8943 | 2008-11-12 09:48:04 +0100 | [diff] [blame] | 4651 | } |
Matt | 4e55096 | 2005-07-04 17:51:39 +0200 | [diff] [blame] | 4652 | } |
| 4653 | |
Takashi Iwai | f73d358 | 2008-11-25 08:21:51 +0100 | [diff] [blame] | 4654 | static void stac_toggle_power_map(struct hda_codec *codec, hda_nid_t nid, |
| 4655 | int enable) |
Matthew Ranostay | a64135a | 2008-01-10 16:55:06 +0100 | [diff] [blame] | 4656 | { |
| 4657 | struct sigmatel_spec *spec = codec->spec; |
Takashi Iwai | f73d358 | 2008-11-25 08:21:51 +0100 | [diff] [blame] | 4658 | unsigned int idx, val; |
| 4659 | |
| 4660 | for (idx = 0; idx < spec->num_pwrs; idx++) { |
| 4661 | if (spec->pwr_nids[idx] == nid) |
| 4662 | break; |
| 4663 | } |
| 4664 | if (idx >= spec->num_pwrs) |
| 4665 | return; |
Matthew Ranostay | d0513fc | 2008-07-27 10:30:30 +0200 | [diff] [blame] | 4666 | |
Charles Chin | afef2cf | 2011-11-11 08:05:28 +0100 | [diff] [blame] | 4667 | idx = 1 << idx; |
Matthew Ranostay | a64135a | 2008-01-10 16:55:06 +0100 | [diff] [blame] | 4668 | |
Takashi Iwai | c882246 | 2012-05-15 09:11:36 +0200 | [diff] [blame] | 4669 | val = spec->power_map_bits; |
Takashi Iwai | f73d358 | 2008-11-25 08:21:51 +0100 | [diff] [blame] | 4670 | if (enable) |
Matthew Ranostay | a64135a | 2008-01-10 16:55:06 +0100 | [diff] [blame] | 4671 | val &= ~idx; |
| 4672 | else |
| 4673 | val |= idx; |
| 4674 | |
| 4675 | /* power down unused output ports */ |
Takashi Iwai | c882246 | 2012-05-15 09:11:36 +0200 | [diff] [blame] | 4676 | if (val != spec->power_map_bits) { |
| 4677 | spec->power_map_bits = val; |
| 4678 | snd_hda_codec_write(codec, codec->afg, 0, |
| 4679 | AC_VERB_IDT_SET_POWER_MAP, val); |
| 4680 | } |
Matthew Ranostay | 74aeaab | 2008-10-25 01:06:04 -0400 | [diff] [blame] | 4681 | } |
| 4682 | |
Takashi Iwai | f73d358 | 2008-11-25 08:21:51 +0100 | [diff] [blame] | 4683 | static void stac92xx_pin_sense(struct hda_codec *codec, hda_nid_t nid) |
| 4684 | { |
Takashi Iwai | e6e3ea2 | 2008-12-05 12:54:56 +0100 | [diff] [blame] | 4685 | stac_toggle_power_map(codec, nid, get_pin_presence(codec, nid)); |
Takashi Iwai | f73d358 | 2008-11-25 08:21:51 +0100 | [diff] [blame] | 4686 | } |
Matthew Ranostay | a64135a | 2008-01-10 16:55:06 +0100 | [diff] [blame] | 4687 | |
Vitaliy Kulikov | ab5a6eb | 2010-09-08 09:00:17 +0200 | [diff] [blame] | 4688 | /* get the pin connection (fixed, none, etc) */ |
| 4689 | static unsigned int stac_get_defcfg_connect(struct hda_codec *codec, int idx) |
| 4690 | { |
| 4691 | struct sigmatel_spec *spec = codec->spec; |
| 4692 | unsigned int cfg; |
| 4693 | |
| 4694 | cfg = snd_hda_codec_get_pincfg(codec, spec->pin_nids[idx]); |
| 4695 | return get_defcfg_connect(cfg); |
| 4696 | } |
| 4697 | |
| 4698 | static int stac92xx_connected_ports(struct hda_codec *codec, |
Takashi Iwai | 2b63536 | 2011-05-02 12:33:43 +0200 | [diff] [blame] | 4699 | const hda_nid_t *nids, int num_nids) |
Vitaliy Kulikov | ab5a6eb | 2010-09-08 09:00:17 +0200 | [diff] [blame] | 4700 | { |
| 4701 | struct sigmatel_spec *spec = codec->spec; |
| 4702 | int idx, num; |
| 4703 | unsigned int def_conf; |
| 4704 | |
| 4705 | for (num = 0; num < num_nids; num++) { |
| 4706 | for (idx = 0; idx < spec->num_pins; idx++) |
| 4707 | if (spec->pin_nids[idx] == nids[num]) |
| 4708 | break; |
| 4709 | if (idx >= spec->num_pins) |
| 4710 | break; |
| 4711 | def_conf = stac_get_defcfg_connect(codec, idx); |
| 4712 | if (def_conf == AC_JACK_PORT_NONE) |
| 4713 | break; |
| 4714 | } |
| 4715 | return num; |
| 4716 | } |
| 4717 | |
Takashi Iwai | 3d21d3f | 2009-07-29 14:32:56 +0200 | [diff] [blame] | 4718 | static void stac92xx_mic_detect(struct hda_codec *codec) |
| 4719 | { |
| 4720 | struct sigmatel_spec *spec = codec->spec; |
| 4721 | struct sigmatel_mic_route *mic; |
| 4722 | |
| 4723 | if (get_pin_presence(codec, spec->ext_mic.pin)) |
| 4724 | mic = &spec->ext_mic; |
Charles Chin | 9907790 | 2010-09-17 10:22:32 +0200 | [diff] [blame] | 4725 | else if (get_pin_presence(codec, spec->dock_mic.pin)) |
| 4726 | mic = &spec->dock_mic; |
Takashi Iwai | 3d21d3f | 2009-07-29 14:32:56 +0200 | [diff] [blame] | 4727 | else |
| 4728 | mic = &spec->int_mic; |
Takashi Iwai | 02d3332 | 2009-10-01 16:38:11 +0200 | [diff] [blame] | 4729 | if (mic->dmux_idx >= 0) |
Takashi Iwai | 3d21d3f | 2009-07-29 14:32:56 +0200 | [diff] [blame] | 4730 | snd_hda_codec_write_cache(codec, spec->dmux_nids[0], 0, |
| 4731 | AC_VERB_SET_CONNECT_SEL, |
| 4732 | mic->dmux_idx); |
Takashi Iwai | 02d3332 | 2009-10-01 16:38:11 +0200 | [diff] [blame] | 4733 | if (mic->mux_idx >= 0) |
Takashi Iwai | 3d21d3f | 2009-07-29 14:32:56 +0200 | [diff] [blame] | 4734 | snd_hda_codec_write_cache(codec, spec->mux_nids[0], 0, |
| 4735 | AC_VERB_SET_CONNECT_SEL, |
| 4736 | mic->mux_idx); |
| 4737 | } |
| 4738 | |
Takashi Iwai | 1835a0f | 2011-10-27 22:12:46 +0200 | [diff] [blame] | 4739 | static void handle_unsol_event(struct hda_codec *codec, |
Takashi Iwai | 3a93897 | 2011-10-28 01:16:55 +0200 | [diff] [blame] | 4740 | struct hda_jack_tbl *event) |
Takashi Iwai | 314634b | 2006-09-21 11:56:18 +0200 | [diff] [blame] | 4741 | { |
Matthew Ranostay | a64135a | 2008-01-10 16:55:06 +0100 | [diff] [blame] | 4742 | struct sigmatel_spec *spec = codec->spec; |
Takashi Iwai | 1835a0f | 2011-10-27 22:12:46 +0200 | [diff] [blame] | 4743 | int data; |
Matthew Ranostay | a64135a | 2008-01-10 16:55:06 +0100 | [diff] [blame] | 4744 | |
Takashi Iwai | 3a93897 | 2011-10-28 01:16:55 +0200 | [diff] [blame] | 4745 | switch (event->action) { |
Takashi Iwai | 314634b | 2006-09-21 11:56:18 +0200 | [diff] [blame] | 4746 | case STAC_HP_EVENT: |
Takashi Iwai | fefd67f | 2009-07-30 18:03:05 +0200 | [diff] [blame] | 4747 | case STAC_LO_EVENT: |
Takashi Iwai | 16ffe32 | 2009-08-04 13:40:54 +0200 | [diff] [blame] | 4748 | stac92xx_hp_detect(codec); |
Takashi Iwai | fefd67f | 2009-07-30 18:03:05 +0200 | [diff] [blame] | 4749 | break; |
Takashi Iwai | 3d21d3f | 2009-07-29 14:32:56 +0200 | [diff] [blame] | 4750 | case STAC_MIC_EVENT: |
| 4751 | stac92xx_mic_detect(codec); |
| 4752 | break; |
| 4753 | } |
| 4754 | |
Takashi Iwai | 3a93897 | 2011-10-28 01:16:55 +0200 | [diff] [blame] | 4755 | switch (event->action) { |
Takashi Iwai | 3d21d3f | 2009-07-29 14:32:56 +0200 | [diff] [blame] | 4756 | case STAC_HP_EVENT: |
Takashi Iwai | fefd67f | 2009-07-30 18:03:05 +0200 | [diff] [blame] | 4757 | case STAC_LO_EVENT: |
Takashi Iwai | 3d21d3f | 2009-07-29 14:32:56 +0200 | [diff] [blame] | 4758 | case STAC_MIC_EVENT: |
Matthew Ranostay | 74aeaab | 2008-10-25 01:06:04 -0400 | [diff] [blame] | 4759 | case STAC_INSERT_EVENT: |
Matthew Ranostay | a64135a | 2008-01-10 16:55:06 +0100 | [diff] [blame] | 4760 | case STAC_PWR_EVENT: |
Takashi Iwai | c6e4c66 | 2008-11-25 11:58:19 +0100 | [diff] [blame] | 4761 | if (spec->num_pwrs > 0) |
| 4762 | stac92xx_pin_sense(codec, event->nid); |
Matthew Ranostay | fd60cc8 | 2009-04-06 09:30:46 -0400 | [diff] [blame] | 4763 | |
| 4764 | switch (codec->subsystem_id) { |
| 4765 | case 0x103c308f: |
| 4766 | if (event->nid == 0xb) { |
| 4767 | int pin = AC_PINCTL_IN_EN; |
| 4768 | |
| 4769 | if (get_pin_presence(codec, 0xa) |
| 4770 | && get_pin_presence(codec, 0xb)) |
| 4771 | pin |= AC_PINCTL_VREF_80; |
| 4772 | if (!get_pin_presence(codec, 0xb)) |
| 4773 | pin |= AC_PINCTL_VREF_80; |
| 4774 | |
| 4775 | /* toggle VREF state based on mic + hp pin |
| 4776 | * status |
| 4777 | */ |
| 4778 | stac92xx_auto_set_pinctl(codec, 0x0a, pin); |
| 4779 | } |
| 4780 | } |
Matthew Ranostay | 72474be | 2008-10-09 09:32:17 -0400 | [diff] [blame] | 4781 | break; |
Takashi Iwai | c6e4c66 | 2008-11-25 11:58:19 +0100 | [diff] [blame] | 4782 | case STAC_VREF_EVENT: |
| 4783 | data = snd_hda_codec_read(codec, codec->afg, 0, |
| 4784 | AC_VERB_GET_GPIO_DATA, 0); |
Matthew Ranostay | 72474be | 2008-10-09 09:32:17 -0400 | [diff] [blame] | 4785 | /* toggle VREF state based on GPIOx status */ |
| 4786 | snd_hda_codec_write(codec, codec->afg, 0, 0x7e0, |
Takashi Iwai | 3a93897 | 2011-10-28 01:16:55 +0200 | [diff] [blame] | 4787 | !!(data & (1 << event->private_data))); |
Matthew Ranostay | 72474be | 2008-10-09 09:32:17 -0400 | [diff] [blame] | 4788 | break; |
Takashi Iwai | 314634b | 2006-09-21 11:56:18 +0200 | [diff] [blame] | 4789 | } |
| 4790 | } |
| 4791 | |
Takashi Iwai | 1835a0f | 2011-10-27 22:12:46 +0200 | [diff] [blame] | 4792 | static void stac_issue_unsol_event(struct hda_codec *codec, hda_nid_t nid) |
| 4793 | { |
Takashi Iwai | 3a93897 | 2011-10-28 01:16:55 +0200 | [diff] [blame] | 4794 | struct hda_jack_tbl *event = snd_hda_jack_tbl_get(codec, nid); |
Takashi Iwai | 1835a0f | 2011-10-27 22:12:46 +0200 | [diff] [blame] | 4795 | if (!event) |
| 4796 | return; |
| 4797 | handle_unsol_event(codec, event); |
| 4798 | } |
| 4799 | |
| 4800 | static void stac92xx_unsol_event(struct hda_codec *codec, unsigned int res) |
| 4801 | { |
Takashi Iwai | 3a93897 | 2011-10-28 01:16:55 +0200 | [diff] [blame] | 4802 | struct hda_jack_tbl *event; |
Takashi Iwai | 1835a0f | 2011-10-27 22:12:46 +0200 | [diff] [blame] | 4803 | int tag; |
| 4804 | |
| 4805 | tag = (res >> 26) & 0x7f; |
Takashi Iwai | 3a93897 | 2011-10-28 01:16:55 +0200 | [diff] [blame] | 4806 | event = snd_hda_jack_tbl_get_from_tag(codec, tag); |
Takashi Iwai | 1835a0f | 2011-10-27 22:12:46 +0200 | [diff] [blame] | 4807 | if (!event) |
| 4808 | return; |
Takashi Iwai | 3a93897 | 2011-10-28 01:16:55 +0200 | [diff] [blame] | 4809 | event->jack_dirty = 1; |
Takashi Iwai | 1835a0f | 2011-10-27 22:12:46 +0200 | [diff] [blame] | 4810 | handle_unsol_event(codec, event); |
Takashi Iwai | 01a61e1 | 2011-10-28 00:03:22 +0200 | [diff] [blame] | 4811 | snd_hda_jack_report_sync(codec); |
Takashi Iwai | 1835a0f | 2011-10-27 22:12:46 +0200 | [diff] [blame] | 4812 | } |
| 4813 | |
Kunal Gangakhedkar | d38cce7 | 2010-01-15 21:01:47 +0530 | [diff] [blame] | 4814 | static int hp_blike_system(u32 subsystem_id); |
| 4815 | |
| 4816 | static void set_hp_led_gpio(struct hda_codec *codec) |
| 4817 | { |
| 4818 | struct sigmatel_spec *spec = codec->spec; |
Takashi Iwai | 07f8044 | 2010-02-08 15:06:13 +0100 | [diff] [blame] | 4819 | unsigned int gpio; |
| 4820 | |
Takashi Iwai | 26ebe0a | 2010-05-11 08:36:29 +0200 | [diff] [blame] | 4821 | if (spec->gpio_led) |
| 4822 | return; |
| 4823 | |
Takashi Iwai | 07f8044 | 2010-02-08 15:06:13 +0100 | [diff] [blame] | 4824 | gpio = snd_hda_param_read(codec, codec->afg, AC_PAR_GPIO_CAP); |
| 4825 | gpio &= AC_GPIO_IO_COUNT; |
| 4826 | if (gpio > 3) |
| 4827 | spec->gpio_led = 0x08; /* GPIO 3 */ |
| 4828 | else |
| 4829 | spec->gpio_led = 0x01; /* GPIO 0 */ |
Kunal Gangakhedkar | d38cce7 | 2010-01-15 21:01:47 +0530 | [diff] [blame] | 4830 | } |
| 4831 | |
Vitaliy Kulikov | c357aab | 2009-12-11 07:51:54 +0100 | [diff] [blame] | 4832 | /* |
| 4833 | * This method searches for the mute LED GPIO configuration |
| 4834 | * provided as OEM string in SMBIOS. The format of that string |
| 4835 | * is HP_Mute_LED_P_G or HP_Mute_LED_P |
| 4836 | * where P can be 0 or 1 and defines mute LED GPIO control state (low/high) |
| 4837 | * that corresponds to the NOT muted state of the master volume |
| 4838 | * and G is the index of the GPIO to use as the mute LED control (0..9) |
| 4839 | * If _G portion is missing it is assigned based on the codec ID |
| 4840 | * |
| 4841 | * So, HP B-series like systems may have HP_Mute_LED_0 (current models) |
| 4842 | * or HP_Mute_LED_0_3 (future models) OEM SMBIOS strings |
Kunal Gangakhedkar | d38cce7 | 2010-01-15 21:01:47 +0530 | [diff] [blame] | 4843 | * |
| 4844 | * |
| 4845 | * The dv-series laptops don't seem to have the HP_Mute_LED* strings in |
| 4846 | * SMBIOS - at least the ones I have seen do not have them - which include |
| 4847 | * my own system (HP Pavilion dv6-1110ax) and my cousin's |
| 4848 | * HP Pavilion dv9500t CTO. |
| 4849 | * Need more information on whether it is true across the entire series. |
| 4850 | * -- kunal |
Vitaliy Kulikov | c357aab | 2009-12-11 07:51:54 +0100 | [diff] [blame] | 4851 | */ |
Vitaliy Kulikov | 6a557c9 | 2011-12-12 17:35:13 -0600 | [diff] [blame] | 4852 | static int find_mute_led_cfg(struct hda_codec *codec, int default_polarity) |
Vitaliy Kulikov | c357aab | 2009-12-11 07:51:54 +0100 | [diff] [blame] | 4853 | { |
| 4854 | struct sigmatel_spec *spec = codec->spec; |
| 4855 | const struct dmi_device *dev = NULL; |
| 4856 | |
Takashi Iwai | 7560931 | 2012-05-14 16:52:00 +0200 | [diff] [blame] | 4857 | if (get_int_hint(codec, "gpio_led", &spec->gpio_led)) { |
| 4858 | get_int_hint(codec, "gpio_led_polarity", |
| 4859 | &spec->gpio_led_polarity); |
| 4860 | return 1; |
| 4861 | } |
Vitaliy Kulikov | c357aab | 2009-12-11 07:51:54 +0100 | [diff] [blame] | 4862 | if ((codec->subsystem_id >> 16) == PCI_VENDOR_ID_HP) { |
| 4863 | while ((dev = dmi_find_device(DMI_DEV_TYPE_OEM_STRING, |
| 4864 | NULL, dev))) { |
Vitaliy Kulikov | 45eebda | 2011-07-26 16:56:20 -0500 | [diff] [blame] | 4865 | if (sscanf(dev->name, "HP_Mute_LED_%d_%x", |
Kunal Gangakhedkar | d38cce7 | 2010-01-15 21:01:47 +0530 | [diff] [blame] | 4866 | &spec->gpio_led_polarity, |
| 4867 | &spec->gpio_led) == 2) { |
Takashi Iwai | f1a7374 | 2011-12-04 13:44:06 +0100 | [diff] [blame] | 4868 | unsigned int max_gpio; |
| 4869 | max_gpio = snd_hda_param_read(codec, codec->afg, |
| 4870 | AC_PAR_GPIO_CAP); |
| 4871 | max_gpio &= AC_GPIO_IO_COUNT; |
| 4872 | if (spec->gpio_led < max_gpio) |
Vitaliy Kulikov | 45eebda | 2011-07-26 16:56:20 -0500 | [diff] [blame] | 4873 | spec->gpio_led = 1 << spec->gpio_led; |
Takashi Iwai | f1a7374 | 2011-12-04 13:44:06 +0100 | [diff] [blame] | 4874 | else |
| 4875 | spec->vref_mute_led_nid = spec->gpio_led; |
Vitaliy Kulikov | c357aab | 2009-12-11 07:51:54 +0100 | [diff] [blame] | 4876 | return 1; |
| 4877 | } |
| 4878 | if (sscanf(dev->name, "HP_Mute_LED_%d", |
Kunal Gangakhedkar | d38cce7 | 2010-01-15 21:01:47 +0530 | [diff] [blame] | 4879 | &spec->gpio_led_polarity) == 1) { |
| 4880 | set_hp_led_gpio(codec); |
| 4881 | return 1; |
Vitaliy Kulikov | c357aab | 2009-12-11 07:51:54 +0100 | [diff] [blame] | 4882 | } |
Gustavo Maciel Dias Vieira | e2ef36c | 2011-12-13 11:47:22 -0200 | [diff] [blame] | 4883 | /* BIOS bug: unfilled OEM string */ |
| 4884 | if (strstr(dev->name, "HP_Mute_LED_P_G")) { |
| 4885 | set_hp_led_gpio(codec); |
Gustavo Maciel Dias Vieira | a6a600d | 2012-01-24 13:27:56 -0200 | [diff] [blame] | 4886 | switch (codec->subsystem_id) { |
| 4887 | case 0x103c148a: |
| 4888 | spec->gpio_led_polarity = 0; |
| 4889 | break; |
| 4890 | default: |
| 4891 | spec->gpio_led_polarity = 1; |
| 4892 | break; |
| 4893 | } |
Gustavo Maciel Dias Vieira | e2ef36c | 2011-12-13 11:47:22 -0200 | [diff] [blame] | 4894 | return 1; |
| 4895 | } |
Vitaliy Kulikov | c357aab | 2009-12-11 07:51:54 +0100 | [diff] [blame] | 4896 | } |
Kunal Gangakhedkar | d38cce7 | 2010-01-15 21:01:47 +0530 | [diff] [blame] | 4897 | |
| 4898 | /* |
| 4899 | * Fallback case - if we don't find the DMI strings, |
Vitaliy Kulikov | 6a557c9 | 2011-12-12 17:35:13 -0600 | [diff] [blame] | 4900 | * we statically set the GPIO - if not a B-series system |
| 4901 | * and default polarity is provided |
Kunal Gangakhedkar | d38cce7 | 2010-01-15 21:01:47 +0530 | [diff] [blame] | 4902 | */ |
Vitaliy Kulikov | 6a557c9 | 2011-12-12 17:35:13 -0600 | [diff] [blame] | 4903 | if (!hp_blike_system(codec->subsystem_id) && |
| 4904 | (default_polarity == 0 || default_polarity == 1)) { |
Kunal Gangakhedkar | d38cce7 | 2010-01-15 21:01:47 +0530 | [diff] [blame] | 4905 | set_hp_led_gpio(codec); |
Takashi Iwai | dce17d4 | 2010-02-09 09:25:26 +0100 | [diff] [blame] | 4906 | spec->gpio_led_polarity = default_polarity; |
Kunal Gangakhedkar | d38cce7 | 2010-01-15 21:01:47 +0530 | [diff] [blame] | 4907 | return 1; |
| 4908 | } |
Vitaliy Kulikov | c357aab | 2009-12-11 07:51:54 +0100 | [diff] [blame] | 4909 | } |
| 4910 | return 0; |
| 4911 | } |
| 4912 | |
| 4913 | static int hp_blike_system(u32 subsystem_id) |
Randy Dunlap | 78987bd | 2009-11-05 09:22:30 -0800 | [diff] [blame] | 4914 | { |
| 4915 | switch (subsystem_id) { |
Vitaliy Kulikov | c357aab | 2009-12-11 07:51:54 +0100 | [diff] [blame] | 4916 | case 0x103c1520: |
| 4917 | case 0x103c1521: |
| 4918 | case 0x103c1523: |
| 4919 | case 0x103c1524: |
| 4920 | case 0x103c1525: |
Randy Dunlap | 78987bd | 2009-11-05 09:22:30 -0800 | [diff] [blame] | 4921 | case 0x103c1722: |
| 4922 | case 0x103c1723: |
| 4923 | case 0x103c1724: |
| 4924 | case 0x103c1725: |
| 4925 | case 0x103c1726: |
| 4926 | case 0x103c1727: |
| 4927 | case 0x103c1728: |
| 4928 | case 0x103c1729: |
Vitaliy Kulikov | c357aab | 2009-12-11 07:51:54 +0100 | [diff] [blame] | 4929 | case 0x103c172a: |
| 4930 | case 0x103c172b: |
| 4931 | case 0x103c307e: |
| 4932 | case 0x103c307f: |
| 4933 | case 0x103c3080: |
| 4934 | case 0x103c3081: |
| 4935 | case 0x103c7007: |
| 4936 | case 0x103c7008: |
Randy Dunlap | 78987bd | 2009-11-05 09:22:30 -0800 | [diff] [blame] | 4937 | return 1; |
| 4938 | } |
| 4939 | return 0; |
| 4940 | } |
| 4941 | |
Takashi Iwai | 2d34e1b | 2008-11-28 14:35:16 +0100 | [diff] [blame] | 4942 | #ifdef CONFIG_PROC_FS |
| 4943 | static void stac92hd_proc_hook(struct snd_info_buffer *buffer, |
| 4944 | struct hda_codec *codec, hda_nid_t nid) |
| 4945 | { |
| 4946 | if (nid == codec->afg) |
| 4947 | snd_iprintf(buffer, "Power-Map: 0x%02x\n", |
Takashi Iwai | c882246 | 2012-05-15 09:11:36 +0200 | [diff] [blame] | 4948 | snd_hda_codec_read(codec, nid, 0, |
| 4949 | AC_VERB_IDT_GET_POWER_MAP, 0)); |
Takashi Iwai | 2d34e1b | 2008-11-28 14:35:16 +0100 | [diff] [blame] | 4950 | } |
| 4951 | |
| 4952 | static void analog_loop_proc_hook(struct snd_info_buffer *buffer, |
| 4953 | struct hda_codec *codec, |
| 4954 | unsigned int verb) |
| 4955 | { |
| 4956 | snd_iprintf(buffer, "Analog Loopback: 0x%02x\n", |
| 4957 | snd_hda_codec_read(codec, codec->afg, 0, verb, 0)); |
| 4958 | } |
| 4959 | |
| 4960 | /* stac92hd71bxx, stac92hd73xx */ |
| 4961 | static void stac92hd7x_proc_hook(struct snd_info_buffer *buffer, |
| 4962 | struct hda_codec *codec, hda_nid_t nid) |
| 4963 | { |
| 4964 | stac92hd_proc_hook(buffer, codec, nid); |
| 4965 | if (nid == codec->afg) |
| 4966 | analog_loop_proc_hook(buffer, codec, 0xfa0); |
| 4967 | } |
| 4968 | |
| 4969 | static void stac9205_proc_hook(struct snd_info_buffer *buffer, |
| 4970 | struct hda_codec *codec, hda_nid_t nid) |
| 4971 | { |
| 4972 | if (nid == codec->afg) |
| 4973 | analog_loop_proc_hook(buffer, codec, 0xfe0); |
| 4974 | } |
| 4975 | |
| 4976 | static void stac927x_proc_hook(struct snd_info_buffer *buffer, |
| 4977 | struct hda_codec *codec, hda_nid_t nid) |
| 4978 | { |
| 4979 | if (nid == codec->afg) |
| 4980 | analog_loop_proc_hook(buffer, codec, 0xfeb); |
| 4981 | } |
| 4982 | #else |
| 4983 | #define stac92hd_proc_hook NULL |
| 4984 | #define stac92hd7x_proc_hook NULL |
| 4985 | #define stac9205_proc_hook NULL |
| 4986 | #define stac927x_proc_hook NULL |
| 4987 | #endif |
| 4988 | |
Takashi Iwai | 2a43952 | 2011-07-26 09:52:50 +0200 | [diff] [blame] | 4989 | #ifdef CONFIG_PM |
Matt | ff6fdc3 | 2005-06-27 15:06:52 +0200 | [diff] [blame] | 4990 | static int stac92xx_resume(struct hda_codec *codec) |
| 4991 | { |
Takashi Iwai | 2c88587 | 2008-11-18 09:36:55 +0100 | [diff] [blame] | 4992 | stac92xx_init(codec); |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 4993 | snd_hda_codec_resume_amp(codec); |
| 4994 | snd_hda_codec_resume_cache(codec); |
Takashi Iwai | 2c88587 | 2008-11-18 09:36:55 +0100 | [diff] [blame] | 4995 | /* fake event to set up pins again to override cached values */ |
Takashi Iwai | f2cbba7 | 2012-01-11 12:34:11 +0100 | [diff] [blame] | 4996 | stac_fake_hp_events(codec); |
Matt | ff6fdc3 | 2005-06-27 15:06:52 +0200 | [diff] [blame] | 4997 | return 0; |
| 4998 | } |
Matthew Ranostay | c6798d2 | 2008-11-18 20:54:17 -0500 | [diff] [blame] | 4999 | |
Vitaliy Kulikov | 45eebda | 2011-07-26 16:56:20 -0500 | [diff] [blame] | 5000 | static int stac92xx_suspend(struct hda_codec *codec, pm_message_t state) |
| 5001 | { |
| 5002 | stac92xx_shutup(codec); |
| 5003 | return 0; |
| 5004 | } |
| 5005 | |
Vitaliy Kulikov | 45eebda | 2011-07-26 16:56:20 -0500 | [diff] [blame] | 5006 | static void stac92xx_set_power_state(struct hda_codec *codec, hda_nid_t fg, |
| 5007 | unsigned int power_state) |
| 5008 | { |
| 5009 | unsigned int afg_power_state = power_state; |
| 5010 | struct sigmatel_spec *spec = codec->spec; |
| 5011 | |
| 5012 | if (power_state == AC_PWRST_D3) { |
Takashi Iwai | f1a7374 | 2011-12-04 13:44:06 +0100 | [diff] [blame] | 5013 | if (spec->vref_mute_led_nid) { |
Vitaliy Kulikov | 45eebda | 2011-07-26 16:56:20 -0500 | [diff] [blame] | 5014 | /* with vref-out pin used for mute led control |
| 5015 | * codec AFG is prevented from D3 state |
| 5016 | */ |
| 5017 | afg_power_state = AC_PWRST_D1; |
| 5018 | } |
| 5019 | /* this delay seems necessary to avoid click noise at power-down */ |
| 5020 | msleep(100); |
| 5021 | } |
| 5022 | snd_hda_codec_read(codec, fg, 0, AC_VERB_SET_POWER_STATE, |
| 5023 | afg_power_state); |
| 5024 | snd_hda_codec_set_power_to_all(codec, fg, power_state, true); |
| 5025 | } |
Takashi Iwai | 350eba43 | 2012-03-16 16:09:03 +0100 | [diff] [blame] | 5026 | #else |
| 5027 | #define stac92xx_suspend NULL |
| 5028 | #define stac92xx_resume NULL |
Takashi Iwai | 350eba43 | 2012-03-16 16:09:03 +0100 | [diff] [blame] | 5029 | #define stac92xx_set_power_state NULL |
Takashi Iwai | 2faa3bf | 2012-03-12 12:30:22 +0100 | [diff] [blame] | 5030 | #endif /* CONFIG_PM */ |
Vitaliy Kulikov | 45eebda | 2011-07-26 16:56:20 -0500 | [diff] [blame] | 5031 | |
Takashi Iwai | 2faa3bf | 2012-03-12 12:30:22 +0100 | [diff] [blame] | 5032 | /* update mute-LED accoring to the master switch */ |
| 5033 | static void stac92xx_update_led_status(struct hda_codec *codec, int enabled) |
Christoph Plattner | ae6241f | 2009-03-08 23:19:05 +0100 | [diff] [blame] | 5034 | { |
| 5035 | struct sigmatel_spec *spec = codec->spec; |
Takashi Iwai | 2faa3bf | 2012-03-12 12:30:22 +0100 | [diff] [blame] | 5036 | int muted = !enabled; |
Takashi Iwai | 6fce61a | 2009-03-10 07:48:57 +0100 | [diff] [blame] | 5037 | |
Vitaliy Kulikov | 45eebda | 2011-07-26 16:56:20 -0500 | [diff] [blame] | 5038 | if (!spec->gpio_led) |
Takashi Iwai | 2faa3bf | 2012-03-12 12:30:22 +0100 | [diff] [blame] | 5039 | return; |
Vitaliy Kulikov | 45eebda | 2011-07-26 16:56:20 -0500 | [diff] [blame] | 5040 | |
Takashi Iwai | 2faa3bf | 2012-03-12 12:30:22 +0100 | [diff] [blame] | 5041 | /* LED state is inverted on these systems */ |
| 5042 | if (spec->gpio_led_polarity) |
| 5043 | muted = !muted; |
| 5044 | |
Takashi Iwai | f1a7374 | 2011-12-04 13:44:06 +0100 | [diff] [blame] | 5045 | if (!spec->vref_mute_led_nid) { |
Vitaliy Kulikov | 45eebda | 2011-07-26 16:56:20 -0500 | [diff] [blame] | 5046 | if (muted) |
Takashi Iwai | 3e84319 | 2012-04-19 12:04:03 +0200 | [diff] [blame] | 5047 | spec->gpio_data |= spec->gpio_led; |
Vitaliy Kulikov | 45eebda | 2011-07-26 16:56:20 -0500 | [diff] [blame] | 5048 | else |
Takashi Iwai | 3e84319 | 2012-04-19 12:04:03 +0200 | [diff] [blame] | 5049 | spec->gpio_data &= ~spec->gpio_led; |
Vitaliy Kulikov | 45eebda | 2011-07-26 16:56:20 -0500 | [diff] [blame] | 5050 | stac_gpio_set(codec, spec->gpio_mask, |
| 5051 | spec->gpio_dir, spec->gpio_data); |
| 5052 | } else { |
Takashi Iwai | 2faa3bf | 2012-03-12 12:30:22 +0100 | [diff] [blame] | 5053 | spec->vref_led = muted ? AC_PINCTL_VREF_50 : AC_PINCTL_VREF_GRD; |
Takashi Iwai | f1a7374 | 2011-12-04 13:44:06 +0100 | [diff] [blame] | 5054 | stac_vrefout_set(codec, spec->vref_mute_led_nid, |
| 5055 | spec->vref_led); |
Christoph Plattner | ae6241f | 2009-03-08 23:19:05 +0100 | [diff] [blame] | 5056 | } |
Takashi Iwai | b4e8187 | 2009-11-18 17:20:24 +0100 | [diff] [blame] | 5057 | } |
Vitaliy Kulikov | 7df1ce1 | 2011-07-25 17:52:57 -0500 | [diff] [blame] | 5058 | |
Takashi Iwai | 2b63536 | 2011-05-02 12:33:43 +0200 | [diff] [blame] | 5059 | static const struct hda_codec_ops stac92xx_patch_ops = { |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 5060 | .build_controls = stac92xx_build_controls, |
| 5061 | .build_pcms = stac92xx_build_pcms, |
| 5062 | .init = stac92xx_init, |
| 5063 | .free = stac92xx_free, |
Matt | 4e55096 | 2005-07-04 17:51:39 +0200 | [diff] [blame] | 5064 | .unsol_event = stac92xx_unsol_event, |
Takashi Iwai | 2a43952 | 2011-07-26 09:52:50 +0200 | [diff] [blame] | 5065 | #ifdef CONFIG_PM |
Matthew Ranostay | c6798d2 | 2008-11-18 20:54:17 -0500 | [diff] [blame] | 5066 | .suspend = stac92xx_suspend, |
Matt | ff6fdc3 | 2005-06-27 15:06:52 +0200 | [diff] [blame] | 5067 | .resume = stac92xx_resume, |
| 5068 | #endif |
Takashi Iwai | fb8d1a3 | 2009-11-10 16:02:29 +0100 | [diff] [blame] | 5069 | .reboot_notify = stac92xx_shutup, |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 5070 | }; |
| 5071 | |
| 5072 | static int patch_stac9200(struct hda_codec *codec) |
| 5073 | { |
| 5074 | struct sigmatel_spec *spec; |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 5075 | int err; |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 5076 | |
Takashi Iwai | e560d8d | 2005-09-09 14:21:46 +0200 | [diff] [blame] | 5077 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 5078 | if (spec == NULL) |
| 5079 | return -ENOMEM; |
| 5080 | |
Takashi Iwai | a252c81 | 2009-12-25 22:56:20 +0100 | [diff] [blame] | 5081 | codec->no_trigger_sense = 1; |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 5082 | codec->spec = spec; |
Daniel J Blueman | 1b0e372 | 2010-08-03 11:09:13 +0100 | [diff] [blame] | 5083 | spec->linear_tone_beep = 1; |
Takashi Iwai | a4eed13 | 2007-07-06 18:17:04 +0200 | [diff] [blame] | 5084 | spec->num_pins = ARRAY_SIZE(stac9200_pin_nids); |
Richard Fish | 11b44bb | 2006-08-23 18:31:34 +0200 | [diff] [blame] | 5085 | spec->pin_nids = stac9200_pin_nids; |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 5086 | spec->board_config = snd_hda_check_board_config(codec, STAC_9200_MODELS, |
| 5087 | stac9200_models, |
| 5088 | stac9200_cfg_tbl); |
Takashi Iwai | 330ee99 | 2009-02-20 14:33:36 +0100 | [diff] [blame] | 5089 | if (spec->board_config < 0) |
Takashi Iwai | 9a11f1a | 2009-07-28 16:01:20 +0200 | [diff] [blame] | 5090 | snd_printdd(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n", |
| 5091 | codec->chip_name); |
Takashi Iwai | 330ee99 | 2009-02-20 14:33:36 +0100 | [diff] [blame] | 5092 | else |
| 5093 | stac92xx_set_config_regs(codec, |
Takashi Iwai | af9f341 | 2008-11-18 10:38:56 +0100 | [diff] [blame] | 5094 | stac9200_brd_tbl[spec->board_config]); |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 5095 | |
| 5096 | spec->multiout.max_channels = 2; |
| 5097 | spec->multiout.num_dacs = 1; |
| 5098 | spec->multiout.dac_nids = stac9200_dac_nids; |
| 5099 | spec->adc_nids = stac9200_adc_nids; |
| 5100 | spec->mux_nids = stac9200_mux_nids; |
Matt | dabbed6 | 2005-06-14 10:19:34 +0200 | [diff] [blame] | 5101 | spec->num_muxes = 1; |
Matt Porter | 8b65727 | 2006-10-26 17:12:59 +0200 | [diff] [blame] | 5102 | spec->num_dmics = 0; |
Maxim Levitsky | 9e05b7a | 2007-09-03 15:31:02 +0200 | [diff] [blame] | 5103 | spec->num_adcs = 1; |
Matthew Ranostay | a64135a | 2008-01-10 16:55:06 +0100 | [diff] [blame] | 5104 | spec->num_pwrs = 0; |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 5105 | |
Mauro Carvalho Chehab | 58eec42 | 2008-08-11 10:18:39 +0200 | [diff] [blame] | 5106 | if (spec->board_config == STAC_9200_M4 || |
| 5107 | spec->board_config == STAC_9200_M4_2 || |
Tobin Davis | bf27778 | 2008-02-03 20:31:47 +0100 | [diff] [blame] | 5108 | spec->board_config == STAC_9200_OQO) |
Takashi Iwai | 1194b5b | 2007-10-10 10:04:26 +0200 | [diff] [blame] | 5109 | spec->init = stac9200_eapd_init; |
| 5110 | else |
| 5111 | spec->init = stac9200_core_init; |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 5112 | spec->mixer = stac9200_mixer; |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 5113 | |
Takashi Iwai | 117f257 | 2008-03-18 09:53:23 +0100 | [diff] [blame] | 5114 | if (spec->board_config == STAC_9200_PANASONIC) { |
| 5115 | spec->gpio_mask = spec->gpio_dir = 0x09; |
| 5116 | spec->gpio_data = 0x00; |
| 5117 | } |
| 5118 | |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 5119 | err = stac9200_parse_auto_config(codec); |
| 5120 | if (err < 0) { |
| 5121 | stac92xx_free(codec); |
| 5122 | return err; |
| 5123 | } |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 5124 | |
Takashi Iwai | 2acc9dc | 2009-01-09 16:57:14 +0100 | [diff] [blame] | 5125 | /* CF-74 has no headphone detection, and the driver should *NOT* |
| 5126 | * do detection and HP/speaker toggle because the hardware does it. |
| 5127 | */ |
| 5128 | if (spec->board_config == STAC_9200_PANASONIC) |
| 5129 | spec->hp_detect = 0; |
| 5130 | |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 5131 | codec->patch_ops = stac92xx_patch_ops; |
| 5132 | |
| 5133 | return 0; |
| 5134 | } |
| 5135 | |
Tobin Davis | 8e21c34 | 2007-01-08 11:04:17 +0100 | [diff] [blame] | 5136 | static int patch_stac925x(struct hda_codec *codec) |
| 5137 | { |
| 5138 | struct sigmatel_spec *spec; |
| 5139 | int err; |
| 5140 | |
| 5141 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
| 5142 | if (spec == NULL) |
| 5143 | return -ENOMEM; |
| 5144 | |
Takashi Iwai | a252c81 | 2009-12-25 22:56:20 +0100 | [diff] [blame] | 5145 | codec->no_trigger_sense = 1; |
Tobin Davis | 8e21c34 | 2007-01-08 11:04:17 +0100 | [diff] [blame] | 5146 | codec->spec = spec; |
Daniel J Blueman | 1b0e372 | 2010-08-03 11:09:13 +0100 | [diff] [blame] | 5147 | spec->linear_tone_beep = 1; |
Takashi Iwai | a4eed13 | 2007-07-06 18:17:04 +0200 | [diff] [blame] | 5148 | spec->num_pins = ARRAY_SIZE(stac925x_pin_nids); |
Tobin Davis | 8e21c34 | 2007-01-08 11:04:17 +0100 | [diff] [blame] | 5149 | spec->pin_nids = stac925x_pin_nids; |
Mauro Carvalho Chehab | 9cb36c2 | 2008-08-11 10:18:39 +0200 | [diff] [blame] | 5150 | |
| 5151 | /* Check first for codec ID */ |
| 5152 | spec->board_config = snd_hda_check_board_codec_sid_config(codec, |
| 5153 | STAC_925x_MODELS, |
| 5154 | stac925x_models, |
| 5155 | stac925x_codec_id_cfg_tbl); |
| 5156 | |
| 5157 | /* Now checks for PCI ID, if codec ID is not found */ |
| 5158 | if (spec->board_config < 0) |
| 5159 | spec->board_config = snd_hda_check_board_config(codec, |
| 5160 | STAC_925x_MODELS, |
Tobin Davis | 8e21c34 | 2007-01-08 11:04:17 +0100 | [diff] [blame] | 5161 | stac925x_models, |
| 5162 | stac925x_cfg_tbl); |
Takashi Iwai | 9e507ab | 2007-02-08 17:50:10 +0100 | [diff] [blame] | 5163 | again: |
Takashi Iwai | 330ee99 | 2009-02-20 14:33:36 +0100 | [diff] [blame] | 5164 | if (spec->board_config < 0) |
Takashi Iwai | 9a11f1a | 2009-07-28 16:01:20 +0200 | [diff] [blame] | 5165 | snd_printdd(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n", |
| 5166 | codec->chip_name); |
Takashi Iwai | 330ee99 | 2009-02-20 14:33:36 +0100 | [diff] [blame] | 5167 | else |
| 5168 | stac92xx_set_config_regs(codec, |
Takashi Iwai | af9f341 | 2008-11-18 10:38:56 +0100 | [diff] [blame] | 5169 | stac925x_brd_tbl[spec->board_config]); |
Tobin Davis | 8e21c34 | 2007-01-08 11:04:17 +0100 | [diff] [blame] | 5170 | |
| 5171 | spec->multiout.max_channels = 2; |
| 5172 | spec->multiout.num_dacs = 1; |
| 5173 | spec->multiout.dac_nids = stac925x_dac_nids; |
| 5174 | spec->adc_nids = stac925x_adc_nids; |
| 5175 | spec->mux_nids = stac925x_mux_nids; |
| 5176 | spec->num_muxes = 1; |
Maxim Levitsky | 9e05b7a | 2007-09-03 15:31:02 +0200 | [diff] [blame] | 5177 | spec->num_adcs = 1; |
Matthew Ranostay | a64135a | 2008-01-10 16:55:06 +0100 | [diff] [blame] | 5178 | spec->num_pwrs = 0; |
Tobin Davis | 2c11f95 | 2007-05-17 09:36:34 +0200 | [diff] [blame] | 5179 | switch (codec->vendor_id) { |
| 5180 | case 0x83847632: /* STAC9202 */ |
| 5181 | case 0x83847633: /* STAC9202D */ |
| 5182 | case 0x83847636: /* STAC9251 */ |
| 5183 | case 0x83847637: /* STAC9251D */ |
Takashi Iwai | f6e9852 | 2007-10-16 14:27:04 +0200 | [diff] [blame] | 5184 | spec->num_dmics = STAC925X_NUM_DMICS; |
Tobin Davis | 2c11f95 | 2007-05-17 09:36:34 +0200 | [diff] [blame] | 5185 | spec->dmic_nids = stac925x_dmic_nids; |
Takashi Iwai | 1697055e | 2007-12-18 18:05:52 +0100 | [diff] [blame] | 5186 | spec->num_dmuxes = ARRAY_SIZE(stac925x_dmux_nids); |
| 5187 | spec->dmux_nids = stac925x_dmux_nids; |
Tobin Davis | 2c11f95 | 2007-05-17 09:36:34 +0200 | [diff] [blame] | 5188 | break; |
| 5189 | default: |
| 5190 | spec->num_dmics = 0; |
| 5191 | break; |
| 5192 | } |
Tobin Davis | 8e21c34 | 2007-01-08 11:04:17 +0100 | [diff] [blame] | 5193 | |
| 5194 | spec->init = stac925x_core_init; |
| 5195 | spec->mixer = stac925x_mixer; |
Takashi Iwai | 6479c63 | 2009-07-28 18:20:25 +0200 | [diff] [blame] | 5196 | spec->num_caps = 1; |
| 5197 | spec->capvols = stac925x_capvols; |
| 5198 | spec->capsws = stac925x_capsws; |
Tobin Davis | 8e21c34 | 2007-01-08 11:04:17 +0100 | [diff] [blame] | 5199 | |
Charles Chin | 9009b0e | 2011-11-03 10:27:27 +0100 | [diff] [blame] | 5200 | err = stac92xx_parse_auto_config(codec); |
Takashi Iwai | 9e507ab | 2007-02-08 17:50:10 +0100 | [diff] [blame] | 5201 | if (!err) { |
| 5202 | if (spec->board_config < 0) { |
| 5203 | printk(KERN_WARNING "hda_codec: No auto-config is " |
| 5204 | "available, default to model=ref\n"); |
| 5205 | spec->board_config = STAC_925x_REF; |
| 5206 | goto again; |
| 5207 | } |
| 5208 | err = -EINVAL; |
| 5209 | } |
Tobin Davis | 8e21c34 | 2007-01-08 11:04:17 +0100 | [diff] [blame] | 5210 | if (err < 0) { |
| 5211 | stac92xx_free(codec); |
| 5212 | return err; |
| 5213 | } |
| 5214 | |
| 5215 | codec->patch_ops = stac92xx_patch_ops; |
| 5216 | |
| 5217 | return 0; |
| 5218 | } |
| 5219 | |
Matthew Ranostay | e1f0d66 | 2007-12-13 17:47:21 +0100 | [diff] [blame] | 5220 | static int patch_stac92hd73xx(struct hda_codec *codec) |
| 5221 | { |
| 5222 | struct sigmatel_spec *spec; |
| 5223 | hda_nid_t conn[STAC92HD73_DAC_COUNT + 2]; |
| 5224 | int err = 0; |
Takashi Iwai | c21ca4a | 2008-12-19 09:26:08 +0100 | [diff] [blame] | 5225 | int num_dacs; |
Matthew Ranostay | e1f0d66 | 2007-12-13 17:47:21 +0100 | [diff] [blame] | 5226 | |
| 5227 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
| 5228 | if (spec == NULL) |
| 5229 | return -ENOMEM; |
| 5230 | |
Takashi Iwai | a252c81 | 2009-12-25 22:56:20 +0100 | [diff] [blame] | 5231 | codec->no_trigger_sense = 1; |
Matthew Ranostay | e1f0d66 | 2007-12-13 17:47:21 +0100 | [diff] [blame] | 5232 | codec->spec = spec; |
Daniel J Blueman | 1b0e372 | 2010-08-03 11:09:13 +0100 | [diff] [blame] | 5233 | spec->linear_tone_beep = 0; |
Matthew Ranostay | e99d32b | 2008-09-09 10:46:38 +0200 | [diff] [blame] | 5234 | codec->slave_dig_outs = stac92hd73xx_slave_dig_outs; |
Matthew Ranostay | e1f0d66 | 2007-12-13 17:47:21 +0100 | [diff] [blame] | 5235 | spec->num_pins = ARRAY_SIZE(stac92hd73xx_pin_nids); |
| 5236 | spec->pin_nids = stac92hd73xx_pin_nids; |
| 5237 | spec->board_config = snd_hda_check_board_config(codec, |
| 5238 | STAC_92HD73XX_MODELS, |
| 5239 | stac92hd73xx_models, |
| 5240 | stac92hd73xx_cfg_tbl); |
Takashi Iwai | 842ae63 | 2009-09-02 07:43:08 +0200 | [diff] [blame] | 5241 | /* check codec subsystem id if not found */ |
| 5242 | if (spec->board_config < 0) |
| 5243 | spec->board_config = |
| 5244 | snd_hda_check_board_codec_sid_config(codec, |
| 5245 | STAC_92HD73XX_MODELS, stac92hd73xx_models, |
| 5246 | stac92hd73xx_codec_id_cfg_tbl); |
Matthew Ranostay | e1f0d66 | 2007-12-13 17:47:21 +0100 | [diff] [blame] | 5247 | again: |
Takashi Iwai | 330ee99 | 2009-02-20 14:33:36 +0100 | [diff] [blame] | 5248 | if (spec->board_config < 0) |
Takashi Iwai | 9a11f1a | 2009-07-28 16:01:20 +0200 | [diff] [blame] | 5249 | snd_printdd(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n", |
| 5250 | codec->chip_name); |
Takashi Iwai | 330ee99 | 2009-02-20 14:33:36 +0100 | [diff] [blame] | 5251 | else |
| 5252 | stac92xx_set_config_regs(codec, |
Takashi Iwai | af9f341 | 2008-11-18 10:38:56 +0100 | [diff] [blame] | 5253 | stac92hd73xx_brd_tbl[spec->board_config]); |
Matthew Ranostay | e1f0d66 | 2007-12-13 17:47:21 +0100 | [diff] [blame] | 5254 | |
Takashi Iwai | c21ca4a | 2008-12-19 09:26:08 +0100 | [diff] [blame] | 5255 | num_dacs = snd_hda_get_connections(codec, 0x0a, |
Matthew Ranostay | e1f0d66 | 2007-12-13 17:47:21 +0100 | [diff] [blame] | 5256 | conn, STAC92HD73_DAC_COUNT + 2) - 1; |
| 5257 | |
Takashi Iwai | c21ca4a | 2008-12-19 09:26:08 +0100 | [diff] [blame] | 5258 | if (num_dacs < 3 || num_dacs > 5) { |
Matthew Ranostay | e1f0d66 | 2007-12-13 17:47:21 +0100 | [diff] [blame] | 5259 | printk(KERN_WARNING "hda_codec: Could not determine " |
| 5260 | "number of channels defaulting to DAC count\n"); |
Takashi Iwai | c21ca4a | 2008-12-19 09:26:08 +0100 | [diff] [blame] | 5261 | num_dacs = STAC92HD73_DAC_COUNT; |
Matthew Ranostay | e1f0d66 | 2007-12-13 17:47:21 +0100 | [diff] [blame] | 5262 | } |
Takashi Iwai | e2aec17 | 2009-09-02 01:00:05 +0200 | [diff] [blame] | 5263 | spec->init = stac92hd73xx_core_init; |
Takashi Iwai | c21ca4a | 2008-12-19 09:26:08 +0100 | [diff] [blame] | 5264 | switch (num_dacs) { |
Matthew Ranostay | e1f0d66 | 2007-12-13 17:47:21 +0100 | [diff] [blame] | 5265 | case 0x3: /* 6 Channel */ |
Takashi Iwai | d78d7a9 | 2009-03-02 14:26:25 +0100 | [diff] [blame] | 5266 | spec->aloopback_ctl = stac92hd73xx_6ch_loopback; |
Matthew Ranostay | e1f0d66 | 2007-12-13 17:47:21 +0100 | [diff] [blame] | 5267 | break; |
| 5268 | case 0x4: /* 8 Channel */ |
Takashi Iwai | d78d7a9 | 2009-03-02 14:26:25 +0100 | [diff] [blame] | 5269 | spec->aloopback_ctl = stac92hd73xx_8ch_loopback; |
Matthew Ranostay | e1f0d66 | 2007-12-13 17:47:21 +0100 | [diff] [blame] | 5270 | break; |
| 5271 | case 0x5: /* 10 Channel */ |
Takashi Iwai | d78d7a9 | 2009-03-02 14:26:25 +0100 | [diff] [blame] | 5272 | spec->aloopback_ctl = stac92hd73xx_10ch_loopback; |
| 5273 | break; |
Takashi Iwai | c21ca4a | 2008-12-19 09:26:08 +0100 | [diff] [blame] | 5274 | } |
| 5275 | spec->multiout.dac_nids = spec->dac_nids; |
Matthew Ranostay | e1f0d66 | 2007-12-13 17:47:21 +0100 | [diff] [blame] | 5276 | |
Matthew Ranostay | e1f0d66 | 2007-12-13 17:47:21 +0100 | [diff] [blame] | 5277 | spec->aloopback_mask = 0x01; |
| 5278 | spec->aloopback_shift = 8; |
| 5279 | |
Matthew Ranostay | 1cd2224 | 2008-07-18 18:20:52 +0200 | [diff] [blame] | 5280 | spec->digbeep_nid = 0x1c; |
Matthew Ranostay | e1f0d66 | 2007-12-13 17:47:21 +0100 | [diff] [blame] | 5281 | spec->mux_nids = stac92hd73xx_mux_nids; |
| 5282 | spec->adc_nids = stac92hd73xx_adc_nids; |
| 5283 | spec->dmic_nids = stac92hd73xx_dmic_nids; |
| 5284 | spec->dmux_nids = stac92hd73xx_dmux_nids; |
Matthew Ranostay | d973775 | 2008-09-07 12:03:41 +0200 | [diff] [blame] | 5285 | spec->smux_nids = stac92hd73xx_smux_nids; |
Matthew Ranostay | e1f0d66 | 2007-12-13 17:47:21 +0100 | [diff] [blame] | 5286 | |
| 5287 | spec->num_muxes = ARRAY_SIZE(stac92hd73xx_mux_nids); |
| 5288 | spec->num_adcs = ARRAY_SIZE(stac92hd73xx_adc_nids); |
Takashi Iwai | 1697055e | 2007-12-18 18:05:52 +0100 | [diff] [blame] | 5289 | spec->num_dmuxes = ARRAY_SIZE(stac92hd73xx_dmux_nids); |
Matthew Ranostay | 2a9c781 | 2008-09-13 16:45:39 -0400 | [diff] [blame] | 5290 | |
Takashi Iwai | 6479c63 | 2009-07-28 18:20:25 +0200 | [diff] [blame] | 5291 | spec->num_caps = STAC92HD73XX_NUM_CAPS; |
| 5292 | spec->capvols = stac92hd73xx_capvols; |
| 5293 | spec->capsws = stac92hd73xx_capsws; |
| 5294 | |
Matthew Ranostay | a766264 | 2008-02-21 07:51:14 +0100 | [diff] [blame] | 5295 | switch (spec->board_config) { |
Matthew Ranostay | 6b3ab21 | 2008-11-03 08:12:43 -0500 | [diff] [blame] | 5296 | case STAC_DELL_EQ: |
Matthew Ranostay | d654a66 | 2008-03-14 08:46:51 +0100 | [diff] [blame] | 5297 | spec->init = dell_eq_core_init; |
Matthew Ranostay | 6b3ab21 | 2008-11-03 08:12:43 -0500 | [diff] [blame] | 5298 | /* fallthru */ |
Takashi Iwai | 661cd8f | 2008-11-25 15:18:29 +0100 | [diff] [blame] | 5299 | case STAC_DELL_M6_AMIC: |
| 5300 | case STAC_DELL_M6_DMIC: |
| 5301 | case STAC_DELL_M6_BOTH: |
Matthew Ranostay | 2a9c781 | 2008-09-13 16:45:39 -0400 | [diff] [blame] | 5302 | spec->num_smuxes = 0; |
Matthew Ranostay | c0cea0d | 2008-11-16 11:42:34 -0500 | [diff] [blame] | 5303 | spec->eapd_switch = 0; |
Matthew Ranostay | 6b3ab21 | 2008-11-03 08:12:43 -0500 | [diff] [blame] | 5304 | |
Takashi Iwai | 661cd8f | 2008-11-25 15:18:29 +0100 | [diff] [blame] | 5305 | switch (spec->board_config) { |
| 5306 | case STAC_DELL_M6_AMIC: /* Analog Mics */ |
Takashi Iwai | 330ee99 | 2009-02-20 14:33:36 +0100 | [diff] [blame] | 5307 | snd_hda_codec_set_pincfg(codec, 0x0b, 0x90A70170); |
Matthew Ranostay | a766264 | 2008-02-21 07:51:14 +0100 | [diff] [blame] | 5308 | spec->num_dmics = 0; |
| 5309 | break; |
Takashi Iwai | 661cd8f | 2008-11-25 15:18:29 +0100 | [diff] [blame] | 5310 | case STAC_DELL_M6_DMIC: /* Digital Mics */ |
Takashi Iwai | 330ee99 | 2009-02-20 14:33:36 +0100 | [diff] [blame] | 5311 | snd_hda_codec_set_pincfg(codec, 0x13, 0x90A60160); |
Matthew Ranostay | a766264 | 2008-02-21 07:51:14 +0100 | [diff] [blame] | 5312 | spec->num_dmics = 1; |
| 5313 | break; |
Takashi Iwai | 661cd8f | 2008-11-25 15:18:29 +0100 | [diff] [blame] | 5314 | case STAC_DELL_M6_BOTH: /* Both */ |
Takashi Iwai | 330ee99 | 2009-02-20 14:33:36 +0100 | [diff] [blame] | 5315 | snd_hda_codec_set_pincfg(codec, 0x0b, 0x90A70170); |
| 5316 | snd_hda_codec_set_pincfg(codec, 0x13, 0x90A60160); |
Matthew Ranostay | a766264 | 2008-02-21 07:51:14 +0100 | [diff] [blame] | 5317 | spec->num_dmics = 1; |
| 5318 | break; |
| 5319 | } |
| 5320 | break; |
Takashi Iwai | 842ae63 | 2009-09-02 07:43:08 +0200 | [diff] [blame] | 5321 | case STAC_ALIENWARE_M17X: |
| 5322 | spec->num_dmics = STAC92HD73XX_NUM_DMICS; |
| 5323 | spec->num_smuxes = ARRAY_SIZE(stac92hd73xx_smux_nids); |
| 5324 | spec->eapd_switch = 0; |
| 5325 | break; |
Matthew Ranostay | a766264 | 2008-02-21 07:51:14 +0100 | [diff] [blame] | 5326 | default: |
| 5327 | spec->num_dmics = STAC92HD73XX_NUM_DMICS; |
Matthew Ranostay | 2a9c781 | 2008-09-13 16:45:39 -0400 | [diff] [blame] | 5328 | spec->num_smuxes = ARRAY_SIZE(stac92hd73xx_smux_nids); |
Matthew Ranostay | c0cea0d | 2008-11-16 11:42:34 -0500 | [diff] [blame] | 5329 | spec->eapd_switch = 1; |
Takashi Iwai | 5207e10 | 2009-07-30 13:09:08 +0200 | [diff] [blame] | 5330 | break; |
Matthew Ranostay | a766264 | 2008-02-21 07:51:14 +0100 | [diff] [blame] | 5331 | } |
Takashi Iwai | af6ee30 | 2009-09-14 15:03:12 +0200 | [diff] [blame] | 5332 | if (spec->board_config != STAC_92HD73XX_REF) { |
Matthew Ranostay | b2c4f4d | 2008-09-26 10:06:40 -0400 | [diff] [blame] | 5333 | /* GPIO0 High = Enable EAPD */ |
| 5334 | spec->eapd_mask = spec->gpio_mask = spec->gpio_dir = 0x1; |
| 5335 | spec->gpio_data = 0x01; |
| 5336 | } |
Matthew Ranostay | a766264 | 2008-02-21 07:51:14 +0100 | [diff] [blame] | 5337 | |
Matthew Ranostay | a64135a | 2008-01-10 16:55:06 +0100 | [diff] [blame] | 5338 | spec->num_pwrs = ARRAY_SIZE(stac92hd73xx_pwr_nids); |
| 5339 | spec->pwr_nids = stac92hd73xx_pwr_nids; |
| 5340 | |
Charles Chin | 9009b0e | 2011-11-03 10:27:27 +0100 | [diff] [blame] | 5341 | err = stac92xx_parse_auto_config(codec); |
Matthew Ranostay | e1f0d66 | 2007-12-13 17:47:21 +0100 | [diff] [blame] | 5342 | |
| 5343 | if (!err) { |
| 5344 | if (spec->board_config < 0) { |
| 5345 | printk(KERN_WARNING "hda_codec: No auto-config is " |
| 5346 | "available, default to model=ref\n"); |
| 5347 | spec->board_config = STAC_92HD73XX_REF; |
| 5348 | goto again; |
| 5349 | } |
| 5350 | err = -EINVAL; |
| 5351 | } |
| 5352 | |
| 5353 | if (err < 0) { |
| 5354 | stac92xx_free(codec); |
| 5355 | return err; |
| 5356 | } |
| 5357 | |
Takashi Iwai | 9e43f0d | 2008-12-17 14:51:01 +0100 | [diff] [blame] | 5358 | if (spec->board_config == STAC_92HD73XX_NO_JD) |
| 5359 | spec->hp_detect = 0; |
| 5360 | |
Matthew Ranostay | e1f0d66 | 2007-12-13 17:47:21 +0100 | [diff] [blame] | 5361 | codec->patch_ops = stac92xx_patch_ops; |
| 5362 | |
Takashi Iwai | 2d34e1b | 2008-11-28 14:35:16 +0100 | [diff] [blame] | 5363 | codec->proc_widget_hook = stac92hd7x_proc_hook; |
| 5364 | |
Matthew Ranostay | e1f0d66 | 2007-12-13 17:47:21 +0100 | [diff] [blame] | 5365 | return 0; |
| 5366 | } |
| 5367 | |
Vitaliy Kulikov | cbbf50b | 2011-01-14 17:21:13 -0600 | [diff] [blame] | 5368 | static int hp_bnb2011_with_dock(struct hda_codec *codec) |
Vitaliy Kulikov | 335e3b8 | 2010-10-22 18:38:31 -0500 | [diff] [blame] | 5369 | { |
| 5370 | if (codec->vendor_id != 0x111d7605 && |
| 5371 | codec->vendor_id != 0x111d76d1) |
| 5372 | return 0; |
| 5373 | |
| 5374 | switch (codec->subsystem_id) { |
| 5375 | case 0x103c1618: |
| 5376 | case 0x103c1619: |
| 5377 | case 0x103c161a: |
| 5378 | case 0x103c161b: |
| 5379 | case 0x103c161c: |
| 5380 | case 0x103c161d: |
| 5381 | case 0x103c161e: |
| 5382 | case 0x103c161f: |
Vitaliy Kulikov | 335e3b8 | 2010-10-22 18:38:31 -0500 | [diff] [blame] | 5383 | |
| 5384 | case 0x103c162a: |
| 5385 | case 0x103c162b: |
| 5386 | |
| 5387 | case 0x103c1630: |
| 5388 | case 0x103c1631: |
| 5389 | |
| 5390 | case 0x103c1633: |
Vitaliy Kulikov | cbbf50b | 2011-01-14 17:21:13 -0600 | [diff] [blame] | 5391 | case 0x103c1634: |
Vitaliy Kulikov | 335e3b8 | 2010-10-22 18:38:31 -0500 | [diff] [blame] | 5392 | case 0x103c1635: |
| 5393 | |
Vitaliy Kulikov | 335e3b8 | 2010-10-22 18:38:31 -0500 | [diff] [blame] | 5394 | case 0x103c3587: |
| 5395 | case 0x103c3588: |
| 5396 | case 0x103c3589: |
| 5397 | case 0x103c358a: |
| 5398 | |
| 5399 | case 0x103c3667: |
| 5400 | case 0x103c3668: |
Vitaliy Kulikov | cbbf50b | 2011-01-14 17:21:13 -0600 | [diff] [blame] | 5401 | case 0x103c3669: |
| 5402 | |
| 5403 | return 1; |
Vitaliy Kulikov | 335e3b8 | 2010-10-22 18:38:31 -0500 | [diff] [blame] | 5404 | } |
| 5405 | return 0; |
| 5406 | } |
| 5407 | |
Vitaliy Kulikov | 699d899 | 2011-03-10 13:43:35 -0600 | [diff] [blame] | 5408 | static void stac92hd8x_add_pin(struct hda_codec *codec, hda_nid_t nid) |
| 5409 | { |
| 5410 | struct sigmatel_spec *spec = codec->spec; |
| 5411 | unsigned int def_conf = snd_hda_codec_get_pincfg(codec, nid); |
| 5412 | int i; |
| 5413 | |
| 5414 | spec->auto_pin_nids[spec->auto_pin_cnt] = nid; |
| 5415 | spec->auto_pin_cnt++; |
| 5416 | |
| 5417 | if (get_defcfg_device(def_conf) == AC_JACK_MIC_IN && |
| 5418 | get_defcfg_connect(def_conf) != AC_JACK_PORT_NONE) { |
| 5419 | for (i = 0; i < ARRAY_SIZE(stac92hd83xxx_dmic_nids); i++) { |
| 5420 | if (nid == stac92hd83xxx_dmic_nids[i]) { |
| 5421 | spec->auto_dmic_nids[spec->auto_dmic_cnt] = nid; |
| 5422 | spec->auto_dmic_cnt++; |
| 5423 | } |
| 5424 | } |
| 5425 | } |
| 5426 | } |
| 5427 | |
| 5428 | static void stac92hd8x_add_adc(struct hda_codec *codec, hda_nid_t nid) |
| 5429 | { |
| 5430 | struct sigmatel_spec *spec = codec->spec; |
| 5431 | |
| 5432 | spec->auto_adc_nids[spec->auto_adc_cnt] = nid; |
| 5433 | spec->auto_adc_cnt++; |
| 5434 | } |
| 5435 | |
| 5436 | static void stac92hd8x_add_mux(struct hda_codec *codec, hda_nid_t nid) |
| 5437 | { |
| 5438 | int i, j; |
| 5439 | struct sigmatel_spec *spec = codec->spec; |
| 5440 | |
| 5441 | for (i = 0; i < spec->auto_adc_cnt; i++) { |
| 5442 | if (get_connection_index(codec, |
| 5443 | spec->auto_adc_nids[i], nid) >= 0) { |
| 5444 | /* mux and volume for adc_nids[i] */ |
| 5445 | if (!spec->auto_mux_nids[i]) { |
| 5446 | spec->auto_mux_nids[i] = nid; |
| 5447 | /* 92hd codecs capture volume is in mux */ |
| 5448 | spec->auto_capvols[i] = HDA_COMPOSE_AMP_VAL(nid, |
| 5449 | 3, 0, HDA_OUTPUT); |
| 5450 | } |
| 5451 | for (j = 0; j < spec->auto_dmic_cnt; j++) { |
| 5452 | if (get_connection_index(codec, nid, |
| 5453 | spec->auto_dmic_nids[j]) >= 0) { |
| 5454 | /* dmux for adc_nids[i] */ |
| 5455 | if (!spec->auto_dmux_nids[i]) |
| 5456 | spec->auto_dmux_nids[i] = nid; |
| 5457 | break; |
| 5458 | } |
| 5459 | } |
| 5460 | break; |
| 5461 | } |
| 5462 | } |
| 5463 | } |
| 5464 | |
| 5465 | static void stac92hd8x_fill_auto_spec(struct hda_codec *codec) |
| 5466 | { |
| 5467 | hda_nid_t nid, end_nid; |
| 5468 | unsigned int wid_caps, wid_type; |
| 5469 | struct sigmatel_spec *spec = codec->spec; |
| 5470 | |
| 5471 | end_nid = codec->start_nid + codec->num_nodes; |
| 5472 | |
| 5473 | for (nid = codec->start_nid; nid < end_nid; nid++) { |
| 5474 | wid_caps = get_wcaps(codec, nid); |
| 5475 | wid_type = get_wcaps_type(wid_caps); |
| 5476 | |
| 5477 | if (wid_type == AC_WID_PIN) |
| 5478 | stac92hd8x_add_pin(codec, nid); |
| 5479 | |
| 5480 | if (wid_type == AC_WID_AUD_IN && !(wid_caps & AC_WCAP_DIGITAL)) |
| 5481 | stac92hd8x_add_adc(codec, nid); |
| 5482 | } |
| 5483 | |
| 5484 | for (nid = codec->start_nid; nid < end_nid; nid++) { |
| 5485 | wid_caps = get_wcaps(codec, nid); |
| 5486 | wid_type = get_wcaps_type(wid_caps); |
| 5487 | |
| 5488 | if (wid_type == AC_WID_AUD_SEL) |
| 5489 | stac92hd8x_add_mux(codec, nid); |
| 5490 | } |
| 5491 | |
| 5492 | spec->pin_nids = spec->auto_pin_nids; |
| 5493 | spec->num_pins = spec->auto_pin_cnt; |
| 5494 | spec->adc_nids = spec->auto_adc_nids; |
| 5495 | spec->num_adcs = spec->auto_adc_cnt; |
| 5496 | spec->capvols = spec->auto_capvols; |
| 5497 | spec->capsws = spec->auto_capvols; |
| 5498 | spec->num_caps = spec->auto_adc_cnt; |
| 5499 | spec->mux_nids = spec->auto_mux_nids; |
| 5500 | spec->num_muxes = spec->auto_adc_cnt; |
| 5501 | spec->dmux_nids = spec->auto_dmux_nids; |
| 5502 | spec->num_dmuxes = spec->auto_adc_cnt; |
| 5503 | spec->dmic_nids = spec->auto_dmic_nids; |
| 5504 | spec->num_dmics = spec->auto_dmic_cnt; |
| 5505 | } |
| 5506 | |
Matthew Ranostay | d0513fc | 2008-07-27 10:30:30 +0200 | [diff] [blame] | 5507 | static int patch_stac92hd83xxx(struct hda_codec *codec) |
| 5508 | { |
| 5509 | struct sigmatel_spec *spec; |
| 5510 | int err; |
| 5511 | |
| 5512 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
| 5513 | if (spec == NULL) |
| 5514 | return -ENOMEM; |
| 5515 | |
Vitaliy Kulikov | cbbf50b | 2011-01-14 17:21:13 -0600 | [diff] [blame] | 5516 | if (hp_bnb2011_with_dock(codec)) { |
| 5517 | snd_hda_codec_set_pincfg(codec, 0xa, 0x2101201f); |
| 5518 | snd_hda_codec_set_pincfg(codec, 0xf, 0x2181205e); |
| 5519 | } |
| 5520 | |
Takashi Iwai | a252c81 | 2009-12-25 22:56:20 +0100 | [diff] [blame] | 5521 | codec->no_trigger_sense = 1; |
Matthew Ranostay | d0513fc | 2008-07-27 10:30:30 +0200 | [diff] [blame] | 5522 | codec->spec = spec; |
Vitaliy Kulikov | 699d899 | 2011-03-10 13:43:35 -0600 | [diff] [blame] | 5523 | |
| 5524 | stac92hd8x_fill_auto_spec(codec); |
| 5525 | |
Takashi Iwai | 1db7ccdb | 2010-12-03 15:19:14 +0100 | [diff] [blame] | 5526 | spec->linear_tone_beep = 0; |
Matthew Ranostay | 0ffa980 | 2008-09-08 11:20:05 -0400 | [diff] [blame] | 5527 | codec->slave_dig_outs = stac92hd83xxx_slave_dig_outs; |
Matthew Ranostay | d0513fc | 2008-07-27 10:30:30 +0200 | [diff] [blame] | 5528 | spec->digbeep_nid = 0x21; |
Matthew Ranostay | d0513fc | 2008-07-27 10:30:30 +0200 | [diff] [blame] | 5529 | spec->pwr_nids = stac92hd83xxx_pwr_nids; |
Matthew Ranostay | d0513fc | 2008-07-27 10:30:30 +0200 | [diff] [blame] | 5530 | spec->num_pwrs = ARRAY_SIZE(stac92hd83xxx_pwr_nids); |
Takashi Iwai | c21ca4a | 2008-12-19 09:26:08 +0100 | [diff] [blame] | 5531 | spec->multiout.dac_nids = spec->dac_nids; |
Matthew Ranostay | d0513fc | 2008-07-27 10:30:30 +0200 | [diff] [blame] | 5532 | spec->init = stac92hd83xxx_core_init; |
Takashi Iwai | 6479c63 | 2009-07-28 18:20:25 +0200 | [diff] [blame] | 5533 | |
Matthew Ranostay | d0513fc | 2008-07-27 10:30:30 +0200 | [diff] [blame] | 5534 | spec->board_config = snd_hda_check_board_config(codec, |
| 5535 | STAC_92HD83XXX_MODELS, |
| 5536 | stac92hd83xxx_models, |
| 5537 | stac92hd83xxx_cfg_tbl); |
Vitaliy Kulikov | 5556e14 | 2012-02-27 16:47:37 -0600 | [diff] [blame] | 5538 | /* check codec subsystem id if not found */ |
| 5539 | if (spec->board_config < 0) |
| 5540 | spec->board_config = |
| 5541 | snd_hda_check_board_codec_sid_config(codec, |
| 5542 | STAC_92HD83XXX_MODELS, stac92hd83xxx_models, |
| 5543 | stac92hd83xxx_codec_id_cfg_tbl); |
Matthew Ranostay | d0513fc | 2008-07-27 10:30:30 +0200 | [diff] [blame] | 5544 | again: |
Takashi Iwai | 330ee99 | 2009-02-20 14:33:36 +0100 | [diff] [blame] | 5545 | if (spec->board_config < 0) |
Takashi Iwai | 9a11f1a | 2009-07-28 16:01:20 +0200 | [diff] [blame] | 5546 | snd_printdd(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n", |
| 5547 | codec->chip_name); |
Takashi Iwai | 330ee99 | 2009-02-20 14:33:36 +0100 | [diff] [blame] | 5548 | else |
| 5549 | stac92xx_set_config_regs(codec, |
Takashi Iwai | af9f341 | 2008-11-18 10:38:56 +0100 | [diff] [blame] | 5550 | stac92hd83xxx_brd_tbl[spec->board_config]); |
Matthew Ranostay | d0513fc | 2008-07-27 10:30:30 +0200 | [diff] [blame] | 5551 | |
Takashi Iwai | b4e8187 | 2009-11-18 17:20:24 +0100 | [diff] [blame] | 5552 | codec->patch_ops = stac92xx_patch_ops; |
| 5553 | |
Vitaliy Kulikov | 5556e14 | 2012-02-27 16:47:37 -0600 | [diff] [blame] | 5554 | switch (spec->board_config) { |
| 5555 | case STAC_HP_ZEPHYR: |
| 5556 | spec->init = stac92hd83xxx_hp_zephyr_init; |
| 5557 | break; |
| 5558 | } |
| 5559 | |
Vitaliy Kulikov | 6a557c9 | 2011-12-12 17:35:13 -0600 | [diff] [blame] | 5560 | if (find_mute_led_cfg(codec, -1/*no default cfg*/)) |
Vitaliy Kulikov | e108c7b | 2010-01-28 19:21:07 +0100 | [diff] [blame] | 5561 | snd_printd("mute LED gpio %d polarity %d\n", |
| 5562 | spec->gpio_led, |
| 5563 | spec->gpio_led_polarity); |
| 5564 | |
Takashi Iwai | b4e8187 | 2009-11-18 17:20:24 +0100 | [diff] [blame] | 5565 | if (spec->gpio_led) { |
Takashi Iwai | f1a7374 | 2011-12-04 13:44:06 +0100 | [diff] [blame] | 5566 | if (!spec->vref_mute_led_nid) { |
Vitaliy Kulikov | 45eebda | 2011-07-26 16:56:20 -0500 | [diff] [blame] | 5567 | spec->gpio_mask |= spec->gpio_led; |
| 5568 | spec->gpio_dir |= spec->gpio_led; |
| 5569 | spec->gpio_data |= spec->gpio_led; |
| 5570 | } else { |
| 5571 | codec->patch_ops.set_power_state = |
| 5572 | stac92xx_set_power_state; |
Vitaliy Kulikov | 45eebda | 2011-07-26 16:56:20 -0500 | [diff] [blame] | 5573 | } |
Takashi Iwai | b4e8187 | 2009-11-18 17:20:24 +0100 | [diff] [blame] | 5574 | } |
Takashi Iwai | b4e8187 | 2009-11-18 17:20:24 +0100 | [diff] [blame] | 5575 | |
Charles Chin | 9009b0e | 2011-11-03 10:27:27 +0100 | [diff] [blame] | 5576 | err = stac92xx_parse_auto_config(codec); |
Matthew Ranostay | d0513fc | 2008-07-27 10:30:30 +0200 | [diff] [blame] | 5577 | if (!err) { |
| 5578 | if (spec->board_config < 0) { |
| 5579 | printk(KERN_WARNING "hda_codec: No auto-config is " |
| 5580 | "available, default to model=ref\n"); |
| 5581 | spec->board_config = STAC_92HD83XXX_REF; |
| 5582 | goto again; |
| 5583 | } |
| 5584 | err = -EINVAL; |
| 5585 | } |
| 5586 | |
| 5587 | if (err < 0) { |
| 5588 | stac92xx_free(codec); |
| 5589 | return err; |
| 5590 | } |
| 5591 | |
Takashi Iwai | 2d34e1b | 2008-11-28 14:35:16 +0100 | [diff] [blame] | 5592 | codec->proc_widget_hook = stac92hd_proc_hook; |
| 5593 | |
Matthew Ranostay | d0513fc | 2008-07-27 10:30:30 +0200 | [diff] [blame] | 5594 | return 0; |
| 5595 | } |
| 5596 | |
Herton Ronaldo Krzesinski | 6df703a | 2009-02-04 11:34:22 -0500 | [diff] [blame] | 5597 | static int stac92hd71bxx_connected_smuxes(struct hda_codec *codec, |
| 5598 | hda_nid_t dig0pin) |
| 5599 | { |
| 5600 | struct sigmatel_spec *spec = codec->spec; |
| 5601 | int idx; |
| 5602 | |
| 5603 | for (idx = 0; idx < spec->num_pins; idx++) |
| 5604 | if (spec->pin_nids[idx] == dig0pin) |
| 5605 | break; |
| 5606 | if ((idx + 2) >= spec->num_pins) |
| 5607 | return 0; |
| 5608 | |
| 5609 | /* dig1pin case */ |
Takashi Iwai | 330ee99 | 2009-02-20 14:33:36 +0100 | [diff] [blame] | 5610 | if (stac_get_defcfg_connect(codec, idx + 1) != AC_JACK_PORT_NONE) |
Herton Ronaldo Krzesinski | 6df703a | 2009-02-04 11:34:22 -0500 | [diff] [blame] | 5611 | return 2; |
| 5612 | |
| 5613 | /* dig0pin + dig2pin case */ |
Takashi Iwai | 330ee99 | 2009-02-20 14:33:36 +0100 | [diff] [blame] | 5614 | if (stac_get_defcfg_connect(codec, idx + 2) != AC_JACK_PORT_NONE) |
Herton Ronaldo Krzesinski | 6df703a | 2009-02-04 11:34:22 -0500 | [diff] [blame] | 5615 | return 2; |
Takashi Iwai | 330ee99 | 2009-02-20 14:33:36 +0100 | [diff] [blame] | 5616 | if (stac_get_defcfg_connect(codec, idx) != AC_JACK_PORT_NONE) |
Herton Ronaldo Krzesinski | 6df703a | 2009-02-04 11:34:22 -0500 | [diff] [blame] | 5617 | return 1; |
| 5618 | else |
| 5619 | return 0; |
| 5620 | } |
| 5621 | |
Takashi Iwai | 75d1aeb | 2009-12-22 11:56:32 +0100 | [diff] [blame] | 5622 | /* HP dv7 bass switch - GPIO5 */ |
| 5623 | #define stac_hp_bass_gpio_info snd_ctl_boolean_mono_info |
| 5624 | static int stac_hp_bass_gpio_get(struct snd_kcontrol *kcontrol, |
| 5625 | struct snd_ctl_elem_value *ucontrol) |
| 5626 | { |
| 5627 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 5628 | struct sigmatel_spec *spec = codec->spec; |
| 5629 | ucontrol->value.integer.value[0] = !!(spec->gpio_data & 0x20); |
| 5630 | return 0; |
| 5631 | } |
| 5632 | |
| 5633 | static int stac_hp_bass_gpio_put(struct snd_kcontrol *kcontrol, |
| 5634 | struct snd_ctl_elem_value *ucontrol) |
| 5635 | { |
| 5636 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 5637 | struct sigmatel_spec *spec = codec->spec; |
| 5638 | unsigned int gpio_data; |
| 5639 | |
| 5640 | gpio_data = (spec->gpio_data & ~0x20) | |
| 5641 | (ucontrol->value.integer.value[0] ? 0x20 : 0); |
| 5642 | if (gpio_data == spec->gpio_data) |
| 5643 | return 0; |
| 5644 | spec->gpio_data = gpio_data; |
| 5645 | stac_gpio_set(codec, spec->gpio_mask, spec->gpio_dir, spec->gpio_data); |
| 5646 | return 1; |
| 5647 | } |
| 5648 | |
Takashi Iwai | 2b63536 | 2011-05-02 12:33:43 +0200 | [diff] [blame] | 5649 | static const struct snd_kcontrol_new stac_hp_bass_sw_ctrl = { |
Takashi Iwai | 75d1aeb | 2009-12-22 11:56:32 +0100 | [diff] [blame] | 5650 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 5651 | .info = stac_hp_bass_gpio_info, |
| 5652 | .get = stac_hp_bass_gpio_get, |
| 5653 | .put = stac_hp_bass_gpio_put, |
| 5654 | }; |
| 5655 | |
| 5656 | static int stac_add_hp_bass_switch(struct hda_codec *codec) |
| 5657 | { |
| 5658 | struct sigmatel_spec *spec = codec->spec; |
| 5659 | |
| 5660 | if (!stac_control_new(spec, &stac_hp_bass_sw_ctrl, |
| 5661 | "Bass Speaker Playback Switch", 0)) |
| 5662 | return -ENOMEM; |
| 5663 | |
| 5664 | spec->gpio_mask |= 0x20; |
| 5665 | spec->gpio_dir |= 0x20; |
| 5666 | spec->gpio_data |= 0x20; |
| 5667 | return 0; |
| 5668 | } |
| 5669 | |
Matthew Ranostay | e035b84 | 2007-11-06 11:53:55 +0100 | [diff] [blame] | 5670 | static int patch_stac92hd71bxx(struct hda_codec *codec) |
| 5671 | { |
| 5672 | struct sigmatel_spec *spec; |
Takashi Iwai | 2b63536 | 2011-05-02 12:33:43 +0200 | [diff] [blame] | 5673 | const struct hda_verb *unmute_init = stac92hd71bxx_unmute_core_init; |
Vitaliy Kulikov | 5bdaaad | 2009-11-04 07:57:45 +0100 | [diff] [blame] | 5674 | unsigned int pin_cfg; |
Matthew Ranostay | e035b84 | 2007-11-06 11:53:55 +0100 | [diff] [blame] | 5675 | int err = 0; |
| 5676 | |
| 5677 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
| 5678 | if (spec == NULL) |
| 5679 | return -ENOMEM; |
| 5680 | |
Takashi Iwai | a252c81 | 2009-12-25 22:56:20 +0100 | [diff] [blame] | 5681 | codec->no_trigger_sense = 1; |
Matthew Ranostay | e035b84 | 2007-11-06 11:53:55 +0100 | [diff] [blame] | 5682 | codec->spec = spec; |
Daniel J Blueman | 1b0e372 | 2010-08-03 11:09:13 +0100 | [diff] [blame] | 5683 | spec->linear_tone_beep = 0; |
Matthew Ranostay | 8daaaa9 | 2008-08-15 07:45:52 +0200 | [diff] [blame] | 5684 | codec->patch_ops = stac92xx_patch_ops; |
Herton Ronaldo Krzesinski | 616f89e | 2009-02-04 11:23:19 -0500 | [diff] [blame] | 5685 | spec->num_pins = STAC92HD71BXX_NUM_PINS; |
| 5686 | switch (codec->vendor_id) { |
| 5687 | case 0x111d76b6: |
| 5688 | case 0x111d76b7: |
| 5689 | spec->pin_nids = stac92hd71bxx_pin_nids_4port; |
| 5690 | break; |
| 5691 | case 0x111d7603: |
| 5692 | case 0x111d7608: |
| 5693 | /* On 92HD75Bx 0x27 isn't a pin nid */ |
| 5694 | spec->num_pins--; |
| 5695 | /* fallthrough */ |
| 5696 | default: |
| 5697 | spec->pin_nids = stac92hd71bxx_pin_nids_6port; |
| 5698 | } |
Matthew Ranostay | aafc441 | 2008-06-13 18:04:33 +0200 | [diff] [blame] | 5699 | spec->num_pwrs = ARRAY_SIZE(stac92hd71bxx_pwr_nids); |
Matthew Ranostay | e035b84 | 2007-11-06 11:53:55 +0100 | [diff] [blame] | 5700 | spec->board_config = snd_hda_check_board_config(codec, |
| 5701 | STAC_92HD71BXX_MODELS, |
| 5702 | stac92hd71bxx_models, |
| 5703 | stac92hd71bxx_cfg_tbl); |
| 5704 | again: |
Takashi Iwai | 330ee99 | 2009-02-20 14:33:36 +0100 | [diff] [blame] | 5705 | if (spec->board_config < 0) |
Takashi Iwai | 9a11f1a | 2009-07-28 16:01:20 +0200 | [diff] [blame] | 5706 | snd_printdd(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n", |
| 5707 | codec->chip_name); |
Takashi Iwai | 330ee99 | 2009-02-20 14:33:36 +0100 | [diff] [blame] | 5708 | else |
| 5709 | stac92xx_set_config_regs(codec, |
Takashi Iwai | af9f341 | 2008-11-18 10:38:56 +0100 | [diff] [blame] | 5710 | stac92hd71bxx_brd_tbl[spec->board_config]); |
Matthew Ranostay | e035b84 | 2007-11-06 11:53:55 +0100 | [diff] [blame] | 5711 | |
Takashi Iwai | fc64b26 | 2009-09-14 15:33:01 +0200 | [diff] [blame] | 5712 | if (spec->board_config != STAC_92HD71BXX_REF) { |
Takashi Iwai | 41c3b64 | 2008-11-18 10:45:15 +0100 | [diff] [blame] | 5713 | /* GPIO0 = EAPD */ |
| 5714 | spec->gpio_mask = 0x01; |
| 5715 | spec->gpio_dir = 0x01; |
| 5716 | spec->gpio_data = 0x01; |
| 5717 | } |
| 5718 | |
Herton Ronaldo Krzesinski | 6df703a | 2009-02-04 11:34:22 -0500 | [diff] [blame] | 5719 | spec->dmic_nids = stac92hd71bxx_dmic_nids; |
| 5720 | spec->dmux_nids = stac92hd71bxx_dmux_nids; |
| 5721 | |
Takashi Iwai | 6479c63 | 2009-07-28 18:20:25 +0200 | [diff] [blame] | 5722 | spec->num_caps = STAC92HD71BXX_NUM_CAPS; |
| 5723 | spec->capvols = stac92hd71bxx_capvols; |
| 5724 | spec->capsws = stac92hd71bxx_capsws; |
| 5725 | |
Matthew Ranostay | 541eee8 | 2007-12-14 12:08:04 +0100 | [diff] [blame] | 5726 | switch (codec->vendor_id) { |
| 5727 | case 0x111d76b6: /* 4 Port without Analog Mixer */ |
| 5728 | case 0x111d76b7: |
Herton Ronaldo Krzesinski | 23c7b52 | 2009-02-08 19:51:28 -0200 | [diff] [blame] | 5729 | unmute_init++; |
| 5730 | /* fallthru */ |
Matthew Ranostay | 541eee8 | 2007-12-14 12:08:04 +0100 | [diff] [blame] | 5731 | case 0x111d76b4: /* 6 Port without Analog Mixer */ |
| 5732 | case 0x111d76b5: |
Matthew Ranostay | 541eee8 | 2007-12-14 12:08:04 +0100 | [diff] [blame] | 5733 | spec->init = stac92hd71bxx_core_init; |
Matthew Ranostay | 0ffa980 | 2008-09-08 11:20:05 -0400 | [diff] [blame] | 5734 | codec->slave_dig_outs = stac92hd71bxx_slave_dig_outs; |
Vitaliy Kulikov | ab5a6eb | 2010-09-08 09:00:17 +0200 | [diff] [blame] | 5735 | spec->num_dmics = stac92xx_connected_ports(codec, |
Herton Ronaldo Krzesinski | 6df703a | 2009-02-04 11:34:22 -0500 | [diff] [blame] | 5736 | stac92hd71bxx_dmic_nids, |
| 5737 | STAC92HD71BXX_NUM_DMICS); |
Matthew Ranostay | 541eee8 | 2007-12-14 12:08:04 +0100 | [diff] [blame] | 5738 | break; |
Matthew Ranostay | aafc441 | 2008-06-13 18:04:33 +0200 | [diff] [blame] | 5739 | case 0x111d7608: /* 5 Port with Analog Mixer */ |
Takashi Iwai | 8e5f262 | 2008-11-15 19:28:54 +0100 | [diff] [blame] | 5740 | switch (spec->board_config) { |
| 5741 | case STAC_HP_M4: |
Matthew Ranostay | 72474be | 2008-10-09 09:32:17 -0400 | [diff] [blame] | 5742 | /* Enable VREF power saving on GPIO1 detect */ |
Takashi Iwai | 3a93897 | 2011-10-28 01:16:55 +0200 | [diff] [blame] | 5743 | err = stac_add_event(codec, codec->afg, |
Takashi Iwai | c6e4c66 | 2008-11-25 11:58:19 +0100 | [diff] [blame] | 5744 | STAC_VREF_EVENT, 0x02); |
| 5745 | if (err < 0) |
| 5746 | return err; |
Takashi Iwai | c5d08bb | 2008-11-18 10:55:36 +0100 | [diff] [blame] | 5747 | snd_hda_codec_write_cache(codec, codec->afg, 0, |
Matthew Ranostay | 72474be | 2008-10-09 09:32:17 -0400 | [diff] [blame] | 5748 | AC_VERB_SET_GPIO_UNSOLICITED_RSP_MASK, 0x02); |
Takashi Iwai | 3a93897 | 2011-10-28 01:16:55 +0200 | [diff] [blame] | 5749 | snd_hda_jack_detect_enable(codec, codec->afg, 0); |
Matthew Ranostay | 72474be | 2008-10-09 09:32:17 -0400 | [diff] [blame] | 5750 | spec->gpio_mask |= 0x02; |
| 5751 | break; |
| 5752 | } |
Matthew Ranostay | 8daaaa9 | 2008-08-15 07:45:52 +0200 | [diff] [blame] | 5753 | if ((codec->revision_id & 0xf) == 0 || |
Takashi Iwai | 8c2f767 | 2008-12-01 11:54:35 +0100 | [diff] [blame] | 5754 | (codec->revision_id & 0xf) == 1) |
Matthew Ranostay | 8daaaa9 | 2008-08-15 07:45:52 +0200 | [diff] [blame] | 5755 | spec->stream_delay = 40; /* 40 milliseconds */ |
Matthew Ranostay | 8daaaa9 | 2008-08-15 07:45:52 +0200 | [diff] [blame] | 5756 | |
Matthew Ranostay | aafc441 | 2008-06-13 18:04:33 +0200 | [diff] [blame] | 5757 | /* disable VSW */ |
Takashi Iwai | 26a2798 | 2009-07-29 16:28:09 +0200 | [diff] [blame] | 5758 | spec->init = stac92hd71bxx_core_init; |
Matthew Ranostay | ca8d33f | 2009-01-26 09:33:52 -0500 | [diff] [blame] | 5759 | unmute_init++; |
Takashi Iwai | 330ee99 | 2009-02-20 14:33:36 +0100 | [diff] [blame] | 5760 | snd_hda_codec_set_pincfg(codec, 0x0f, 0x40f000f0); |
| 5761 | snd_hda_codec_set_pincfg(codec, 0x19, 0x40f000f3); |
Takashi Iwai | 2b63536 | 2011-05-02 12:33:43 +0200 | [diff] [blame] | 5762 | spec->dmic_nids = stac92hd71bxx_dmic_5port_nids; |
Vitaliy Kulikov | ab5a6eb | 2010-09-08 09:00:17 +0200 | [diff] [blame] | 5763 | spec->num_dmics = stac92xx_connected_ports(codec, |
Takashi Iwai | 2b63536 | 2011-05-02 12:33:43 +0200 | [diff] [blame] | 5764 | stac92hd71bxx_dmic_5port_nids, |
Herton Ronaldo Krzesinski | 6df703a | 2009-02-04 11:34:22 -0500 | [diff] [blame] | 5765 | STAC92HD71BXX_NUM_DMICS - 1); |
Matthew Ranostay | aafc441 | 2008-06-13 18:04:33 +0200 | [diff] [blame] | 5766 | break; |
| 5767 | case 0x111d7603: /* 6 Port with Analog Mixer */ |
Takashi Iwai | 8c2f767 | 2008-12-01 11:54:35 +0100 | [diff] [blame] | 5768 | if ((codec->revision_id & 0xf) == 1) |
Matthew Ranostay | 8daaaa9 | 2008-08-15 07:45:52 +0200 | [diff] [blame] | 5769 | spec->stream_delay = 40; /* 40 milliseconds */ |
Matthew Ranostay | 8daaaa9 | 2008-08-15 07:45:52 +0200 | [diff] [blame] | 5770 | |
Matthew Ranostay | aafc441 | 2008-06-13 18:04:33 +0200 | [diff] [blame] | 5771 | /* fallthru */ |
Matthew Ranostay | 541eee8 | 2007-12-14 12:08:04 +0100 | [diff] [blame] | 5772 | default: |
Takashi Iwai | 26a2798 | 2009-07-29 16:28:09 +0200 | [diff] [blame] | 5773 | spec->init = stac92hd71bxx_core_init; |
Matthew Ranostay | 0ffa980 | 2008-09-08 11:20:05 -0400 | [diff] [blame] | 5774 | codec->slave_dig_outs = stac92hd71bxx_slave_dig_outs; |
Vitaliy Kulikov | ab5a6eb | 2010-09-08 09:00:17 +0200 | [diff] [blame] | 5775 | spec->num_dmics = stac92xx_connected_ports(codec, |
Herton Ronaldo Krzesinski | 6df703a | 2009-02-04 11:34:22 -0500 | [diff] [blame] | 5776 | stac92hd71bxx_dmic_nids, |
| 5777 | STAC92HD71BXX_NUM_DMICS); |
Takashi Iwai | 5207e10 | 2009-07-30 13:09:08 +0200 | [diff] [blame] | 5778 | break; |
Matthew Ranostay | 541eee8 | 2007-12-14 12:08:04 +0100 | [diff] [blame] | 5779 | } |
| 5780 | |
Matthew Ranostay | ca8d33f | 2009-01-26 09:33:52 -0500 | [diff] [blame] | 5781 | if (get_wcaps(codec, 0xa) & AC_WCAP_IN_AMP) |
| 5782 | snd_hda_sequence_write_cache(codec, unmute_init); |
| 5783 | |
Takashi Iwai | d78d7a9 | 2009-03-02 14:26:25 +0100 | [diff] [blame] | 5784 | spec->aloopback_ctl = stac92hd71bxx_loopback; |
Matthew Ranostay | 4b33c76 | 2008-10-10 09:07:23 -0400 | [diff] [blame] | 5785 | spec->aloopback_mask = 0x50; |
Matthew Ranostay | 541eee8 | 2007-12-14 12:08:04 +0100 | [diff] [blame] | 5786 | spec->aloopback_shift = 0; |
| 5787 | |
Matthew Ranostay | 8daaaa9 | 2008-08-15 07:45:52 +0200 | [diff] [blame] | 5788 | spec->powerdown_adcs = 1; |
Matthew Ranostay | 1cd2224 | 2008-07-18 18:20:52 +0200 | [diff] [blame] | 5789 | spec->digbeep_nid = 0x26; |
Matthew Ranostay | e035b84 | 2007-11-06 11:53:55 +0100 | [diff] [blame] | 5790 | spec->mux_nids = stac92hd71bxx_mux_nids; |
| 5791 | spec->adc_nids = stac92hd71bxx_adc_nids; |
Matthew Ranostay | d973775 | 2008-09-07 12:03:41 +0200 | [diff] [blame] | 5792 | spec->smux_nids = stac92hd71bxx_smux_nids; |
Matthew Ranostay | aafc441 | 2008-06-13 18:04:33 +0200 | [diff] [blame] | 5793 | spec->pwr_nids = stac92hd71bxx_pwr_nids; |
Matthew Ranostay | e035b84 | 2007-11-06 11:53:55 +0100 | [diff] [blame] | 5794 | |
| 5795 | spec->num_muxes = ARRAY_SIZE(stac92hd71bxx_mux_nids); |
| 5796 | spec->num_adcs = ARRAY_SIZE(stac92hd71bxx_adc_nids); |
Takashi Iwai | 5207e10 | 2009-07-30 13:09:08 +0200 | [diff] [blame] | 5797 | spec->num_dmuxes = ARRAY_SIZE(stac92hd71bxx_dmux_nids); |
Herton Ronaldo Krzesinski | 6df703a | 2009-02-04 11:34:22 -0500 | [diff] [blame] | 5798 | spec->num_smuxes = stac92hd71bxx_connected_smuxes(codec, 0x1e); |
Matthew Ranostay | e035b84 | 2007-11-06 11:53:55 +0100 | [diff] [blame] | 5799 | |
Kunal Gangakhedkar | d38cce7 | 2010-01-15 21:01:47 +0530 | [diff] [blame] | 5800 | snd_printdd("Found board config: %d\n", spec->board_config); |
| 5801 | |
Matthew Ranostay | 6a14f58 | 2008-09-12 12:02:30 -0400 | [diff] [blame] | 5802 | switch (spec->board_config) { |
| 5803 | case STAC_HP_M4: |
Matthew Ranostay | 6a14f58 | 2008-09-12 12:02:30 -0400 | [diff] [blame] | 5804 | /* enable internal microphone */ |
Takashi Iwai | 330ee99 | 2009-02-20 14:33:36 +0100 | [diff] [blame] | 5805 | snd_hda_codec_set_pincfg(codec, 0x0e, 0x01813040); |
Matthew Ranostay | b9aea71 | 2008-10-09 08:37:28 -0400 | [diff] [blame] | 5806 | stac92xx_auto_set_pinctl(codec, 0x0e, |
| 5807 | AC_PINCTL_IN_EN | AC_PINCTL_VREF_80); |
Matthew Ranostay | 3a7abfd | 2008-11-20 21:21:43 -0500 | [diff] [blame] | 5808 | /* fallthru */ |
| 5809 | case STAC_DELL_M4_2: |
| 5810 | spec->num_dmics = 0; |
| 5811 | spec->num_smuxes = 0; |
| 5812 | spec->num_dmuxes = 0; |
| 5813 | break; |
| 5814 | case STAC_DELL_M4_1: |
| 5815 | case STAC_DELL_M4_3: |
| 5816 | spec->num_dmics = 1; |
| 5817 | spec->num_smuxes = 0; |
Takashi Iwai | ea18aa4 | 2009-02-27 17:36:33 +0100 | [diff] [blame] | 5818 | spec->num_dmuxes = 1; |
Matthew Ranostay | 6a14f58 | 2008-09-12 12:02:30 -0400 | [diff] [blame] | 5819 | break; |
James Gardiner | 514bf54 | 2009-05-03 04:00:44 -0400 | [diff] [blame] | 5820 | case STAC_HP_DV4_1222NR: |
| 5821 | spec->num_dmics = 1; |
| 5822 | /* I don't know if it needs 1 or 2 smuxes - will wait for |
| 5823 | * bug reports to fix if needed |
| 5824 | */ |
| 5825 | spec->num_smuxes = 1; |
| 5826 | spec->num_dmuxes = 1; |
James Gardiner | 514bf54 | 2009-05-03 04:00:44 -0400 | [diff] [blame] | 5827 | /* fallthrough */ |
Takashi Iwai | 2a6ce6e | 2010-05-12 10:16:20 +0200 | [diff] [blame] | 5828 | case STAC_HP_DV4: |
| 5829 | spec->gpio_led = 0x01; |
| 5830 | /* fallthrough */ |
Herton Ronaldo Krzesinski | e2ea57a | 2009-02-16 10:23:00 +0100 | [diff] [blame] | 5831 | case STAC_HP_DV5: |
Takashi Iwai | 330ee99 | 2009-02-20 14:33:36 +0100 | [diff] [blame] | 5832 | snd_hda_codec_set_pincfg(codec, 0x0d, 0x90170010); |
Herton Ronaldo Krzesinski | e2ea57a | 2009-02-16 10:23:00 +0100 | [diff] [blame] | 5833 | stac92xx_auto_set_pinctl(codec, 0x0d, AC_PINCTL_OUT_EN); |
Takashi Iwai | 6e34c03 | 2009-09-14 15:42:18 +0200 | [diff] [blame] | 5834 | /* HP dv6 gives the headphone pin as a line-out. Thus we |
| 5835 | * need to set hp_detect flag here to force to enable HP |
| 5836 | * detection. |
| 5837 | */ |
| 5838 | spec->hp_detect = 1; |
Herton Ronaldo Krzesinski | e2ea57a | 2009-02-16 10:23:00 +0100 | [diff] [blame] | 5839 | break; |
Christoph Plattner | ae6241f | 2009-03-08 23:19:05 +0100 | [diff] [blame] | 5840 | case STAC_HP_HDX: |
| 5841 | spec->num_dmics = 1; |
| 5842 | spec->num_dmuxes = 1; |
| 5843 | spec->num_smuxes = 1; |
Takashi Iwai | 26ebe0a | 2010-05-11 08:36:29 +0200 | [diff] [blame] | 5844 | spec->gpio_led = 0x08; |
Takashi Iwai | 86d190e | 2009-05-26 15:18:58 +0200 | [diff] [blame] | 5845 | break; |
| 5846 | } |
Christoph Plattner | 443e26d | 2009-03-10 00:05:56 +0100 | [diff] [blame] | 5847 | |
Vitaliy Kulikov | c357aab | 2009-12-11 07:51:54 +0100 | [diff] [blame] | 5848 | if (hp_blike_system(codec->subsystem_id)) { |
Vitaliy Kulikov | 5bdaaad | 2009-11-04 07:57:45 +0100 | [diff] [blame] | 5849 | pin_cfg = snd_hda_codec_get_pincfg(codec, 0x0f); |
| 5850 | if (get_defcfg_device(pin_cfg) == AC_JACK_LINE_OUT || |
| 5851 | get_defcfg_device(pin_cfg) == AC_JACK_SPEAKER || |
| 5852 | get_defcfg_device(pin_cfg) == AC_JACK_HP_OUT) { |
| 5853 | /* It was changed in the BIOS to just satisfy MS DTM. |
| 5854 | * Lets turn it back into slaved HP |
| 5855 | */ |
| 5856 | pin_cfg = (pin_cfg & (~AC_DEFCFG_DEVICE)) |
| 5857 | | (AC_JACK_HP_OUT << |
| 5858 | AC_DEFCFG_DEVICE_SHIFT); |
| 5859 | pin_cfg = (pin_cfg & (~(AC_DEFCFG_DEF_ASSOC |
| 5860 | | AC_DEFCFG_SEQUENCE))) |
| 5861 | | 0x1f; |
| 5862 | snd_hda_codec_set_pincfg(codec, 0x0f, pin_cfg); |
| 5863 | } |
| 5864 | } |
| 5865 | |
Vitaliy Kulikov | 6a557c9 | 2011-12-12 17:35:13 -0600 | [diff] [blame] | 5866 | if (find_mute_led_cfg(codec, 1)) |
Vitaliy Kulikov | c357aab | 2009-12-11 07:51:54 +0100 | [diff] [blame] | 5867 | snd_printd("mute LED gpio %d polarity %d\n", |
| 5868 | spec->gpio_led, |
| 5869 | spec->gpio_led_polarity); |
Vitaliy Kulikov | 5bdaaad | 2009-11-04 07:57:45 +0100 | [diff] [blame] | 5870 | |
Takashi Iwai | 86d190e | 2009-05-26 15:18:58 +0200 | [diff] [blame] | 5871 | if (spec->gpio_led) { |
Takashi Iwai | f1a7374 | 2011-12-04 13:44:06 +0100 | [diff] [blame] | 5872 | if (!spec->vref_mute_led_nid) { |
Vitaliy Kulikov | 45eebda | 2011-07-26 16:56:20 -0500 | [diff] [blame] | 5873 | spec->gpio_mask |= spec->gpio_led; |
| 5874 | spec->gpio_dir |= spec->gpio_led; |
| 5875 | spec->gpio_data |= spec->gpio_led; |
| 5876 | } else { |
| 5877 | codec->patch_ops.set_power_state = |
| 5878 | stac92xx_set_power_state; |
Vitaliy Kulikov | 45eebda | 2011-07-26 16:56:20 -0500 | [diff] [blame] | 5879 | } |
Takashi Iwai | 86d190e | 2009-05-26 15:18:58 +0200 | [diff] [blame] | 5880 | } |
Matthew Ranostay | 6a14f58 | 2008-09-12 12:02:30 -0400 | [diff] [blame] | 5881 | |
Takashi Iwai | c21ca4a | 2008-12-19 09:26:08 +0100 | [diff] [blame] | 5882 | spec->multiout.dac_nids = spec->dac_nids; |
Matthew Ranostay | e035b84 | 2007-11-06 11:53:55 +0100 | [diff] [blame] | 5883 | |
Charles Chin | 9009b0e | 2011-11-03 10:27:27 +0100 | [diff] [blame] | 5884 | err = stac92xx_parse_auto_config(codec); |
Matthew Ranostay | e035b84 | 2007-11-06 11:53:55 +0100 | [diff] [blame] | 5885 | if (!err) { |
| 5886 | if (spec->board_config < 0) { |
| 5887 | printk(KERN_WARNING "hda_codec: No auto-config is " |
| 5888 | "available, default to model=ref\n"); |
| 5889 | spec->board_config = STAC_92HD71BXX_REF; |
| 5890 | goto again; |
| 5891 | } |
| 5892 | err = -EINVAL; |
| 5893 | } |
| 5894 | |
| 5895 | if (err < 0) { |
| 5896 | stac92xx_free(codec); |
| 5897 | return err; |
| 5898 | } |
| 5899 | |
Takashi Iwai | 75d1aeb | 2009-12-22 11:56:32 +0100 | [diff] [blame] | 5900 | /* enable bass on HP dv7 */ |
Takashi Iwai | 2a6ce6e | 2010-05-12 10:16:20 +0200 | [diff] [blame] | 5901 | if (spec->board_config == STAC_HP_DV4 || |
| 5902 | spec->board_config == STAC_HP_DV5) { |
Takashi Iwai | 75d1aeb | 2009-12-22 11:56:32 +0100 | [diff] [blame] | 5903 | unsigned int cap; |
| 5904 | cap = snd_hda_param_read(codec, 0x1, AC_PAR_GPIO_CAP); |
| 5905 | cap &= AC_GPIO_IO_COUNT; |
| 5906 | if (cap >= 6) |
| 5907 | stac_add_hp_bass_switch(codec); |
| 5908 | } |
| 5909 | |
Takashi Iwai | 2d34e1b | 2008-11-28 14:35:16 +0100 | [diff] [blame] | 5910 | codec->proc_widget_hook = stac92hd7x_proc_hook; |
| 5911 | |
Matthew Ranostay | e035b84 | 2007-11-06 11:53:55 +0100 | [diff] [blame] | 5912 | return 0; |
Takashi Iwai | 86d190e | 2009-05-26 15:18:58 +0200 | [diff] [blame] | 5913 | } |
Matthew Ranostay | e035b84 | 2007-11-06 11:53:55 +0100 | [diff] [blame] | 5914 | |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 5915 | static int patch_stac922x(struct hda_codec *codec) |
| 5916 | { |
| 5917 | struct sigmatel_spec *spec; |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 5918 | int err; |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 5919 | |
Takashi Iwai | e560d8d | 2005-09-09 14:21:46 +0200 | [diff] [blame] | 5920 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 5921 | if (spec == NULL) |
| 5922 | return -ENOMEM; |
| 5923 | |
Takashi Iwai | a252c81 | 2009-12-25 22:56:20 +0100 | [diff] [blame] | 5924 | codec->no_trigger_sense = 1; |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 5925 | codec->spec = spec; |
Daniel J Blueman | 1b0e372 | 2010-08-03 11:09:13 +0100 | [diff] [blame] | 5926 | spec->linear_tone_beep = 1; |
Takashi Iwai | a4eed13 | 2007-07-06 18:17:04 +0200 | [diff] [blame] | 5927 | spec->num_pins = ARRAY_SIZE(stac922x_pin_nids); |
Richard Fish | 11b44bb | 2006-08-23 18:31:34 +0200 | [diff] [blame] | 5928 | spec->pin_nids = stac922x_pin_nids; |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 5929 | spec->board_config = snd_hda_check_board_config(codec, STAC_922X_MODELS, |
| 5930 | stac922x_models, |
| 5931 | stac922x_cfg_tbl); |
Nicolas Boichat | 536319a | 2008-07-21 22:18:01 +0800 | [diff] [blame] | 5932 | if (spec->board_config == STAC_INTEL_MAC_AUTO) { |
Matthew Ranostay | 4fe5195 | 2008-01-29 15:28:44 +0100 | [diff] [blame] | 5933 | spec->gpio_mask = spec->gpio_dir = 0x03; |
| 5934 | spec->gpio_data = 0x03; |
Takashi Iwai | 3fc24d8 | 2007-02-16 13:27:18 +0100 | [diff] [blame] | 5935 | /* Intel Macs have all same PCI SSID, so we need to check |
| 5936 | * codec SSID to distinguish the exact models |
| 5937 | */ |
Nicolas Boichat | 6f0778d | 2007-03-15 12:38:15 +0100 | [diff] [blame] | 5938 | printk(KERN_INFO "hda_codec: STAC922x, Apple subsys_id=%x\n", codec->subsystem_id); |
Takashi Iwai | 3fc24d8 | 2007-02-16 13:27:18 +0100 | [diff] [blame] | 5939 | switch (codec->subsystem_id) { |
Ivan N. Zlatev | 5d5d3bc | 2007-05-29 16:03:00 +0200 | [diff] [blame] | 5940 | |
| 5941 | case 0x106b0800: |
| 5942 | spec->board_config = STAC_INTEL_MAC_V1; |
Abhijit Bhopatkar | c45e20e | 2007-04-17 11:57:16 +0200 | [diff] [blame] | 5943 | break; |
Ivan N. Zlatev | 5d5d3bc | 2007-05-29 16:03:00 +0200 | [diff] [blame] | 5944 | case 0x106b0600: |
| 5945 | case 0x106b0700: |
| 5946 | spec->board_config = STAC_INTEL_MAC_V2; |
Nicolas Boichat | 6f0778d | 2007-03-15 12:38:15 +0100 | [diff] [blame] | 5947 | break; |
Ivan N. Zlatev | 5d5d3bc | 2007-05-29 16:03:00 +0200 | [diff] [blame] | 5948 | case 0x106b0e00: |
| 5949 | case 0x106b0f00: |
| 5950 | case 0x106b1600: |
| 5951 | case 0x106b1700: |
| 5952 | case 0x106b0200: |
| 5953 | case 0x106b1e00: |
| 5954 | spec->board_config = STAC_INTEL_MAC_V3; |
Takashi Iwai | 3fc24d8 | 2007-02-16 13:27:18 +0100 | [diff] [blame] | 5955 | break; |
Ivan N. Zlatev | 5d5d3bc | 2007-05-29 16:03:00 +0200 | [diff] [blame] | 5956 | case 0x106b1a00: |
| 5957 | case 0x00000100: |
| 5958 | spec->board_config = STAC_INTEL_MAC_V4; |
Sylvain FORET | f16928f | 2007-04-27 14:22:36 +0200 | [diff] [blame] | 5959 | break; |
Ivan N. Zlatev | 5d5d3bc | 2007-05-29 16:03:00 +0200 | [diff] [blame] | 5960 | case 0x106b0a00: |
| 5961 | case 0x106b2200: |
| 5962 | spec->board_config = STAC_INTEL_MAC_V5; |
Takashi Iwai | 0dae0f8 | 2007-05-21 12:41:29 +0200 | [diff] [blame] | 5963 | break; |
Nicolas Boichat | 536319a | 2008-07-21 22:18:01 +0800 | [diff] [blame] | 5964 | default: |
| 5965 | spec->board_config = STAC_INTEL_MAC_V3; |
| 5966 | break; |
Takashi Iwai | 3fc24d8 | 2007-02-16 13:27:18 +0100 | [diff] [blame] | 5967 | } |
| 5968 | } |
| 5969 | |
Takashi Iwai | 9e507ab | 2007-02-08 17:50:10 +0100 | [diff] [blame] | 5970 | again: |
Takashi Iwai | 330ee99 | 2009-02-20 14:33:36 +0100 | [diff] [blame] | 5971 | if (spec->board_config < 0) |
Takashi Iwai | 9a11f1a | 2009-07-28 16:01:20 +0200 | [diff] [blame] | 5972 | snd_printdd(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n", |
| 5973 | codec->chip_name); |
Takashi Iwai | 330ee99 | 2009-02-20 14:33:36 +0100 | [diff] [blame] | 5974 | else |
| 5975 | stac92xx_set_config_regs(codec, |
Takashi Iwai | af9f341 | 2008-11-18 10:38:56 +0100 | [diff] [blame] | 5976 | stac922x_brd_tbl[spec->board_config]); |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 5977 | |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 5978 | spec->adc_nids = stac922x_adc_nids; |
| 5979 | spec->mux_nids = stac922x_mux_nids; |
Takashi Iwai | 2549413 | 2007-03-12 12:36:16 +0100 | [diff] [blame] | 5980 | spec->num_muxes = ARRAY_SIZE(stac922x_mux_nids); |
Maxim Levitsky | 9e05b7a | 2007-09-03 15:31:02 +0200 | [diff] [blame] | 5981 | spec->num_adcs = ARRAY_SIZE(stac922x_adc_nids); |
Matt Porter | 8b65727 | 2006-10-26 17:12:59 +0200 | [diff] [blame] | 5982 | spec->num_dmics = 0; |
Matthew Ranostay | a64135a | 2008-01-10 16:55:06 +0100 | [diff] [blame] | 5983 | spec->num_pwrs = 0; |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 5984 | |
| 5985 | spec->init = stac922x_core_init; |
Takashi Iwai | 6479c63 | 2009-07-28 18:20:25 +0200 | [diff] [blame] | 5986 | |
| 5987 | spec->num_caps = STAC922X_NUM_CAPS; |
| 5988 | spec->capvols = stac922x_capvols; |
| 5989 | spec->capsws = stac922x_capsws; |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 5990 | |
| 5991 | spec->multiout.dac_nids = spec->dac_nids; |
Takashi Iwai | 19039bd | 2006-06-28 15:52:16 +0200 | [diff] [blame] | 5992 | |
Charles Chin | 9009b0e | 2011-11-03 10:27:27 +0100 | [diff] [blame] | 5993 | err = stac92xx_parse_auto_config(codec); |
Takashi Iwai | 9e507ab | 2007-02-08 17:50:10 +0100 | [diff] [blame] | 5994 | if (!err) { |
| 5995 | if (spec->board_config < 0) { |
| 5996 | printk(KERN_WARNING "hda_codec: No auto-config is " |
| 5997 | "available, default to model=ref\n"); |
| 5998 | spec->board_config = STAC_D945_REF; |
| 5999 | goto again; |
| 6000 | } |
| 6001 | err = -EINVAL; |
| 6002 | } |
Matt Porter | 3cc08dc | 2006-01-23 15:27:49 +0100 | [diff] [blame] | 6003 | if (err < 0) { |
| 6004 | stac92xx_free(codec); |
| 6005 | return err; |
| 6006 | } |
| 6007 | |
| 6008 | codec->patch_ops = stac92xx_patch_ops; |
| 6009 | |
Takashi Iwai | 807a4636 | 2007-05-29 19:01:37 +0200 | [diff] [blame] | 6010 | /* Fix Mux capture level; max to 2 */ |
| 6011 | snd_hda_override_amp_caps(codec, 0x12, HDA_OUTPUT, |
| 6012 | (0 << AC_AMPCAP_OFFSET_SHIFT) | |
| 6013 | (2 << AC_AMPCAP_NUM_STEPS_SHIFT) | |
| 6014 | (0x27 << AC_AMPCAP_STEP_SIZE_SHIFT) | |
| 6015 | (0 << AC_AMPCAP_MUTE_SHIFT)); |
| 6016 | |
Matt Porter | 3cc08dc | 2006-01-23 15:27:49 +0100 | [diff] [blame] | 6017 | return 0; |
| 6018 | } |
| 6019 | |
| 6020 | static int patch_stac927x(struct hda_codec *codec) |
| 6021 | { |
| 6022 | struct sigmatel_spec *spec; |
| 6023 | int err; |
| 6024 | |
| 6025 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
| 6026 | if (spec == NULL) |
| 6027 | return -ENOMEM; |
| 6028 | |
Takashi Iwai | a252c81 | 2009-12-25 22:56:20 +0100 | [diff] [blame] | 6029 | codec->no_trigger_sense = 1; |
Matt Porter | 3cc08dc | 2006-01-23 15:27:49 +0100 | [diff] [blame] | 6030 | codec->spec = spec; |
Daniel J Blueman | 1b0e372 | 2010-08-03 11:09:13 +0100 | [diff] [blame] | 6031 | spec->linear_tone_beep = 1; |
Matthew Ranostay | 45c1d85 | 2009-02-04 17:49:41 -0500 | [diff] [blame] | 6032 | codec->slave_dig_outs = stac927x_slave_dig_outs; |
Takashi Iwai | a4eed13 | 2007-07-06 18:17:04 +0200 | [diff] [blame] | 6033 | spec->num_pins = ARRAY_SIZE(stac927x_pin_nids); |
Richard Fish | 11b44bb | 2006-08-23 18:31:34 +0200 | [diff] [blame] | 6034 | spec->pin_nids = stac927x_pin_nids; |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 6035 | spec->board_config = snd_hda_check_board_config(codec, STAC_927X_MODELS, |
| 6036 | stac927x_models, |
| 6037 | stac927x_cfg_tbl); |
Takashi Iwai | 9e507ab | 2007-02-08 17:50:10 +0100 | [diff] [blame] | 6038 | again: |
Takashi Iwai | 330ee99 | 2009-02-20 14:33:36 +0100 | [diff] [blame] | 6039 | if (spec->board_config < 0) |
Takashi Iwai | 9a11f1a | 2009-07-28 16:01:20 +0200 | [diff] [blame] | 6040 | snd_printdd(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n", |
| 6041 | codec->chip_name); |
Takashi Iwai | 330ee99 | 2009-02-20 14:33:36 +0100 | [diff] [blame] | 6042 | else |
| 6043 | stac92xx_set_config_regs(codec, |
Takashi Iwai | af9f341 | 2008-11-18 10:38:56 +0100 | [diff] [blame] | 6044 | stac927x_brd_tbl[spec->board_config]); |
Matt Porter | 3cc08dc | 2006-01-23 15:27:49 +0100 | [diff] [blame] | 6045 | |
Matthew Ranostay | 1cd2224 | 2008-07-18 18:20:52 +0200 | [diff] [blame] | 6046 | spec->digbeep_nid = 0x23; |
Matthew Ranostay | 8e9068b | 2007-12-17 11:58:13 +0100 | [diff] [blame] | 6047 | spec->adc_nids = stac927x_adc_nids; |
| 6048 | spec->num_adcs = ARRAY_SIZE(stac927x_adc_nids); |
| 6049 | spec->mux_nids = stac927x_mux_nids; |
| 6050 | spec->num_muxes = ARRAY_SIZE(stac927x_mux_nids); |
Matthew Ranostay | d973775 | 2008-09-07 12:03:41 +0200 | [diff] [blame] | 6051 | spec->smux_nids = stac927x_smux_nids; |
| 6052 | spec->num_smuxes = ARRAY_SIZE(stac927x_smux_nids); |
Matthew Ranostay | 6597363 | 2008-09-16 10:39:37 -0400 | [diff] [blame] | 6053 | spec->spdif_labels = stac927x_spdif_labels; |
Matthew Ranostay | b76c850 | 2008-02-06 14:49:44 +0100 | [diff] [blame] | 6054 | spec->dac_list = stac927x_dac_nids; |
Matthew Ranostay | 8e9068b | 2007-12-17 11:58:13 +0100 | [diff] [blame] | 6055 | spec->multiout.dac_nids = spec->dac_nids; |
| 6056 | |
Takashi Iwai | af6ee30 | 2009-09-14 15:03:12 +0200 | [diff] [blame] | 6057 | if (spec->board_config != STAC_D965_REF) { |
| 6058 | /* GPIO0 High = Enable EAPD */ |
| 6059 | spec->eapd_mask = spec->gpio_mask = 0x01; |
| 6060 | spec->gpio_dir = spec->gpio_data = 0x01; |
| 6061 | } |
| 6062 | |
Tobin Davis | 81d3dbd | 2006-08-22 19:44:45 +0200 | [diff] [blame] | 6063 | switch (spec->board_config) { |
Tobin Davis | 93ed150 | 2006-09-01 21:03:12 +0200 | [diff] [blame] | 6064 | case STAC_D965_3ST: |
Matthew Ranostay | 8e9068b | 2007-12-17 11:58:13 +0100 | [diff] [blame] | 6065 | case STAC_D965_5ST: |
| 6066 | /* GPIO0 High = Enable EAPD */ |
Matthew Ranostay | 8e9068b | 2007-12-17 11:58:13 +0100 | [diff] [blame] | 6067 | spec->num_dmics = 0; |
Tobin Davis | 93ed150 | 2006-09-01 21:03:12 +0200 | [diff] [blame] | 6068 | spec->init = d965_core_init; |
Tobin Davis | 81d3dbd | 2006-08-22 19:44:45 +0200 | [diff] [blame] | 6069 | break; |
Matthew Ranostay | 8e9068b | 2007-12-17 11:58:13 +0100 | [diff] [blame] | 6070 | case STAC_DELL_BIOS: |
Matthew Ranostay | 780c8be | 2008-04-14 13:32:27 +0200 | [diff] [blame] | 6071 | switch (codec->subsystem_id) { |
| 6072 | case 0x10280209: |
| 6073 | case 0x1028022e: |
| 6074 | /* correct the device field to SPDIF out */ |
Takashi Iwai | 330ee99 | 2009-02-20 14:33:36 +0100 | [diff] [blame] | 6075 | snd_hda_codec_set_pincfg(codec, 0x21, 0x01442070); |
Matthew Ranostay | 780c8be | 2008-04-14 13:32:27 +0200 | [diff] [blame] | 6076 | break; |
Takashi Iwai | 86d190e | 2009-05-26 15:18:58 +0200 | [diff] [blame] | 6077 | } |
Matthew Ranostay | 03d7ca1 | 2008-02-21 07:51:46 +0100 | [diff] [blame] | 6078 | /* configure the analog microphone on some laptops */ |
Takashi Iwai | 330ee99 | 2009-02-20 14:33:36 +0100 | [diff] [blame] | 6079 | snd_hda_codec_set_pincfg(codec, 0x0c, 0x90a79130); |
Matthew Ranostay | 2f32d90 | 2008-01-10 13:06:26 +0100 | [diff] [blame] | 6080 | /* correct the front output jack as a hp out */ |
Takashi Iwai | 330ee99 | 2009-02-20 14:33:36 +0100 | [diff] [blame] | 6081 | snd_hda_codec_set_pincfg(codec, 0x0f, 0x0227011f); |
Matthew Ranostay | c481fca | 2008-01-07 12:18:28 +0100 | [diff] [blame] | 6082 | /* correct the front input jack as a mic */ |
Takashi Iwai | 330ee99 | 2009-02-20 14:33:36 +0100 | [diff] [blame] | 6083 | snd_hda_codec_set_pincfg(codec, 0x0e, 0x02a79130); |
Matthew Ranostay | c481fca | 2008-01-07 12:18:28 +0100 | [diff] [blame] | 6084 | /* fallthru */ |
Matthew Ranostay | 8e9068b | 2007-12-17 11:58:13 +0100 | [diff] [blame] | 6085 | case STAC_DELL_3ST: |
Takashi Iwai | af6ee30 | 2009-09-14 15:03:12 +0200 | [diff] [blame] | 6086 | if (codec->subsystem_id != 0x1028022f) { |
| 6087 | /* GPIO2 High = Enable EAPD */ |
| 6088 | spec->eapd_mask = spec->gpio_mask = 0x04; |
| 6089 | spec->gpio_dir = spec->gpio_data = 0x04; |
| 6090 | } |
Matthew Ranostay | 8e9068b | 2007-12-17 11:58:13 +0100 | [diff] [blame] | 6091 | spec->dmic_nids = stac927x_dmic_nids; |
| 6092 | spec->num_dmics = STAC927X_NUM_DMICS; |
| 6093 | |
Takashi Iwai | ccca7cd | 2009-10-13 15:32:21 +0200 | [diff] [blame] | 6094 | spec->init = dell_3st_core_init; |
Matthew Ranostay | 8e9068b | 2007-12-17 11:58:13 +0100 | [diff] [blame] | 6095 | spec->dmux_nids = stac927x_dmux_nids; |
Takashi Iwai | 1697055e | 2007-12-18 18:05:52 +0100 | [diff] [blame] | 6096 | spec->num_dmuxes = ARRAY_SIZE(stac927x_dmux_nids); |
Tobin Davis | 81d3dbd | 2006-08-22 19:44:45 +0200 | [diff] [blame] | 6097 | break; |
Takashi Iwai | 5493053 | 2009-10-11 17:38:29 +0200 | [diff] [blame] | 6098 | case STAC_927X_VOLKNOB: |
| 6099 | spec->num_dmics = 0; |
| 6100 | spec->init = stac927x_volknob_core_init; |
| 6101 | break; |
Tobin Davis | 81d3dbd | 2006-08-22 19:44:45 +0200 | [diff] [blame] | 6102 | default: |
Matthew Ranostay | 8e9068b | 2007-12-17 11:58:13 +0100 | [diff] [blame] | 6103 | spec->num_dmics = 0; |
Tobin Davis | 81d3dbd | 2006-08-22 19:44:45 +0200 | [diff] [blame] | 6104 | spec->init = stac927x_core_init; |
Takashi Iwai | af6ee30 | 2009-09-14 15:03:12 +0200 | [diff] [blame] | 6105 | break; |
Tobin Davis | 81d3dbd | 2006-08-22 19:44:45 +0200 | [diff] [blame] | 6106 | } |
Matt Porter | 3cc08dc | 2006-01-23 15:27:49 +0100 | [diff] [blame] | 6107 | |
Takashi Iwai | 6479c63 | 2009-07-28 18:20:25 +0200 | [diff] [blame] | 6108 | spec->num_caps = STAC927X_NUM_CAPS; |
| 6109 | spec->capvols = stac927x_capvols; |
| 6110 | spec->capsws = stac927x_capsws; |
| 6111 | |
Matthew Ranostay | a64135a | 2008-01-10 16:55:06 +0100 | [diff] [blame] | 6112 | spec->num_pwrs = 0; |
Takashi Iwai | d78d7a9 | 2009-03-02 14:26:25 +0100 | [diff] [blame] | 6113 | spec->aloopback_ctl = stac927x_loopback; |
Matthew Ranostay | e1f0d66 | 2007-12-13 17:47:21 +0100 | [diff] [blame] | 6114 | spec->aloopback_mask = 0x40; |
| 6115 | spec->aloopback_shift = 0; |
Matthew Ranostay | c0cea0d | 2008-11-16 11:42:34 -0500 | [diff] [blame] | 6116 | spec->eapd_switch = 1; |
Matthew Ranostay | 8e9068b | 2007-12-17 11:58:13 +0100 | [diff] [blame] | 6117 | |
Charles Chin | 9009b0e | 2011-11-03 10:27:27 +0100 | [diff] [blame] | 6118 | err = stac92xx_parse_auto_config(codec); |
Takashi Iwai | 9e507ab | 2007-02-08 17:50:10 +0100 | [diff] [blame] | 6119 | if (!err) { |
| 6120 | if (spec->board_config < 0) { |
| 6121 | printk(KERN_WARNING "hda_codec: No auto-config is " |
| 6122 | "available, default to model=ref\n"); |
| 6123 | spec->board_config = STAC_D965_REF; |
| 6124 | goto again; |
| 6125 | } |
| 6126 | err = -EINVAL; |
| 6127 | } |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 6128 | if (err < 0) { |
| 6129 | stac92xx_free(codec); |
| 6130 | return err; |
| 6131 | } |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 6132 | |
| 6133 | codec->patch_ops = stac92xx_patch_ops; |
| 6134 | |
Takashi Iwai | 2d34e1b | 2008-11-28 14:35:16 +0100 | [diff] [blame] | 6135 | codec->proc_widget_hook = stac927x_proc_hook; |
| 6136 | |
Takashi Iwai | 5298765 | 2008-01-16 16:09:47 +0100 | [diff] [blame] | 6137 | /* |
| 6138 | * !!FIXME!! |
| 6139 | * The STAC927x seem to require fairly long delays for certain |
| 6140 | * command sequences. With too short delays (even if the answer |
| 6141 | * is set to RIRB properly), it results in the silence output |
| 6142 | * on some hardwares like Dell. |
| 6143 | * |
| 6144 | * The below flag enables the longer delay (see get_response |
| 6145 | * in hda_intel.c). |
| 6146 | */ |
| 6147 | codec->bus->needs_damn_long_delay = 1; |
| 6148 | |
Takashi Iwai | e28d832 | 2008-12-17 13:48:29 +0100 | [diff] [blame] | 6149 | /* no jack detecion for ref-no-jd model */ |
| 6150 | if (spec->board_config == STAC_D965_REF_NO_JD) |
| 6151 | spec->hp_detect = 0; |
| 6152 | |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 6153 | return 0; |
| 6154 | } |
| 6155 | |
Matt Porter | f3302a5 | 2006-07-31 12:49:34 +0200 | [diff] [blame] | 6156 | static int patch_stac9205(struct hda_codec *codec) |
| 6157 | { |
| 6158 | struct sigmatel_spec *spec; |
Takashi Iwai | 8259980 | 2007-07-31 15:56:24 +0200 | [diff] [blame] | 6159 | int err; |
Matt Porter | f3302a5 | 2006-07-31 12:49:34 +0200 | [diff] [blame] | 6160 | |
| 6161 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
| 6162 | if (spec == NULL) |
| 6163 | return -ENOMEM; |
| 6164 | |
Takashi Iwai | a252c81 | 2009-12-25 22:56:20 +0100 | [diff] [blame] | 6165 | codec->no_trigger_sense = 1; |
Matt Porter | f3302a5 | 2006-07-31 12:49:34 +0200 | [diff] [blame] | 6166 | codec->spec = spec; |
Daniel J Blueman | 1b0e372 | 2010-08-03 11:09:13 +0100 | [diff] [blame] | 6167 | spec->linear_tone_beep = 1; |
Takashi Iwai | a4eed13 | 2007-07-06 18:17:04 +0200 | [diff] [blame] | 6168 | spec->num_pins = ARRAY_SIZE(stac9205_pin_nids); |
Richard Fish | 11b44bb | 2006-08-23 18:31:34 +0200 | [diff] [blame] | 6169 | spec->pin_nids = stac9205_pin_nids; |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 6170 | spec->board_config = snd_hda_check_board_config(codec, STAC_9205_MODELS, |
| 6171 | stac9205_models, |
| 6172 | stac9205_cfg_tbl); |
Takashi Iwai | 9e507ab | 2007-02-08 17:50:10 +0100 | [diff] [blame] | 6173 | again: |
Takashi Iwai | 330ee99 | 2009-02-20 14:33:36 +0100 | [diff] [blame] | 6174 | if (spec->board_config < 0) |
Takashi Iwai | 9a11f1a | 2009-07-28 16:01:20 +0200 | [diff] [blame] | 6175 | snd_printdd(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n", |
| 6176 | codec->chip_name); |
Takashi Iwai | 330ee99 | 2009-02-20 14:33:36 +0100 | [diff] [blame] | 6177 | else |
| 6178 | stac92xx_set_config_regs(codec, |
Takashi Iwai | af9f341 | 2008-11-18 10:38:56 +0100 | [diff] [blame] | 6179 | stac9205_brd_tbl[spec->board_config]); |
Matt Porter | f3302a5 | 2006-07-31 12:49:34 +0200 | [diff] [blame] | 6180 | |
Matthew Ranostay | 1cd2224 | 2008-07-18 18:20:52 +0200 | [diff] [blame] | 6181 | spec->digbeep_nid = 0x23; |
Matt Porter | f3302a5 | 2006-07-31 12:49:34 +0200 | [diff] [blame] | 6182 | spec->adc_nids = stac9205_adc_nids; |
Maxim Levitsky | 9e05b7a | 2007-09-03 15:31:02 +0200 | [diff] [blame] | 6183 | spec->num_adcs = ARRAY_SIZE(stac9205_adc_nids); |
Matt Porter | f3302a5 | 2006-07-31 12:49:34 +0200 | [diff] [blame] | 6184 | spec->mux_nids = stac9205_mux_nids; |
Takashi Iwai | 2549413 | 2007-03-12 12:36:16 +0100 | [diff] [blame] | 6185 | spec->num_muxes = ARRAY_SIZE(stac9205_mux_nids); |
Matthew Ranostay | d973775 | 2008-09-07 12:03:41 +0200 | [diff] [blame] | 6186 | spec->smux_nids = stac9205_smux_nids; |
| 6187 | spec->num_smuxes = ARRAY_SIZE(stac9205_smux_nids); |
Matt Porter | 8b65727 | 2006-10-26 17:12:59 +0200 | [diff] [blame] | 6188 | spec->dmic_nids = stac9205_dmic_nids; |
Takashi Iwai | f6e9852 | 2007-10-16 14:27:04 +0200 | [diff] [blame] | 6189 | spec->num_dmics = STAC9205_NUM_DMICS; |
Matthew Ranostay | e1f0d66 | 2007-12-13 17:47:21 +0100 | [diff] [blame] | 6190 | spec->dmux_nids = stac9205_dmux_nids; |
Takashi Iwai | 1697055e | 2007-12-18 18:05:52 +0100 | [diff] [blame] | 6191 | spec->num_dmuxes = ARRAY_SIZE(stac9205_dmux_nids); |
Matthew Ranostay | a64135a | 2008-01-10 16:55:06 +0100 | [diff] [blame] | 6192 | spec->num_pwrs = 0; |
Matt Porter | f3302a5 | 2006-07-31 12:49:34 +0200 | [diff] [blame] | 6193 | |
| 6194 | spec->init = stac9205_core_init; |
Takashi Iwai | d78d7a9 | 2009-03-02 14:26:25 +0100 | [diff] [blame] | 6195 | spec->aloopback_ctl = stac9205_loopback; |
Matt Porter | f3302a5 | 2006-07-31 12:49:34 +0200 | [diff] [blame] | 6196 | |
Takashi Iwai | 6479c63 | 2009-07-28 18:20:25 +0200 | [diff] [blame] | 6197 | spec->num_caps = STAC9205_NUM_CAPS; |
| 6198 | spec->capvols = stac9205_capvols; |
| 6199 | spec->capsws = stac9205_capsws; |
| 6200 | |
Matthew Ranostay | e1f0d66 | 2007-12-13 17:47:21 +0100 | [diff] [blame] | 6201 | spec->aloopback_mask = 0x40; |
| 6202 | spec->aloopback_shift = 0; |
Takashi Iwai | d9a4268 | 2009-01-22 17:40:18 +0100 | [diff] [blame] | 6203 | /* Turn on/off EAPD per HP plugging */ |
| 6204 | if (spec->board_config != STAC_9205_EAPD) |
| 6205 | spec->eapd_switch = 1; |
Matt Porter | f3302a5 | 2006-07-31 12:49:34 +0200 | [diff] [blame] | 6206 | spec->multiout.dac_nids = spec->dac_nids; |
Matthew Ranostay | 87d4836 | 2007-07-17 11:52:24 +0200 | [diff] [blame] | 6207 | |
Tobin Davis | ae0a8ed | 2007-08-13 15:50:29 +0200 | [diff] [blame] | 6208 | switch (spec->board_config){ |
Tobin Davis | ae0a8ed | 2007-08-13 15:50:29 +0200 | [diff] [blame] | 6209 | case STAC_9205_DELL_M43: |
Matthew Ranostay | 87d4836 | 2007-07-17 11:52:24 +0200 | [diff] [blame] | 6210 | /* Enable SPDIF in/out */ |
Takashi Iwai | 330ee99 | 2009-02-20 14:33:36 +0100 | [diff] [blame] | 6211 | snd_hda_codec_set_pincfg(codec, 0x1f, 0x01441030); |
| 6212 | snd_hda_codec_set_pincfg(codec, 0x20, 0x1c410030); |
Matt Porter | 3338240 | 2006-12-18 13:17:28 +0100 | [diff] [blame] | 6213 | |
Matthew Ranostay | 4fe5195 | 2008-01-29 15:28:44 +0100 | [diff] [blame] | 6214 | /* Enable unsol response for GPIO4/Dock HP connection */ |
Takashi Iwai | 3a93897 | 2011-10-28 01:16:55 +0200 | [diff] [blame] | 6215 | err = stac_add_event(codec, codec->afg, STAC_VREF_EVENT, 0x01); |
Takashi Iwai | c6e4c66 | 2008-11-25 11:58:19 +0100 | [diff] [blame] | 6216 | if (err < 0) |
| 6217 | return err; |
Takashi Iwai | c5d08bb | 2008-11-18 10:55:36 +0100 | [diff] [blame] | 6218 | snd_hda_codec_write_cache(codec, codec->afg, 0, |
Matthew Ranostay | 4fe5195 | 2008-01-29 15:28:44 +0100 | [diff] [blame] | 6219 | AC_VERB_SET_GPIO_UNSOLICITED_RSP_MASK, 0x10); |
Takashi Iwai | 3a93897 | 2011-10-28 01:16:55 +0200 | [diff] [blame] | 6220 | snd_hda_jack_detect_enable(codec, codec->afg, 0); |
Matthew Ranostay | 4fe5195 | 2008-01-29 15:28:44 +0100 | [diff] [blame] | 6221 | |
| 6222 | spec->gpio_dir = 0x0b; |
Matthew Ranostay | 0fc9dec | 2008-04-14 13:32:54 +0200 | [diff] [blame] | 6223 | spec->eapd_mask = 0x01; |
Matthew Ranostay | 4fe5195 | 2008-01-29 15:28:44 +0100 | [diff] [blame] | 6224 | spec->gpio_mask = 0x1b; |
| 6225 | spec->gpio_mute = 0x10; |
Matthew Ranostay | e2e7d62 | 2008-01-24 15:32:15 +0100 | [diff] [blame] | 6226 | /* GPIO0 High = EAPD, GPIO1 Low = Headphone Mute, |
Matthew Ranostay | 4fe5195 | 2008-01-29 15:28:44 +0100 | [diff] [blame] | 6227 | * GPIO3 Low = DRM |
Matthew Ranostay | 87d4836 | 2007-07-17 11:52:24 +0200 | [diff] [blame] | 6228 | */ |
Matthew Ranostay | 4fe5195 | 2008-01-29 15:28:44 +0100 | [diff] [blame] | 6229 | spec->gpio_data = 0x01; |
Tobin Davis | ae0a8ed | 2007-08-13 15:50:29 +0200 | [diff] [blame] | 6230 | break; |
Matthew Ranostay | b2c4f4d | 2008-09-26 10:06:40 -0400 | [diff] [blame] | 6231 | case STAC_9205_REF: |
| 6232 | /* SPDIF-In enabled */ |
| 6233 | break; |
Tobin Davis | ae0a8ed | 2007-08-13 15:50:29 +0200 | [diff] [blame] | 6234 | default: |
| 6235 | /* GPIO0 High = EAPD */ |
Matthew Ranostay | 0fc9dec | 2008-04-14 13:32:54 +0200 | [diff] [blame] | 6236 | spec->eapd_mask = spec->gpio_mask = spec->gpio_dir = 0x1; |
Matthew Ranostay | 4fe5195 | 2008-01-29 15:28:44 +0100 | [diff] [blame] | 6237 | spec->gpio_data = 0x01; |
Tobin Davis | ae0a8ed | 2007-08-13 15:50:29 +0200 | [diff] [blame] | 6238 | break; |
| 6239 | } |
Matthew Ranostay | 87d4836 | 2007-07-17 11:52:24 +0200 | [diff] [blame] | 6240 | |
Charles Chin | 9009b0e | 2011-11-03 10:27:27 +0100 | [diff] [blame] | 6241 | err = stac92xx_parse_auto_config(codec); |
Takashi Iwai | 9e507ab | 2007-02-08 17:50:10 +0100 | [diff] [blame] | 6242 | if (!err) { |
| 6243 | if (spec->board_config < 0) { |
| 6244 | printk(KERN_WARNING "hda_codec: No auto-config is " |
| 6245 | "available, default to model=ref\n"); |
| 6246 | spec->board_config = STAC_9205_REF; |
| 6247 | goto again; |
| 6248 | } |
| 6249 | err = -EINVAL; |
| 6250 | } |
Matt Porter | f3302a5 | 2006-07-31 12:49:34 +0200 | [diff] [blame] | 6251 | if (err < 0) { |
| 6252 | stac92xx_free(codec); |
| 6253 | return err; |
| 6254 | } |
| 6255 | |
| 6256 | codec->patch_ops = stac92xx_patch_ops; |
| 6257 | |
Takashi Iwai | 2d34e1b | 2008-11-28 14:35:16 +0100 | [diff] [blame] | 6258 | codec->proc_widget_hook = stac9205_proc_hook; |
| 6259 | |
Matt Porter | f3302a5 | 2006-07-31 12:49:34 +0200 | [diff] [blame] | 6260 | return 0; |
| 6261 | } |
| 6262 | |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 6263 | /* |
Guillaume Munch | 6d85906 | 2006-08-22 17:15:47 +0200 | [diff] [blame] | 6264 | * STAC9872 hack |
Takashi Iwai | db064e5 | 2006-03-16 16:04:58 +0100 | [diff] [blame] | 6265 | */ |
| 6266 | |
Takashi Iwai | 2b63536 | 2011-05-02 12:33:43 +0200 | [diff] [blame] | 6267 | static const struct hda_verb stac9872_core_init[] = { |
Takashi Iwai | 1624cb9 | 2007-07-05 13:10:51 +0200 | [diff] [blame] | 6268 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x1}, /* mic-sel: 0a,0d,14,02 */ |
Takashi Iwai | db064e5 | 2006-03-16 16:04:58 +0100 | [diff] [blame] | 6269 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Mic-in -> 0x9 */ |
| 6270 | {} |
| 6271 | }; |
| 6272 | |
Takashi Iwai | 2b63536 | 2011-05-02 12:33:43 +0200 | [diff] [blame] | 6273 | static const hda_nid_t stac9872_pin_nids[] = { |
Takashi Iwai | caa10b6 | 2009-01-20 17:19:01 +0100 | [diff] [blame] | 6274 | 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, |
| 6275 | 0x11, 0x13, 0x14, |
| 6276 | }; |
| 6277 | |
Takashi Iwai | 2b63536 | 2011-05-02 12:33:43 +0200 | [diff] [blame] | 6278 | static const hda_nid_t stac9872_adc_nids[] = { |
Takashi Iwai | caa10b6 | 2009-01-20 17:19:01 +0100 | [diff] [blame] | 6279 | 0x8 /*,0x6*/ |
| 6280 | }; |
| 6281 | |
Takashi Iwai | 2b63536 | 2011-05-02 12:33:43 +0200 | [diff] [blame] | 6282 | static const hda_nid_t stac9872_mux_nids[] = { |
Takashi Iwai | caa10b6 | 2009-01-20 17:19:01 +0100 | [diff] [blame] | 6283 | 0x15 |
| 6284 | }; |
| 6285 | |
Takashi Iwai | 2b63536 | 2011-05-02 12:33:43 +0200 | [diff] [blame] | 6286 | static const unsigned long stac9872_capvols[] = { |
Takashi Iwai | 6479c63 | 2009-07-28 18:20:25 +0200 | [diff] [blame] | 6287 | HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_INPUT), |
| 6288 | }; |
| 6289 | #define stac9872_capsws stac9872_capvols |
| 6290 | |
Takashi Iwai | 2b63536 | 2011-05-02 12:33:43 +0200 | [diff] [blame] | 6291 | static const unsigned int stac9872_vaio_pin_configs[9] = { |
Takashi Iwai | 307282c | 2009-03-12 18:17:58 +0100 | [diff] [blame] | 6292 | 0x03211020, 0x411111f0, 0x411111f0, 0x03a15030, |
| 6293 | 0x411111f0, 0x90170110, 0x411111f0, 0x411111f0, |
| 6294 | 0x90a7013e |
| 6295 | }; |
| 6296 | |
Takashi Iwai | ea73496 | 2011-01-17 11:29:34 +0100 | [diff] [blame] | 6297 | static const char * const stac9872_models[STAC_9872_MODELS] = { |
Takashi Iwai | 307282c | 2009-03-12 18:17:58 +0100 | [diff] [blame] | 6298 | [STAC_9872_AUTO] = "auto", |
| 6299 | [STAC_9872_VAIO] = "vaio", |
| 6300 | }; |
| 6301 | |
Takashi Iwai | 2b63536 | 2011-05-02 12:33:43 +0200 | [diff] [blame] | 6302 | static const unsigned int *stac9872_brd_tbl[STAC_9872_MODELS] = { |
Takashi Iwai | 307282c | 2009-03-12 18:17:58 +0100 | [diff] [blame] | 6303 | [STAC_9872_VAIO] = stac9872_vaio_pin_configs, |
| 6304 | }; |
| 6305 | |
Takashi Iwai | 2b63536 | 2011-05-02 12:33:43 +0200 | [diff] [blame] | 6306 | static const struct snd_pci_quirk stac9872_cfg_tbl[] = { |
Takashi Iwai | b04add9 | 2009-07-20 08:01:36 +0200 | [diff] [blame] | 6307 | SND_PCI_QUIRK_MASK(0x104d, 0xfff0, 0x81e0, |
| 6308 | "Sony VAIO F/S", STAC_9872_VAIO), |
Takashi Iwai | 307282c | 2009-03-12 18:17:58 +0100 | [diff] [blame] | 6309 | {} /* terminator */ |
| 6310 | }; |
| 6311 | |
Guillaume Munch | 6d85906 | 2006-08-22 17:15:47 +0200 | [diff] [blame] | 6312 | static int patch_stac9872(struct hda_codec *codec) |
Takashi Iwai | db064e5 | 2006-03-16 16:04:58 +0100 | [diff] [blame] | 6313 | { |
| 6314 | struct sigmatel_spec *spec; |
Takashi Iwai | 1e137f9 | 2009-01-21 07:41:22 +0100 | [diff] [blame] | 6315 | int err; |
Takashi Iwai | db064e5 | 2006-03-16 16:04:58 +0100 | [diff] [blame] | 6316 | |
Takashi Iwai | db064e5 | 2006-03-16 16:04:58 +0100 | [diff] [blame] | 6317 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
| 6318 | if (spec == NULL) |
| 6319 | return -ENOMEM; |
Takashi Iwai | a252c81 | 2009-12-25 22:56:20 +0100 | [diff] [blame] | 6320 | codec->no_trigger_sense = 1; |
Takashi Iwai | db064e5 | 2006-03-16 16:04:58 +0100 | [diff] [blame] | 6321 | codec->spec = spec; |
Daniel J Blueman | 1b0e372 | 2010-08-03 11:09:13 +0100 | [diff] [blame] | 6322 | spec->linear_tone_beep = 1; |
Takashi Iwai | b04add9 | 2009-07-20 08:01:36 +0200 | [diff] [blame] | 6323 | spec->num_pins = ARRAY_SIZE(stac9872_pin_nids); |
| 6324 | spec->pin_nids = stac9872_pin_nids; |
Takashi Iwai | caa10b6 | 2009-01-20 17:19:01 +0100 | [diff] [blame] | 6325 | |
| 6326 | spec->board_config = snd_hda_check_board_config(codec, STAC_9872_MODELS, |
| 6327 | stac9872_models, |
| 6328 | stac9872_cfg_tbl); |
Takashi Iwai | 307282c | 2009-03-12 18:17:58 +0100 | [diff] [blame] | 6329 | if (spec->board_config < 0) |
Takashi Iwai | 9a11f1a | 2009-07-28 16:01:20 +0200 | [diff] [blame] | 6330 | snd_printdd(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n", |
| 6331 | codec->chip_name); |
Takashi Iwai | 307282c | 2009-03-12 18:17:58 +0100 | [diff] [blame] | 6332 | else |
| 6333 | stac92xx_set_config_regs(codec, |
| 6334 | stac9872_brd_tbl[spec->board_config]); |
Takashi Iwai | caa10b6 | 2009-01-20 17:19:01 +0100 | [diff] [blame] | 6335 | |
Takashi Iwai | 1e137f9 | 2009-01-21 07:41:22 +0100 | [diff] [blame] | 6336 | spec->multiout.dac_nids = spec->dac_nids; |
| 6337 | spec->num_adcs = ARRAY_SIZE(stac9872_adc_nids); |
| 6338 | spec->adc_nids = stac9872_adc_nids; |
| 6339 | spec->num_muxes = ARRAY_SIZE(stac9872_mux_nids); |
| 6340 | spec->mux_nids = stac9872_mux_nids; |
Takashi Iwai | 1e137f9 | 2009-01-21 07:41:22 +0100 | [diff] [blame] | 6341 | spec->init = stac9872_core_init; |
Takashi Iwai | 6479c63 | 2009-07-28 18:20:25 +0200 | [diff] [blame] | 6342 | spec->num_caps = 1; |
| 6343 | spec->capvols = stac9872_capvols; |
| 6344 | spec->capsws = stac9872_capsws; |
Takashi Iwai | caa10b6 | 2009-01-20 17:19:01 +0100 | [diff] [blame] | 6345 | |
Charles Chin | 9009b0e | 2011-11-03 10:27:27 +0100 | [diff] [blame] | 6346 | err = stac92xx_parse_auto_config(codec); |
Takashi Iwai | 1e137f9 | 2009-01-21 07:41:22 +0100 | [diff] [blame] | 6347 | if (err < 0) { |
| 6348 | stac92xx_free(codec); |
| 6349 | return -EINVAL; |
Takashi Iwai | caa10b6 | 2009-01-20 17:19:01 +0100 | [diff] [blame] | 6350 | } |
Takashi Iwai | 1e137f9 | 2009-01-21 07:41:22 +0100 | [diff] [blame] | 6351 | spec->input_mux = &spec->private_imux; |
| 6352 | codec->patch_ops = stac92xx_patch_ops; |
Takashi Iwai | db064e5 | 2006-03-16 16:04:58 +0100 | [diff] [blame] | 6353 | return 0; |
| 6354 | } |
| 6355 | |
| 6356 | |
| 6357 | /* |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 6358 | * patch entries |
| 6359 | */ |
Takashi Iwai | 2b63536 | 2011-05-02 12:33:43 +0200 | [diff] [blame] | 6360 | static const struct hda_codec_preset snd_hda_preset_sigmatel[] = { |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 6361 | { .id = 0x83847690, .name = "STAC9200", .patch = patch_stac9200 }, |
| 6362 | { .id = 0x83847882, .name = "STAC9220 A1", .patch = patch_stac922x }, |
| 6363 | { .id = 0x83847680, .name = "STAC9221 A1", .patch = patch_stac922x }, |
| 6364 | { .id = 0x83847880, .name = "STAC9220 A2", .patch = patch_stac922x }, |
| 6365 | { .id = 0x83847681, .name = "STAC9220D/9223D A2", .patch = patch_stac922x }, |
| 6366 | { .id = 0x83847682, .name = "STAC9221 A2", .patch = patch_stac922x }, |
| 6367 | { .id = 0x83847683, .name = "STAC9221D A2", .patch = patch_stac922x }, |
Matt Porter | 22a27c7 | 2006-07-06 18:49:10 +0200 | [diff] [blame] | 6368 | { .id = 0x83847618, .name = "STAC9227", .patch = patch_stac927x }, |
| 6369 | { .id = 0x83847619, .name = "STAC9227", .patch = patch_stac927x }, |
| 6370 | { .id = 0x83847616, .name = "STAC9228", .patch = patch_stac927x }, |
| 6371 | { .id = 0x83847617, .name = "STAC9228", .patch = patch_stac927x }, |
| 6372 | { .id = 0x83847614, .name = "STAC9229", .patch = patch_stac927x }, |
| 6373 | { .id = 0x83847615, .name = "STAC9229", .patch = patch_stac927x }, |
Matt Porter | 3cc08dc | 2006-01-23 15:27:49 +0100 | [diff] [blame] | 6374 | { .id = 0x83847620, .name = "STAC9274", .patch = patch_stac927x }, |
| 6375 | { .id = 0x83847621, .name = "STAC9274D", .patch = patch_stac927x }, |
| 6376 | { .id = 0x83847622, .name = "STAC9273X", .patch = patch_stac927x }, |
| 6377 | { .id = 0x83847623, .name = "STAC9273D", .patch = patch_stac927x }, |
| 6378 | { .id = 0x83847624, .name = "STAC9272X", .patch = patch_stac927x }, |
| 6379 | { .id = 0x83847625, .name = "STAC9272D", .patch = patch_stac927x }, |
| 6380 | { .id = 0x83847626, .name = "STAC9271X", .patch = patch_stac927x }, |
| 6381 | { .id = 0x83847627, .name = "STAC9271D", .patch = patch_stac927x }, |
| 6382 | { .id = 0x83847628, .name = "STAC9274X5NH", .patch = patch_stac927x }, |
| 6383 | { .id = 0x83847629, .name = "STAC9274D5NH", .patch = patch_stac927x }, |
Tobin Davis | 8e21c34 | 2007-01-08 11:04:17 +0100 | [diff] [blame] | 6384 | { .id = 0x83847632, .name = "STAC9202", .patch = patch_stac925x }, |
| 6385 | { .id = 0x83847633, .name = "STAC9202D", .patch = patch_stac925x }, |
| 6386 | { .id = 0x83847634, .name = "STAC9250", .patch = patch_stac925x }, |
| 6387 | { .id = 0x83847635, .name = "STAC9250D", .patch = patch_stac925x }, |
| 6388 | { .id = 0x83847636, .name = "STAC9251", .patch = patch_stac925x }, |
| 6389 | { .id = 0x83847637, .name = "STAC9250D", .patch = patch_stac925x }, |
Takashi Iwai | 7bd3c0f | 2008-05-02 12:28:02 +0200 | [diff] [blame] | 6390 | { .id = 0x83847645, .name = "92HD206X", .patch = patch_stac927x }, |
| 6391 | { .id = 0x83847646, .name = "92HD206D", .patch = patch_stac927x }, |
Guillaume Munch | 6d85906 | 2006-08-22 17:15:47 +0200 | [diff] [blame] | 6392 | /* The following does not take into account .id=0x83847661 when subsys = |
| 6393 | * 104D0C00 which is STAC9225s. Because of this, some SZ Notebooks are |
| 6394 | * currently not fully supported. |
| 6395 | */ |
| 6396 | { .id = 0x83847661, .name = "CXD9872RD/K", .patch = patch_stac9872 }, |
| 6397 | { .id = 0x83847662, .name = "STAC9872AK", .patch = patch_stac9872 }, |
| 6398 | { .id = 0x83847664, .name = "CXD9872AKD", .patch = patch_stac9872 }, |
Simos Xenitellis | a5c0f88 | 2009-06-10 16:33:31 +0100 | [diff] [blame] | 6399 | { .id = 0x83847698, .name = "STAC9205", .patch = patch_stac9205 }, |
Matt Porter | f3302a5 | 2006-07-31 12:49:34 +0200 | [diff] [blame] | 6400 | { .id = 0x838476a0, .name = "STAC9205", .patch = patch_stac9205 }, |
| 6401 | { .id = 0x838476a1, .name = "STAC9205D", .patch = patch_stac9205 }, |
| 6402 | { .id = 0x838476a2, .name = "STAC9204", .patch = patch_stac9205 }, |
| 6403 | { .id = 0x838476a3, .name = "STAC9204D", .patch = patch_stac9205 }, |
| 6404 | { .id = 0x838476a4, .name = "STAC9255", .patch = patch_stac9205 }, |
| 6405 | { .id = 0x838476a5, .name = "STAC9255D", .patch = patch_stac9205 }, |
| 6406 | { .id = 0x838476a6, .name = "STAC9254", .patch = patch_stac9205 }, |
| 6407 | { .id = 0x838476a7, .name = "STAC9254D", .patch = patch_stac9205 }, |
Matthew Ranostay | aafc441 | 2008-06-13 18:04:33 +0200 | [diff] [blame] | 6408 | { .id = 0x111d7603, .name = "92HD75B3X5", .patch = patch_stac92hd71bxx}, |
Matthew Ranostay | d0513fc | 2008-07-27 10:30:30 +0200 | [diff] [blame] | 6409 | { .id = 0x111d7604, .name = "92HD83C1X5", .patch = patch_stac92hd83xxx}, |
Vitaliy Kulikov | a9694fa | 2010-02-04 08:58:23 +0100 | [diff] [blame] | 6410 | { .id = 0x111d76d4, .name = "92HD83C1C5", .patch = patch_stac92hd83xxx}, |
Matthew Ranostay | d0513fc | 2008-07-27 10:30:30 +0200 | [diff] [blame] | 6411 | { .id = 0x111d7605, .name = "92HD81B1X5", .patch = patch_stac92hd83xxx}, |
Matthew Ranostay | ff2e733 | 2009-04-01 14:49:48 -0400 | [diff] [blame] | 6412 | { .id = 0x111d76d5, .name = "92HD81B1C5", .patch = patch_stac92hd83xxx}, |
Charles Chin | 8a345a0 | 2010-08-10 11:43:25 +0200 | [diff] [blame] | 6413 | { .id = 0x111d76d1, .name = "92HD87B1/3", .patch = patch_stac92hd83xxx}, |
| 6414 | { .id = 0x111d76d9, .name = "92HD87B2/4", .patch = patch_stac92hd83xxx}, |
Charles Chin | 3670600 | 2010-01-29 12:05:51 +0100 | [diff] [blame] | 6415 | { .id = 0x111d7666, .name = "92HD88B3", .patch = patch_stac92hd83xxx}, |
| 6416 | { .id = 0x111d7667, .name = "92HD88B1", .patch = patch_stac92hd83xxx}, |
| 6417 | { .id = 0x111d7668, .name = "92HD88B2", .patch = patch_stac92hd83xxx}, |
| 6418 | { .id = 0x111d7669, .name = "92HD88B4", .patch = patch_stac92hd83xxx}, |
Matthew Ranostay | aafc441 | 2008-06-13 18:04:33 +0200 | [diff] [blame] | 6419 | { .id = 0x111d7608, .name = "92HD75B2X5", .patch = patch_stac92hd71bxx}, |
Matthew Ranostay | 541eee8 | 2007-12-14 12:08:04 +0100 | [diff] [blame] | 6420 | { .id = 0x111d7674, .name = "92HD73D1X5", .patch = patch_stac92hd73xx }, |
| 6421 | { .id = 0x111d7675, .name = "92HD73C1X5", .patch = patch_stac92hd73xx }, |
Matthew Ranostay | e1f0d66 | 2007-12-13 17:47:21 +0100 | [diff] [blame] | 6422 | { .id = 0x111d7676, .name = "92HD73E1X5", .patch = patch_stac92hd73xx }, |
Matthew Ranostay | 541eee8 | 2007-12-14 12:08:04 +0100 | [diff] [blame] | 6423 | { .id = 0x111d76b0, .name = "92HD71B8X", .patch = patch_stac92hd71bxx }, |
| 6424 | { .id = 0x111d76b1, .name = "92HD71B8X", .patch = patch_stac92hd71bxx }, |
| 6425 | { .id = 0x111d76b2, .name = "92HD71B7X", .patch = patch_stac92hd71bxx }, |
| 6426 | { .id = 0x111d76b3, .name = "92HD71B7X", .patch = patch_stac92hd71bxx }, |
| 6427 | { .id = 0x111d76b4, .name = "92HD71B6X", .patch = patch_stac92hd71bxx }, |
| 6428 | { .id = 0x111d76b5, .name = "92HD71B6X", .patch = patch_stac92hd71bxx }, |
| 6429 | { .id = 0x111d76b6, .name = "92HD71B5X", .patch = patch_stac92hd71bxx }, |
| 6430 | { .id = 0x111d76b7, .name = "92HD71B5X", .patch = patch_stac92hd71bxx }, |
Charles Chin | 4d8ec5f | 2010-08-19 08:06:16 +0200 | [diff] [blame] | 6431 | { .id = 0x111d76c0, .name = "92HD89C3", .patch = patch_stac92hd73xx }, |
| 6432 | { .id = 0x111d76c1, .name = "92HD89C2", .patch = patch_stac92hd73xx }, |
| 6433 | { .id = 0x111d76c2, .name = "92HD89C1", .patch = patch_stac92hd73xx }, |
| 6434 | { .id = 0x111d76c3, .name = "92HD89B3", .patch = patch_stac92hd73xx }, |
| 6435 | { .id = 0x111d76c4, .name = "92HD89B2", .patch = patch_stac92hd73xx }, |
| 6436 | { .id = 0x111d76c5, .name = "92HD89B1", .patch = patch_stac92hd73xx }, |
| 6437 | { .id = 0x111d76c6, .name = "92HD89E3", .patch = patch_stac92hd73xx }, |
| 6438 | { .id = 0x111d76c7, .name = "92HD89E2", .patch = patch_stac92hd73xx }, |
| 6439 | { .id = 0x111d76c8, .name = "92HD89E1", .patch = patch_stac92hd73xx }, |
| 6440 | { .id = 0x111d76c9, .name = "92HD89D3", .patch = patch_stac92hd73xx }, |
| 6441 | { .id = 0x111d76ca, .name = "92HD89D2", .patch = patch_stac92hd73xx }, |
| 6442 | { .id = 0x111d76cb, .name = "92HD89D1", .patch = patch_stac92hd73xx }, |
| 6443 | { .id = 0x111d76cc, .name = "92HD89F3", .patch = patch_stac92hd73xx }, |
| 6444 | { .id = 0x111d76cd, .name = "92HD89F2", .patch = patch_stac92hd73xx }, |
| 6445 | { .id = 0x111d76ce, .name = "92HD89F1", .patch = patch_stac92hd73xx }, |
David Henningsson | 46724c2 | 2011-09-20 09:02:22 +0200 | [diff] [blame] | 6446 | { .id = 0x111d76df, .name = "92HD93BXX", .patch = patch_stac92hd83xxx}, |
Vitaliy Kulikov | ab5a6eb | 2010-09-08 09:00:17 +0200 | [diff] [blame] | 6447 | { .id = 0x111d76e0, .name = "92HD91BXX", .patch = patch_stac92hd83xxx}, |
Vitaliy Kulikov | 4dfb8a4 | 2011-02-22 17:32:19 -0600 | [diff] [blame] | 6448 | { .id = 0x111d76e3, .name = "92HD98BXX", .patch = patch_stac92hd83xxx}, |
| 6449 | { .id = 0x111d76e5, .name = "92HD99BXX", .patch = patch_stac92hd83xxx}, |
Vitaliy Kulikov | ab5a6eb | 2010-09-08 09:00:17 +0200 | [diff] [blame] | 6450 | { .id = 0x111d76e7, .name = "92HD90BXX", .patch = patch_stac92hd83xxx}, |
Charles Chin | ad5d875 | 2011-11-02 07:56:58 +0100 | [diff] [blame] | 6451 | { .id = 0x111d76e8, .name = "92HD66B1X5", .patch = patch_stac92hd83xxx}, |
| 6452 | { .id = 0x111d76e9, .name = "92HD66B2X5", .patch = patch_stac92hd83xxx}, |
| 6453 | { .id = 0x111d76ea, .name = "92HD66B3X5", .patch = patch_stac92hd83xxx}, |
| 6454 | { .id = 0x111d76eb, .name = "92HD66C1X5", .patch = patch_stac92hd83xxx}, |
| 6455 | { .id = 0x111d76ec, .name = "92HD66C2X5", .patch = patch_stac92hd83xxx}, |
| 6456 | { .id = 0x111d76ed, .name = "92HD66C3X5", .patch = patch_stac92hd83xxx}, |
| 6457 | { .id = 0x111d76ee, .name = "92HD66B1X3", .patch = patch_stac92hd83xxx}, |
| 6458 | { .id = 0x111d76ef, .name = "92HD66B2X3", .patch = patch_stac92hd83xxx}, |
| 6459 | { .id = 0x111d76f0, .name = "92HD66B3X3", .patch = patch_stac92hd83xxx}, |
| 6460 | { .id = 0x111d76f1, .name = "92HD66C1X3", .patch = patch_stac92hd83xxx}, |
| 6461 | { .id = 0x111d76f2, .name = "92HD66C2X3", .patch = patch_stac92hd83xxx}, |
| 6462 | { .id = 0x111d76f3, .name = "92HD66C3/65", .patch = patch_stac92hd83xxx}, |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 6463 | {} /* terminator */ |
| 6464 | }; |
Takashi Iwai | 1289e9e | 2008-11-27 15:47:11 +0100 | [diff] [blame] | 6465 | |
| 6466 | MODULE_ALIAS("snd-hda-codec-id:8384*"); |
| 6467 | MODULE_ALIAS("snd-hda-codec-id:111d*"); |
| 6468 | |
| 6469 | MODULE_LICENSE("GPL"); |
| 6470 | MODULE_DESCRIPTION("IDT/Sigmatel HD-audio codec"); |
| 6471 | |
| 6472 | static struct hda_codec_preset_list sigmatel_list = { |
| 6473 | .preset = snd_hda_preset_sigmatel, |
| 6474 | .owner = THIS_MODULE, |
| 6475 | }; |
| 6476 | |
| 6477 | static int __init patch_sigmatel_init(void) |
| 6478 | { |
| 6479 | return snd_hda_add_codec_preset(&sigmatel_list); |
| 6480 | } |
| 6481 | |
| 6482 | static void __exit patch_sigmatel_exit(void) |
| 6483 | { |
| 6484 | snd_hda_delete_codec_preset(&sigmatel_list); |
| 6485 | } |
| 6486 | |
| 6487 | module_init(patch_sigmatel_init) |
| 6488 | module_exit(patch_sigmatel_exit) |