File Index
Files and directories
Sign in
FILE

analog.c

File preview with syntax highlighting.

linux-6.19.14/sound/hda/codecs/analog.c C
   1// SPDX-License-Identifier: GPL-2.0-or-later
   2/*
   3 * HD audio codec driver for AD1882, AD1884, AD1981HD, AD1983, AD1984,
   4 *   AD1986A, AD1988
   5 *
   6 * Copyright (c) 2005-2007 Takashi Iwai <tiwai@suse.de>
   7 */
   8
   9#include <linux/init.h>
  10#include <linux/slab.h>
  11#include <linux/module.h>
  12
  13#include <sound/core.h>
  14#include <sound/hda_codec.h>
  15#include "hda_local.h"
  16#include "hda_auto_parser.h"
  17#include "hda_beep.h"
  18#include "hda_jack.h"
  19#include "generic.h"
  20
  21enum {
  22	MODEL_AD1882,
  23	MODEL_AD1884,
  24	MODEL_AD1981,
  25	MODEL_AD1983,
  26	MODEL_AD1986A,
  27	MODEL_AD1988,
  28};
  29
  30struct ad198x_spec {
  31	struct hda_gen_spec gen;
  32	int model;
  33
  34	/* for auto parser */
  35	int smux_paths[4];
  36	unsigned int cur_smux;
  37	hda_nid_t eapd_nid;
  38
  39	unsigned int beep_amp;	/* beep amp value, set via set_beep_amp() */
  40	int num_smux_conns;
  41};
  42
  43
  44#ifdef CONFIG_SND_HDA_INPUT_BEEP
  45/* additional beep mixers; the actual parameters are overwritten at build */
  46static const struct snd_kcontrol_new ad_beep_mixer[] = {
  47	HDA_CODEC_VOLUME("Beep Playback Volume", 0, 0, HDA_OUTPUT),
  48	HDA_CODEC_MUTE_BEEP("Beep Playback Switch", 0, 0, HDA_OUTPUT),
  49	{ } /* end */
  50};
  51
  52#define set_beep_amp(spec, nid, idx, dir) \
  53	((spec)->beep_amp = HDA_COMPOSE_AMP_VAL(nid, 1, idx, dir)) /* mono */
  54#else
  55#define set_beep_amp(spec, nid, idx, dir) /* NOP */
  56#endif
  57
  58#ifdef CONFIG_SND_HDA_INPUT_BEEP
  59static int create_beep_ctls(struct hda_codec *codec)
  60{
  61	struct ad198x_spec *spec = codec->spec;
  62	const struct snd_kcontrol_new *knew;
  63
  64	if (!spec->beep_amp)
  65		return 0;
  66
  67	for (knew = ad_beep_mixer ; knew->name; knew++) {
  68		int err;
  69		struct snd_kcontrol *kctl;
  70		kctl = snd_ctl_new1(knew, codec);
  71		if (!kctl)
  72			return -ENOMEM;
  73		kctl->private_value = spec->beep_amp;
  74		err = snd_hda_ctl_add(codec, 0, kctl);
  75		if (err < 0)
  76			return err;
  77	}
  78	return 0;
  79}
  80#else
  81#define create_beep_ctls(codec)		0
  82#endif
  83
  84static void ad198x_power_eapd_write(struct hda_codec *codec, hda_nid_t front,
  85				hda_nid_t hp)
  86{
  87	if (snd_hda_query_pin_caps(codec, front) & AC_PINCAP_EAPD)
  88		snd_hda_codec_write(codec, front, 0, AC_VERB_SET_EAPD_BTLENABLE,
  89			    !codec->inv_eapd ? 0x00 : 0x02);
  90	if (snd_hda_query_pin_caps(codec, hp) & AC_PINCAP_EAPD)
  91		snd_hda_codec_write(codec, hp, 0, AC_VERB_SET_EAPD_BTLENABLE,
  92			    !codec->inv_eapd ? 0x00 : 0x02);
  93}
  94
  95static void ad198x_power_eapd(struct hda_codec *codec)
  96{
  97	/* We currently only handle front, HP */
  98	switch (codec->core.vendor_id) {
  99	case 0x11d41882:
 100	case 0x11d4882a:
 101	case 0x11d41884:
 102	case 0x11d41984:
 103	case 0x11d41883:
 104	case 0x11d4184a:
 105	case 0x11d4194a:
 106	case 0x11d4194b:
 107	case 0x11d41988:
 108	case 0x11d4198b:
 109	case 0x11d4989a:
 110	case 0x11d4989b:
 111		ad198x_power_eapd_write(codec, 0x12, 0x11);
 112		break;
 113	case 0x11d41981:
 114	case 0x11d41983:
 115		ad198x_power_eapd_write(codec, 0x05, 0x06);
 116		break;
 117	case 0x11d41986:
 118		ad198x_power_eapd_write(codec, 0x1b, 0x1a);
 119		break;
 120	}
 121}
 122
 123static int ad_codec_suspend(struct hda_codec *codec)
 124{
 125	snd_hda_shutup_pins(codec);
 126	ad198x_power_eapd(codec);
 127	return 0;
 128}
 129
 130/* follow EAPD via vmaster hook */
 131static void ad_vmaster_eapd_hook(void *private_data, int enabled)
 132{
 133	struct hda_codec *codec = private_data;
 134	struct ad198x_spec *spec = codec->spec;
 135
 136	if (!spec->eapd_nid)
 137		return;
 138	if (codec->inv_eapd)
 139		enabled = !enabled;
 140	snd_hda_codec_write_cache(codec, spec->eapd_nid, 0,
 141				   AC_VERB_SET_EAPD_BTLENABLE,
 142				   enabled ? 0x02 : 0x00);
 143}
 144
 145/*
 146 * Automatic parse of I/O pins from the BIOS configuration
 147 */
 148
 149static int ad_codec_build_controls(struct hda_codec *codec)
 150{
 151	int err;
 152
 153	err = snd_hda_gen_build_controls(codec);
 154	if (err < 0)
 155		return err;
 156	err = create_beep_ctls(codec);
 157	if (err < 0)
 158		return err;
 159	return 0;
 160}
 161
 162static int ad198x_parse_auto_config(struct hda_codec *codec, bool indep_hp)
 163{
 164	struct ad198x_spec *spec = codec->spec;
 165	struct auto_pin_cfg *cfg = &spec->gen.autocfg;
 166	int err;
 167
 168	codec->spdif_status_reset = 1;
 169	codec->no_trigger_sense = 1;
 170	codec->no_sticky_stream = 1;
 171
 172	spec->gen.indep_hp = indep_hp;
 173	if (!spec->gen.add_stereo_mix_input)
 174		spec->gen.add_stereo_mix_input = HDA_HINT_STEREO_MIX_AUTO;
 175
 176	err = snd_hda_parse_pin_defcfg(codec, cfg, NULL, 0);
 177	if (err < 0)
 178		return err;
 179	err = snd_hda_gen_parse_auto_config(codec, cfg);
 180	if (err < 0)
 181		return err;
 182
 183	return 0;
 184}
 185
 186/*
 187 * AD1986A specific
 188 */
 189
 190static int alloc_ad_spec(struct hda_codec *codec)
 191{
 192	struct ad198x_spec *spec;
 193
 194	spec = kzalloc(sizeof(*spec), GFP_KERNEL);
 195	if (!spec)
 196		return -ENOMEM;
 197	codec->spec = spec;
 198	snd_hda_gen_spec_init(&spec->gen);
 199	return 0;
 200}
 201
 202/*
 203 * AD1986A fixup codes
 204 */
 205
 206/* Lenovo N100 seems to report the reversed bit for HP jack-sensing */
 207static void ad_fixup_inv_jack_detect(struct hda_codec *codec,
 208				     const struct hda_fixup *fix, int action)
 209{
 210	struct ad198x_spec *spec = codec->spec;
 211
 212	if (action == HDA_FIXUP_ACT_PRE_PROBE) {
 213		codec->inv_jack_detect = 1;
 214		spec->gen.keep_eapd_on = 1;
 215		spec->gen.vmaster_mute.hook = ad_vmaster_eapd_hook;
 216		spec->eapd_nid = 0x1b;
 217	}
 218}
 219
 220/* Toshiba Satellite L40 implements EAPD in a standard way unlike others */
 221static void ad1986a_fixup_eapd(struct hda_codec *codec,
 222			       const struct hda_fixup *fix, int action)
 223{
 224	struct ad198x_spec *spec = codec->spec;
 225
 226	if (action == HDA_FIXUP_ACT_PRE_PROBE) {
 227		codec->inv_eapd = 0;
 228		spec->gen.keep_eapd_on = 1;
 229		spec->eapd_nid = 0x1b;
 230	}
 231}
 232
 233/* enable stereo-mix input for avoiding regression on KDE (bko#88251) */
 234static void ad1986a_fixup_eapd_mix_in(struct hda_codec *codec,
 235				      const struct hda_fixup *fix, int action)
 236{
 237	struct ad198x_spec *spec = codec->spec;
 238
 239	if (action == HDA_FIXUP_ACT_PRE_PROBE) {
 240		ad1986a_fixup_eapd(codec, fix, action);
 241		spec->gen.add_stereo_mix_input = HDA_HINT_STEREO_MIX_ENABLE;
 242	}
 243}
 244
 245enum {
 246	AD1986A_FIXUP_INV_JACK_DETECT,
 247	AD1986A_FIXUP_ULTRA,
 248	AD1986A_FIXUP_SAMSUNG,
 249	AD1986A_FIXUP_3STACK,
 250	AD1986A_FIXUP_LAPTOP,
 251	AD1986A_FIXUP_LAPTOP_IMIC,
 252	AD1986A_FIXUP_EAPD,
 253	AD1986A_FIXUP_EAPD_MIX_IN,
 254	AD1986A_FIXUP_EASYNOTE,
 255};
 256
 257static const struct hda_fixup ad1986a_fixups[] = {
 258	[AD1986A_FIXUP_INV_JACK_DETECT] = {
 259		.type = HDA_FIXUP_FUNC,
 260		.v.func = ad_fixup_inv_jack_detect,
 261	},
 262	[AD1986A_FIXUP_ULTRA] = {
 263		.type = HDA_FIXUP_PINS,
 264		.v.pins = (const struct hda_pintbl[]) {
 265			{ 0x1b, 0x90170110 }, /* speaker */
 266			{ 0x1d, 0x90a7013e }, /* int mic */
 267			{}
 268		},
 269	},
 270	[AD1986A_FIXUP_SAMSUNG] = {
 271		.type = HDA_FIXUP_PINS,
 272		.v.pins = (const struct hda_pintbl[]) {
 273			{ 0x1b, 0x90170110 }, /* speaker */
 274			{ 0x1d, 0x90a7013e }, /* int mic */
 275			{ 0x20, 0x411111f0 }, /* N/A */
 276			{ 0x24, 0x411111f0 }, /* N/A */
 277			{}
 278		},
 279	},
 280	[AD1986A_FIXUP_3STACK] = {
 281		.type = HDA_FIXUP_PINS,
 282		.v.pins = (const struct hda_pintbl[]) {
 283			{ 0x1a, 0x02214021 }, /* headphone */
 284			{ 0x1b, 0x01014011 }, /* front */
 285			{ 0x1c, 0x01813030 }, /* line-in */
 286			{ 0x1d, 0x01a19020 }, /* rear mic */
 287			{ 0x1e, 0x411111f0 }, /* N/A */
 288			{ 0x1f, 0x02a190f0 }, /* mic */
 289			{ 0x20, 0x411111f0 }, /* N/A */
 290			{}
 291		},
 292	},
 293	[AD1986A_FIXUP_LAPTOP] = {
 294		.type = HDA_FIXUP_PINS,
 295		.v.pins = (const struct hda_pintbl[]) {
 296			{ 0x1a, 0x02214021 }, /* headphone */
 297			{ 0x1b, 0x90170110 }, /* speaker */
 298			{ 0x1c, 0x411111f0 }, /* N/A */
 299			{ 0x1d, 0x411111f0 }, /* N/A */
 300			{ 0x1e, 0x411111f0 }, /* N/A */
 301			{ 0x1f, 0x02a191f0 }, /* mic */
 302			{ 0x20, 0x411111f0 }, /* N/A */
 303			{}
 304		},
 305	},
 306	[AD1986A_FIXUP_LAPTOP_IMIC] = {
 307		.type = HDA_FIXUP_PINS,
 308		.v.pins = (const struct hda_pintbl[]) {
 309			{ 0x1d, 0x90a7013e }, /* int mic */
 310			{}
 311		},
 312		.chained_before = 1,
 313		.chain_id = AD1986A_FIXUP_LAPTOP,
 314	},
 315	[AD1986A_FIXUP_EAPD] = {
 316		.type = HDA_FIXUP_FUNC,
 317		.v.func = ad1986a_fixup_eapd,
 318	},
 319	[AD1986A_FIXUP_EAPD_MIX_IN] = {
 320		.type = HDA_FIXUP_FUNC,
 321		.v.func = ad1986a_fixup_eapd_mix_in,
 322	},
 323	[AD1986A_FIXUP_EASYNOTE] = {
 324		.type = HDA_FIXUP_PINS,
 325		.v.pins = (const struct hda_pintbl[]) {
 326			{ 0x1a, 0x0421402f }, /* headphone */
 327			{ 0x1b, 0x90170110 }, /* speaker */
 328			{ 0x1c, 0x411111f0 }, /* N/A */
 329			{ 0x1d, 0x90a70130 }, /* int mic */
 330			{ 0x1e, 0x411111f0 }, /* N/A */
 331			{ 0x1f, 0x04a19040 }, /* mic */
 332			{ 0x20, 0x411111f0 }, /* N/A */
 333			{ 0x21, 0x411111f0 }, /* N/A */
 334			{ 0x22, 0x411111f0 }, /* N/A */
 335			{ 0x23, 0x411111f0 }, /* N/A */
 336			{ 0x24, 0x411111f0 }, /* N/A */
 337			{ 0x25, 0x411111f0 }, /* N/A */
 338			{}
 339		},
 340		.chained = true,
 341		.chain_id = AD1986A_FIXUP_EAPD_MIX_IN,
 342	},
 343};
 344
 345static const struct hda_quirk ad1986a_fixup_tbl[] = {
 346	SND_PCI_QUIRK(0x103c, 0x30af, "HP B2800", AD1986A_FIXUP_LAPTOP_IMIC),
 347	SND_PCI_QUIRK(0x1043, 0x1153, "ASUS M9V", AD1986A_FIXUP_LAPTOP_IMIC),
 348	SND_PCI_QUIRK(0x1043, 0x1443, "ASUS Z99He", AD1986A_FIXUP_EAPD),
 349	SND_PCI_QUIRK(0x1043, 0x1447, "ASUS A8JN", AD1986A_FIXUP_EAPD),
 350	SND_PCI_QUIRK_MASK(0x1043, 0xff00, 0x8100, "ASUS P5", AD1986A_FIXUP_3STACK),
 351	SND_PCI_QUIRK_MASK(0x1043, 0xff00, 0x8200, "ASUS M2", AD1986A_FIXUP_3STACK),
 352	SND_PCI_QUIRK(0x10de, 0xcb84, "ASUS A8N-VM", AD1986A_FIXUP_3STACK),
 353	SND_PCI_QUIRK(0x1179, 0xff40, "Toshiba Satellite L40", AD1986A_FIXUP_EAPD),
 354	SND_PCI_QUIRK(0x144d, 0xc01e, "FSC V2060", AD1986A_FIXUP_LAPTOP),
 355	SND_PCI_QUIRK_MASK(0x144d, 0xff00, 0xc000, "Samsung", AD1986A_FIXUP_SAMSUNG),
 356	SND_PCI_QUIRK(0x144d, 0xc027, "Samsung Q1", AD1986A_FIXUP_ULTRA),
 357	SND_PCI_QUIRK(0x1631, 0xc022, "PackardBell EasyNote MX65", AD1986A_FIXUP_EASYNOTE),
 358	SND_PCI_QUIRK(0x17aa, 0x2066, "Lenovo N100", AD1986A_FIXUP_INV_JACK_DETECT),
 359	SND_PCI_QUIRK(0x17aa, 0x1011, "Lenovo M55", AD1986A_FIXUP_3STACK),
 360	SND_PCI_QUIRK(0x17aa, 0x1017, "Lenovo A60", AD1986A_FIXUP_3STACK),
 361	{}
 362};
 363
 364static const struct hda_model_fixup ad1986a_fixup_models[] = {
 365	{ .id = AD1986A_FIXUP_3STACK, .name = "3stack" },
 366	{ .id = AD1986A_FIXUP_LAPTOP, .name = "laptop" },
 367	{ .id = AD1986A_FIXUP_LAPTOP_IMIC, .name = "laptop-imic" },
 368	{ .id = AD1986A_FIXUP_LAPTOP_IMIC, .name = "laptop-eapd" }, /* alias */
 369	{ .id = AD1986A_FIXUP_EAPD, .name = "eapd" },
 370	{}
 371};
 372
 373/*
 374 */
 375static int ad1986a_probe(struct hda_codec *codec)
 376{
 377	int err;
 378	struct ad198x_spec *spec = codec->spec;
 379	static const hda_nid_t preferred_pairs[] = {
 380		0x1a, 0x03,
 381		0x1b, 0x03,
 382		0x1c, 0x04,
 383		0x1d, 0x05,
 384		0x1e, 0x03,
 385		0
 386	};
 387
 388	/* AD1986A has the inverted EAPD implementation */
 389	codec->inv_eapd = 1;
 390
 391	spec->gen.mixer_nid = 0x07;
 392	spec->gen.beep_nid = 0x19;
 393	set_beep_amp(spec, 0x18, 0, HDA_OUTPUT);
 394
 395	/* AD1986A has a hardware problem that it can't share a stream
 396	 * with multiple output pins.  The copy of front to surrounds
 397	 * causes noisy or silent outputs at a certain timing, e.g.
 398	 * changing the volume.
 399	 * So, let's disable the shared stream.
 400	 */
 401	spec->gen.multiout.no_share_stream = 1;
 402	/* give fixed DAC/pin pairs */
 403	spec->gen.preferred_dacs = preferred_pairs;
 404
 405	/* AD1986A can't manage the dynamic pin on/off smoothly */
 406	spec->gen.auto_mute_via_amp = 1;
 407
 408	snd_hda_pick_fixup(codec, ad1986a_fixup_models, ad1986a_fixup_tbl,
 409			   ad1986a_fixups);
 410	snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
 411
 412	err = ad198x_parse_auto_config(codec, false);
 413	if (err < 0)
 414		return err;
 415
 416	snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
 417
 418	return 0;
 419}
 420
 421
 422/*
 423 * AD1983 specific
 424 */
 425
 426/*
 427 * SPDIF mux control for AD1983 auto-parser
 428 */
 429static int ad1983_auto_smux_enum_info(struct snd_kcontrol *kcontrol,
 430				      struct snd_ctl_elem_info *uinfo)
 431{
 432	struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
 433	struct ad198x_spec *spec = codec->spec;
 434	static const char * const texts2[] = { "PCM", "ADC" };
 435	static const char * const texts3[] = { "PCM", "ADC1", "ADC2" };
 436	int num_conns = spec->num_smux_conns;
 437
 438	if (num_conns == 2)
 439		return snd_hda_enum_helper_info(kcontrol, uinfo, 2, texts2);
 440	else if (num_conns == 3)
 441		return snd_hda_enum_helper_info(kcontrol, uinfo, 3, texts3);
 442	else
 443		return -EINVAL;
 444}
 445
 446static int ad1983_auto_smux_enum_get(struct snd_kcontrol *kcontrol,
 447				     struct snd_ctl_elem_value *ucontrol)
 448{
 449	struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
 450	struct ad198x_spec *spec = codec->spec;
 451
 452	ucontrol->value.enumerated.item[0] = spec->cur_smux;
 453	return 0;
 454}
 455
 456static int ad1983_auto_smux_enum_put(struct snd_kcontrol *kcontrol,
 457				     struct snd_ctl_elem_value *ucontrol)
 458{
 459	struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
 460	struct ad198x_spec *spec = codec->spec;
 461	unsigned int val = ucontrol->value.enumerated.item[0];
 462	hda_nid_t dig_out = spec->gen.multiout.dig_out_nid;
 463	int num_conns = spec->num_smux_conns;
 464
 465	if (val >= num_conns)
 466		return -EINVAL;
 467	if (spec->cur_smux == val)
 468		return 0;
 469	spec->cur_smux = val;
 470	snd_hda_codec_write_cache(codec, dig_out, 0,
 471				  AC_VERB_SET_CONNECT_SEL, val);
 472	return 1;
 473}
 474
 475static const struct snd_kcontrol_new ad1983_auto_smux_mixer = {
 476	.iface = SNDRV_CTL_ELEM_IFACE_MIXER,
 477	.name = "IEC958 Playback Source",
 478	.info = ad1983_auto_smux_enum_info,
 479	.get = ad1983_auto_smux_enum_get,
 480	.put = ad1983_auto_smux_enum_put,
 481};
 482
 483static int ad1983_add_spdif_mux_ctl(struct hda_codec *codec)
 484{
 485	struct ad198x_spec *spec = codec->spec;
 486	hda_nid_t dig_out = spec->gen.multiout.dig_out_nid;
 487	int num_conns;
 488
 489	if (!dig_out)
 490		return 0;
 491	num_conns = snd_hda_get_num_conns(codec, dig_out);
 492	if (num_conns != 2 && num_conns != 3)
 493		return 0;
 494	spec->num_smux_conns = num_conns;
 495	if (!snd_hda_gen_add_kctl(&spec->gen, NULL, &ad1983_auto_smux_mixer))
 496		return -ENOMEM;
 497	return 0;
 498}
 499
 500static int ad1983_probe(struct hda_codec *codec)
 501{
 502	static const hda_nid_t conn_0c[] = { 0x08 };
 503	static const hda_nid_t conn_0d[] = { 0x09 };
 504	struct ad198x_spec *spec = codec->spec;
 505	int err;
 506
 507	spec->gen.mixer_nid = 0x0e;
 508	spec->gen.beep_nid = 0x10;
 509	set_beep_amp(spec, 0x10, 0, HDA_OUTPUT);
 510
 511	/* limit the loopback routes not to confuse the parser */
 512	snd_hda_override_conn_list(codec, 0x0c, ARRAY_SIZE(conn_0c), conn_0c);
 513	snd_hda_override_conn_list(codec, 0x0d, ARRAY_SIZE(conn_0d), conn_0d);
 514
 515	err = ad198x_parse_auto_config(codec, false);
 516	if (err < 0)
 517		return err;
 518	err = ad1983_add_spdif_mux_ctl(codec);
 519	if (err < 0)
 520		return err;
 521	return 0;
 522}
 523
 524
 525/*
 526 * AD1981 HD specific
 527 */
 528
 529static void ad1981_fixup_hp_eapd(struct hda_codec *codec,
 530				 const struct hda_fixup *fix, int action)
 531{
 532	struct ad198x_spec *spec = codec->spec;
 533
 534	if (action == HDA_FIXUP_ACT_PRE_PROBE) {
 535		spec->gen.vmaster_mute.hook = ad_vmaster_eapd_hook;
 536		spec->eapd_nid = 0x05;
 537	}
 538}
 539
 540/* set the upper-limit for mixer amp to 0dB for avoiding the possible
 541 * damage by overloading
 542 */
 543static void ad1981_fixup_amp_override(struct hda_codec *codec,
 544				      const struct hda_fixup *fix, int action)
 545{
 546	if (action == HDA_FIXUP_ACT_PRE_PROBE)
 547		snd_hda_override_amp_caps(codec, 0x11, HDA_INPUT,
 548					  (0x17 << AC_AMPCAP_OFFSET_SHIFT) |
 549					  (0x17 << AC_AMPCAP_NUM_STEPS_SHIFT) |
 550					  (0x05 << AC_AMPCAP_STEP_SIZE_SHIFT) |
 551					  (1 << AC_AMPCAP_MUTE_SHIFT));
 552}
 553
 554enum {
 555	AD1981_FIXUP_AMP_OVERRIDE,
 556	AD1981_FIXUP_HP_EAPD,
 557};
 558
 559static const struct hda_fixup ad1981_fixups[] = {
 560	[AD1981_FIXUP_AMP_OVERRIDE] = {
 561		.type = HDA_FIXUP_FUNC,
 562		.v.func = ad1981_fixup_amp_override,
 563	},
 564	[AD1981_FIXUP_HP_EAPD] = {
 565		.type = HDA_FIXUP_FUNC,
 566		.v.func = ad1981_fixup_hp_eapd,
 567		.chained = true,
 568		.chain_id = AD1981_FIXUP_AMP_OVERRIDE,
 569	},
 570};
 571
 572static const struct hda_quirk ad1981_fixup_tbl[] = {
 573	SND_PCI_QUIRK_VENDOR(0x1014, "Lenovo", AD1981_FIXUP_AMP_OVERRIDE),
 574	SND_PCI_QUIRK_VENDOR(0x103c, "HP", AD1981_FIXUP_HP_EAPD),
 575	SND_PCI_QUIRK_VENDOR(0x17aa, "Lenovo", AD1981_FIXUP_AMP_OVERRIDE),
 576	/* HP nx6320 (reversed SSID, H/W bug) */
 577	SND_PCI_QUIRK(0x30b0, 0x103c, "HP nx6320", AD1981_FIXUP_HP_EAPD),
 578	{}
 579};
 580
 581static int ad1981_probe(struct hda_codec *codec)
 582{
 583	struct ad198x_spec *spec = codec->spec;
 584	int err;
 585
 586	spec->gen.mixer_nid = 0x0e;
 587	spec->gen.beep_nid = 0x10;
 588	set_beep_amp(spec, 0x0d, 0, HDA_OUTPUT);
 589
 590	snd_hda_pick_fixup(codec, NULL, ad1981_fixup_tbl, ad1981_fixups);
 591	snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
 592
 593	err = ad198x_parse_auto_config(codec, false);
 594	if (err < 0)
 595		return err;
 596	err = ad1983_add_spdif_mux_ctl(codec);
 597	if (err < 0)
 598		return err;
 599
 600	snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
 601
 602	return 0;
 603}
 604
 605
 606/*
 607 * AD1988
 608 *
 609 * Output pins and routes
 610 *
 611 *        Pin               Mix     Sel     DAC (*)
 612 * port-A 0x11 (mute/hp) <- 0x22 <- 0x37 <- 03/04/06
 613 * port-B 0x14 (mute/hp) <- 0x2b <- 0x30 <- 03/04/06
 614 * port-C 0x15 (mute)    <- 0x2c <- 0x31 <- 05/0a
 615 * port-D 0x12 (mute/hp) <- 0x29         <- 04
 616 * port-E 0x17 (mute/hp) <- 0x26 <- 0x32 <- 05/0a
 617 * port-F 0x16 (mute)    <- 0x2a         <- 06
 618 * port-G 0x24 (mute)    <- 0x27         <- 05
 619 * port-H 0x25 (mute)    <- 0x28         <- 0a
 620 * mono   0x13 (mute/amp)<- 0x1e <- 0x36 <- 03/04/06
 621 *
 622 * DAC0 = 03h, DAC1 = 04h, DAC2 = 05h, DAC3 = 06h, DAC4 = 0ah
 623 * (*) DAC2/3/4 are swapped to DAC3/4/2 on AD198A rev.2 due to a h/w bug.
 624 *
 625 * Input pins and routes
 626 *
 627 *        pin     boost   mix input # / adc input #
 628 * port-A 0x11 -> 0x38 -> mix 2, ADC 0
 629 * port-B 0x14 -> 0x39 -> mix 0, ADC 1
 630 * port-C 0x15 -> 0x3a -> 33:0 - mix 1, ADC 2
 631 * port-D 0x12 -> 0x3d -> mix 3, ADC 8
 632 * port-E 0x17 -> 0x3c -> 34:0 - mix 4, ADC 4
 633 * port-F 0x16 -> 0x3b -> mix 5, ADC 3
 634 * port-G 0x24 -> N/A  -> 33:1 - mix 1, 34:1 - mix 4, ADC 6
 635 * port-H 0x25 -> N/A  -> 33:2 - mix 1, 34:2 - mix 4, ADC 7
 636 *
 637 *
 638 * DAC assignment
 639 *   6stack - front/surr/CLFE/side/opt DACs - 04/06/05/0a/03
 640 *   3stack - front/surr/CLFE/opt DACs - 04/05/0a/03
 641 *
 642 * Inputs of Analog Mix (0x20)
 643 *   0:Port-B (front mic)
 644 *   1:Port-C/G/H (line-in)
 645 *   2:Port-A
 646 *   3:Port-D (line-in/2)
 647 *   4:Port-E/G/H (mic-in)
 648 *   5:Port-F (mic2-in)
 649 *   6:CD
 650 *   7:Beep
 651 *
 652 * ADC selection
 653 *   0:Port-A
 654 *   1:Port-B (front mic-in)
 655 *   2:Port-C (line-in)
 656 *   3:Port-F (mic2-in)
 657 *   4:Port-E (mic-in)
 658 *   5:CD
 659 *   6:Port-G
 660 *   7:Port-H
 661 *   8:Port-D (line-in/2)
 662 *   9:Mix
 663 *
 664 * Proposed pin assignments by the datasheet
 665 *
 666 * 6-stack
 667 * Port-A front headphone
 668 *      B front mic-in
 669 *      C rear line-in
 670 *      D rear front-out
 671 *      E rear mic-in
 672 *      F rear surround
 673 *      G rear CLFE
 674 *      H rear side
 675 *
 676 * 3-stack
 677 * Port-A front headphone
 678 *      B front mic
 679 *      C rear line-in/surround
 680 *      D rear front-out
 681 *      E rear mic-in/CLFE
 682 *
 683 * laptop
 684 * Port-A headphone
 685 *      B mic-in
 686 *      C docking station
 687 *      D internal speaker (with EAPD)
 688 *      E/F quad mic array
 689 */
 690
 691static int ad1988_auto_smux_enum_info(struct snd_kcontrol *kcontrol,
 692				      struct snd_ctl_elem_info *uinfo)
 693{
 694	struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
 695	struct ad198x_spec *spec = codec->spec;
 696	static const char * const texts[] = {
 697		"PCM", "ADC1", "ADC2", "ADC3",
 698	};
 699	int num_conns = spec->num_smux_conns;
 700
 701	if (num_conns > 4)
 702		num_conns = 4;
 703	return snd_hda_enum_helper_info(kcontrol, uinfo, num_conns, texts);
 704}
 705
 706static int ad1988_auto_smux_enum_get(struct snd_kcontrol *kcontrol,
 707				     struct snd_ctl_elem_value *ucontrol)
 708{
 709	struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
 710	struct ad198x_spec *spec = codec->spec;
 711
 712	ucontrol->value.enumerated.item[0] = spec->cur_smux;
 713	return 0;
 714}
 715
 716static int ad1988_auto_smux_enum_put(struct snd_kcontrol *kcontrol,
 717				     struct snd_ctl_elem_value *ucontrol)
 718{
 719	struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
 720	struct ad198x_spec *spec = codec->spec;
 721	unsigned int val = ucontrol->value.enumerated.item[0];
 722	struct nid_path *path;
 723	int num_conns = spec->num_smux_conns;
 724
 725	if (val >= num_conns)
 726		return -EINVAL;
 727	if (spec->cur_smux == val)
 728		return 0;
 729
 730	guard(mutex)(&codec->control_mutex);
 731	path = snd_hda_get_path_from_idx(codec,
 732					 spec->smux_paths[spec->cur_smux]);
 733	if (path)
 734		snd_hda_activate_path(codec, path, false, true);
 735	path = snd_hda_get_path_from_idx(codec, spec->smux_paths[val]);
 736	if (path)
 737		snd_hda_activate_path(codec, path, true, true);
 738	spec->cur_smux = val;
 739	return 1;
 740}
 741
 742static const struct snd_kcontrol_new ad1988_auto_smux_mixer = {
 743	.iface = SNDRV_CTL_ELEM_IFACE_MIXER,
 744	.name = "IEC958 Playback Source",
 745	.info = ad1988_auto_smux_enum_info,
 746	.get = ad1988_auto_smux_enum_get,
 747	.put = ad1988_auto_smux_enum_put,
 748};
 749
 750static int ad_codec_init(struct hda_codec *codec)
 751{
 752	struct ad198x_spec *spec = codec->spec;
 753	int i, err;
 754
 755	err = snd_hda_gen_init(codec);
 756	if (err < 0)
 757		return err;
 758	if (spec->model != MODEL_AD1988)
 759		return 0;
 760	if (!spec->gen.autocfg.dig_outs)
 761		return 0;
 762
 763	for (i = 0; i < 4; i++) {
 764		struct nid_path *path;
 765		path = snd_hda_get_path_from_idx(codec, spec->smux_paths[i]);
 766		if (path)
 767			snd_hda_activate_path(codec, path, path->active, false);
 768	}
 769
 770	return 0;
 771}
 772
 773static int ad1988_add_spdif_mux_ctl(struct hda_codec *codec)
 774{
 775	struct ad198x_spec *spec = codec->spec;
 776	int i, num_conns;
 777	/* we create four static faked paths, since AD codecs have odd
 778	 * widget connections regarding the SPDIF out source
 779	 */
 780	static const struct nid_path fake_paths[4] = {
 781		{
 782			.depth = 3,
 783			.path = { 0x02, 0x1d, 0x1b },
 784			.idx = { 0, 0, 0 },
 785			.multi = { 0, 0, 0 },
 786		},
 787		{
 788			.depth = 4,
 789			.path = { 0x08, 0x0b, 0x1d, 0x1b },
 790			.idx = { 0, 0, 1, 0 },
 791			.multi = { 0, 1, 0, 0 },
 792		},
 793		{
 794			.depth = 4,
 795			.path = { 0x09, 0x0b, 0x1d, 0x1b },
 796			.idx = { 0, 1, 1, 0 },
 797			.multi = { 0, 1, 0, 0 },
 798		},
 799		{
 800			.depth = 4,
 801			.path = { 0x0f, 0x0b, 0x1d, 0x1b },
 802			.idx = { 0, 2, 1, 0 },
 803			.multi = { 0, 1, 0, 0 },
 804		},
 805	};
 806
 807	/* SPDIF source mux appears to be present only on AD1988A */
 808	if (!spec->gen.autocfg.dig_outs ||
 809	    get_wcaps_type(get_wcaps(codec, 0x1d)) != AC_WID_AUD_MIX)
 810		return 0;
 811
 812	num_conns = snd_hda_get_num_conns(codec, 0x0b) + 1;
 813	if (num_conns != 3 && num_conns != 4)
 814		return 0;
 815	spec->num_smux_conns = num_conns;
 816
 817	for (i = 0; i < num_conns; i++) {
 818		struct nid_path *path = snd_array_new(&spec->gen.paths);
 819		if (!path)
 820			return -ENOMEM;
 821		*path = fake_paths[i];
 822		if (!i)
 823			path->active = 1;
 824		spec->smux_paths[i] = snd_hda_get_path_idx(codec, path);
 825	}
 826
 827	if (!snd_hda_gen_add_kctl(&spec->gen, NULL, &ad1988_auto_smux_mixer))
 828		return -ENOMEM;
 829
 830	return 0;
 831}
 832
 833/*
 834 */
 835
 836enum {
 837	AD1988_FIXUP_6STACK_DIG,
 838};
 839
 840static const struct hda_fixup ad1988_fixups[] = {
 841	[AD1988_FIXUP_6STACK_DIG] = {
 842		.type = HDA_FIXUP_PINS,
 843		.v.pins = (const struct hda_pintbl[]) {
 844			{ 0x11, 0x02214130 }, /* front-hp */
 845			{ 0x12, 0x01014010 }, /* line-out */
 846			{ 0x14, 0x02a19122 }, /* front-mic */
 847			{ 0x15, 0x01813021 }, /* line-in */
 848			{ 0x16, 0x01011012 }, /* line-out */
 849			{ 0x17, 0x01a19020 }, /* mic */
 850			{ 0x1b, 0x0145f1f0 }, /* SPDIF */
 851			{ 0x24, 0x01016011 }, /* line-out */
 852			{ 0x25, 0x01012013 }, /* line-out */
 853			{ }
 854		}
 855	},
 856};
 857
 858static const struct hda_model_fixup ad1988_fixup_models[] = {
 859	{ .id = AD1988_FIXUP_6STACK_DIG, .name = "6stack-dig" },
 860	{}
 861};
 862
 863static int ad1988_probe(struct hda_codec *codec)
 864{
 865	struct ad198x_spec *spec = codec->spec;
 866	int err;
 867
 868	spec->gen.mixer_nid = 0x20;
 869	spec->gen.mixer_merge_nid = 0x21;
 870	spec->gen.beep_nid = 0x10;
 871	set_beep_amp(spec, 0x10, 0, HDA_OUTPUT);
 872
 873	snd_hda_pick_fixup(codec, ad1988_fixup_models, NULL, ad1988_fixups);
 874	snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
 875
 876	err = ad198x_parse_auto_config(codec, true);
 877	if (err < 0)
 878		return err;
 879	err = ad1988_add_spdif_mux_ctl(codec);
 880	if (err < 0)
 881		return err;
 882
 883	snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
 884
 885	return 0;
 886}
 887
 888
 889/*
 890 * AD1884 / AD1984
 891 *
 892 * port-B - front line/mic-in
 893 * port-E - aux in/out
 894 * port-F - aux in/out
 895 * port-C - rear line/mic-in
 896 * port-D - rear line/hp-out
 897 * port-A - front line/hp-out
 898 *
 899 * AD1984 = AD1884 + two digital mic-ins
 900 *
 901 * AD1883 / AD1884A / AD1984A / AD1984B
 902 *
 903 * port-B (0x14) - front mic-in
 904 * port-E (0x1c) - rear mic-in
 905 * port-F (0x16) - CD / ext out
 906 * port-C (0x15) - rear line-in
 907 * port-D (0x12) - rear line-out
 908 * port-A (0x11) - front hp-out
 909 *
 910 * AD1984A = AD1884A + digital-mic
 911 * AD1883 = equivalent with AD1984A
 912 * AD1984B = AD1984A + extra SPDIF-out
 913 */
 914
 915/* set the upper-limit for mixer amp to 0dB for avoiding the possible
 916 * damage by overloading
 917 */
 918static void ad1884_fixup_amp_override(struct hda_codec *codec,
 919				      const struct hda_fixup *fix, int action)
 920{
 921	if (action == HDA_FIXUP_ACT_PRE_PROBE)
 922		snd_hda_override_amp_caps(codec, 0x20, HDA_INPUT,
 923					  (0x17 << AC_AMPCAP_OFFSET_SHIFT) |
 924					  (0x17 << AC_AMPCAP_NUM_STEPS_SHIFT) |
 925					  (0x05 << AC_AMPCAP_STEP_SIZE_SHIFT) |
 926					  (1 << AC_AMPCAP_MUTE_SHIFT));
 927}
 928
 929/* toggle GPIO1 according to the mute state */
 930static void ad1884_vmaster_hp_gpio_hook(void *private_data, int enabled)
 931{
 932	struct hda_codec *codec = private_data;
 933	struct ad198x_spec *spec = codec->spec;
 934
 935	if (spec->eapd_nid)
 936		ad_vmaster_eapd_hook(private_data, enabled);
 937	snd_hda_codec_write_cache(codec, 0x01, 0,
 938				   AC_VERB_SET_GPIO_DATA,
 939				   enabled ? 0x00 : 0x02);
 940}
 941
 942static void ad1884_fixup_hp_eapd(struct hda_codec *codec,
 943				 const struct hda_fixup *fix, int action)
 944{
 945	struct ad198x_spec *spec = codec->spec;
 946
 947	switch (action) {
 948	case HDA_FIXUP_ACT_PRE_PROBE:
 949		spec->gen.vmaster_mute.hook = ad1884_vmaster_hp_gpio_hook;
 950		spec->gen.own_eapd_ctl = 1;
 951		snd_hda_codec_write_cache(codec, 0x01, 0,
 952					  AC_VERB_SET_GPIO_MASK, 0x02);
 953		snd_hda_codec_write_cache(codec, 0x01, 0,
 954					  AC_VERB_SET_GPIO_DIRECTION, 0x02);
 955		snd_hda_codec_write_cache(codec, 0x01, 0,
 956					  AC_VERB_SET_GPIO_DATA, 0x02);
 957		break;
 958	case HDA_FIXUP_ACT_PROBE:
 959		if (spec->gen.autocfg.line_out_type == AUTO_PIN_SPEAKER_OUT)
 960			spec->eapd_nid = spec->gen.autocfg.line_out_pins[0];
 961		else
 962			spec->eapd_nid = spec->gen.autocfg.speaker_pins[0];
 963		break;
 964	}
 965}
 966
 967static void ad1884_fixup_thinkpad(struct hda_codec *codec,
 968				  const struct hda_fixup *fix, int action)
 969{
 970	struct ad198x_spec *spec = codec->spec;
 971
 972	if (action == HDA_FIXUP_ACT_PRE_PROBE) {
 973		spec->gen.keep_eapd_on = 1;
 974		spec->gen.vmaster_mute.hook = ad_vmaster_eapd_hook;
 975		spec->eapd_nid = 0x12;
 976		/* Analog PC Beeper - allow firmware/ACPI beeps */
 977		spec->beep_amp = HDA_COMPOSE_AMP_VAL(0x20, 3, 3, HDA_INPUT);
 978		spec->gen.beep_nid = 0; /* no digital beep */
 979	}
 980}
 981
 982/* set magic COEFs for dmic */
 983static const struct hda_verb ad1884_dmic_init_verbs[] = {
 984	{0x01, AC_VERB_SET_COEF_INDEX, 0x13f7},
 985	{0x01, AC_VERB_SET_PROC_COEF, 0x08},
 986	{}
 987};
 988
 989enum {
 990	AD1884_FIXUP_AMP_OVERRIDE,
 991	AD1884_FIXUP_HP_EAPD,
 992	AD1884_FIXUP_DMIC_COEF,
 993	AD1884_FIXUP_THINKPAD,
 994	AD1884_FIXUP_HP_TOUCHSMART,
 995};
 996
 997static const struct hda_fixup ad1884_fixups[] = {
 998	[AD1884_FIXUP_AMP_OVERRIDE] = {
 999		.type = HDA_FIXUP_FUNC,
1000		.v.func = ad1884_fixup_amp_override,
1001	},
1002	[AD1884_FIXUP_HP_EAPD] = {
1003		.type = HDA_FIXUP_FUNC,
1004		.v.func = ad1884_fixup_hp_eapd,
1005		.chained = true,
1006		.chain_id = AD1884_FIXUP_AMP_OVERRIDE,
1007	},
1008	[AD1884_FIXUP_DMIC_COEF] = {
1009		.type = HDA_FIXUP_VERBS,
1010		.v.verbs = ad1884_dmic_init_verbs,
1011	},
1012	[AD1884_FIXUP_THINKPAD] = {
1013		.type = HDA_FIXUP_FUNC,
1014		.v.func = ad1884_fixup_thinkpad,
1015		.chained = true,
1016		.chain_id = AD1884_FIXUP_DMIC_COEF,
1017	},
1018	[AD1884_FIXUP_HP_TOUCHSMART] = {
1019		.type = HDA_FIXUP_VERBS,
1020		.v.verbs = ad1884_dmic_init_verbs,
1021		.chained = true,
1022		.chain_id = AD1884_FIXUP_HP_EAPD,
1023	},
1024};
1025
1026static const struct hda_quirk ad1884_fixup_tbl[] = {
1027	SND_PCI_QUIRK(0x103c, 0x2a82, "HP Touchsmart", AD1884_FIXUP_HP_TOUCHSMART),
1028	SND_PCI_QUIRK_VENDOR(0x103c, "HP", AD1884_FIXUP_HP_EAPD),
1029	SND_PCI_QUIRK_VENDOR(0x17aa, "Lenovo Thinkpad", AD1884_FIXUP_THINKPAD),
1030	{}
1031};
1032
1033
1034static int ad1884_probe(struct hda_codec *codec)
1035{
1036	struct ad198x_spec *spec = codec->spec;
1037	int err;
1038
1039	spec->gen.mixer_nid = 0x20;
1040	spec->gen.mixer_merge_nid = 0x21;
1041	spec->gen.beep_nid = 0x10;
1042	set_beep_amp(spec, 0x10, 0, HDA_OUTPUT);
1043
1044	snd_hda_pick_fixup(codec, NULL, ad1884_fixup_tbl, ad1884_fixups);
1045	snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
1046
1047	err = ad198x_parse_auto_config(codec, true);
1048	if (err < 0)
1049		return err;
1050	err = ad1983_add_spdif_mux_ctl(codec);
1051	if (err < 0)
1052		return err;
1053
1054	snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
1055
1056	return 0;
1057}
1058
1059/*
1060 * AD1882 / AD1882A
1061 *
1062 * port-A - front hp-out
1063 * port-B - front mic-in
1064 * port-C - rear line-in, shared surr-out (3stack)
1065 * port-D - rear line-out
1066 * port-E - rear mic-in, shared clfe-out (3stack)
1067 * port-F - rear surr-out (6stack)
1068 * port-G - rear clfe-out (6stack)
1069 */
1070
1071static int ad1882_probe(struct hda_codec *codec)
1072{
1073	struct ad198x_spec *spec = codec->spec;
1074	int err;
1075
1076	spec->gen.mixer_nid = 0x20;
1077	spec->gen.mixer_merge_nid = 0x21;
1078	spec->gen.beep_nid = 0x10;
1079	set_beep_amp(spec, 0x10, 0, HDA_OUTPUT);
1080	err = ad198x_parse_auto_config(codec, true);
1081	if (err < 0)
1082		return err;
1083	err = ad1988_add_spdif_mux_ctl(codec);
1084	if (err < 0)
1085		return err;
1086	return 0;
1087}
1088
1089/*
1090 * driver entries
1091 */
1092static int ad_codec_probe(struct hda_codec *codec,
1093			  const struct hda_device_id *id)
1094{
1095	struct ad198x_spec *spec;
1096	int err;
1097
1098	err = alloc_ad_spec(codec);
1099	if (err < 0)
1100		return -ENOMEM;
1101	spec = codec->spec;
1102	spec->model = id->driver_data;
1103
1104	switch (spec->model) {
1105	case MODEL_AD1882:
1106		err = ad1882_probe(codec);
1107		break;
1108	case MODEL_AD1884:
1109		err = ad1884_probe(codec);
1110		break;
1111	case MODEL_AD1981:
1112		err = ad1981_probe(codec);
1113		break;
1114	case MODEL_AD1983:
1115		err = ad1983_probe(codec);
1116		break;
1117	case MODEL_AD1986A:
1118		err = ad1986a_probe(codec);
1119		break;
1120	case MODEL_AD1988:
1121		err = ad1988_probe(codec);
1122		break;
1123	default:
1124		err = -EINVAL;
1125		break;
1126	}
1127
1128	if (err < 0) {
1129		snd_hda_gen_remove(codec);
1130		return err;
1131	}
1132
1133	return 0;
1134}
1135
1136static const struct hda_codec_ops ad_codec_ops = {
1137	.probe = ad_codec_probe,
1138	.remove = snd_hda_gen_remove,
1139	.build_controls = ad_codec_build_controls,
1140	.build_pcms = snd_hda_gen_build_pcms,
1141	.init = ad_codec_init,
1142	.unsol_event = snd_hda_jack_unsol_event,
1143	.suspend = ad_codec_suspend,
1144	.check_power_status = snd_hda_gen_check_power_status,
1145	.stream_pm = snd_hda_gen_stream_pm,
1146};
1147
1148static const struct hda_device_id snd_hda_id_analog[] = {
1149	HDA_CODEC_ID_MODEL(0x11d4184a, "AD1884A", MODEL_AD1884),
1150	HDA_CODEC_ID_MODEL(0x11d41882, "AD1882", MODEL_AD1882),
1151	HDA_CODEC_ID_MODEL(0x11d41883, "AD1883", MODEL_AD1884),
1152	HDA_CODEC_ID_MODEL(0x11d41884, "AD1884", MODEL_AD1884),
1153	HDA_CODEC_ID_MODEL(0x11d4194a, "AD1984A", MODEL_AD1884),
1154	HDA_CODEC_ID_MODEL(0x11d4194b, "AD1984B", MODEL_AD1884),
1155	HDA_CODEC_ID_MODEL(0x11d41981, "AD1981", MODEL_AD1981),
1156	HDA_CODEC_ID_MODEL(0x11d41983, "AD1983", MODEL_AD1983),
1157	HDA_CODEC_ID_MODEL(0x11d41984, "AD1984", MODEL_AD1884),
1158	HDA_CODEC_ID_MODEL(0x11d41986, "AD1986A", MODEL_AD1986A),
1159	HDA_CODEC_ID_MODEL(0x11d41988, "AD1988", MODEL_AD1988),
1160	HDA_CODEC_ID_MODEL(0x11d4198b, "AD1988B", MODEL_AD1988),
1161	HDA_CODEC_ID_MODEL(0x11d4882a, "AD1882A", MODEL_AD1882),
1162	HDA_CODEC_ID_MODEL(0x11d4989a, "AD1989A", MODEL_AD1988),
1163	HDA_CODEC_ID_MODEL(0x11d4989b, "AD1989B", MODEL_AD1988),
1164	{} /* terminator */
1165};
1166MODULE_DEVICE_TABLE(hdaudio, snd_hda_id_analog);
1167
1168MODULE_LICENSE("GPL");
1169MODULE_DESCRIPTION("Analog Devices HD-audio codec");
1170
1171static struct hda_codec_driver analog_driver = {
1172	.id = snd_hda_id_analog,
1173	.ops = &ad_codec_ops,
1174};
1175
1176module_hda_codec_driver(analog_driver);
~/ Read-only file preview.