Takashi Iwai | e5f1424 | 2009-07-01 18:11:44 +0200 | [diff] [blame] | 1 | /* |
| 2 | * HD audio interface patch for Cirrus Logic CS420x chip |
| 3 | * |
| 4 | * Copyright (c) 2009 Takashi Iwai <tiwai@suse.de> |
| 5 | * |
| 6 | * This driver is free software; you can redistribute it and/or modify |
| 7 | * it under the terms of the GNU General Public License as published by |
| 8 | * the Free Software Foundation; either version 2 of the License, or |
| 9 | * (at your option) any later version. |
| 10 | * |
| 11 | * This driver is distributed in the hope that it will be useful, |
| 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 14 | * GNU General Public License for more details. |
| 15 | * |
| 16 | * You should have received a copy of the GNU General Public License |
| 17 | * along with this program; if not, write to the Free Software |
| 18 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
| 19 | */ |
| 20 | |
| 21 | #include <linux/init.h> |
Takashi Iwai | e5f1424 | 2009-07-01 18:11:44 +0200 | [diff] [blame] | 22 | #include <linux/slab.h> |
Paul Gortmaker | da155d5 | 2011-07-15 12:38:28 -0400 | [diff] [blame] | 23 | #include <linux/module.h> |
Takashi Iwai | e5f1424 | 2009-07-01 18:11:44 +0200 | [diff] [blame] | 24 | #include <sound/core.h> |
Takashi Iwai | 1077a02 | 2012-12-19 16:39:18 +0100 | [diff] [blame] | 25 | #include <sound/tlv.h> |
Takashi Iwai | e5f1424 | 2009-07-01 18:11:44 +0200 | [diff] [blame] | 26 | #include "hda_codec.h" |
| 27 | #include "hda_local.h" |
Takashi Iwai | 128bc4b | 2012-05-07 17:42:31 +0200 | [diff] [blame] | 28 | #include "hda_auto_parser.h" |
Takashi Iwai | 1835a0f | 2011-10-27 22:12:46 +0200 | [diff] [blame] | 29 | #include "hda_jack.h" |
Takashi Iwai | 1077a02 | 2012-12-19 16:39:18 +0100 | [diff] [blame] | 30 | #include "hda_generic.h" |
Takashi Iwai | e5f1424 | 2009-07-01 18:11:44 +0200 | [diff] [blame] | 31 | |
| 32 | /* |
| 33 | */ |
| 34 | |
| 35 | struct cs_spec { |
Takashi Iwai | 1077a02 | 2012-12-19 16:39:18 +0100 | [diff] [blame] | 36 | struct hda_gen_spec gen; |
Takashi Iwai | e5f1424 | 2009-07-01 18:11:44 +0200 | [diff] [blame] | 37 | |
Takashi Iwai | ed20825 | 2009-07-07 09:04:26 +0200 | [diff] [blame] | 38 | unsigned int gpio_mask; |
| 39 | unsigned int gpio_dir; |
| 40 | unsigned int gpio_data; |
Takashi Iwai | 6dfeb703 | 2011-11-22 20:00:31 +0100 | [diff] [blame] | 41 | unsigned int gpio_eapd_hp; /* EAPD GPIO bit for headphones */ |
| 42 | unsigned int gpio_eapd_speaker; /* EAPD GPIO bit for speakers */ |
Takashi Iwai | ed20825 | 2009-07-07 09:04:26 +0200 | [diff] [blame] | 43 | |
Tim Howe | 56487c2 | 2011-07-22 16:41:00 -0500 | [diff] [blame] | 44 | /* CS421x */ |
| 45 | unsigned int spdif_detect:1; |
Takashi Iwai | 1077a02 | 2012-12-19 16:39:18 +0100 | [diff] [blame] | 46 | unsigned int spdif_present:1; |
Tim Howe | 56487c2 | 2011-07-22 16:41:00 -0500 | [diff] [blame] | 47 | unsigned int sense_b:1; |
| 48 | hda_nid_t vendor_nid; |
Takashi Iwai | 0c52db8 | 2013-11-08 13:03:57 +0100 | [diff] [blame] | 49 | |
| 50 | /* for MBP SPDIF control */ |
| 51 | int (*spdif_sw_put)(struct snd_kcontrol *kcontrol, |
| 52 | struct snd_ctl_elem_value *ucontrol); |
Takashi Iwai | e5f1424 | 2009-07-01 18:11:44 +0200 | [diff] [blame] | 53 | }; |
| 54 | |
Tim Howe | 56487c2 | 2011-07-22 16:41:00 -0500 | [diff] [blame] | 55 | /* available models with CS420x */ |
Takashi Iwai | a6bae20 | 2009-07-06 15:15:22 +0200 | [diff] [blame] | 56 | enum { |
Vince Weaver | 4e7d7c6 | 2010-09-22 17:31:37 -0400 | [diff] [blame] | 57 | CS420X_MBP53, |
Takashi Iwai | a6bae20 | 2009-07-06 15:15:22 +0200 | [diff] [blame] | 58 | CS420X_MBP55, |
Rafael Avila de Espindola | 1a5ba2e | 2009-12-22 07:59:37 +0100 | [diff] [blame] | 59 | CS420X_IMAC27, |
Takashi Iwai | b35aabd | 2012-08-24 19:09:45 +0200 | [diff] [blame] | 60 | CS420X_GPIO_13, |
| 61 | CS420X_GPIO_23, |
Takashi Iwai | ef596a5 | 2012-09-11 16:53:08 +0200 | [diff] [blame] | 62 | CS420X_MBP101, |
Takashi Iwai | ffe4d12b | 2012-11-23 08:34:13 +0100 | [diff] [blame] | 63 | CS420X_MBP81, |
Takashi Iwai | 6ab982e | 2013-06-17 10:19:49 +0200 | [diff] [blame] | 64 | CS420X_MBA42, |
Takashi Iwai | a6bae20 | 2009-07-06 15:15:22 +0200 | [diff] [blame] | 65 | CS420X_AUTO, |
Takashi Iwai | 03efce7 | 2012-09-13 09:56:57 +0200 | [diff] [blame] | 66 | /* aliases */ |
| 67 | CS420X_IMAC27_122 = CS420X_GPIO_23, |
| 68 | CS420X_APPLE = CS420X_GPIO_13, |
Takashi Iwai | a6bae20 | 2009-07-06 15:15:22 +0200 | [diff] [blame] | 69 | }; |
| 70 | |
Tim Howe | 56487c2 | 2011-07-22 16:41:00 -0500 | [diff] [blame] | 71 | /* CS421x boards */ |
| 72 | enum { |
| 73 | CS421X_CDB4210, |
Takashi Iwai | b35aabd | 2012-08-24 19:09:45 +0200 | [diff] [blame] | 74 | CS421X_SENSE_B, |
Dylan Reid | 4af1610 | 2013-04-04 15:35:31 -0700 | [diff] [blame] | 75 | CS421X_STUMPY, |
Tim Howe | 56487c2 | 2011-07-22 16:41:00 -0500 | [diff] [blame] | 76 | }; |
| 77 | |
Takashi Iwai | 40c20fa | 2009-07-06 13:00:57 +0200 | [diff] [blame] | 78 | /* Vendor-specific processing widget */ |
| 79 | #define CS420X_VENDOR_NID 0x11 |
| 80 | #define CS_DIG_OUT1_PIN_NID 0x10 |
| 81 | #define CS_DIG_OUT2_PIN_NID 0x15 |
Daniel J Blueman | 16337e0 | 2012-11-04 13:19:03 +0800 | [diff] [blame] | 82 | #define CS_DMIC1_PIN_NID 0x0e |
| 83 | #define CS_DMIC2_PIN_NID 0x12 |
Takashi Iwai | 40c20fa | 2009-07-06 13:00:57 +0200 | [diff] [blame] | 84 | |
| 85 | /* coef indices */ |
| 86 | #define IDX_SPDIF_STAT 0x0000 |
| 87 | #define IDX_SPDIF_CTL 0x0001 |
| 88 | #define IDX_ADC_CFG 0x0002 |
| 89 | /* SZC bitmask, 4 modes below: |
| 90 | * 0 = immediate, |
| 91 | * 1 = digital immediate, analog zero-cross |
| 92 | * 2 = digtail & analog soft-ramp |
| 93 | * 3 = digital soft-ramp, analog zero-cross |
| 94 | */ |
| 95 | #define CS_COEF_ADC_SZC_MASK (3 << 0) |
| 96 | #define CS_COEF_ADC_MIC_SZC_MODE (3 << 0) /* SZC setup for mic */ |
| 97 | #define CS_COEF_ADC_LI_SZC_MODE (3 << 0) /* SZC setup for line-in */ |
| 98 | /* PGA mode: 0 = differential, 1 = signle-ended */ |
| 99 | #define CS_COEF_ADC_MIC_PGA_MODE (1 << 5) /* PGA setup for mic */ |
| 100 | #define CS_COEF_ADC_LI_PGA_MODE (1 << 6) /* PGA setup for line-in */ |
| 101 | #define IDX_DAC_CFG 0x0003 |
| 102 | /* SZC bitmask, 4 modes below: |
| 103 | * 0 = Immediate |
| 104 | * 1 = zero-cross |
| 105 | * 2 = soft-ramp |
| 106 | * 3 = soft-ramp on zero-cross |
| 107 | */ |
| 108 | #define CS_COEF_DAC_HP_SZC_MODE (3 << 0) /* nid 0x02 */ |
| 109 | #define CS_COEF_DAC_LO_SZC_MODE (3 << 2) /* nid 0x03 */ |
| 110 | #define CS_COEF_DAC_SPK_SZC_MODE (3 << 4) /* nid 0x04 */ |
| 111 | |
| 112 | #define IDX_BEEP_CFG 0x0004 |
| 113 | /* 0x0008 - test reg key */ |
| 114 | /* 0x0009 - 0x0014 -> 12 test regs */ |
| 115 | /* 0x0015 - visibility reg */ |
| 116 | |
Ben Whitten | b5bf0a9 | 2013-09-27 10:13:51 +0200 | [diff] [blame] | 117 | /* Cirrus Logic CS4208 */ |
| 118 | #define CS4208_VENDOR_NID 0x24 |
| 119 | |
Tim Howe | 56487c2 | 2011-07-22 16:41:00 -0500 | [diff] [blame] | 120 | /* |
| 121 | * Cirrus Logic CS4210 |
| 122 | * |
| 123 | * 1 DAC => HP(sense) / Speakers, |
| 124 | * 1 ADC <= LineIn(sense) / MicIn / DMicIn, |
| 125 | * 1 SPDIF OUT => SPDIF Trasmitter(sense) |
| 126 | */ |
| 127 | #define CS4210_DAC_NID 0x02 |
| 128 | #define CS4210_ADC_NID 0x03 |
David Henningsson | 5660ffd | 2012-01-02 12:40:17 +0100 | [diff] [blame] | 129 | #define CS4210_VENDOR_NID 0x0B |
Tim Howe | 56487c2 | 2011-07-22 16:41:00 -0500 | [diff] [blame] | 130 | #define CS421X_DMIC_PIN_NID 0x09 /* Port E */ |
| 131 | #define CS421X_SPDIF_PIN_NID 0x0A /* Port H */ |
| 132 | |
| 133 | #define CS421X_IDX_DEV_CFG 0x01 |
| 134 | #define CS421X_IDX_ADC_CFG 0x02 |
| 135 | #define CS421X_IDX_DAC_CFG 0x03 |
| 136 | #define CS421X_IDX_SPK_CTL 0x04 |
| 137 | |
David Henningsson | 5660ffd | 2012-01-02 12:40:17 +0100 | [diff] [blame] | 138 | /* Cirrus Logic CS4213 is like CS4210 but does not have SPDIF input/output */ |
| 139 | #define CS4213_VENDOR_NID 0x09 |
| 140 | |
| 141 | |
Takashi Iwai | 277a57c | 2009-07-08 12:42:08 +0200 | [diff] [blame] | 142 | static inline int cs_vendor_coef_get(struct hda_codec *codec, unsigned int idx) |
Takashi Iwai | 40c20fa | 2009-07-06 13:00:57 +0200 | [diff] [blame] | 143 | { |
Tim Howe | 56487c2 | 2011-07-22 16:41:00 -0500 | [diff] [blame] | 144 | struct cs_spec *spec = codec->spec; |
| 145 | snd_hda_codec_write(codec, spec->vendor_nid, 0, |
Takashi Iwai | 40c20fa | 2009-07-06 13:00:57 +0200 | [diff] [blame] | 146 | AC_VERB_SET_COEF_INDEX, idx); |
Tim Howe | 56487c2 | 2011-07-22 16:41:00 -0500 | [diff] [blame] | 147 | return snd_hda_codec_read(codec, spec->vendor_nid, 0, |
Takashi Iwai | 40c20fa | 2009-07-06 13:00:57 +0200 | [diff] [blame] | 148 | AC_VERB_GET_PROC_COEF, 0); |
| 149 | } |
| 150 | |
Takashi Iwai | 277a57c | 2009-07-08 12:42:08 +0200 | [diff] [blame] | 151 | static inline void cs_vendor_coef_set(struct hda_codec *codec, unsigned int idx, |
| 152 | unsigned int coef) |
Takashi Iwai | 40c20fa | 2009-07-06 13:00:57 +0200 | [diff] [blame] | 153 | { |
Tim Howe | 56487c2 | 2011-07-22 16:41:00 -0500 | [diff] [blame] | 154 | struct cs_spec *spec = codec->spec; |
| 155 | snd_hda_codec_write(codec, spec->vendor_nid, 0, |
Takashi Iwai | 40c20fa | 2009-07-06 13:00:57 +0200 | [diff] [blame] | 156 | AC_VERB_SET_COEF_INDEX, idx); |
Tim Howe | 56487c2 | 2011-07-22 16:41:00 -0500 | [diff] [blame] | 157 | snd_hda_codec_write(codec, spec->vendor_nid, 0, |
Takashi Iwai | 40c20fa | 2009-07-06 13:00:57 +0200 | [diff] [blame] | 158 | AC_VERB_SET_PROC_COEF, coef); |
| 159 | } |
| 160 | |
Takashi Iwai | 21a4dc4 | 2009-07-06 12:55:46 +0200 | [diff] [blame] | 161 | /* |
| 162 | * auto-mute and auto-mic switching |
Tim Howe | 56487c2 | 2011-07-22 16:41:00 -0500 | [diff] [blame] | 163 | * CS421x auto-output redirecting |
| 164 | * HP/SPK/SPDIF |
Takashi Iwai | 21a4dc4 | 2009-07-06 12:55:46 +0200 | [diff] [blame] | 165 | */ |
| 166 | |
Takashi Iwai | 1077a02 | 2012-12-19 16:39:18 +0100 | [diff] [blame] | 167 | static void cs_automute(struct hda_codec *codec) |
Takashi Iwai | e5f1424 | 2009-07-01 18:11:44 +0200 | [diff] [blame] | 168 | { |
| 169 | struct cs_spec *spec = codec->spec; |
Takashi Iwai | e5f1424 | 2009-07-01 18:11:44 +0200 | [diff] [blame] | 170 | |
Takashi Iwai | 1077a02 | 2012-12-19 16:39:18 +0100 | [diff] [blame] | 171 | /* mute HPs if spdif jack (SENSE_B) is present */ |
| 172 | spec->gen.master_mute = !!(spec->spdif_present && spec->sense_b); |
Tim Howe | 56487c2 | 2011-07-22 16:41:00 -0500 | [diff] [blame] | 173 | |
Takashi Iwai | 1077a02 | 2012-12-19 16:39:18 +0100 | [diff] [blame] | 174 | snd_hda_gen_update_outputs(codec); |
Tim Howe | 56487c2 | 2011-07-22 16:41:00 -0500 | [diff] [blame] | 175 | |
Takashi Iwai | be8cf44 | 2013-09-09 13:57:57 +0200 | [diff] [blame] | 176 | if (spec->gpio_eapd_hp || spec->gpio_eapd_speaker) { |
Takashi Iwai | 039eb75 | 2013-03-18 16:55:49 +0100 | [diff] [blame] | 177 | spec->gpio_data = spec->gen.hp_jack_present ? |
Takashi Iwai | 6dfeb703 | 2011-11-22 20:00:31 +0100 | [diff] [blame] | 178 | spec->gpio_eapd_hp : spec->gpio_eapd_speaker; |
Stelian Pop | 3a38516 | 2009-07-30 14:44:27 +0200 | [diff] [blame] | 179 | snd_hda_codec_write(codec, 0x01, 0, |
Takashi Iwai | 039eb75 | 2013-03-18 16:55:49 +0100 | [diff] [blame] | 180 | AC_VERB_SET_GPIO_DATA, spec->gpio_data); |
Stelian Pop | 3a38516 | 2009-07-30 14:44:27 +0200 | [diff] [blame] | 181 | } |
Takashi Iwai | e5f1424 | 2009-07-01 18:11:44 +0200 | [diff] [blame] | 182 | } |
| 183 | |
Takashi Iwai | 1077a02 | 2012-12-19 16:39:18 +0100 | [diff] [blame] | 184 | static bool is_active_pin(struct hda_codec *codec, hda_nid_t nid) |
Takashi Iwai | e5f1424 | 2009-07-01 18:11:44 +0200 | [diff] [blame] | 185 | { |
Takashi Iwai | 1077a02 | 2012-12-19 16:39:18 +0100 | [diff] [blame] | 186 | unsigned int val; |
| 187 | val = snd_hda_codec_get_pincfg(codec, nid); |
| 188 | return (get_defcfg_connect(val) != AC_JACK_PORT_NONE); |
Takashi Iwai | e5f1424 | 2009-07-01 18:11:44 +0200 | [diff] [blame] | 189 | } |
| 190 | |
Takashi Iwai | 1077a02 | 2012-12-19 16:39:18 +0100 | [diff] [blame] | 191 | static void init_input_coef(struct hda_codec *codec) |
Takashi Iwai | e5f1424 | 2009-07-01 18:11:44 +0200 | [diff] [blame] | 192 | { |
| 193 | struct cs_spec *spec = codec->spec; |
Takashi Iwai | 40c20fa | 2009-07-06 13:00:57 +0200 | [diff] [blame] | 194 | unsigned int coef; |
Takashi Iwai | e5f1424 | 2009-07-01 18:11:44 +0200 | [diff] [blame] | 195 | |
David Henningsson | 5660ffd | 2012-01-02 12:40:17 +0100 | [diff] [blame] | 196 | /* CS420x has multiple ADC, CS421x has single ADC */ |
| 197 | if (spec->vendor_nid == CS420X_VENDOR_NID) { |
Daniel J Blueman | 16337e0 | 2012-11-04 13:19:03 +0800 | [diff] [blame] | 198 | coef = cs_vendor_coef_get(codec, IDX_BEEP_CFG); |
Tim Howe | 56487c2 | 2011-07-22 16:41:00 -0500 | [diff] [blame] | 199 | if (is_active_pin(codec, CS_DMIC2_PIN_NID)) |
Daniel J Blueman | 16337e0 | 2012-11-04 13:19:03 +0800 | [diff] [blame] | 200 | coef |= 1 << 4; /* DMIC2 2 chan on, GPIO1 off */ |
Tim Howe | 56487c2 | 2011-07-22 16:41:00 -0500 | [diff] [blame] | 201 | if (is_active_pin(codec, CS_DMIC1_PIN_NID)) |
Daniel J Blueman | 16337e0 | 2012-11-04 13:19:03 +0800 | [diff] [blame] | 202 | coef |= 1 << 3; /* DMIC1 2 chan on, GPIO0 off |
Tim Howe | 56487c2 | 2011-07-22 16:41:00 -0500 | [diff] [blame] | 203 | * No effect if SPDIF_OUT2 is |
| 204 | * selected in IDX_SPDIF_CTL. |
| 205 | */ |
Daniel J Blueman | 16337e0 | 2012-11-04 13:19:03 +0800 | [diff] [blame] | 206 | |
| 207 | cs_vendor_coef_set(codec, IDX_BEEP_CFG, coef); |
Tim Howe | 56487c2 | 2011-07-22 16:41:00 -0500 | [diff] [blame] | 208 | } |
Takashi Iwai | 40c20fa | 2009-07-06 13:00:57 +0200 | [diff] [blame] | 209 | } |
| 210 | |
Takashi Iwai | c42d478 | 2011-05-02 11:36:09 +0200 | [diff] [blame] | 211 | static const struct hda_verb cs_coef_init_verbs[] = { |
Takashi Iwai | 40c20fa | 2009-07-06 13:00:57 +0200 | [diff] [blame] | 212 | {0x11, AC_VERB_SET_PROC_STATE, 1}, |
| 213 | {0x11, AC_VERB_SET_COEF_INDEX, IDX_DAC_CFG}, |
| 214 | {0x11, AC_VERB_SET_PROC_COEF, |
| 215 | (0x002a /* DAC1/2/3 SZCMode Soft Ramp */ |
| 216 | | 0x0040 /* Mute DACs on FIFO error */ |
| 217 | | 0x1000 /* Enable DACs High Pass Filter */ |
| 218 | | 0x0400 /* Disable Coefficient Auto increment */ |
| 219 | )}, |
Takashi Iwai | 829e87e | 2012-11-23 08:25:25 +0100 | [diff] [blame] | 220 | /* ADC1/2 - Digital and Analog Soft Ramp */ |
| 221 | {0x11, AC_VERB_SET_COEF_INDEX, IDX_ADC_CFG}, |
| 222 | {0x11, AC_VERB_SET_PROC_COEF, 0x000a}, |
Takashi Iwai | 40c20fa | 2009-07-06 13:00:57 +0200 | [diff] [blame] | 223 | /* Beep */ |
Alexander Stein | 5a83b4b | 2012-11-01 13:42:37 +0100 | [diff] [blame] | 224 | {0x11, AC_VERB_SET_COEF_INDEX, IDX_BEEP_CFG}, |
Takashi Iwai | 40c20fa | 2009-07-06 13:00:57 +0200 | [diff] [blame] | 225 | {0x11, AC_VERB_SET_PROC_COEF, 0x0007}, /* Enable Beep thru DAC1/2/3 */ |
| 226 | |
| 227 | {} /* terminator */ |
| 228 | }; |
| 229 | |
Ben Whitten | b5bf0a9 | 2013-09-27 10:13:51 +0200 | [diff] [blame] | 230 | static const struct hda_verb cs4208_coef_init_verbs[] = { |
| 231 | {0x01, AC_VERB_SET_POWER_STATE, 0x00}, /* AFG: D0 */ |
| 232 | {0x24, AC_VERB_SET_PROC_STATE, 0x01}, /* VPW: processing on */ |
| 233 | {0x24, AC_VERB_SET_COEF_INDEX, 0x0033}, |
| 234 | {0x24, AC_VERB_SET_PROC_COEF, 0x0001}, /* A1 ICS */ |
| 235 | {0x24, AC_VERB_SET_COEF_INDEX, 0x0034}, |
| 236 | {0x24, AC_VERB_SET_PROC_COEF, 0x1C01}, /* A1 Enable, A Thresh = 300mV */ |
| 237 | {} /* terminator */ |
| 238 | }; |
| 239 | |
Brian Austin | a769cbc | 2010-09-07 14:36:22 -0500 | [diff] [blame] | 240 | /* Errata: CS4207 rev C0/C1/C2 Silicon |
| 241 | * |
| 242 | * http://www.cirrus.com/en/pubs/errata/ER880C3.pdf |
| 243 | * |
| 244 | * 6. At high temperature (TA > +85°C), the digital supply current (IVD) |
| 245 | * may be excessive (up to an additional 200 μA), which is most easily |
| 246 | * observed while the part is being held in reset (RESET# active low). |
| 247 | * |
| 248 | * Root Cause: At initial powerup of the device, the logic that drives |
| 249 | * the clock and write enable to the S/PDIF SRC RAMs is not properly |
| 250 | * initialized. |
| 251 | * Certain random patterns will cause a steady leakage current in those |
| 252 | * RAM cells. The issue will resolve once the SRCs are used (turned on). |
| 253 | * |
| 254 | * Workaround: The following verb sequence briefly turns on the S/PDIF SRC |
| 255 | * blocks, which will alleviate the issue. |
| 256 | */ |
| 257 | |
Takashi Iwai | c42d478 | 2011-05-02 11:36:09 +0200 | [diff] [blame] | 258 | static const struct hda_verb cs_errata_init_verbs[] = { |
Brian Austin | a769cbc | 2010-09-07 14:36:22 -0500 | [diff] [blame] | 259 | {0x01, AC_VERB_SET_POWER_STATE, 0x00}, /* AFG: D0 */ |
| 260 | {0x11, AC_VERB_SET_PROC_STATE, 0x01}, /* VPW: processing on */ |
| 261 | |
| 262 | {0x11, AC_VERB_SET_COEF_INDEX, 0x0008}, |
| 263 | {0x11, AC_VERB_SET_PROC_COEF, 0x9999}, |
| 264 | {0x11, AC_VERB_SET_COEF_INDEX, 0x0017}, |
| 265 | {0x11, AC_VERB_SET_PROC_COEF, 0xa412}, |
| 266 | {0x11, AC_VERB_SET_COEF_INDEX, 0x0001}, |
| 267 | {0x11, AC_VERB_SET_PROC_COEF, 0x0009}, |
| 268 | |
| 269 | {0x07, AC_VERB_SET_POWER_STATE, 0x00}, /* S/PDIF Rx: D0 */ |
| 270 | {0x08, AC_VERB_SET_POWER_STATE, 0x00}, /* S/PDIF Tx: D0 */ |
| 271 | |
| 272 | {0x11, AC_VERB_SET_COEF_INDEX, 0x0017}, |
| 273 | {0x11, AC_VERB_SET_PROC_COEF, 0x2412}, |
| 274 | {0x11, AC_VERB_SET_COEF_INDEX, 0x0008}, |
| 275 | {0x11, AC_VERB_SET_PROC_COEF, 0x0000}, |
| 276 | {0x11, AC_VERB_SET_COEF_INDEX, 0x0001}, |
| 277 | {0x11, AC_VERB_SET_PROC_COEF, 0x0008}, |
| 278 | {0x11, AC_VERB_SET_PROC_STATE, 0x00}, |
| 279 | |
Takashi Iwai | 38c0764 | 2011-03-03 14:54:19 +0100 | [diff] [blame] | 280 | #if 0 /* Don't to set to D3 as we are in power-up sequence */ |
Brian Austin | a769cbc | 2010-09-07 14:36:22 -0500 | [diff] [blame] | 281 | {0x07, AC_VERB_SET_POWER_STATE, 0x03}, /* S/PDIF Rx: D3 */ |
| 282 | {0x08, AC_VERB_SET_POWER_STATE, 0x03}, /* S/PDIF Tx: D3 */ |
| 283 | /*{0x01, AC_VERB_SET_POWER_STATE, 0x03},*/ /* AFG: D3 This is already handled */ |
Takashi Iwai | 38c0764 | 2011-03-03 14:54:19 +0100 | [diff] [blame] | 284 | #endif |
Brian Austin | a769cbc | 2010-09-07 14:36:22 -0500 | [diff] [blame] | 285 | |
| 286 | {} /* terminator */ |
| 287 | }; |
| 288 | |
Takashi Iwai | 40c20fa | 2009-07-06 13:00:57 +0200 | [diff] [blame] | 289 | /* SPDIF setup */ |
Takashi Iwai | 1077a02 | 2012-12-19 16:39:18 +0100 | [diff] [blame] | 290 | static void init_digital_coef(struct hda_codec *codec) |
Takashi Iwai | 40c20fa | 2009-07-06 13:00:57 +0200 | [diff] [blame] | 291 | { |
| 292 | unsigned int coef; |
| 293 | |
| 294 | coef = 0x0002; /* SRC_MUTE soft-mute on SPDIF (if no lock) */ |
| 295 | coef |= 0x0008; /* Replace with mute on error */ |
| 296 | if (is_active_pin(codec, CS_DIG_OUT2_PIN_NID)) |
| 297 | coef |= 0x4000; /* RX to TX1 or TX2 Loopthru / SPDIF2 |
| 298 | * SPDIF_OUT2 is shared with GPIO1 and |
| 299 | * DMIC_SDA2. |
| 300 | */ |
| 301 | cs_vendor_coef_set(codec, IDX_SPDIF_CTL, coef); |
Takashi Iwai | e5f1424 | 2009-07-01 18:11:44 +0200 | [diff] [blame] | 302 | } |
| 303 | |
| 304 | static int cs_init(struct hda_codec *codec) |
| 305 | { |
| 306 | struct cs_spec *spec = codec->spec; |
| 307 | |
Takashi Iwai | be8cf44 | 2013-09-09 13:57:57 +0200 | [diff] [blame] | 308 | if (spec->vendor_nid == CS420X_VENDOR_NID) { |
| 309 | /* init_verb sequence for C0/C1/C2 errata*/ |
| 310 | snd_hda_sequence_write(codec, cs_errata_init_verbs); |
| 311 | snd_hda_sequence_write(codec, cs_coef_init_verbs); |
Ben Whitten | b5bf0a9 | 2013-09-27 10:13:51 +0200 | [diff] [blame] | 312 | } else if (spec->vendor_nid == CS4208_VENDOR_NID) { |
| 313 | snd_hda_sequence_write(codec, cs4208_coef_init_verbs); |
Takashi Iwai | be8cf44 | 2013-09-09 13:57:57 +0200 | [diff] [blame] | 314 | } |
Takashi Iwai | ed20825 | 2009-07-07 09:04:26 +0200 | [diff] [blame] | 315 | |
Takashi Iwai | 1077a02 | 2012-12-19 16:39:18 +0100 | [diff] [blame] | 316 | snd_hda_gen_init(codec); |
Takashi Iwai | 98415ea | 2012-11-23 08:26:58 +0100 | [diff] [blame] | 317 | |
Takashi Iwai | ed20825 | 2009-07-07 09:04:26 +0200 | [diff] [blame] | 318 | if (spec->gpio_mask) { |
| 319 | snd_hda_codec_write(codec, 0x01, 0, AC_VERB_SET_GPIO_MASK, |
| 320 | spec->gpio_mask); |
| 321 | snd_hda_codec_write(codec, 0x01, 0, AC_VERB_SET_GPIO_DIRECTION, |
| 322 | spec->gpio_dir); |
| 323 | snd_hda_codec_write(codec, 0x01, 0, AC_VERB_SET_GPIO_DATA, |
| 324 | spec->gpio_data); |
| 325 | } |
| 326 | |
Takashi Iwai | be8cf44 | 2013-09-09 13:57:57 +0200 | [diff] [blame] | 327 | if (spec->vendor_nid == CS420X_VENDOR_NID) { |
| 328 | init_input_coef(codec); |
| 329 | init_digital_coef(codec); |
| 330 | } |
Takashi Iwai | 01a61e1 | 2011-10-28 00:03:22 +0200 | [diff] [blame] | 331 | |
Takashi Iwai | e5f1424 | 2009-07-01 18:11:44 +0200 | [diff] [blame] | 332 | return 0; |
| 333 | } |
| 334 | |
Takashi Iwai | 0c52db8 | 2013-11-08 13:03:57 +0100 | [diff] [blame] | 335 | static int cs_build_controls(struct hda_codec *codec) |
| 336 | { |
| 337 | int err; |
| 338 | |
| 339 | err = snd_hda_gen_build_controls(codec); |
| 340 | if (err < 0) |
| 341 | return err; |
| 342 | snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_BUILD); |
| 343 | return 0; |
| 344 | } |
| 345 | |
Takashi Iwai | 1077a02 | 2012-12-19 16:39:18 +0100 | [diff] [blame] | 346 | #define cs_free snd_hda_gen_free |
Takashi Iwai | e5f1424 | 2009-07-01 18:11:44 +0200 | [diff] [blame] | 347 | |
Takashi Iwai | c42d478 | 2011-05-02 11:36:09 +0200 | [diff] [blame] | 348 | static const struct hda_codec_ops cs_patch_ops = { |
Takashi Iwai | 0c52db8 | 2013-11-08 13:03:57 +0100 | [diff] [blame] | 349 | .build_controls = cs_build_controls, |
Takashi Iwai | 1077a02 | 2012-12-19 16:39:18 +0100 | [diff] [blame] | 350 | .build_pcms = snd_hda_gen_build_pcms, |
Takashi Iwai | e5f1424 | 2009-07-01 18:11:44 +0200 | [diff] [blame] | 351 | .init = cs_init, |
| 352 | .free = cs_free, |
David Henningsson | 5c2e4e0 | 2012-10-08 15:44:15 +0200 | [diff] [blame] | 353 | .unsol_event = snd_hda_jack_unsol_event, |
Takashi Iwai | e5f1424 | 2009-07-01 18:11:44 +0200 | [diff] [blame] | 354 | }; |
| 355 | |
| 356 | static int cs_parse_auto_config(struct hda_codec *codec) |
| 357 | { |
| 358 | struct cs_spec *spec = codec->spec; |
| 359 | int err; |
| 360 | |
Takashi Iwai | 1077a02 | 2012-12-19 16:39:18 +0100 | [diff] [blame] | 361 | err = snd_hda_parse_pin_defcfg(codec, &spec->gen.autocfg, NULL, 0); |
Takashi Iwai | e5f1424 | 2009-07-01 18:11:44 +0200 | [diff] [blame] | 362 | if (err < 0) |
| 363 | return err; |
Takashi Iwai | ed20825 | 2009-07-07 09:04:26 +0200 | [diff] [blame] | 364 | |
Takashi Iwai | 1077a02 | 2012-12-19 16:39:18 +0100 | [diff] [blame] | 365 | err = snd_hda_gen_parse_auto_config(codec, &spec->gen.autocfg); |
Takashi Iwai | ed20825 | 2009-07-07 09:04:26 +0200 | [diff] [blame] | 366 | if (err < 0) |
| 367 | return err; |
Takashi Iwai | 1077a02 | 2012-12-19 16:39:18 +0100 | [diff] [blame] | 368 | |
Takashi Iwai | e5f1424 | 2009-07-01 18:11:44 +0200 | [diff] [blame] | 369 | return 0; |
| 370 | } |
| 371 | |
Takashi Iwai | b35aabd | 2012-08-24 19:09:45 +0200 | [diff] [blame] | 372 | static const struct hda_model_fixup cs420x_models[] = { |
| 373 | { .id = CS420X_MBP53, .name = "mbp53" }, |
| 374 | { .id = CS420X_MBP55, .name = "mbp55" }, |
| 375 | { .id = CS420X_IMAC27, .name = "imac27" }, |
| 376 | { .id = CS420X_IMAC27_122, .name = "imac27_122" }, |
| 377 | { .id = CS420X_APPLE, .name = "apple" }, |
Takashi Iwai | ef596a5 | 2012-09-11 16:53:08 +0200 | [diff] [blame] | 378 | { .id = CS420X_MBP101, .name = "mbp101" }, |
Takashi Iwai | ffe4d12b | 2012-11-23 08:34:13 +0100 | [diff] [blame] | 379 | { .id = CS420X_MBP81, .name = "mbp81" }, |
Takashi Iwai | 6ab982e | 2013-06-17 10:19:49 +0200 | [diff] [blame] | 380 | { .id = CS420X_MBA42, .name = "mba42" }, |
Takashi Iwai | b35aabd | 2012-08-24 19:09:45 +0200 | [diff] [blame] | 381 | {} |
Takashi Iwai | a6bae20 | 2009-07-06 15:15:22 +0200 | [diff] [blame] | 382 | }; |
| 383 | |
Takashi Iwai | b35aabd | 2012-08-24 19:09:45 +0200 | [diff] [blame] | 384 | static const struct snd_pci_quirk cs420x_fixup_tbl[] = { |
Vince Weaver | 4e7d7c6 | 2010-09-22 17:31:37 -0400 | [diff] [blame] | 385 | SND_PCI_QUIRK(0x10de, 0x0ac0, "MacBookPro 5,3", CS420X_MBP53), |
Edgar (gimli) Hucek | 87232dd | 2010-11-03 08:14:10 +0100 | [diff] [blame] | 386 | SND_PCI_QUIRK(0x10de, 0x0d94, "MacBookAir 3,1(2)", CS420X_MBP55), |
Takashi Iwai | a6bae20 | 2009-07-06 15:15:22 +0200 | [diff] [blame] | 387 | SND_PCI_QUIRK(0x10de, 0xcb79, "MacBookPro 5,5", CS420X_MBP55), |
Takashi Iwai | f46119b | 2010-10-11 14:46:35 +0200 | [diff] [blame] | 388 | SND_PCI_QUIRK(0x10de, 0xcb89, "MacBookPro 7,1", CS420X_MBP55), |
Takashi Iwai | 6dfeb703 | 2011-11-22 20:00:31 +0100 | [diff] [blame] | 389 | /* this conflicts with too many other models */ |
| 390 | /*SND_PCI_QUIRK(0x8086, 0x7270, "IMac 27 Inch", CS420X_IMAC27),*/ |
Takashi Iwai | 6dfeb703 | 2011-11-22 20:00:31 +0100 | [diff] [blame] | 391 | |
Takashi Iwai | b35aabd | 2012-08-24 19:09:45 +0200 | [diff] [blame] | 392 | /* codec SSID */ |
Takashi Iwai | ffe4d12b | 2012-11-23 08:34:13 +0100 | [diff] [blame] | 393 | SND_PCI_QUIRK(0x106b, 0x1c00, "MacBookPro 8,1", CS420X_MBP81), |
Jérémy Lal | 7e5bea1 | 2012-01-09 17:19:45 +0100 | [diff] [blame] | 394 | SND_PCI_QUIRK(0x106b, 0x2000, "iMac 12,2", CS420X_IMAC27_122), |
Takashi Iwai | ef596a5 | 2012-09-11 16:53:08 +0200 | [diff] [blame] | 395 | SND_PCI_QUIRK(0x106b, 0x2800, "MacBookPro 10,1", CS420X_MBP101), |
Takashi Iwai | 2ddee91 | 2015-03-12 20:47:15 +0100 | [diff] [blame] | 396 | SND_PCI_QUIRK(0x106b, 0x5600, "MacBookAir 5,2", CS420X_MBP81), |
Takashi Iwai | 6ab982e | 2013-06-17 10:19:49 +0200 | [diff] [blame] | 397 | SND_PCI_QUIRK(0x106b, 0x5b00, "MacBookAir 4,2", CS420X_MBA42), |
Takashi Iwai | 6dfeb703 | 2011-11-22 20:00:31 +0100 | [diff] [blame] | 398 | SND_PCI_QUIRK_VENDOR(0x106b, "Apple", CS420X_APPLE), |
Takashi Iwai | a6bae20 | 2009-07-06 15:15:22 +0200 | [diff] [blame] | 399 | {} /* terminator */ |
| 400 | }; |
| 401 | |
Takashi Iwai | b35aabd | 2012-08-24 19:09:45 +0200 | [diff] [blame] | 402 | static const struct hda_pintbl mbp53_pincfgs[] = { |
Vince Weaver | 4e7d7c6 | 2010-09-22 17:31:37 -0400 | [diff] [blame] | 403 | { 0x09, 0x012b4050 }, |
| 404 | { 0x0a, 0x90100141 }, |
| 405 | { 0x0b, 0x90100140 }, |
| 406 | { 0x0c, 0x018b3020 }, |
| 407 | { 0x0d, 0x90a00110 }, |
| 408 | { 0x0e, 0x400000f0 }, |
| 409 | { 0x0f, 0x01cbe030 }, |
| 410 | { 0x10, 0x014be060 }, |
| 411 | { 0x12, 0x400000f0 }, |
| 412 | { 0x15, 0x400000f0 }, |
| 413 | {} /* terminator */ |
| 414 | }; |
| 415 | |
Takashi Iwai | b35aabd | 2012-08-24 19:09:45 +0200 | [diff] [blame] | 416 | static const struct hda_pintbl mbp55_pincfgs[] = { |
Takashi Iwai | a6bae20 | 2009-07-06 15:15:22 +0200 | [diff] [blame] | 417 | { 0x09, 0x012b4030 }, |
| 418 | { 0x0a, 0x90100121 }, |
| 419 | { 0x0b, 0x90100120 }, |
| 420 | { 0x0c, 0x400000f0 }, |
| 421 | { 0x0d, 0x90a00110 }, |
| 422 | { 0x0e, 0x400000f0 }, |
| 423 | { 0x0f, 0x400000f0 }, |
| 424 | { 0x10, 0x014be040 }, |
| 425 | { 0x12, 0x400000f0 }, |
| 426 | { 0x15, 0x400000f0 }, |
| 427 | {} /* terminator */ |
| 428 | }; |
| 429 | |
Takashi Iwai | b35aabd | 2012-08-24 19:09:45 +0200 | [diff] [blame] | 430 | static const struct hda_pintbl imac27_pincfgs[] = { |
Rafael Avila de Espindola | 1a5ba2e | 2009-12-22 07:59:37 +0100 | [diff] [blame] | 431 | { 0x09, 0x012b4050 }, |
| 432 | { 0x0a, 0x90100140 }, |
| 433 | { 0x0b, 0x90100142 }, |
| 434 | { 0x0c, 0x018b3020 }, |
| 435 | { 0x0d, 0x90a00110 }, |
| 436 | { 0x0e, 0x400000f0 }, |
| 437 | { 0x0f, 0x01cbe030 }, |
| 438 | { 0x10, 0x014be060 }, |
| 439 | { 0x12, 0x01ab9070 }, |
| 440 | { 0x15, 0x400000f0 }, |
| 441 | {} /* terminator */ |
| 442 | }; |
| 443 | |
Takashi Iwai | ef596a5 | 2012-09-11 16:53:08 +0200 | [diff] [blame] | 444 | static const struct hda_pintbl mbp101_pincfgs[] = { |
| 445 | { 0x0d, 0x40ab90f0 }, |
| 446 | { 0x0e, 0x90a600f0 }, |
| 447 | { 0x12, 0x50a600f0 }, |
| 448 | {} /* terminator */ |
| 449 | }; |
| 450 | |
Takashi Iwai | 6ab982e | 2013-06-17 10:19:49 +0200 | [diff] [blame] | 451 | static const struct hda_pintbl mba42_pincfgs[] = { |
| 452 | { 0x09, 0x012b4030 }, /* HP */ |
| 453 | { 0x0a, 0x400000f0 }, |
| 454 | { 0x0b, 0x90100120 }, /* speaker */ |
| 455 | { 0x0c, 0x400000f0 }, |
| 456 | { 0x0d, 0x90a00110 }, /* mic */ |
| 457 | { 0x0e, 0x400000f0 }, |
| 458 | { 0x0f, 0x400000f0 }, |
| 459 | { 0x10, 0x400000f0 }, |
| 460 | { 0x12, 0x400000f0 }, |
| 461 | { 0x15, 0x400000f0 }, |
| 462 | {} /* terminator */ |
| 463 | }; |
| 464 | |
Ben Whitten | b5bf0a9 | 2013-09-27 10:13:51 +0200 | [diff] [blame] | 465 | static const struct hda_pintbl mba6_pincfgs[] = { |
| 466 | { 0x10, 0x032120f0 }, /* HP */ |
| 467 | { 0x11, 0x500000f0 }, |
| 468 | { 0x12, 0x90100010 }, /* Speaker */ |
| 469 | { 0x13, 0x500000f0 }, |
| 470 | { 0x14, 0x500000f0 }, |
| 471 | { 0x15, 0x770000f0 }, |
| 472 | { 0x16, 0x770000f0 }, |
| 473 | { 0x17, 0x430000f0 }, |
| 474 | { 0x18, 0x43ab9030 }, /* Mic */ |
| 475 | { 0x19, 0x770000f0 }, |
| 476 | { 0x1a, 0x770000f0 }, |
| 477 | { 0x1b, 0x770000f0 }, |
| 478 | { 0x1c, 0x90a00090 }, |
| 479 | { 0x1d, 0x500000f0 }, |
| 480 | { 0x1e, 0x500000f0 }, |
| 481 | { 0x1f, 0x500000f0 }, |
| 482 | { 0x20, 0x500000f0 }, |
| 483 | { 0x21, 0x430000f0 }, |
| 484 | { 0x22, 0x430000f0 }, |
| 485 | {} /* terminator */ |
| 486 | }; |
| 487 | |
Takashi Iwai | b35aabd | 2012-08-24 19:09:45 +0200 | [diff] [blame] | 488 | static void cs420x_fixup_gpio_13(struct hda_codec *codec, |
| 489 | const struct hda_fixup *fix, int action) |
Takashi Iwai | a6bae20 | 2009-07-06 15:15:22 +0200 | [diff] [blame] | 490 | { |
Takashi Iwai | b35aabd | 2012-08-24 19:09:45 +0200 | [diff] [blame] | 491 | if (action == HDA_FIXUP_ACT_PRE_PROBE) { |
| 492 | struct cs_spec *spec = codec->spec; |
| 493 | spec->gpio_eapd_hp = 2; /* GPIO1 = headphones */ |
| 494 | spec->gpio_eapd_speaker = 8; /* GPIO3 = speakers */ |
| 495 | spec->gpio_mask = spec->gpio_dir = |
| 496 | spec->gpio_eapd_hp | spec->gpio_eapd_speaker; |
| 497 | } |
Takashi Iwai | a6bae20 | 2009-07-06 15:15:22 +0200 | [diff] [blame] | 498 | } |
| 499 | |
Takashi Iwai | b35aabd | 2012-08-24 19:09:45 +0200 | [diff] [blame] | 500 | static void cs420x_fixup_gpio_23(struct hda_codec *codec, |
| 501 | const struct hda_fixup *fix, int action) |
| 502 | { |
| 503 | if (action == HDA_FIXUP_ACT_PRE_PROBE) { |
| 504 | struct cs_spec *spec = codec->spec; |
| 505 | spec->gpio_eapd_hp = 4; /* GPIO2 = headphones */ |
| 506 | spec->gpio_eapd_speaker = 8; /* GPIO3 = speakers */ |
| 507 | spec->gpio_mask = spec->gpio_dir = |
| 508 | spec->gpio_eapd_hp | spec->gpio_eapd_speaker; |
| 509 | } |
| 510 | } |
| 511 | |
| 512 | static const struct hda_fixup cs420x_fixups[] = { |
| 513 | [CS420X_MBP53] = { |
| 514 | .type = HDA_FIXUP_PINS, |
| 515 | .v.pins = mbp53_pincfgs, |
| 516 | .chained = true, |
| 517 | .chain_id = CS420X_APPLE, |
| 518 | }, |
| 519 | [CS420X_MBP55] = { |
| 520 | .type = HDA_FIXUP_PINS, |
| 521 | .v.pins = mbp55_pincfgs, |
| 522 | .chained = true, |
| 523 | .chain_id = CS420X_GPIO_13, |
| 524 | }, |
| 525 | [CS420X_IMAC27] = { |
| 526 | .type = HDA_FIXUP_PINS, |
| 527 | .v.pins = imac27_pincfgs, |
| 528 | .chained = true, |
| 529 | .chain_id = CS420X_GPIO_13, |
| 530 | }, |
| 531 | [CS420X_GPIO_13] = { |
| 532 | .type = HDA_FIXUP_FUNC, |
| 533 | .v.func = cs420x_fixup_gpio_13, |
| 534 | }, |
| 535 | [CS420X_GPIO_23] = { |
| 536 | .type = HDA_FIXUP_FUNC, |
| 537 | .v.func = cs420x_fixup_gpio_23, |
| 538 | }, |
Takashi Iwai | ef596a5 | 2012-09-11 16:53:08 +0200 | [diff] [blame] | 539 | [CS420X_MBP101] = { |
| 540 | .type = HDA_FIXUP_PINS, |
| 541 | .v.pins = mbp101_pincfgs, |
| 542 | .chained = true, |
Takashi Iwai | ef596a5 | 2012-09-11 16:53:08 +0200 | [diff] [blame] | 543 | .chain_id = CS420X_GPIO_13, |
| 544 | }, |
Takashi Iwai | ffe4d12b | 2012-11-23 08:34:13 +0100 | [diff] [blame] | 545 | [CS420X_MBP81] = { |
| 546 | .type = HDA_FIXUP_VERBS, |
| 547 | .v.verbs = (const struct hda_verb[]) { |
| 548 | /* internal mic ADC2: right only, single ended */ |
| 549 | {0x11, AC_VERB_SET_COEF_INDEX, IDX_ADC_CFG}, |
| 550 | {0x11, AC_VERB_SET_PROC_COEF, 0x102a}, |
| 551 | {} |
| 552 | }, |
| 553 | .chained = true, |
| 554 | .chain_id = CS420X_GPIO_13, |
| 555 | }, |
Takashi Iwai | 6ab982e | 2013-06-17 10:19:49 +0200 | [diff] [blame] | 556 | [CS420X_MBA42] = { |
| 557 | .type = HDA_FIXUP_PINS, |
| 558 | .v.pins = mba42_pincfgs, |
| 559 | .chained = true, |
| 560 | .chain_id = CS420X_GPIO_13, |
| 561 | }, |
Takashi Iwai | b35aabd | 2012-08-24 19:09:45 +0200 | [diff] [blame] | 562 | }; |
| 563 | |
Takashi Iwai | 1077a02 | 2012-12-19 16:39:18 +0100 | [diff] [blame] | 564 | static struct cs_spec *cs_alloc_spec(struct hda_codec *codec, int vendor_nid) |
| 565 | { |
| 566 | struct cs_spec *spec; |
| 567 | |
| 568 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
| 569 | if (!spec) |
| 570 | return NULL; |
| 571 | codec->spec = spec; |
| 572 | spec->vendor_nid = vendor_nid; |
| 573 | snd_hda_gen_spec_init(&spec->gen); |
| 574 | |
| 575 | return spec; |
| 576 | } |
| 577 | |
Takashi Iwai | e5f1424 | 2009-07-01 18:11:44 +0200 | [diff] [blame] | 578 | static int patch_cs420x(struct hda_codec *codec) |
| 579 | { |
| 580 | struct cs_spec *spec; |
| 581 | int err; |
| 582 | |
Takashi Iwai | 1077a02 | 2012-12-19 16:39:18 +0100 | [diff] [blame] | 583 | spec = cs_alloc_spec(codec, CS420X_VENDOR_NID); |
Takashi Iwai | e5f1424 | 2009-07-01 18:11:44 +0200 | [diff] [blame] | 584 | if (!spec) |
| 585 | return -ENOMEM; |
Tim Howe | 56487c2 | 2011-07-22 16:41:00 -0500 | [diff] [blame] | 586 | |
Takashi Iwai | 225068a | 2015-05-29 10:42:14 +0200 | [diff] [blame] | 587 | codec->patch_ops = cs_patch_ops; |
Takashi Iwai | 6d3073e | 2013-03-15 14:23:32 +0100 | [diff] [blame] | 588 | spec->gen.automute_hook = cs_automute; |
Takashi Iwai | bad994f | 2015-03-12 20:28:04 +0100 | [diff] [blame] | 589 | codec->single_adc_amp = 1; |
Takashi Iwai | 6d3073e | 2013-03-15 14:23:32 +0100 | [diff] [blame] | 590 | |
Takashi Iwai | b35aabd | 2012-08-24 19:09:45 +0200 | [diff] [blame] | 591 | snd_hda_pick_fixup(codec, cs420x_models, cs420x_fixup_tbl, |
| 592 | cs420x_fixups); |
| 593 | snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE); |
Takashi Iwai | e5f1424 | 2009-07-01 18:11:44 +0200 | [diff] [blame] | 594 | |
Takashi Iwai | ed20825 | 2009-07-07 09:04:26 +0200 | [diff] [blame] | 595 | err = cs_parse_auto_config(codec); |
Takashi Iwai | 21a4dc4 | 2009-07-06 12:55:46 +0200 | [diff] [blame] | 596 | if (err < 0) |
| 597 | goto error; |
| 598 | |
Takashi Iwai | b35aabd | 2012-08-24 19:09:45 +0200 | [diff] [blame] | 599 | snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE); |
| 600 | |
Takashi Iwai | e5f1424 | 2009-07-01 18:11:44 +0200 | [diff] [blame] | 601 | return 0; |
| 602 | |
| 603 | error: |
Takashi Iwai | c5e0b6d | 2012-10-10 08:50:35 +0200 | [diff] [blame] | 604 | cs_free(codec); |
Takashi Iwai | e5f1424 | 2009-07-01 18:11:44 +0200 | [diff] [blame] | 605 | return err; |
| 606 | } |
| 607 | |
Tim Howe | 56487c2 | 2011-07-22 16:41:00 -0500 | [diff] [blame] | 608 | /* |
Takashi Iwai | be8cf44 | 2013-09-09 13:57:57 +0200 | [diff] [blame] | 609 | * CS4208 support: |
Ben Whitten | b5bf0a9 | 2013-09-27 10:13:51 +0200 | [diff] [blame] | 610 | * Its layout is no longer compatible with CS4206/CS4207 |
Takashi Iwai | be8cf44 | 2013-09-09 13:57:57 +0200 | [diff] [blame] | 611 | */ |
| 612 | enum { |
Takashi Iwai | 885845d | 2013-11-08 12:50:31 +0100 | [diff] [blame] | 613 | CS4208_MAC_AUTO, |
Ben Whitten | b5bf0a9 | 2013-09-27 10:13:51 +0200 | [diff] [blame] | 614 | CS4208_MBA6, |
Takashi Iwai | 0c52db8 | 2013-11-08 13:03:57 +0100 | [diff] [blame] | 615 | CS4208_MBP11, |
Takashi Iwai | be8cf44 | 2013-09-09 13:57:57 +0200 | [diff] [blame] | 616 | CS4208_GPIO0, |
| 617 | }; |
| 618 | |
| 619 | static const struct hda_model_fixup cs4208_models[] = { |
| 620 | { .id = CS4208_GPIO0, .name = "gpio0" }, |
Ben Whitten | b5bf0a9 | 2013-09-27 10:13:51 +0200 | [diff] [blame] | 621 | { .id = CS4208_MBA6, .name = "mba6" }, |
Takashi Iwai | 0c52db8 | 2013-11-08 13:03:57 +0100 | [diff] [blame] | 622 | { .id = CS4208_MBP11, .name = "mbp11" }, |
Takashi Iwai | be8cf44 | 2013-09-09 13:57:57 +0200 | [diff] [blame] | 623 | {} |
| 624 | }; |
| 625 | |
| 626 | static const struct snd_pci_quirk cs4208_fixup_tbl[] = { |
Takashi Iwai | 885845d | 2013-11-08 12:50:31 +0100 | [diff] [blame] | 627 | SND_PCI_QUIRK_VENDOR(0x106b, "Apple", CS4208_MAC_AUTO), |
| 628 | {} /* terminator */ |
| 629 | }; |
| 630 | |
| 631 | /* codec SSID matching */ |
| 632 | static const struct snd_pci_quirk cs4208_mac_fixup_tbl[] = { |
Takashi Iwai | 0c52db8 | 2013-11-08 13:03:57 +0100 | [diff] [blame] | 633 | SND_PCI_QUIRK(0x106b, 0x5e00, "MacBookPro 11,2", CS4208_MBP11), |
Ben Whitten | b5bf0a9 | 2013-09-27 10:13:51 +0200 | [diff] [blame] | 634 | SND_PCI_QUIRK(0x106b, 0x7100, "MacBookAir 6,1", CS4208_MBA6), |
| 635 | SND_PCI_QUIRK(0x106b, 0x7200, "MacBookAir 6,2", CS4208_MBA6), |
Takashi Iwai | be8cf44 | 2013-09-09 13:57:57 +0200 | [diff] [blame] | 636 | {} /* terminator */ |
| 637 | }; |
| 638 | |
| 639 | static void cs4208_fixup_gpio0(struct hda_codec *codec, |
| 640 | const struct hda_fixup *fix, int action) |
| 641 | { |
| 642 | if (action == HDA_FIXUP_ACT_PRE_PROBE) { |
| 643 | struct cs_spec *spec = codec->spec; |
| 644 | spec->gpio_eapd_hp = 0; |
| 645 | spec->gpio_eapd_speaker = 1; |
| 646 | spec->gpio_mask = spec->gpio_dir = |
| 647 | spec->gpio_eapd_hp | spec->gpio_eapd_speaker; |
| 648 | } |
| 649 | } |
| 650 | |
Takashi Iwai | 885845d | 2013-11-08 12:50:31 +0100 | [diff] [blame] | 651 | static const struct hda_fixup cs4208_fixups[]; |
| 652 | |
| 653 | /* remap the fixup from codec SSID and apply it */ |
| 654 | static void cs4208_fixup_mac(struct hda_codec *codec, |
| 655 | const struct hda_fixup *fix, int action) |
| 656 | { |
| 657 | if (action != HDA_FIXUP_ACT_PRE_PROBE) |
| 658 | return; |
David Henningsson | f5662e1 | 2014-07-22 14:09:34 +0200 | [diff] [blame] | 659 | |
| 660 | codec->fixup_id = HDA_FIXUP_ID_NOT_SET; |
Takashi Iwai | 885845d | 2013-11-08 12:50:31 +0100 | [diff] [blame] | 661 | snd_hda_pick_fixup(codec, NULL, cs4208_mac_fixup_tbl, cs4208_fixups); |
David Henningsson | f5662e1 | 2014-07-22 14:09:34 +0200 | [diff] [blame] | 662 | if (codec->fixup_id == HDA_FIXUP_ID_NOT_SET) |
Takashi Iwai | 885845d | 2013-11-08 12:50:31 +0100 | [diff] [blame] | 663 | codec->fixup_id = CS4208_GPIO0; /* default fixup */ |
| 664 | snd_hda_apply_fixup(codec, action); |
| 665 | } |
| 666 | |
Takashi Iwai | 0c52db8 | 2013-11-08 13:03:57 +0100 | [diff] [blame] | 667 | static int cs4208_spdif_sw_put(struct snd_kcontrol *kcontrol, |
| 668 | struct snd_ctl_elem_value *ucontrol) |
| 669 | { |
| 670 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 671 | struct cs_spec *spec = codec->spec; |
| 672 | hda_nid_t pin = spec->gen.autocfg.dig_out_pins[0]; |
| 673 | int pinctl = ucontrol->value.integer.value[0] ? PIN_OUT : 0; |
| 674 | |
| 675 | snd_hda_set_pin_ctl_cache(codec, pin, pinctl); |
| 676 | return spec->spdif_sw_put(kcontrol, ucontrol); |
| 677 | } |
| 678 | |
| 679 | /* hook the SPDIF switch */ |
| 680 | static void cs4208_fixup_spdif_switch(struct hda_codec *codec, |
| 681 | const struct hda_fixup *fix, int action) |
| 682 | { |
| 683 | if (action == HDA_FIXUP_ACT_BUILD) { |
| 684 | struct cs_spec *spec = codec->spec; |
| 685 | struct snd_kcontrol *kctl; |
| 686 | |
| 687 | if (!spec->gen.autocfg.dig_out_pins[0]) |
| 688 | return; |
| 689 | kctl = snd_hda_find_mixer_ctl(codec, "IEC958 Playback Switch"); |
| 690 | if (!kctl) |
| 691 | return; |
| 692 | spec->spdif_sw_put = kctl->put; |
| 693 | kctl->put = cs4208_spdif_sw_put; |
| 694 | } |
| 695 | } |
| 696 | |
Takashi Iwai | be8cf44 | 2013-09-09 13:57:57 +0200 | [diff] [blame] | 697 | static const struct hda_fixup cs4208_fixups[] = { |
Ben Whitten | b5bf0a9 | 2013-09-27 10:13:51 +0200 | [diff] [blame] | 698 | [CS4208_MBA6] = { |
| 699 | .type = HDA_FIXUP_PINS, |
| 700 | .v.pins = mba6_pincfgs, |
| 701 | .chained = true, |
| 702 | .chain_id = CS4208_GPIO0, |
| 703 | }, |
Takashi Iwai | 0c52db8 | 2013-11-08 13:03:57 +0100 | [diff] [blame] | 704 | [CS4208_MBP11] = { |
| 705 | .type = HDA_FIXUP_FUNC, |
| 706 | .v.func = cs4208_fixup_spdif_switch, |
| 707 | .chained = true, |
| 708 | .chain_id = CS4208_GPIO0, |
| 709 | }, |
Takashi Iwai | be8cf44 | 2013-09-09 13:57:57 +0200 | [diff] [blame] | 710 | [CS4208_GPIO0] = { |
| 711 | .type = HDA_FIXUP_FUNC, |
| 712 | .v.func = cs4208_fixup_gpio0, |
| 713 | }, |
Takashi Iwai | 885845d | 2013-11-08 12:50:31 +0100 | [diff] [blame] | 714 | [CS4208_MAC_AUTO] = { |
| 715 | .type = HDA_FIXUP_FUNC, |
| 716 | .v.func = cs4208_fixup_mac, |
| 717 | }, |
Takashi Iwai | be8cf44 | 2013-09-09 13:57:57 +0200 | [diff] [blame] | 718 | }; |
| 719 | |
Ben Whitten | b5bf0a9 | 2013-09-27 10:13:51 +0200 | [diff] [blame] | 720 | /* correct the 0dB offset of input pins */ |
| 721 | static void cs4208_fix_amp_caps(struct hda_codec *codec, hda_nid_t adc) |
| 722 | { |
| 723 | unsigned int caps; |
| 724 | |
| 725 | caps = query_amp_caps(codec, adc, HDA_INPUT); |
| 726 | caps &= ~(AC_AMPCAP_OFFSET); |
| 727 | caps |= 0x02; |
| 728 | snd_hda_override_amp_caps(codec, adc, HDA_INPUT, caps); |
| 729 | } |
| 730 | |
Takashi Iwai | be8cf44 | 2013-09-09 13:57:57 +0200 | [diff] [blame] | 731 | static int patch_cs4208(struct hda_codec *codec) |
| 732 | { |
| 733 | struct cs_spec *spec; |
| 734 | int err; |
| 735 | |
Ben Whitten | b5bf0a9 | 2013-09-27 10:13:51 +0200 | [diff] [blame] | 736 | spec = cs_alloc_spec(codec, CS4208_VENDOR_NID); |
Takashi Iwai | be8cf44 | 2013-09-09 13:57:57 +0200 | [diff] [blame] | 737 | if (!spec) |
| 738 | return -ENOMEM; |
| 739 | |
Takashi Iwai | 225068a | 2015-05-29 10:42:14 +0200 | [diff] [blame] | 740 | codec->patch_ops = cs_patch_ops; |
Takashi Iwai | be8cf44 | 2013-09-09 13:57:57 +0200 | [diff] [blame] | 741 | spec->gen.automute_hook = cs_automute; |
Takashi Iwai | a1114a8 | 2013-11-04 16:32:01 +0100 | [diff] [blame] | 742 | /* exclude NID 0x10 (HP) from output volumes due to different steps */ |
| 743 | spec->gen.out_vol_mask = 1ULL << 0x10; |
Takashi Iwai | be8cf44 | 2013-09-09 13:57:57 +0200 | [diff] [blame] | 744 | |
| 745 | snd_hda_pick_fixup(codec, cs4208_models, cs4208_fixup_tbl, |
| 746 | cs4208_fixups); |
| 747 | snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE); |
| 748 | |
Ben Whitten | b5bf0a9 | 2013-09-27 10:13:51 +0200 | [diff] [blame] | 749 | snd_hda_override_wcaps(codec, 0x18, |
| 750 | get_wcaps(codec, 0x18) | AC_WCAP_STEREO); |
| 751 | cs4208_fix_amp_caps(codec, 0x18); |
| 752 | cs4208_fix_amp_caps(codec, 0x1b); |
| 753 | cs4208_fix_amp_caps(codec, 0x1c); |
| 754 | |
Takashi Iwai | be8cf44 | 2013-09-09 13:57:57 +0200 | [diff] [blame] | 755 | err = cs_parse_auto_config(codec); |
| 756 | if (err < 0) |
| 757 | goto error; |
| 758 | |
Takashi Iwai | be8cf44 | 2013-09-09 13:57:57 +0200 | [diff] [blame] | 759 | snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE); |
| 760 | |
| 761 | return 0; |
| 762 | |
| 763 | error: |
| 764 | cs_free(codec); |
| 765 | return err; |
| 766 | } |
| 767 | |
| 768 | /* |
Tim Howe | 56487c2 | 2011-07-22 16:41:00 -0500 | [diff] [blame] | 769 | * Cirrus Logic CS4210 |
| 770 | * |
| 771 | * 1 DAC => HP(sense) / Speakers, |
| 772 | * 1 ADC <= LineIn(sense) / MicIn / DMicIn, |
| 773 | * 1 SPDIF OUT => SPDIF Trasmitter(sense) |
| 774 | */ |
| 775 | |
| 776 | /* CS4210 board names */ |
Takashi Iwai | b35aabd | 2012-08-24 19:09:45 +0200 | [diff] [blame] | 777 | static const struct hda_model_fixup cs421x_models[] = { |
| 778 | { .id = CS421X_CDB4210, .name = "cdb4210" }, |
Dylan Reid | 4af1610 | 2013-04-04 15:35:31 -0700 | [diff] [blame] | 779 | { .id = CS421X_STUMPY, .name = "stumpy" }, |
Takashi Iwai | b35aabd | 2012-08-24 19:09:45 +0200 | [diff] [blame] | 780 | {} |
Tim Howe | 56487c2 | 2011-07-22 16:41:00 -0500 | [diff] [blame] | 781 | }; |
| 782 | |
Takashi Iwai | b35aabd | 2012-08-24 19:09:45 +0200 | [diff] [blame] | 783 | static const struct snd_pci_quirk cs421x_fixup_tbl[] = { |
Tim Howe | 56487c2 | 2011-07-22 16:41:00 -0500 | [diff] [blame] | 784 | /* Test Intel board + CDB2410 */ |
| 785 | SND_PCI_QUIRK(0x8086, 0x5001, "DP45SG/CDB4210", CS421X_CDB4210), |
| 786 | {} /* terminator */ |
| 787 | }; |
| 788 | |
| 789 | /* CS4210 board pinconfigs */ |
| 790 | /* Default CS4210 (CDB4210)*/ |
Takashi Iwai | b35aabd | 2012-08-24 19:09:45 +0200 | [diff] [blame] | 791 | static const struct hda_pintbl cdb4210_pincfgs[] = { |
Tim Howe | 56487c2 | 2011-07-22 16:41:00 -0500 | [diff] [blame] | 792 | { 0x05, 0x0321401f }, |
| 793 | { 0x06, 0x90170010 }, |
| 794 | { 0x07, 0x03813031 }, |
| 795 | { 0x08, 0xb7a70037 }, |
| 796 | { 0x09, 0xb7a6003e }, |
| 797 | { 0x0a, 0x034510f0 }, |
| 798 | {} /* terminator */ |
| 799 | }; |
| 800 | |
Dylan Reid | 4af1610 | 2013-04-04 15:35:31 -0700 | [diff] [blame] | 801 | /* Stumpy ChromeBox */ |
| 802 | static const struct hda_pintbl stumpy_pincfgs[] = { |
| 803 | { 0x05, 0x022120f0 }, |
| 804 | { 0x06, 0x901700f0 }, |
| 805 | { 0x07, 0x02a120f0 }, |
| 806 | { 0x08, 0x77a70037 }, |
| 807 | { 0x09, 0x77a6003e }, |
| 808 | { 0x0a, 0x434510f0 }, |
| 809 | {} /* terminator */ |
| 810 | }; |
| 811 | |
Takashi Iwai | b35aabd | 2012-08-24 19:09:45 +0200 | [diff] [blame] | 812 | /* Setup GPIO/SENSE for each board (if used) */ |
| 813 | static void cs421x_fixup_sense_b(struct hda_codec *codec, |
| 814 | const struct hda_fixup *fix, int action) |
| 815 | { |
| 816 | struct cs_spec *spec = codec->spec; |
| 817 | if (action == HDA_FIXUP_ACT_PRE_PROBE) |
| 818 | spec->sense_b = 1; |
| 819 | } |
| 820 | |
| 821 | static const struct hda_fixup cs421x_fixups[] = { |
| 822 | [CS421X_CDB4210] = { |
| 823 | .type = HDA_FIXUP_PINS, |
| 824 | .v.pins = cdb4210_pincfgs, |
| 825 | .chained = true, |
| 826 | .chain_id = CS421X_SENSE_B, |
| 827 | }, |
| 828 | [CS421X_SENSE_B] = { |
| 829 | .type = HDA_FIXUP_FUNC, |
| 830 | .v.func = cs421x_fixup_sense_b, |
Dylan Reid | 4af1610 | 2013-04-04 15:35:31 -0700 | [diff] [blame] | 831 | }, |
| 832 | [CS421X_STUMPY] = { |
| 833 | .type = HDA_FIXUP_PINS, |
| 834 | .v.pins = stumpy_pincfgs, |
| 835 | }, |
Tim Howe | 56487c2 | 2011-07-22 16:41:00 -0500 | [diff] [blame] | 836 | }; |
| 837 | |
| 838 | static const struct hda_verb cs421x_coef_init_verbs[] = { |
| 839 | {0x0B, AC_VERB_SET_PROC_STATE, 1}, |
| 840 | {0x0B, AC_VERB_SET_COEF_INDEX, CS421X_IDX_DEV_CFG}, |
| 841 | /* |
| 842 | Disable Coefficient Index Auto-Increment(DAI)=1, |
| 843 | PDREF=0 |
| 844 | */ |
| 845 | {0x0B, AC_VERB_SET_PROC_COEF, 0x0001 }, |
| 846 | |
| 847 | {0x0B, AC_VERB_SET_COEF_INDEX, CS421X_IDX_ADC_CFG}, |
| 848 | /* ADC SZCMode = Digital Soft Ramp */ |
| 849 | {0x0B, AC_VERB_SET_PROC_COEF, 0x0002 }, |
| 850 | |
| 851 | {0x0B, AC_VERB_SET_COEF_INDEX, CS421X_IDX_DAC_CFG}, |
| 852 | {0x0B, AC_VERB_SET_PROC_COEF, |
| 853 | (0x0002 /* DAC SZCMode = Digital Soft Ramp */ |
| 854 | | 0x0004 /* Mute DAC on FIFO error */ |
| 855 | | 0x0008 /* Enable DAC High Pass Filter */ |
| 856 | )}, |
| 857 | {} /* terminator */ |
| 858 | }; |
| 859 | |
| 860 | /* Errata: CS4210 rev A1 Silicon |
| 861 | * |
| 862 | * http://www.cirrus.com/en/pubs/errata/ |
| 863 | * |
| 864 | * Description: |
| 865 | * 1. Performance degredation is present in the ADC. |
| 866 | * 2. Speaker output is not completely muted upon HP detect. |
| 867 | * 3. Noise is present when clipping occurs on the amplified |
| 868 | * speaker outputs. |
| 869 | * |
| 870 | * Workaround: |
| 871 | * The following verb sequence written to the registers during |
| 872 | * initialization will correct the issues listed above. |
| 873 | */ |
| 874 | |
| 875 | static const struct hda_verb cs421x_coef_init_verbs_A1_silicon_fixes[] = { |
| 876 | {0x0B, AC_VERB_SET_PROC_STATE, 0x01}, /* VPW: processing on */ |
| 877 | |
| 878 | {0x0B, AC_VERB_SET_COEF_INDEX, 0x0006}, |
| 879 | {0x0B, AC_VERB_SET_PROC_COEF, 0x9999}, /* Test mode: on */ |
| 880 | |
| 881 | {0x0B, AC_VERB_SET_COEF_INDEX, 0x000A}, |
| 882 | {0x0B, AC_VERB_SET_PROC_COEF, 0x14CB}, /* Chop double */ |
| 883 | |
| 884 | {0x0B, AC_VERB_SET_COEF_INDEX, 0x0011}, |
| 885 | {0x0B, AC_VERB_SET_PROC_COEF, 0xA2D0}, /* Increase ADC current */ |
| 886 | |
| 887 | {0x0B, AC_VERB_SET_COEF_INDEX, 0x001A}, |
| 888 | {0x0B, AC_VERB_SET_PROC_COEF, 0x02A9}, /* Mute speaker */ |
| 889 | |
| 890 | {0x0B, AC_VERB_SET_COEF_INDEX, 0x001B}, |
| 891 | {0x0B, AC_VERB_SET_PROC_COEF, 0X1006}, /* Remove noise */ |
| 892 | |
| 893 | {} /* terminator */ |
| 894 | }; |
| 895 | |
| 896 | /* Speaker Amp Gain is controlled by the vendor widget's coef 4 */ |
| 897 | static const DECLARE_TLV_DB_SCALE(cs421x_speaker_boost_db_scale, 900, 300, 0); |
| 898 | |
| 899 | static int cs421x_boost_vol_info(struct snd_kcontrol *kcontrol, |
| 900 | struct snd_ctl_elem_info *uinfo) |
| 901 | { |
| 902 | uinfo->type = SNDRV_CTL_ELEM_TYPE_INTEGER; |
| 903 | uinfo->count = 1; |
| 904 | uinfo->value.integer.min = 0; |
| 905 | uinfo->value.integer.max = 3; |
| 906 | return 0; |
| 907 | } |
| 908 | |
| 909 | static int cs421x_boost_vol_get(struct snd_kcontrol *kcontrol, |
| 910 | struct snd_ctl_elem_value *ucontrol) |
| 911 | { |
| 912 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 913 | |
| 914 | ucontrol->value.integer.value[0] = |
| 915 | cs_vendor_coef_get(codec, CS421X_IDX_SPK_CTL) & 0x0003; |
| 916 | return 0; |
| 917 | } |
| 918 | |
| 919 | static int cs421x_boost_vol_put(struct snd_kcontrol *kcontrol, |
| 920 | struct snd_ctl_elem_value *ucontrol) |
| 921 | { |
| 922 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 923 | |
| 924 | unsigned int vol = ucontrol->value.integer.value[0]; |
| 925 | unsigned int coef = |
| 926 | cs_vendor_coef_get(codec, CS421X_IDX_SPK_CTL); |
| 927 | unsigned int original_coef = coef; |
| 928 | |
| 929 | coef &= ~0x0003; |
| 930 | coef |= (vol & 0x0003); |
| 931 | if (original_coef == coef) |
| 932 | return 0; |
| 933 | else { |
| 934 | cs_vendor_coef_set(codec, CS421X_IDX_SPK_CTL, coef); |
| 935 | return 1; |
| 936 | } |
| 937 | } |
| 938 | |
Takashi Iwai | 1077a02 | 2012-12-19 16:39:18 +0100 | [diff] [blame] | 939 | static const struct snd_kcontrol_new cs421x_speaker_boost_ctl = { |
Tim Howe | 56487c2 | 2011-07-22 16:41:00 -0500 | [diff] [blame] | 940 | |
| 941 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 942 | .access = (SNDRV_CTL_ELEM_ACCESS_READWRITE | |
| 943 | SNDRV_CTL_ELEM_ACCESS_TLV_READ), |
| 944 | .name = "Speaker Boost Playback Volume", |
| 945 | .info = cs421x_boost_vol_info, |
| 946 | .get = cs421x_boost_vol_get, |
| 947 | .put = cs421x_boost_vol_put, |
| 948 | .tlv = { .p = cs421x_speaker_boost_db_scale }, |
| 949 | }; |
| 950 | |
David Henningsson | 5660ffd | 2012-01-02 12:40:17 +0100 | [diff] [blame] | 951 | static void cs4210_pinmux_init(struct hda_codec *codec) |
Tim Howe | 56487c2 | 2011-07-22 16:41:00 -0500 | [diff] [blame] | 952 | { |
| 953 | struct cs_spec *spec = codec->spec; |
| 954 | unsigned int def_conf, coef; |
| 955 | |
| 956 | /* GPIO, DMIC_SCL, DMIC_SDA and SENSE_B are multiplexed */ |
| 957 | coef = cs_vendor_coef_get(codec, CS421X_IDX_DEV_CFG); |
| 958 | |
| 959 | if (spec->gpio_mask) |
| 960 | coef |= 0x0008; /* B1,B2 are GPIOs */ |
| 961 | else |
| 962 | coef &= ~0x0008; |
| 963 | |
| 964 | if (spec->sense_b) |
| 965 | coef |= 0x0010; /* B2 is SENSE_B, not inverted */ |
| 966 | else |
| 967 | coef &= ~0x0010; |
| 968 | |
| 969 | cs_vendor_coef_set(codec, CS421X_IDX_DEV_CFG, coef); |
| 970 | |
| 971 | if ((spec->gpio_mask || spec->sense_b) && |
| 972 | is_active_pin(codec, CS421X_DMIC_PIN_NID)) { |
| 973 | |
| 974 | /* |
| 975 | GPIO or SENSE_B forced - disconnect the DMIC pin. |
| 976 | */ |
| 977 | def_conf = snd_hda_codec_get_pincfg(codec, CS421X_DMIC_PIN_NID); |
| 978 | def_conf &= ~AC_DEFCFG_PORT_CONN; |
| 979 | def_conf |= (AC_JACK_PORT_NONE << AC_DEFCFG_PORT_CONN_SHIFT); |
| 980 | snd_hda_codec_set_pincfg(codec, CS421X_DMIC_PIN_NID, def_conf); |
| 981 | } |
| 982 | } |
| 983 | |
Takashi Iwai | 1077a02 | 2012-12-19 16:39:18 +0100 | [diff] [blame] | 984 | static void cs4210_spdif_automute(struct hda_codec *codec, |
Takashi Iwai | 1a4f69d | 2014-09-11 15:22:46 +0200 | [diff] [blame] | 985 | struct hda_jack_callback *tbl) |
Tim Howe | 56487c2 | 2011-07-22 16:41:00 -0500 | [diff] [blame] | 986 | { |
| 987 | struct cs_spec *spec = codec->spec; |
Takashi Iwai | 1077a02 | 2012-12-19 16:39:18 +0100 | [diff] [blame] | 988 | bool spdif_present = false; |
| 989 | hda_nid_t spdif_pin = spec->gen.autocfg.dig_out_pins[0]; |
Tim Howe | 56487c2 | 2011-07-22 16:41:00 -0500 | [diff] [blame] | 990 | |
Takashi Iwai | 1077a02 | 2012-12-19 16:39:18 +0100 | [diff] [blame] | 991 | /* detect on spdif is specific to CS4210 */ |
| 992 | if (!spec->spdif_detect || |
| 993 | spec->vendor_nid != CS4210_VENDOR_NID) |
| 994 | return; |
| 995 | |
| 996 | spdif_present = snd_hda_jack_detect(codec, spdif_pin); |
| 997 | if (spdif_present == spec->spdif_present) |
| 998 | return; |
| 999 | |
| 1000 | spec->spdif_present = spdif_present; |
| 1001 | /* SPDIF TX on/off */ |
Dan Carpenter | 44008f0 | 2015-07-25 03:03:38 +0300 | [diff] [blame] | 1002 | snd_hda_set_pin_ctl(codec, spdif_pin, spdif_present ? PIN_OUT : 0); |
Takashi Iwai | 1077a02 | 2012-12-19 16:39:18 +0100 | [diff] [blame] | 1003 | |
| 1004 | cs_automute(codec); |
| 1005 | } |
| 1006 | |
| 1007 | static void parse_cs421x_digital(struct hda_codec *codec) |
| 1008 | { |
| 1009 | struct cs_spec *spec = codec->spec; |
| 1010 | struct auto_pin_cfg *cfg = &spec->gen.autocfg; |
| 1011 | int i; |
Tim Howe | 56487c2 | 2011-07-22 16:41:00 -0500 | [diff] [blame] | 1012 | |
| 1013 | for (i = 0; i < cfg->dig_outs; i++) { |
| 1014 | hda_nid_t nid = cfg->dig_out_pins[i]; |
Tim Howe | 56487c2 | 2011-07-22 16:41:00 -0500 | [diff] [blame] | 1015 | if (get_wcaps(codec, nid) & AC_WCAP_UNSOL_CAP) { |
Tim Howe | 56487c2 | 2011-07-22 16:41:00 -0500 | [diff] [blame] | 1016 | spec->spdif_detect = 1; |
Takashi Iwai | 1077a02 | 2012-12-19 16:39:18 +0100 | [diff] [blame] | 1017 | snd_hda_jack_detect_enable_callback(codec, nid, |
Takashi Iwai | 1077a02 | 2012-12-19 16:39:18 +0100 | [diff] [blame] | 1018 | cs4210_spdif_automute); |
Tim Howe | 56487c2 | 2011-07-22 16:41:00 -0500 | [diff] [blame] | 1019 | } |
| 1020 | } |
| 1021 | } |
| 1022 | |
| 1023 | static int cs421x_init(struct hda_codec *codec) |
| 1024 | { |
| 1025 | struct cs_spec *spec = codec->spec; |
| 1026 | |
David Henningsson | 5660ffd | 2012-01-02 12:40:17 +0100 | [diff] [blame] | 1027 | if (spec->vendor_nid == CS4210_VENDOR_NID) { |
| 1028 | snd_hda_sequence_write(codec, cs421x_coef_init_verbs); |
| 1029 | snd_hda_sequence_write(codec, cs421x_coef_init_verbs_A1_silicon_fixes); |
| 1030 | cs4210_pinmux_init(codec); |
| 1031 | } |
Tim Howe | 56487c2 | 2011-07-22 16:41:00 -0500 | [diff] [blame] | 1032 | |
Takashi Iwai | 1077a02 | 2012-12-19 16:39:18 +0100 | [diff] [blame] | 1033 | snd_hda_gen_init(codec); |
| 1034 | |
Tim Howe | 56487c2 | 2011-07-22 16:41:00 -0500 | [diff] [blame] | 1035 | if (spec->gpio_mask) { |
| 1036 | snd_hda_codec_write(codec, 0x01, 0, AC_VERB_SET_GPIO_MASK, |
| 1037 | spec->gpio_mask); |
| 1038 | snd_hda_codec_write(codec, 0x01, 0, AC_VERB_SET_GPIO_DIRECTION, |
| 1039 | spec->gpio_dir); |
| 1040 | snd_hda_codec_write(codec, 0x01, 0, AC_VERB_SET_GPIO_DATA, |
| 1041 | spec->gpio_data); |
| 1042 | } |
| 1043 | |
Takashi Iwai | 1077a02 | 2012-12-19 16:39:18 +0100 | [diff] [blame] | 1044 | init_input_coef(codec); |
| 1045 | |
| 1046 | cs4210_spdif_automute(codec, NULL); |
Tim Howe | 56487c2 | 2011-07-22 16:41:00 -0500 | [diff] [blame] | 1047 | |
| 1048 | return 0; |
| 1049 | } |
| 1050 | |
Tim Howe | 56487c2 | 2011-07-22 16:41:00 -0500 | [diff] [blame] | 1051 | static int cs421x_build_controls(struct hda_codec *codec) |
| 1052 | { |
Takashi Iwai | 01a61e1 | 2011-10-28 00:03:22 +0200 | [diff] [blame] | 1053 | struct cs_spec *spec = codec->spec; |
Tim Howe | 56487c2 | 2011-07-22 16:41:00 -0500 | [diff] [blame] | 1054 | int err; |
| 1055 | |
Takashi Iwai | 1077a02 | 2012-12-19 16:39:18 +0100 | [diff] [blame] | 1056 | err = snd_hda_gen_build_controls(codec); |
Takashi Iwai | 01a61e1 | 2011-10-28 00:03:22 +0200 | [diff] [blame] | 1057 | if (err < 0) |
| 1058 | return err; |
| 1059 | |
Takashi Iwai | 1077a02 | 2012-12-19 16:39:18 +0100 | [diff] [blame] | 1060 | if (spec->gen.autocfg.speaker_outs && |
| 1061 | spec->vendor_nid == CS4210_VENDOR_NID) { |
| 1062 | err = snd_hda_ctl_add(codec, 0, |
| 1063 | snd_ctl_new1(&cs421x_speaker_boost_ctl, codec)); |
| 1064 | if (err < 0) |
| 1065 | return err; |
| 1066 | } |
Takashi Iwai | 01a61e1 | 2011-10-28 00:03:22 +0200 | [diff] [blame] | 1067 | return 0; |
Tim Howe | 56487c2 | 2011-07-22 16:41:00 -0500 | [diff] [blame] | 1068 | } |
| 1069 | |
Takashi Iwai | 1077a02 | 2012-12-19 16:39:18 +0100 | [diff] [blame] | 1070 | static void fix_volume_caps(struct hda_codec *codec, hda_nid_t dac) |
Tim Howe | 56487c2 | 2011-07-22 16:41:00 -0500 | [diff] [blame] | 1071 | { |
Takashi Iwai | 1077a02 | 2012-12-19 16:39:18 +0100 | [diff] [blame] | 1072 | unsigned int caps; |
Tim Howe | 56487c2 | 2011-07-22 16:41:00 -0500 | [diff] [blame] | 1073 | |
Takashi Iwai | 1077a02 | 2012-12-19 16:39:18 +0100 | [diff] [blame] | 1074 | /* set the upper-limit for mixer amp to 0dB */ |
| 1075 | caps = query_amp_caps(codec, dac, HDA_OUTPUT); |
| 1076 | caps &= ~(0x7f << AC_AMPCAP_NUM_STEPS_SHIFT); |
| 1077 | caps |= ((caps >> AC_AMPCAP_OFFSET_SHIFT) & 0x7f) |
| 1078 | << AC_AMPCAP_NUM_STEPS_SHIFT; |
| 1079 | snd_hda_override_amp_caps(codec, dac, HDA_OUTPUT, caps); |
Tim Howe | 56487c2 | 2011-07-22 16:41:00 -0500 | [diff] [blame] | 1080 | } |
| 1081 | |
| 1082 | static int cs421x_parse_auto_config(struct hda_codec *codec) |
| 1083 | { |
| 1084 | struct cs_spec *spec = codec->spec; |
Takashi Iwai | 1077a02 | 2012-12-19 16:39:18 +0100 | [diff] [blame] | 1085 | hda_nid_t dac = CS4210_DAC_NID; |
Tim Howe | 56487c2 | 2011-07-22 16:41:00 -0500 | [diff] [blame] | 1086 | int err; |
| 1087 | |
Takashi Iwai | 1077a02 | 2012-12-19 16:39:18 +0100 | [diff] [blame] | 1088 | fix_volume_caps(codec, dac); |
| 1089 | |
| 1090 | err = snd_hda_parse_pin_defcfg(codec, &spec->gen.autocfg, NULL, 0); |
Tim Howe | 56487c2 | 2011-07-22 16:41:00 -0500 | [diff] [blame] | 1091 | if (err < 0) |
| 1092 | return err; |
Takashi Iwai | 1077a02 | 2012-12-19 16:39:18 +0100 | [diff] [blame] | 1093 | |
| 1094 | err = snd_hda_gen_parse_auto_config(codec, &spec->gen.autocfg); |
Tim Howe | 56487c2 | 2011-07-22 16:41:00 -0500 | [diff] [blame] | 1095 | if (err < 0) |
| 1096 | return err; |
Takashi Iwai | 1077a02 | 2012-12-19 16:39:18 +0100 | [diff] [blame] | 1097 | |
| 1098 | parse_cs421x_digital(codec); |
Tim Howe | 56487c2 | 2011-07-22 16:41:00 -0500 | [diff] [blame] | 1099 | return 0; |
| 1100 | } |
| 1101 | |
| 1102 | #ifdef CONFIG_PM |
| 1103 | /* |
| 1104 | Manage PDREF, when transitioning to D3hot |
| 1105 | (DAC,ADC) -> D3, PDREF=1, AFG->D3 |
| 1106 | */ |
Takashi Iwai | 68cb2b5 | 2012-07-02 15:20:37 +0200 | [diff] [blame] | 1107 | static int cs421x_suspend(struct hda_codec *codec) |
Tim Howe | 56487c2 | 2011-07-22 16:41:00 -0500 | [diff] [blame] | 1108 | { |
David Henningsson | 5660ffd | 2012-01-02 12:40:17 +0100 | [diff] [blame] | 1109 | struct cs_spec *spec = codec->spec; |
Tim Howe | 56487c2 | 2011-07-22 16:41:00 -0500 | [diff] [blame] | 1110 | unsigned int coef; |
| 1111 | |
| 1112 | snd_hda_shutup_pins(codec); |
| 1113 | |
| 1114 | snd_hda_codec_write(codec, CS4210_DAC_NID, 0, |
| 1115 | AC_VERB_SET_POWER_STATE, AC_PWRST_D3); |
| 1116 | snd_hda_codec_write(codec, CS4210_ADC_NID, 0, |
| 1117 | AC_VERB_SET_POWER_STATE, AC_PWRST_D3); |
| 1118 | |
David Henningsson | 5660ffd | 2012-01-02 12:40:17 +0100 | [diff] [blame] | 1119 | if (spec->vendor_nid == CS4210_VENDOR_NID) { |
| 1120 | coef = cs_vendor_coef_get(codec, CS421X_IDX_DEV_CFG); |
| 1121 | coef |= 0x0004; /* PDREF */ |
| 1122 | cs_vendor_coef_set(codec, CS421X_IDX_DEV_CFG, coef); |
| 1123 | } |
Tim Howe | 56487c2 | 2011-07-22 16:41:00 -0500 | [diff] [blame] | 1124 | |
| 1125 | return 0; |
| 1126 | } |
| 1127 | #endif |
| 1128 | |
Daniel J Blueman | 00e17f7 | 2012-11-04 13:19:04 +0800 | [diff] [blame] | 1129 | static const struct hda_codec_ops cs421x_patch_ops = { |
Tim Howe | 56487c2 | 2011-07-22 16:41:00 -0500 | [diff] [blame] | 1130 | .build_controls = cs421x_build_controls, |
Takashi Iwai | 1077a02 | 2012-12-19 16:39:18 +0100 | [diff] [blame] | 1131 | .build_pcms = snd_hda_gen_build_pcms, |
Tim Howe | 56487c2 | 2011-07-22 16:41:00 -0500 | [diff] [blame] | 1132 | .init = cs421x_init, |
| 1133 | .free = cs_free, |
David Henningsson | 5c2e4e0 | 2012-10-08 15:44:15 +0200 | [diff] [blame] | 1134 | .unsol_event = snd_hda_jack_unsol_event, |
Tim Howe | 56487c2 | 2011-07-22 16:41:00 -0500 | [diff] [blame] | 1135 | #ifdef CONFIG_PM |
| 1136 | .suspend = cs421x_suspend, |
| 1137 | #endif |
| 1138 | }; |
| 1139 | |
David Henningsson | 5660ffd | 2012-01-02 12:40:17 +0100 | [diff] [blame] | 1140 | static int patch_cs4210(struct hda_codec *codec) |
Tim Howe | 56487c2 | 2011-07-22 16:41:00 -0500 | [diff] [blame] | 1141 | { |
| 1142 | struct cs_spec *spec; |
| 1143 | int err; |
| 1144 | |
Takashi Iwai | 1077a02 | 2012-12-19 16:39:18 +0100 | [diff] [blame] | 1145 | spec = cs_alloc_spec(codec, CS4210_VENDOR_NID); |
Tim Howe | 56487c2 | 2011-07-22 16:41:00 -0500 | [diff] [blame] | 1146 | if (!spec) |
| 1147 | return -ENOMEM; |
Tim Howe | 56487c2 | 2011-07-22 16:41:00 -0500 | [diff] [blame] | 1148 | |
Takashi Iwai | 225068a | 2015-05-29 10:42:14 +0200 | [diff] [blame] | 1149 | codec->patch_ops = cs421x_patch_ops; |
Takashi Iwai | 6d3073e | 2013-03-15 14:23:32 +0100 | [diff] [blame] | 1150 | spec->gen.automute_hook = cs_automute; |
| 1151 | |
Takashi Iwai | b35aabd | 2012-08-24 19:09:45 +0200 | [diff] [blame] | 1152 | snd_hda_pick_fixup(codec, cs421x_models, cs421x_fixup_tbl, |
| 1153 | cs421x_fixups); |
| 1154 | snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE); |
Tim Howe | 56487c2 | 2011-07-22 16:41:00 -0500 | [diff] [blame] | 1155 | |
| 1156 | /* |
| 1157 | Update the GPIO/DMIC/SENSE_B pinmux before the configuration |
| 1158 | is auto-parsed. If GPIO or SENSE_B is forced, DMIC input |
| 1159 | is disabled. |
| 1160 | */ |
David Henningsson | 5660ffd | 2012-01-02 12:40:17 +0100 | [diff] [blame] | 1161 | cs4210_pinmux_init(codec); |
Tim Howe | 56487c2 | 2011-07-22 16:41:00 -0500 | [diff] [blame] | 1162 | |
| 1163 | err = cs421x_parse_auto_config(codec); |
| 1164 | if (err < 0) |
| 1165 | goto error; |
| 1166 | |
Takashi Iwai | b35aabd | 2012-08-24 19:09:45 +0200 | [diff] [blame] | 1167 | snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE); |
| 1168 | |
Tim Howe | 56487c2 | 2011-07-22 16:41:00 -0500 | [diff] [blame] | 1169 | return 0; |
| 1170 | |
| 1171 | error: |
Takashi Iwai | c5e0b6d | 2012-10-10 08:50:35 +0200 | [diff] [blame] | 1172 | cs_free(codec); |
Tim Howe | 56487c2 | 2011-07-22 16:41:00 -0500 | [diff] [blame] | 1173 | return err; |
| 1174 | } |
| 1175 | |
David Henningsson | 5660ffd | 2012-01-02 12:40:17 +0100 | [diff] [blame] | 1176 | static int patch_cs4213(struct hda_codec *codec) |
| 1177 | { |
| 1178 | struct cs_spec *spec; |
| 1179 | int err; |
| 1180 | |
Takashi Iwai | 1077a02 | 2012-12-19 16:39:18 +0100 | [diff] [blame] | 1181 | spec = cs_alloc_spec(codec, CS4213_VENDOR_NID); |
David Henningsson | 5660ffd | 2012-01-02 12:40:17 +0100 | [diff] [blame] | 1182 | if (!spec) |
| 1183 | return -ENOMEM; |
David Henningsson | 5660ffd | 2012-01-02 12:40:17 +0100 | [diff] [blame] | 1184 | |
Takashi Iwai | 225068a | 2015-05-29 10:42:14 +0200 | [diff] [blame] | 1185 | codec->patch_ops = cs421x_patch_ops; |
| 1186 | |
David Henningsson | 5660ffd | 2012-01-02 12:40:17 +0100 | [diff] [blame] | 1187 | err = cs421x_parse_auto_config(codec); |
| 1188 | if (err < 0) |
| 1189 | goto error; |
| 1190 | |
David Henningsson | 5660ffd | 2012-01-02 12:40:17 +0100 | [diff] [blame] | 1191 | return 0; |
| 1192 | |
| 1193 | error: |
Takashi Iwai | c5e0b6d | 2012-10-10 08:50:35 +0200 | [diff] [blame] | 1194 | cs_free(codec); |
David Henningsson | 5660ffd | 2012-01-02 12:40:17 +0100 | [diff] [blame] | 1195 | return err; |
| 1196 | } |
| 1197 | |
Takashi Iwai | e5f1424 | 2009-07-01 18:11:44 +0200 | [diff] [blame] | 1198 | |
| 1199 | /* |
| 1200 | * patch entries |
| 1201 | */ |
Takashi Iwai | c42d478 | 2011-05-02 11:36:09 +0200 | [diff] [blame] | 1202 | static const struct hda_codec_preset snd_hda_preset_cirrus[] = { |
Takashi Iwai | e5f1424 | 2009-07-01 18:11:44 +0200 | [diff] [blame] | 1203 | { .id = 0x10134206, .name = "CS4206", .patch = patch_cs420x }, |
| 1204 | { .id = 0x10134207, .name = "CS4207", .patch = patch_cs420x }, |
Takashi Iwai | be8cf44 | 2013-09-09 13:57:57 +0200 | [diff] [blame] | 1205 | { .id = 0x10134208, .name = "CS4208", .patch = patch_cs4208 }, |
David Henningsson | 5660ffd | 2012-01-02 12:40:17 +0100 | [diff] [blame] | 1206 | { .id = 0x10134210, .name = "CS4210", .patch = patch_cs4210 }, |
| 1207 | { .id = 0x10134213, .name = "CS4213", .patch = patch_cs4213 }, |
Takashi Iwai | e5f1424 | 2009-07-01 18:11:44 +0200 | [diff] [blame] | 1208 | {} /* terminator */ |
| 1209 | }; |
| 1210 | |
| 1211 | MODULE_ALIAS("snd-hda-codec-id:10134206"); |
| 1212 | MODULE_ALIAS("snd-hda-codec-id:10134207"); |
Takashi Iwai | be8cf44 | 2013-09-09 13:57:57 +0200 | [diff] [blame] | 1213 | MODULE_ALIAS("snd-hda-codec-id:10134208"); |
Tim Howe | 56487c2 | 2011-07-22 16:41:00 -0500 | [diff] [blame] | 1214 | MODULE_ALIAS("snd-hda-codec-id:10134210"); |
David Henningsson | 5660ffd | 2012-01-02 12:40:17 +0100 | [diff] [blame] | 1215 | MODULE_ALIAS("snd-hda-codec-id:10134213"); |
Takashi Iwai | e5f1424 | 2009-07-01 18:11:44 +0200 | [diff] [blame] | 1216 | |
| 1217 | MODULE_LICENSE("GPL"); |
| 1218 | MODULE_DESCRIPTION("Cirrus Logic HD-audio codec"); |
| 1219 | |
Takashi Iwai | d8a766a | 2015-02-17 15:25:37 +0100 | [diff] [blame] | 1220 | static struct hda_codec_driver cirrus_driver = { |
Takashi Iwai | e5f1424 | 2009-07-01 18:11:44 +0200 | [diff] [blame] | 1221 | .preset = snd_hda_preset_cirrus, |
Takashi Iwai | e5f1424 | 2009-07-01 18:11:44 +0200 | [diff] [blame] | 1222 | }; |
| 1223 | |
Takashi Iwai | d8a766a | 2015-02-17 15:25:37 +0100 | [diff] [blame] | 1224 | module_hda_codec_driver(cirrus_driver); |