Date: Wed, 7 Jan 2009 15:28:47 +0000 (UTC) From: Alexander Motin <mav@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org Subject: svn commit: r186862 - stable/7/sys/dev/sound/pci/hda Message-ID: <200901071528.n07FSlXM090711@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: mav Date: Wed Jan 7 15:28:47 2009 New Revision: 186862 URL: http://svn.freebsd.org/changeset/base/186862 Log: Merge updated snd_hda driver version 20081226_0122 from CURRENT. This update gives: - multiple codec per HDA bus support; - multiple functional groups per codec support; - multiple audio devices per functional group support; - digital (SPDIF/HDMI) audio input/output support; - better UAA specification compliance with wide configureability; - headphones redirection controlled by UAA configuration instead of quirks; - improved codec parser, that gives working playback and recording with all of the long list of tested codecs and systems; - suspend/resume support; - part of multichannel audio support (requires OSS improvement to be used); Note, that due to added HDMI audio and logical audio devices support, updated driver often provides several PCM devices. In some cases it can make system default audio device no longer corresponding to the users's habbitual audio connectors. In such cases wanted device can be specified in audio application setup or defined globally via hw.snd.default_unit sysctl according to sound(4) man page. Additional information information about driver operation can be obtained from the updated man page and verbose boot messages. PR: kern/119181, kern/120144, kern/117599, kern/117729, kern/119671, kern/124645, kern/125822, kern/126217, kern/127105 Modified: stable/7/sys/dev/sound/pci/hda/hda_reg.h stable/7/sys/dev/sound/pci/hda/hdac.c stable/7/sys/dev/sound/pci/hda/hdac_private.h Modified: stable/7/sys/dev/sound/pci/hda/hda_reg.h ============================================================================== --- stable/7/sys/dev/sound/pci/hda/hda_reg.h Wed Jan 7 14:00:44 2009 (r186861) +++ stable/7/sys/dev/sound/pci/hda/hda_reg.h Wed Jan 7 15:28:47 2009 (r186862) @@ -180,13 +180,14 @@ HDA_CMD_VERB_SET_CONV_FMT, (payload))) /* Digital Converter Control */ -#define HDA_CMD_VERB_GET_DIGITAL_CONV_FMT 0xf0d +#define HDA_CMD_VERB_GET_DIGITAL_CONV_FMT1 0xf0d +#define HDA_CMD_VERB_GET_DIGITAL_CONV_FMT2 0xf0e #define HDA_CMD_VERB_SET_DIGITAL_CONV_FMT1 0x70d #define HDA_CMD_VERB_SET_DIGITAL_CONV_FMT2 0x70e #define HDA_CMD_GET_DIGITAL_CONV_FMT(cad, nid) \ (HDA_CMD_12BIT((cad), (nid), \ - HDA_CMD_VERB_GET_DIGITAL_CONV_FMTT, 0x0)) + HDA_CMD_VERB_GET_DIGITAL_CONV_FMT1, 0x0)) #define HDA_CMD_SET_DIGITAL_CONV_FMT1(cad, nid, payload) \ (HDA_CMD_12BIT((cad), (nid), \ HDA_CMD_VERB_SET_DIGITAL_CONV_FMT1, (payload))) @@ -1034,7 +1035,7 @@ HDA_PARAM_PIN_CAP_HEADPHONE_CAP_SHIFT) #define HDA_PARAM_PIN_CAP_PRESENCE_DETECT_CAP(param) \ (((param) & HDA_PARAM_PIN_CAP_PRESENCE_DETECT_CAP_MASK) >> \ - HDA_PARAM_PIN_CAP_PRESENCE_DETECT_CAP_MASK) + HDA_PARAM_PIN_CAP_PRESENCE_DETECT_CAP_SHIFT) #define HDA_PARAM_PIN_CAP_TRIGGER_REQD(param) \ (((param) & HDA_PARAM_PIN_CAP_TRIGGER_REQD_MASK) >> \ HDA_PARAM_PIN_CAP_TRIGGER_REQD_SHIFT) @@ -1193,14 +1194,47 @@ HDA_PARAM_VOLUME_KNOB_CAP_NUM_STEPS_SHIFT) -#define HDA_CONFIG_DEFAULTCONF_SEQUENCE_MASK 0x00000000f -#define HDA_CONFIG_DEFAULTCONF_ASSOCIATION_MASK 0x0000000f0 -#define HDA_CONFIG_DEFAULTCONF_MISC_MASK 0x000000f00 -#define HDA_CONFIG_DEFAULTCONF_COLOR_MASK 0x00000f000 -#define HDA_CONFIG_DEFAULTCONF_CONNECTION_TYPE_MASK 0x000f00000 -#define HDA_CONFIG_DEFAULTCONF_DEVICE_MASK 0x000f00000 -#define HDA_CONFIG_DEFAULTCONF_LOCATION_MASK 0x03f000000 -#define HDA_CONFIG_DEFAULTCONF_CONNECTIVITY_MASK 0x0c0000000 +#define HDA_CONFIG_DEFAULTCONF_SEQUENCE_MASK 0x0000000f +#define HDA_CONFIG_DEFAULTCONF_SEQUENCE_SHIFT 0 +#define HDA_CONFIG_DEFAULTCONF_ASSOCIATION_MASK 0x000000f0 +#define HDA_CONFIG_DEFAULTCONF_ASSOCIATION_SHIFT 4 +#define HDA_CONFIG_DEFAULTCONF_MISC_MASK 0x00000f00 +#define HDA_CONFIG_DEFAULTCONF_MISC_SHIFT 8 +#define HDA_CONFIG_DEFAULTCONF_COLOR_MASK 0x0000f000 +#define HDA_CONFIG_DEFAULTCONF_COLOR_SHIFT 12 +#define HDA_CONFIG_DEFAULTCONF_CONNECTION_TYPE_MASK 0x000f0000 +#define HDA_CONFIG_DEFAULTCONF_CONNECTION_TYPE_SHIFT 16 +#define HDA_CONFIG_DEFAULTCONF_DEVICE_MASK 0x00f00000 +#define HDA_CONFIG_DEFAULTCONF_DEVICE_SHIFT 20 +#define HDA_CONFIG_DEFAULTCONF_LOCATION_MASK 0x3f000000 +#define HDA_CONFIG_DEFAULTCONF_LOCATION_SHIFT 24 +#define HDA_CONFIG_DEFAULTCONF_CONNECTIVITY_MASK 0xc0000000 +#define HDA_CONFIG_DEFAULTCONF_CONNECTIVITY_SHIFT 30 + +#define HDA_CONFIG_DEFAULTCONF_SEQUENCE(conf) \ + (((conf) & HDA_CONFIG_DEFAULTCONF_SEQUENCE_MASK) >> \ + HDA_CONFIG_DEFAULTCONF_SEQUENCE_SHIFT) +#define HDA_CONFIG_DEFAULTCONF_ASSOCIATION(conf) \ + (((conf) & HDA_CONFIG_DEFAULTCONF_ASSOCIATION_MASK) >> \ + HDA_CONFIG_DEFAULTCONF_ASSOCIATION_SHIFT) +#define HDA_CONFIG_DEFAULTCONF_MISC(conf) \ + (((conf) & HDA_CONFIG_DEFAULTCONF_MISC_MASK) >> \ + HDA_CONFIG_DEFAULTCONF_MISC_SHIFT) +#define HDA_CONFIG_DEFAULTCONF_COLOR(conf) \ + (((conf) & HDA_CONFIG_DEFAULTCONF_COLOR_MASK) >> \ + HDA_CONFIG_DEFAULTCONF_COLOR_SHIFT) +#define HDA_CONFIG_DEFAULTCONF_CONNECTION_TYPE(conf) \ + (((conf) & HDA_CONFIG_DEFAULTCONF_CONNECTION_TYPE_MASK) >> \ + HDA_CONFIG_DEFAULTCONF_CONNECTION_TYPE_SHIFT) +#define HDA_CONFIG_DEFAULTCONF_DEVICE(conf) \ + (((conf) & HDA_CONFIG_DEFAULTCONF_DEVICE_MASK) >> \ + HDA_CONFIG_DEFAULTCONF_DEVICE_SHIFT) +#define HDA_CONFIG_DEFAULTCONF_LOCATION(conf) \ + (((conf) & HDA_CONFIG_DEFAULTCONF_LOCATION_MASK) >> \ + HDA_CONFIG_DEFAULTCONF_LOCATION_SHIFT) +#define HDA_CONFIG_DEFAULTCONF_CONNECTIVITY(conf) \ + (((conf) & HDA_CONFIG_DEFAULTCONF_CONNECTIVITY_MASK) >> \ + HDA_CONFIG_DEFAULTCONF_CONNECTIVITY_SHIFT) #define HDA_CONFIG_DEFAULTCONF_CONNECTIVITY_JACK (0<<30) #define HDA_CONFIG_DEFAULTCONF_CONNECTIVITY_NONE (1<<30) Modified: stable/7/sys/dev/sound/pci/hda/hdac.c ============================================================================== --- stable/7/sys/dev/sound/pci/hda/hdac.c Wed Jan 7 14:00:44 2009 (r186861) +++ stable/7/sys/dev/sound/pci/hda/hdac.c Wed Jan 7 15:28:47 2009 (r186862) @@ -1,6 +1,7 @@ /*- * Copyright (c) 2006 Stephane E. Potvin <sepotvin@videotron.ca> * Copyright (c) 2006 Ariff Abdullah <ariff@FreeBSD.org> + * Copyright (c) 2008 Alexander Motin <mav@FreeBSD.org> * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -61,6 +62,7 @@ * * Daniel Eischen <deischen@FreeBSD.org> * * * Maxime Guillaud <bsd-ports@mguillaud.net> * * * Ariff Abdullah <ariff@FreeBSD.org> * + * * Alexander Motin <mav@FreeBSD.org> * * * * * * ....and various people from freebsd-multimedia@FreeBSD.org * * * * @@ -81,8 +83,7 @@ #include "mixer_if.h" -#define HDA_DRV_TEST_REV "20080420_0052" -#define HDA_WIDGET_PARSER_REV 1 +#define HDA_DRV_TEST_REV "20081226_0122" SND_DECLARE_FILE("$FreeBSD$"); @@ -92,6 +93,12 @@ SND_DECLARE_FILE("$FreeBSD$"); } \ } while(0) +#define HDA_BOOTHVERBOSE(stmt) do { \ + if (snd_verbose > 3) { \ + stmt \ + } \ +} while(0) + #if 1 #undef HDAC_INTR_EXTRA #define HDAC_INTR_EXTRA 1 @@ -141,6 +148,8 @@ SND_DECLARE_FILE("$FreeBSD$"); #define HDA_INTEL_82801G HDA_MODEL_CONSTRUCT(INTEL, 0x27d8) #define HDA_INTEL_82801H HDA_MODEL_CONSTRUCT(INTEL, 0x284b) #define HDA_INTEL_82801I HDA_MODEL_CONSTRUCT(INTEL, 0x293e) +#define HDA_INTEL_82801J HDA_MODEL_CONSTRUCT(INTEL, 0x3a3e) +#define HDA_INTEL_SCH HDA_MODEL_CONSTRUCT(INTEL, 0x811b) #define HDA_INTEL_ALL HDA_MODEL_CONSTRUCT(INTEL, 0xffff) /* Nvidia */ @@ -153,6 +162,16 @@ SND_DECLARE_FILE("$FreeBSD$"); #define HDA_NVIDIA_MCP65_2 HDA_MODEL_CONSTRUCT(NVIDIA, 0x044b) #define HDA_NVIDIA_MCP67_1 HDA_MODEL_CONSTRUCT(NVIDIA, 0x055c) #define HDA_NVIDIA_MCP67_2 HDA_MODEL_CONSTRUCT(NVIDIA, 0x055d) +#define HDA_NVIDIA_MCP78_1 HDA_MODEL_CONSTRUCT(NVIDIA, 0x0774) +#define HDA_NVIDIA_MCP78_2 HDA_MODEL_CONSTRUCT(NVIDIA, 0x0775) +#define HDA_NVIDIA_MCP78_3 HDA_MODEL_CONSTRUCT(NVIDIA, 0x0776) +#define HDA_NVIDIA_MCP78_4 HDA_MODEL_CONSTRUCT(NVIDIA, 0x0777) +#define HDA_NVIDIA_MCP73_1 HDA_MODEL_CONSTRUCT(NVIDIA, 0x07fc) +#define HDA_NVIDIA_MCP73_2 HDA_MODEL_CONSTRUCT(NVIDIA, 0x07fd) +#define HDA_NVIDIA_MCP79_1 HDA_MODEL_CONSTRUCT(NVIDIA, 0x0ac0) +#define HDA_NVIDIA_MCP79_2 HDA_MODEL_CONSTRUCT(NVIDIA, 0x0ac1) +#define HDA_NVIDIA_MCP79_3 HDA_MODEL_CONSTRUCT(NVIDIA, 0x0ac2) +#define HDA_NVIDIA_MCP79_4 HDA_MODEL_CONSTRUCT(NVIDIA, 0x0ac3) #define HDA_NVIDIA_ALL HDA_MODEL_CONSTRUCT(NVIDIA, 0xffff) /* ATI */ @@ -171,6 +190,11 @@ SND_DECLARE_FILE("$FreeBSD$"); #define HDA_SIS_966 HDA_MODEL_CONSTRUCT(SIS, 0x7502) #define HDA_SIS_ALL HDA_MODEL_CONSTRUCT(SIS, 0xffff) +/* ULI */ +#define ULI_VENDORID 0x10b9 +#define HDA_ULI_M5461 HDA_MODEL_CONSTRUCT(ULI, 0x5461) +#define HDA_ULI_ALL HDA_MODEL_CONSTRUCT(ULI, 0xffff) + /* OEM/subvendors */ /* Intel */ @@ -195,6 +219,7 @@ SND_DECLARE_FILE("$FreeBSD$"); #define DELL_VENDORID 0x1028 #define DELL_D630_SUBVENDOR HDA_MODEL_CONSTRUCT(DELL, 0x01f9) #define DELL_D820_SUBVENDOR HDA_MODEL_CONSTRUCT(DELL, 0x01cc) +#define DELL_V1400_SUBVENDOR HDA_MODEL_CONSTRUCT(DELL, 0x0227) #define DELL_V1500_SUBVENDOR HDA_MODEL_CONSTRUCT(DELL, 0x0228) #define DELL_I1300_SUBVENDOR HDA_MODEL_CONSTRUCT(DELL, 0x01c9) #define DELL_XPSM1210_SUBVENDOR HDA_MODEL_CONSTRUCT(DELL, 0x01d7) @@ -213,6 +238,7 @@ SND_DECLARE_FILE("$FreeBSD$"); #define ACER_A4710_SUBVENDOR HDA_MODEL_CONSTRUCT(ACER, 0x012f) #define ACER_A4715_SUBVENDOR HDA_MODEL_CONSTRUCT(ACER, 0x0133) #define ACER_3681WXM_SUBVENDOR HDA_MODEL_CONSTRUCT(ACER, 0x0110) +#define ACER_T6292_SUBVENDOR HDA_MODEL_CONSTRUCT(ACER, 0x011b) #define ACER_ALL_SUBVENDOR HDA_MODEL_CONSTRUCT(ACER, 0xffff) /* Asus */ @@ -260,6 +286,11 @@ SND_DECLARE_FILE("$FreeBSD$"); #define APPLE_VENDORID 0x106b #define APPLE_MB3_SUBVENDOR HDA_MODEL_CONSTRUCT(APPLE, 0x00a1) +/* Sony */ +#define SONY_VENDORID 0x104d +#define SONY_S5_SUBVENDOR HDA_MODEL_CONSTRUCT(SONY, 0x81cc) +#define SONY_ALL_SUBVENDOR HDA_MODEL_CONSTRUCT(SONY, 0xffff) + /* * Apple Intel MacXXXX seems using Sigmatel codec/vendor id * instead of their own, which is beyond my comprehension @@ -308,6 +339,7 @@ SND_DECLARE_FILE("$FreeBSD$"); /* Misc constants.. */ +#define HDA_AMP_VOL_DEFAULT (-1) #define HDA_AMP_MUTE_DEFAULT (0xffffffff) #define HDA_AMP_MUTE_NONE (0) #define HDA_AMP_MUTE_LEFT (1 << 0) @@ -317,16 +349,10 @@ SND_DECLARE_FILE("$FreeBSD$"); #define HDA_AMP_LEFT_MUTED(v) ((v) & (HDA_AMP_MUTE_LEFT)) #define HDA_AMP_RIGHT_MUTED(v) (((v) & HDA_AMP_MUTE_RIGHT) >> 1) -#define HDA_DAC_PATH (1 << 0) -#define HDA_ADC_PATH (1 << 1) -#define HDA_ADC_RECSEL (1 << 2) - -#define HDA_DAC_LOCKED (1 << 3) -#define HDA_ADC_LOCKED (1 << 4) - -#define HDA_CTL_OUT (1 << 0) -#define HDA_CTL_IN (1 << 1) -#define HDA_CTL_BOTH (HDA_CTL_IN | HDA_CTL_OUT) +#define HDA_ADC_MONITOR (1 << 0) + +#define HDA_CTL_OUT 1 +#define HDA_CTL_IN 2 #define HDA_GPIO_MAX 8 /* 0 - 7 = GPIO , 8 = Flush */ @@ -346,6 +372,7 @@ SND_DECLARE_FILE("$FreeBSD$"); #define HDA_QUIRK_FORCESTEREO (1 << 11) #define HDA_QUIRK_EAPDINV (1 << 12) #define HDA_QUIRK_DMAPOS (1 << 13) +#define HDA_QUIRK_SENSEINV (1 << 14) /* 26 - 31 = vrefs */ #define HDA_QUIRK_IVREF50 (1 << 26) @@ -361,9 +388,6 @@ SND_DECLARE_FILE("$FreeBSD$"); HDA_QUIRK_OVREF100) #define HDA_QUIRK_VREF (HDA_QUIRK_IVREF | HDA_QUIRK_OVREF) -#define SOUND_MASK_SKIP (1 << 30) -#define SOUND_MASK_DISABLE (1 << 31) - #if __FreeBSD_version < 600000 #define taskqueue_drain(...) #endif @@ -386,6 +410,7 @@ static const struct { { "forcestereo", HDA_QUIRK_FORCESTEREO }, { "eapdinv", HDA_QUIRK_EAPDINV }, { "dmapos", HDA_QUIRK_DMAPOS }, + { "senseinv", HDA_QUIRK_SENSEINV }, { "ivref50", HDA_QUIRK_IVREF50 }, { "ivref80", HDA_QUIRK_IVREF80 }, { "ivref100", HDA_QUIRK_IVREF100 }, @@ -413,14 +438,18 @@ static const struct { #define HDA_PARSE_MAXDEPTH 10 #define HDAC_UNSOLTAG_EVENT_HP 0x00 -#define HDAC_UNSOLTAG_EVENT_TEST 0x01 MALLOC_DEFINE(M_HDAC, "hdac", "High Definition Audio Controller"); -enum { - HDA_PARSE_MIXER, - HDA_PARSE_DIRECT -}; +const char *HDA_COLORS[16] = {"Unknown", "Black", "Grey", "Blue", "Green", "Red", + "Orange", "Yellow", "Purple", "Pink", "Res.A", "Res.B", "Res.C", "Res.D", + "White", "Other"}; + +const char *HDA_DEVS[16] = {"Line-out", "Speaker", "Headphones", "CD", + "SPDIF-out", "Digital-out", "Modem-line", "Modem-handset", "Line-in", + "AUX", "Mic", "Telephony", "SPDIF-in", "Digital-in", "Res.E", "Other"}; + +const char *HDA_CONNS[4] = {"Jack", "None", "Fixed", "Both"}; /* Default */ static uint32_t hdac_fmt[] = { @@ -439,6 +468,8 @@ static const struct { { HDA_INTEL_82801G, "Intel 82801G" }, { HDA_INTEL_82801H, "Intel 82801H" }, { HDA_INTEL_82801I, "Intel 82801I" }, + { HDA_INTEL_82801J, "Intel 82801J" }, + { HDA_INTEL_SCH, "Intel SCH" }, { HDA_NVIDIA_MCP51, "NVidia MCP51" }, { HDA_NVIDIA_MCP55, "NVidia MCP55" }, { HDA_NVIDIA_MCP61_1, "NVidia MCP61" }, @@ -447,16 +478,28 @@ static const struct { { HDA_NVIDIA_MCP65_2, "NVidia MCP65" }, { HDA_NVIDIA_MCP67_1, "NVidia MCP67" }, { HDA_NVIDIA_MCP67_2, "NVidia MCP67" }, + { HDA_NVIDIA_MCP73_1, "NVidia MCP73" }, + { HDA_NVIDIA_MCP73_2, "NVidia MCP73" }, + { HDA_NVIDIA_MCP78_1, "NVidia MCP78" }, + { HDA_NVIDIA_MCP78_2, "NVidia MCP78" }, + { HDA_NVIDIA_MCP78_3, "NVidia MCP78" }, + { HDA_NVIDIA_MCP78_4, "NVidia MCP78" }, + { HDA_NVIDIA_MCP79_1, "NVidia MCP79" }, + { HDA_NVIDIA_MCP79_2, "NVidia MCP79" }, + { HDA_NVIDIA_MCP79_3, "NVidia MCP79" }, + { HDA_NVIDIA_MCP79_4, "NVidia MCP79" }, { HDA_ATI_SB450, "ATI SB450" }, { HDA_ATI_SB600, "ATI SB600" }, { HDA_VIA_VT82XX, "VIA VT8251/8237A" }, { HDA_SIS_966, "SiS 966" }, + { HDA_ULI_M5461, "ULI M5461" }, /* Unknown */ { HDA_INTEL_ALL, "Intel (Unknown)" }, { HDA_NVIDIA_ALL, "NVidia (Unknown)" }, { HDA_ATI_ALL, "ATI (Unknown)" }, { HDA_VIA_ALL, "VIA (Unknown)" }, { HDA_SIS_ALL, "SiS (Unknown)" }, + { HDA_ULI_ALL, "ULI (Unknown)" }, }; #define HDAC_DEVICES_LEN (sizeof(hdac_devices) / sizeof(hdac_devices[0])) @@ -526,8 +569,13 @@ static const struct { #define REALTEK_VENDORID 0x10ec #define HDA_CODEC_ALC260 HDA_CODEC_CONSTRUCT(REALTEK, 0x0260) #define HDA_CODEC_ALC262 HDA_CODEC_CONSTRUCT(REALTEK, 0x0262) +#define HDA_CODEC_ALC267 HDA_CODEC_CONSTRUCT(REALTEK, 0x0267) #define HDA_CODEC_ALC268 HDA_CODEC_CONSTRUCT(REALTEK, 0x0268) +#define HDA_CODEC_ALC269 HDA_CODEC_CONSTRUCT(REALTEK, 0x0269) +#define HDA_CODEC_ALC272 HDA_CODEC_CONSTRUCT(REALTEK, 0x0272) #define HDA_CODEC_ALC660 HDA_CODEC_CONSTRUCT(REALTEK, 0x0660) +#define HDA_CODEC_ALC662 HDA_CODEC_CONSTRUCT(REALTEK, 0x0662) +#define HDA_CODEC_ALC663 HDA_CODEC_CONSTRUCT(REALTEK, 0x0663) #define HDA_CODEC_ALC861 HDA_CODEC_CONSTRUCT(REALTEK, 0x0861) #define HDA_CODEC_ALC861VD HDA_CODEC_CONSTRUCT(REALTEK, 0x0862) #define HDA_CODEC_ALC880 HDA_CODEC_CONSTRUCT(REALTEK, 0x0880) @@ -535,16 +583,26 @@ static const struct { #define HDA_CODEC_ALC883 HDA_CODEC_CONSTRUCT(REALTEK, 0x0883) #define HDA_CODEC_ALC885 HDA_CODEC_CONSTRUCT(REALTEK, 0x0885) #define HDA_CODEC_ALC888 HDA_CODEC_CONSTRUCT(REALTEK, 0x0888) +#define HDA_CODEC_ALC889 HDA_CODEC_CONSTRUCT(REALTEK, 0x0889) #define HDA_CODEC_ALCXXXX HDA_CODEC_CONSTRUCT(REALTEK, 0xffff) /* Analog Devices */ #define ANALOGDEVICES_VENDORID 0x11d4 +#define HDA_CODEC_AD1884A HDA_CODEC_CONSTRUCT(ANALOGDEVICES, 0x184a) +#define HDA_CODEC_AD1882 HDA_CODEC_CONSTRUCT(ANALOGDEVICES, 0x1882) +#define HDA_CODEC_AD1883 HDA_CODEC_CONSTRUCT(ANALOGDEVICES, 0x1883) +#define HDA_CODEC_AD1884 HDA_CODEC_CONSTRUCT(ANALOGDEVICES, 0x1884) +#define HDA_CODEC_AD1984A HDA_CODEC_CONSTRUCT(ANALOGDEVICES, 0x194a) +#define HDA_CODEC_AD1984B HDA_CODEC_CONSTRUCT(ANALOGDEVICES, 0x194b) #define HDA_CODEC_AD1981HD HDA_CODEC_CONSTRUCT(ANALOGDEVICES, 0x1981) #define HDA_CODEC_AD1983 HDA_CODEC_CONSTRUCT(ANALOGDEVICES, 0x1983) #define HDA_CODEC_AD1984 HDA_CODEC_CONSTRUCT(ANALOGDEVICES, 0x1984) #define HDA_CODEC_AD1986A HDA_CODEC_CONSTRUCT(ANALOGDEVICES, 0x1986) +#define HDA_CODEC_AD1987 HDA_CODEC_CONSTRUCT(ANALOGDEVICES, 0x1987) #define HDA_CODEC_AD1988 HDA_CODEC_CONSTRUCT(ANALOGDEVICES, 0x1988) #define HDA_CODEC_AD1988B HDA_CODEC_CONSTRUCT(ANALOGDEVICES, 0x198b) +#define HDA_CODEC_AD1882A HDA_CODEC_CONSTRUCT(ANALOGDEVICES, 0x882a) +#define HDA_CODEC_AD1989B HDA_CODEC_CONSTRUCT(ANALOGDEVICES, 0x989b) #define HDA_CODEC_ADXXXX HDA_CODEC_CONSTRUCT(ANALOGDEVICES, 0xffff) /* CMedia */ @@ -554,29 +612,77 @@ static const struct { /* Sigmatel */ #define SIGMATEL_VENDORID 0x8384 +#define HDA_CODEC_STAC9230X HDA_CODEC_CONSTRUCT(SIGMATEL, 0x7612) +#define HDA_CODEC_STAC9230D HDA_CODEC_CONSTRUCT(SIGMATEL, 0x7613) +#define HDA_CODEC_STAC9229X HDA_CODEC_CONSTRUCT(SIGMATEL, 0x7614) +#define HDA_CODEC_STAC9229D HDA_CODEC_CONSTRUCT(SIGMATEL, 0x7615) +#define HDA_CODEC_STAC9228X HDA_CODEC_CONSTRUCT(SIGMATEL, 0x7616) +#define HDA_CODEC_STAC9228D HDA_CODEC_CONSTRUCT(SIGMATEL, 0x7617) +#define HDA_CODEC_STAC9227X HDA_CODEC_CONSTRUCT(SIGMATEL, 0x7618) +#define HDA_CODEC_STAC9227D HDA_CODEC_CONSTRUCT(SIGMATEL, 0x7619) +#define HDA_CODEC_STAC9274 HDA_CODEC_CONSTRUCT(SIGMATEL, 0x7620) +#define HDA_CODEC_STAC9274D HDA_CODEC_CONSTRUCT(SIGMATEL, 0x7621) +#define HDA_CODEC_STAC9273X HDA_CODEC_CONSTRUCT(SIGMATEL, 0x7622) +#define HDA_CODEC_STAC9273D HDA_CODEC_CONSTRUCT(SIGMATEL, 0x7623) +#define HDA_CODEC_STAC9272X HDA_CODEC_CONSTRUCT(SIGMATEL, 0x7624) +#define HDA_CODEC_STAC9272D HDA_CODEC_CONSTRUCT(SIGMATEL, 0x7625) +#define HDA_CODEC_STAC9271X HDA_CODEC_CONSTRUCT(SIGMATEL, 0x7626) +#define HDA_CODEC_STAC9271D HDA_CODEC_CONSTRUCT(SIGMATEL, 0x7627) +#define HDA_CODEC_STAC9274X5NH HDA_CODEC_CONSTRUCT(SIGMATEL, 0x7628) +#define HDA_CODEC_STAC9274D5NH HDA_CODEC_CONSTRUCT(SIGMATEL, 0x7629) +#define HDA_CODEC_STAC9250 HDA_CODEC_CONSTRUCT(SIGMATEL, 0x7634) +#define HDA_CODEC_STAC9251 HDA_CODEC_CONSTRUCT(SIGMATEL, 0x7636) +#define HDA_CODEC_IDT92HD700X HDA_CODEC_CONSTRUCT(SIGMATEL, 0x7638) +#define HDA_CODEC_IDT92HD700D HDA_CODEC_CONSTRUCT(SIGMATEL, 0x7639) +#define HDA_CODEC_IDT92HD206X HDA_CODEC_CONSTRUCT(SIGMATEL, 0x7645) +#define HDA_CODEC_IDT92HD206D HDA_CODEC_CONSTRUCT(SIGMATEL, 0x7646) +#define HDA_CODEC_STAC9872AK HDA_CODEC_CONSTRUCT(SIGMATEL, 0x7662) #define HDA_CODEC_STAC9221 HDA_CODEC_CONSTRUCT(SIGMATEL, 0x7680) +#define HDA_CODEC_STAC922XD HDA_CODEC_CONSTRUCT(SIGMATEL, 0x7681) +#define HDA_CODEC_STAC9221_A2 HDA_CODEC_CONSTRUCT(SIGMATEL, 0x7682) #define HDA_CODEC_STAC9221D HDA_CODEC_CONSTRUCT(SIGMATEL, 0x7683) #define HDA_CODEC_STAC9220 HDA_CODEC_CONSTRUCT(SIGMATEL, 0x7690) -#define HDA_CODEC_STAC922XD HDA_CODEC_CONSTRUCT(SIGMATEL, 0x7681) -#define HDA_CODEC_STAC9227 HDA_CODEC_CONSTRUCT(SIGMATEL, 0x7618) -#define HDA_CODEC_STAC9271D HDA_CODEC_CONSTRUCT(SIGMATEL, 0x7627) -#define HDA_CODEC_STAC9205 HDA_CODEC_CONSTRUCT(SIGMATEL, 0x76a0) -#define HDA_CODEC_STAC9872AK HDA_CODEC_CONSTRUCT(SIGMATEL, 0x7662) +#define HDA_CODEC_STAC9200D HDA_CODEC_CONSTRUCT(SIGMATEL, 0x7691) +#define HDA_CODEC_IDT92HD005 HDA_CODEC_CONSTRUCT(SIGMATEL, 0x7698) +#define HDA_CODEC_IDT92HD005D HDA_CODEC_CONSTRUCT(SIGMATEL, 0x7699) +#define HDA_CODEC_STAC9205X HDA_CODEC_CONSTRUCT(SIGMATEL, 0x76a0) +#define HDA_CODEC_STAC9205D HDA_CODEC_CONSTRUCT(SIGMATEL, 0x76a1) +#define HDA_CODEC_STAC9204X HDA_CODEC_CONSTRUCT(SIGMATEL, 0x76a2) +#define HDA_CODEC_STAC9204D HDA_CODEC_CONSTRUCT(SIGMATEL, 0x76a3) +#define HDA_CODEC_STAC9220_A2 HDA_CODEC_CONSTRUCT(SIGMATEL, 0x7880) +#define HDA_CODEC_STAC9220_A1 HDA_CODEC_CONSTRUCT(SIGMATEL, 0x7882) #define HDA_CODEC_STACXXXX HDA_CODEC_CONSTRUCT(SIGMATEL, 0xffff) -/* - * Conexant - * - * Ok, the truth is, I don't have any idea at all whether - * it is "Venice" or "Waikiki" or other unnamed CXyadayada. The only - * place that tell me it is "Venice" is from its Windows driver INF. - * - * Venice - CX????? - * Waikiki - CX20551-22 - */ +/* IDT */ +#define IDT_VENDORID 0x111d +#define HDA_CODEC_IDT92HD75BX HDA_CODEC_CONSTRUCT(IDT, 0x7603) +#define HDA_CODEC_IDT92HD83C1X HDA_CODEC_CONSTRUCT(IDT, 0x7604) +#define HDA_CODEC_IDT92HD81B1X HDA_CODEC_CONSTRUCT(IDT, 0x7605) +#define HDA_CODEC_IDT92HD75B3 HDA_CODEC_CONSTRUCT(IDT, 0x7608) +#define HDA_CODEC_IDT92HD73D1 HDA_CODEC_CONSTRUCT(IDT, 0x7674) +#define HDA_CODEC_IDT92HD73C1 HDA_CODEC_CONSTRUCT(IDT, 0x7675) +#define HDA_CODEC_IDT92HD73E1 HDA_CODEC_CONSTRUCT(IDT, 0x7676) +#define HDA_CODEC_IDT92HD71B8 HDA_CODEC_CONSTRUCT(IDT, 0x76b0) +#define HDA_CODEC_IDT92HD71B7 HDA_CODEC_CONSTRUCT(IDT, 0x76b2) +#define HDA_CODEC_IDT92HD71B5 HDA_CODEC_CONSTRUCT(IDT, 0x76b6) +#define HDA_CODEC_IDT92HD83C1C HDA_CODEC_CONSTRUCT(IDT, 0x76d4) +#define HDA_CODEC_IDT92HD81B1C HDA_CODEC_CONSTRUCT(IDT, 0x76d5) +#define HDA_CODEC_IDTXXXX HDA_CODEC_CONSTRUCT(IDT, 0xffff) + +/* Silicon Image */ +#define SII_VENDORID 0x1095 +#define HDA_CODEC_SII1392 HDA_CODEC_CONSTRUCT(SII, 0x1392) +#define HDA_CODEC_SIIXXXX HDA_CODEC_CONSTRUCT(SII, 0xffff) + +/* Lucent/Agere */ +#define AGERE_VENDORID 0x11c1 +#define HDA_CODEC_AGEREXXXX HDA_CODEC_CONSTRUCT(AGERE, 0xffff) + +/* Conexant */ #define CONEXANT_VENDORID 0x14f1 -#define HDA_CODEC_CXVENICE HDA_CODEC_CONSTRUCT(CONEXANT, 0x5045) -#define HDA_CODEC_CXWAIKIKI HDA_CODEC_CONSTRUCT(CONEXANT, 0x5047) +#define HDA_CODEC_CX20549 HDA_CODEC_CONSTRUCT(CONEXANT, 0x5045) +#define HDA_CODEC_CX20551 HDA_CODEC_CONSTRUCT(CONEXANT, 0x5047) +#define HDA_CODEC_CX20561 HDA_CODEC_CONSTRUCT(CONEXANT, 0x5051) #define HDA_CODEC_CXXXXX HDA_CODEC_CONSTRUCT(CONEXANT, 0xffff) /* VIA */ @@ -592,8 +698,28 @@ static const struct { #define HDA_CODEC_VT1709_5 HDA_CODEC_CONSTRUCT(VIA, 0xe715) #define HDA_CODEC_VT1709_6 HDA_CODEC_CONSTRUCT(VIA, 0xe716) #define HDA_CODEC_VT1709_7 HDA_CODEC_CONSTRUCT(VIA, 0xe717) +#define HDA_CODEC_VT1708B_0 HDA_CODEC_CONSTRUCT(VIA, 0xe720) +#define HDA_CODEC_VT1708B_1 HDA_CODEC_CONSTRUCT(VIA, 0xe721) +#define HDA_CODEC_VT1708B_2 HDA_CODEC_CONSTRUCT(VIA, 0xe722) +#define HDA_CODEC_VT1708B_3 HDA_CODEC_CONSTRUCT(VIA, 0xe723) +#define HDA_CODEC_VT1708B_4 HDA_CODEC_CONSTRUCT(VIA, 0xe724) +#define HDA_CODEC_VT1708B_5 HDA_CODEC_CONSTRUCT(VIA, 0xe725) +#define HDA_CODEC_VT1708B_6 HDA_CODEC_CONSTRUCT(VIA, 0xe726) +#define HDA_CODEC_VT1708B_7 HDA_CODEC_CONSTRUCT(VIA, 0xe727) #define HDA_CODEC_VTXXXX HDA_CODEC_CONSTRUCT(VIA, 0xffff) +/* ATI */ +#define HDA_CODEC_ATIRS600_1 HDA_CODEC_CONSTRUCT(ATI, 0x793c) +#define HDA_CODEC_ATIRS600_2 HDA_CODEC_CONSTRUCT(ATI, 0x7919) +#define HDA_CODEC_ATIRS690 HDA_CODEC_CONSTRUCT(ATI, 0x791a) +#define HDA_CODEC_ATIR6XX HDA_CODEC_CONSTRUCT(ATI, 0xaa01) +#define HDA_CODEC_ATIXXXX HDA_CODEC_CONSTRUCT(ATI, 0xffff) + +/* NVIDIA */ +#define HDA_CODEC_NVIDIAXXXX HDA_CODEC_CONSTRUCT(NVIDIA, 0xffff) + +/* INTEL */ +#define HDA_CODEC_INTELXXXX HDA_CODEC_CONSTRUCT(INTEL, 0xffff) /* Codecs */ static const struct { @@ -602,8 +728,13 @@ static const struct { } hdac_codecs[] = { { HDA_CODEC_ALC260, "Realtek ALC260" }, { HDA_CODEC_ALC262, "Realtek ALC262" }, + { HDA_CODEC_ALC267, "Realtek ALC267" }, { HDA_CODEC_ALC268, "Realtek ALC268" }, + { HDA_CODEC_ALC269, "Realtek ALC269" }, + { HDA_CODEC_ALC272, "Realtek ALC272" }, { HDA_CODEC_ALC660, "Realtek ALC660" }, + { HDA_CODEC_ALC662, "Realtek ALC662" }, + { HDA_CODEC_ALC663, "Realtek ALC663" }, { HDA_CODEC_ALC861, "Realtek ALC861" }, { HDA_CODEC_ALC861VD, "Realtek ALC861-VD" }, { HDA_CODEC_ALC880, "Realtek ALC880" }, @@ -611,23 +742,77 @@ static const struct { { HDA_CODEC_ALC883, "Realtek ALC883" }, { HDA_CODEC_ALC885, "Realtek ALC885" }, { HDA_CODEC_ALC888, "Realtek ALC888" }, + { HDA_CODEC_ALC889, "Realtek ALC889" }, + { HDA_CODEC_AD1882, "Analog Devices AD1882" }, + { HDA_CODEC_AD1882A, "Analog Devices AD1882A" }, + { HDA_CODEC_AD1883, "Analog Devices AD1883" }, + { HDA_CODEC_AD1884, "Analog Devices AD1884" }, + { HDA_CODEC_AD1884A, "Analog Devices AD1884A" }, { HDA_CODEC_AD1981HD, "Analog Devices AD1981HD" }, { HDA_CODEC_AD1983, "Analog Devices AD1983" }, { HDA_CODEC_AD1984, "Analog Devices AD1984" }, + { HDA_CODEC_AD1984A, "Analog Devices AD1984A" }, + { HDA_CODEC_AD1984B, "Analog Devices AD1984B" }, { HDA_CODEC_AD1986A, "Analog Devices AD1986A" }, - { HDA_CODEC_AD1988, "Analog Devices AD1988" }, + { HDA_CODEC_AD1987, "Analog Devices AD1987" }, + { HDA_CODEC_AD1988, "Analog Devices AD1988A" }, { HDA_CODEC_AD1988B, "Analog Devices AD1988B" }, + { HDA_CODEC_AD1989B, "Analog Devices AD1989B" }, { HDA_CODEC_CMI9880, "CMedia CMI9880" }, + { HDA_CODEC_STAC9200D, "Sigmatel STAC9200D" }, + { HDA_CODEC_STAC9204X, "Sigmatel STAC9204X" }, + { HDA_CODEC_STAC9204D, "Sigmatel STAC9204D" }, + { HDA_CODEC_STAC9205X, "Sigmatel STAC9205X" }, + { HDA_CODEC_STAC9205D, "Sigmatel STAC9205D" }, + { HDA_CODEC_STAC9220, "Sigmatel STAC9220" }, + { HDA_CODEC_STAC9220_A1, "Sigmatel STAC9220_A1" }, + { HDA_CODEC_STAC9220_A2, "Sigmatel STAC9220_A2" }, { HDA_CODEC_STAC9221, "Sigmatel STAC9221" }, + { HDA_CODEC_STAC9221_A2, "Sigmatel STAC9221_A2" }, { HDA_CODEC_STAC9221D, "Sigmatel STAC9221D" }, - { HDA_CODEC_STAC9220, "Sigmatel STAC9220" }, { HDA_CODEC_STAC922XD, "Sigmatel STAC9220D/9223D" }, - { HDA_CODEC_STAC9227, "Sigmatel STAC9227" }, + { HDA_CODEC_STAC9227X, "Sigmatel STAC9227X" }, + { HDA_CODEC_STAC9227D, "Sigmatel STAC9227D" }, + { HDA_CODEC_STAC9228X, "Sigmatel STAC9228X" }, + { HDA_CODEC_STAC9228D, "Sigmatel STAC9228D" }, + { HDA_CODEC_STAC9229X, "Sigmatel STAC9229X" }, + { HDA_CODEC_STAC9229D, "Sigmatel STAC9229D" }, + { HDA_CODEC_STAC9230X, "Sigmatel STAC9230X" }, + { HDA_CODEC_STAC9230D, "Sigmatel STAC9230D" }, + { HDA_CODEC_STAC9250, "Sigmatel STAC9250" }, + { HDA_CODEC_STAC9251, "Sigmatel STAC9251" }, + { HDA_CODEC_STAC9271X, "Sigmatel STAC9271X" }, { HDA_CODEC_STAC9271D, "Sigmatel STAC9271D" }, - { HDA_CODEC_STAC9205, "Sigmatel STAC9205" }, - { HDA_CODEC_STAC9872AK,"Sigmatel STAC9872AK" }, - { HDA_CODEC_CXVENICE, "Conexant Venice" }, - { HDA_CODEC_CXWAIKIKI, "Conexant Waikiki" }, + { HDA_CODEC_STAC9272X, "Sigmatel STAC9272X" }, + { HDA_CODEC_STAC9272D, "Sigmatel STAC9272D" }, + { HDA_CODEC_STAC9273X, "Sigmatel STAC9273X" }, + { HDA_CODEC_STAC9273D, "Sigmatel STAC9273D" }, + { HDA_CODEC_STAC9274, "Sigmatel STAC9274" }, + { HDA_CODEC_STAC9274D, "Sigmatel STAC9274D" }, + { HDA_CODEC_STAC9274X5NH, "Sigmatel STAC9274X5NH" }, + { HDA_CODEC_STAC9274D5NH, "Sigmatel STAC9274D5NH" }, + { HDA_CODEC_STAC9872AK, "Sigmatel STAC9872AK" }, + { HDA_CODEC_IDT92HD005, "IDT 92HD005" }, + { HDA_CODEC_IDT92HD005D, "IDT 92HD005D" }, + { HDA_CODEC_IDT92HD206X, "IDT 92HD206X" }, + { HDA_CODEC_IDT92HD206D, "IDT 92HD206D" }, + { HDA_CODEC_IDT92HD700X, "IDT 92HD700X" }, + { HDA_CODEC_IDT92HD700D, "IDT 92HD700D" }, + { HDA_CODEC_IDT92HD71B5, "IDT 92HD71B5" }, + { HDA_CODEC_IDT92HD71B7, "IDT 92HD71B7" }, + { HDA_CODEC_IDT92HD71B8, "IDT 92HD71B8" }, + { HDA_CODEC_IDT92HD73C1, "IDT 92HD73C1" }, + { HDA_CODEC_IDT92HD73D1, "IDT 92HD73D1" }, + { HDA_CODEC_IDT92HD73E1, "IDT 92HD73E1" }, + { HDA_CODEC_IDT92HD75B3, "IDT 92HD75B3" }, + { HDA_CODEC_IDT92HD75BX, "IDT 92HD75BX" }, + { HDA_CODEC_IDT92HD81B1C, "IDT 92HD81B1C" }, + { HDA_CODEC_IDT92HD81B1X, "IDT 92HD81B1X" }, + { HDA_CODEC_IDT92HD83C1C, "IDT 92HD83C1C" }, + { HDA_CODEC_IDT92HD83C1X, "IDT 92HD83C1X" }, + { HDA_CODEC_CX20549, "Conexant CX20549 (Venice)" }, + { HDA_CODEC_CX20551, "Conexant CX20551 (Waikiki)" }, + { HDA_CODEC_CX20561, "Conexant CX20561 (Hermosa)" }, { HDA_CODEC_VT1708_8, "VIA VT1708_8" }, { HDA_CODEC_VT1708_9, "VIA VT1708_9" }, { HDA_CODEC_VT1708_A, "VIA VT1708_A" }, @@ -640,136 +825,41 @@ static const struct { { HDA_CODEC_VT1709_5, "VIA VT1709_5" }, { HDA_CODEC_VT1709_6, "VIA VT1709_6" }, { HDA_CODEC_VT1709_7, "VIA VT1709_7" }, + { HDA_CODEC_VT1708B_0, "VIA VT1708B_0" }, + { HDA_CODEC_VT1708B_1, "VIA VT1708B_1" }, + { HDA_CODEC_VT1708B_2, "VIA VT1708B_2" }, + { HDA_CODEC_VT1708B_3, "VIA VT1708B_3" }, + { HDA_CODEC_VT1708B_4, "VIA VT1708B_4" }, + { HDA_CODEC_VT1708B_5, "VIA VT1708B_5" }, + { HDA_CODEC_VT1708B_6, "VIA VT1708B_6" }, + { HDA_CODEC_VT1708B_7, "VIA VT1708B_7" }, + { HDA_CODEC_ATIRS600_1,"ATI RS600 HDMI" }, + { HDA_CODEC_ATIRS600_2,"ATI RS600 HDMI" }, + { HDA_CODEC_ATIRS690, "ATI RS690/780 HDMI" }, + { HDA_CODEC_ATIR6XX, "ATI R6xx HDMI" }, + { HDA_CODEC_SII1392, "Silicon Image SiI1392 HDMI" }, /* Unknown codec */ { HDA_CODEC_ALCXXXX, "Realtek (Unknown)" }, { HDA_CODEC_ADXXXX, "Analog Devices (Unknown)" }, { HDA_CODEC_CMIXXXX, "CMedia (Unknown)" }, { HDA_CODEC_STACXXXX, "Sigmatel (Unknown)" }, + { HDA_CODEC_SIIXXXX, "Silicon Image (Unknown)" }, + { HDA_CODEC_AGEREXXXX, "Lucent/Agere Systems (Unknown)" }, { HDA_CODEC_CXXXXX, "Conexant (Unknown)" }, { HDA_CODEC_VTXXXX, "VIA (Unknown)" }, + { HDA_CODEC_ATIXXXX, "ATI (Unknown)" }, + { HDA_CODEC_NVIDIAXXXX,"NVidia (Unknown)" }, + { HDA_CODEC_INTELXXXX, "Intel (Unknown)" }, + { HDA_CODEC_IDTXXXX, "IDT (Unknown)" }, }; #define HDAC_CODECS_LEN (sizeof(hdac_codecs) / sizeof(hdac_codecs[0])) -enum { - HDAC_HP_SWITCH_CTL, - HDAC_HP_SWITCH_CTRL, - HDAC_HP_SWITCH_DEBUG -}; - -static const struct { - uint32_t model; - uint32_t id; - int type; - int inverted; - int polling; - int execsense; - nid_t hpnid; - nid_t spkrnid[8]; - nid_t eapdnid; -} hdac_hp_switch[] = { - /* Specific OEM models */ - { HP_V3000_SUBVENDOR, HDA_CODEC_CXVENICE, HDAC_HP_SWITCH_CTL, - 0, 0, -1, 17, { 16, -1 }, 16 }, - /* { HP_XW4300_SUBVENDOR, HDA_CODEC_ALC260, HDAC_HP_SWITCH_CTL, - 0, 0, -1, 21, { 16, 17, -1 }, -1 } */ - /* { HP_3010_SUBVENDOR, HDA_CODEC_ALC260, HDAC_HP_SWITCH_DEBUG, - 0, 1, 0, 16, { 15, 18, 19, 20, 21, -1 }, -1 }, */ - { HP_NX7400_SUBVENDOR, HDA_CODEC_AD1981HD, HDAC_HP_SWITCH_CTL, - 0, 0, -1, 6, { 5, -1 }, 5 }, - { HP_NX6310_SUBVENDOR, HDA_CODEC_AD1981HD, HDAC_HP_SWITCH_CTL, - 0, 0, -1, 6, { 5, -1 }, 5 }, - { HP_NX6325_SUBVENDOR, HDA_CODEC_AD1981HD, HDAC_HP_SWITCH_CTL, - 0, 0, -1, 6, { 5, -1 }, 5 }, - /* { HP_DC7700_SUBVENDOR, HDA_CODEC_ALC262, HDAC_HP_SWITCH_CTL, - 0, 0, -1, 21, { 22, 27, -1 }, -1 }, */ - { TOSHIBA_U200_SUBVENDOR, HDA_CODEC_AD1981HD, HDAC_HP_SWITCH_CTL, - 0, 0, -1, 6, { 5, -1 }, -1 }, - { TOSHIBA_A135_SUBVENDOR, HDA_CODEC_ALC861VD, HDAC_HP_SWITCH_CTL, - 0, 0, -1, 27, { 20, -1 }, -1 }, - { DELL_D820_SUBVENDOR, HDA_CODEC_STAC9220, HDAC_HP_SWITCH_CTRL, - 0, 0, -1, 13, { 14, -1 }, -1 }, - { DELL_I1300_SUBVENDOR, HDA_CODEC_STAC9220, HDAC_HP_SWITCH_CTRL, - 0, 0, -1, 13, { 14, -1 }, -1 }, - { DELL_OPLX745_SUBVENDOR, HDA_CODEC_AD1983, HDAC_HP_SWITCH_CTL, - 0, 0, -1, 6, { 5, 7, -1 }, -1 }, - { DELL_D630_SUBVENDOR, HDA_CODEC_STAC9205, HDAC_HP_SWITCH_CTRL, - 0, 0, -1, 10, { 13, -1 }, -1 }, - { DELL_V1500_SUBVENDOR, HDA_CODEC_STAC9205, HDAC_HP_SWITCH_CTRL, - 0, 0, -1, 10, { 13, -1 }, -1 }, - { APPLE_MB3_SUBVENDOR, HDA_CODEC_ALC885, HDAC_HP_SWITCH_CTL, - 0, 0, -1, 21, { 20, 22, -1 }, -1 }, - { APPLE_INTEL_MAC, HDA_CODEC_STAC9221, HDAC_HP_SWITCH_CTRL, - 0, 0, -1, 10, { 13, -1 }, -1 }, - { LENOVO_3KN100_SUBVENDOR, HDA_CODEC_AD1986A, HDAC_HP_SWITCH_CTL, - 1, 0, -1, 26, { 27, -1 }, -1 }, - { LENOVO_3KN200_SUBVENDOR, HDA_CODEC_ALC861VD, HDAC_HP_SWITCH_CTL, - 0, 0, -1, 27, { 20, -1 }, -1 }, - /* { LENOVO_TCA55_SUBVENDOR, HDA_CODEC_AD1986A, HDAC_HP_SWITCH_CTL, - 0, 0, -1, 26, { 27, 28, 29, 30, -1 }, -1 }, */ - { LG_LW20_SUBVENDOR, HDA_CODEC_ALC880, HDAC_HP_SWITCH_CTL, - 0, 0, -1, 27, { 20, -1 }, -1 }, - { ACER_A5050_SUBVENDOR, HDA_CODEC_ALC883, HDAC_HP_SWITCH_CTL, - 0, 0, -1, 20, { 21, -1 }, -1 }, - { ACER_3681WXM_SUBVENDOR, HDA_CODEC_ALC883, HDAC_HP_SWITCH_CTL, - 0, 0, -1, 20, { 21, -1 }, -1 }, - { ACER_A4520_SUBVENDOR, HDA_CODEC_ALC268, HDAC_HP_SWITCH_CTL, - 0, 0, -1, 20, { 21, -1 }, -1 }, - { ACER_A4710_SUBVENDOR, HDA_CODEC_ALC268, HDAC_HP_SWITCH_CTL, - 0, 0, -1, 20, { 21, -1 }, -1 }, - { ACER_A4715_SUBVENDOR, HDA_CODEC_ALC268, HDAC_HP_SWITCH_CTL, - 0, 0, -1, 20, { 21, -1 }, -1 }, - { UNIWILL_9080_SUBVENDOR, HDA_CODEC_ALC883, HDAC_HP_SWITCH_CTL, - 0, 0, -1, 20, { 21, -1 }, -1 }, - { MSI_MS1034_SUBVENDOR, HDA_CODEC_ALC883, HDAC_HP_SWITCH_CTL, - 0, 0, -1, 20, { 27, -1 }, -1 }, - { MSI_MS034A_SUBVENDOR, HDA_CODEC_ALC883, HDAC_HP_SWITCH_CTL, - 0, 0, -1, 20, { 27, -1 }, -1 }, - { FS_SI1848_SUBVENDOR, HDA_CODEC_ALC883, HDAC_HP_SWITCH_CTL, - 0, 0, -1, 20, { 21, -1 }, -1 }, - { FL_S7020D_SUBVENDOR, HDA_CODEC_ALC260, HDAC_HP_SWITCH_CTL, - 0, 0, -1, 20, { 16, -1 }, -1 }, - { FL_U1010_SUBVENDOR, HDA_CODEC_ALC262, HDAC_HP_SWITCH_CTL, - 0, 0, -1, 20, { 21, -1 }, -1 }, - /* - * All models that at least come from the same vendor with - * simmilar codec. - */ - { HP_ALL_SUBVENDOR, HDA_CODEC_CXVENICE, HDAC_HP_SWITCH_CTL, - 0, 0, -1, 17, { 16, -1 }, 16 }, - { HP_ALL_SUBVENDOR, HDA_CODEC_AD1981HD, HDAC_HP_SWITCH_CTL, - 0, 0, -1, 6, { 5, -1 }, 5 }, - { TOSHIBA_ALL_SUBVENDOR, HDA_CODEC_AD1981HD, HDAC_HP_SWITCH_CTL, - 0, 0, -1, 6, { 5, -1 }, -1 }, - { DELL_ALL_SUBVENDOR, HDA_CODEC_STAC9220, HDAC_HP_SWITCH_CTRL, - 0, 0, -1, 13, { 14, -1 }, -1 }, -#if 0 - { LENOVO_ALL_SUBVENDOR, HDA_CODEC_AD1986A, HDAC_HP_SWITCH_CTL, - 1, 0, -1, 26, { 27, -1 }, -1 }, - { ACER_ALL_SUBVENDOR, HDA_CODEC_ALC883, HDAC_HP_SWITCH_CTL, - 0, 0, -1, 20, { 21, -1 }, -1 }, -#endif -}; -#define HDAC_HP_SWITCH_LEN \ - (sizeof(hdac_hp_switch) / sizeof(hdac_hp_switch[0])) - -static const struct { - uint32_t model; - uint32_t id; - nid_t eapdnid; - int hp_switch; -} hdac_eapd_switch[] = { - { HP_V3000_SUBVENDOR, HDA_CODEC_CXVENICE, 16, 1 }, - { HP_NX7400_SUBVENDOR, HDA_CODEC_AD1981HD, 5, 1 }, - { HP_NX6310_SUBVENDOR, HDA_CODEC_AD1981HD, 5, 1 }, -}; -#define HDAC_EAPD_SWITCH_LEN \ - (sizeof(hdac_eapd_switch) / sizeof(hdac_eapd_switch[0])) /**************************************************************************** * Function prototypes ****************************************************************************/ static void hdac_intr_handler(void *); -static int hdac_reset(struct hdac_softc *); +static int hdac_reset(struct hdac_softc *, int); static int hdac_get_capabilities(struct hdac_softc *); static void hdac_dma_cb(void *, bus_dma_segment_t *, int, int); static int hdac_dma_alloc(struct hdac_softc *, @@ -783,10 +873,10 @@ static void hdac_corb_init(struct hdac_s static void hdac_rirb_init(struct hdac_softc *); static void hdac_corb_start(struct hdac_softc *); static void hdac_rirb_start(struct hdac_softc *); -static void hdac_scan_codecs(struct hdac_softc *, int); -static int hdac_probe_codec(struct hdac_codec *); -static struct hdac_devinfo *hdac_probe_function(struct hdac_codec *, nid_t); -static void hdac_add_child(struct hdac_softc *, struct hdac_devinfo *); +static void hdac_scan_codecs(struct hdac_softc *); +static void hdac_probe_codec(struct hdac_codec *); +static void hdac_probe_function(struct hdac_codec *, nid_t); +static int hdac_pcmchannel_setup(struct hdac_chan *); static void hdac_attach2(void *); @@ -798,34 +888,37 @@ static void hdac_command_send_internal(s static int hdac_probe(device_t); static int hdac_attach(device_t); static int hdac_detach(device_t); +static int hdac_suspend(device_t); +static int hdac_resume(device_t); static void hdac_widget_connection_select(struct hdac_widget *, uint8_t); static void hdac_audio_ctl_amp_set(struct hdac_audio_ctl *, uint32_t, int, int); static struct hdac_audio_ctl *hdac_audio_ctl_amp_get(struct hdac_devinfo *, - nid_t, int, int); + nid_t, int, int, int); static void hdac_audio_ctl_amp_set_internal(struct hdac_softc *, nid_t, nid_t, int, int, int, int, int, int); -static int hdac_audio_ctl_ossmixer_getnextdev(struct hdac_devinfo *); static struct hdac_widget *hdac_widget_get(struct hdac_devinfo *, nid_t); static int hdac_rirb_flush(struct hdac_softc *sc); static int hdac_unsolq_flush(struct hdac_softc *sc); +static void hdac_dump_pin_config(struct hdac_widget *w, uint32_t conf); + #define hdac_command(a1, a2, a3) \ hdac_command_sendone_internal(a1, a2, a3) -#define hdac_codec_id(d) \ - ((uint32_t)((d == NULL) ? 0x00000000 : \ - ((((uint32_t)(d)->vendor_id & 0x0000ffff) << 16) | \ - ((uint32_t)(d)->device_id & 0x0000ffff)))) +#define hdac_codec_id(c) \ + ((uint32_t)((c == NULL) ? 0x00000000 : \ + ((((uint32_t)(c)->vendor_id & 0x0000ffff) << 16) | \ + ((uint32_t)(c)->device_id & 0x0000ffff)))) static char * -hdac_codec_name(struct hdac_devinfo *devinfo) +hdac_codec_name(struct hdac_codec *codec) { uint32_t id; int i; - id = hdac_codec_id(devinfo); + id = hdac_codec_id(codec); for (i = 0; i < HDAC_CODECS_LEN; i++) { if (HDA_DEV_MATCH(hdac_codecs[i].id, id)) @@ -836,20 +929,6 @@ hdac_codec_name(struct hdac_devinfo *dev } static char * -hdac_audio_ctl_ossmixer_mask2name(uint32_t devmask) -{ - static char *ossname[] = SOUND_DEVICE_NAMES; - static char *unknown = "???"; - int i; - - for (i = SOUND_MIXER_NRDEVICES - 1; i >= 0; i--) { - if (devmask & (1 << i)) - return (ossname[i]); - } - return (unknown); -} - -static void hdac_audio_ctl_ossmixer_mask2allname(uint32_t mask, char *buf, size_t len) { static char *ossname[] = SOUND_DEVICE_NAMES; @@ -864,6 +943,7 @@ hdac_audio_ctl_ossmixer_mask2allname(uin first = 0; } } + return (buf); } static struct hdac_audio_ctl * @@ -879,48 +959,46 @@ hdac_audio_ctl_each(struct hdac_devinfo } static struct hdac_audio_ctl * -hdac_audio_ctl_amp_get(struct hdac_devinfo *devinfo, nid_t nid, +hdac_audio_ctl_amp_get(struct hdac_devinfo *devinfo, nid_t nid, int dir, int index, int cnt) { - struct hdac_audio_ctl *ctl, *retctl = NULL; - int i, at, atindex, found = 0; + struct hdac_audio_ctl *ctl; + int i, found = 0; if (devinfo == NULL || devinfo->function.audio.ctl == NULL) return (NULL); - at = cnt; - if (at == 0) - at = 1; - else if (at < 0) - at = -1; - atindex = index; - if (atindex < 0) - atindex = -1; - i = 0; while ((ctl = hdac_audio_ctl_each(devinfo, &i)) != NULL) { - if (ctl->enable == 0 || ctl->widget == NULL) + if (ctl->enable == 0) continue; - if (!(ctl->widget->nid == nid && (atindex == -1 || - ctl->index == atindex))) + if (ctl->widget->nid != nid) + continue; + if (dir && ctl->ndir != dir) + continue; + if (index >= 0 && ctl->ndir == HDA_CTL_IN && + ctl->dir == ctl->ndir && ctl->index != index) continue; found++; - if (found == cnt) + if (found == cnt || cnt <= 0) return (ctl); - retctl = ctl; } - return ((at == -1) ? retctl : NULL); + return (NULL); } +/* + * Jack detection (Speaker/HP redirection) event handler. + */ static void hdac_hp_switch_handler(struct hdac_devinfo *devinfo) { + struct hdac_audio_as *as; struct hdac_softc *sc; struct hdac_widget *w; struct hdac_audio_ctl *ctl; - uint32_t val, id, res; - int i = 0, j, timeout, forcemute; + uint32_t val, res; + int i, j; nid_t cad; if (devinfo == NULL || devinfo->codec == NULL || @@ -929,84 +1007,47 @@ hdac_hp_switch_handler(struct hdac_devin sc = devinfo->codec->sc; cad = devinfo->codec->cad; - id = hdac_codec_id(devinfo); - for (i = 0; i < HDAC_HP_SWITCH_LEN; i++) { - if (HDA_DEV_MATCH(hdac_hp_switch[i].model, - sc->pci_subvendor) && - hdac_hp_switch[i].id == id) - break; - } - - if (i >= HDAC_HP_SWITCH_LEN) - return; - - forcemute = 0; - if (hdac_hp_switch[i].eapdnid != -1) { - w = hdac_widget_get(devinfo, hdac_hp_switch[i].eapdnid); - if (w != NULL && w->param.eapdbtl != HDAC_INVALID) - forcemute = (w->param.eapdbtl & - HDA_CMD_SET_EAPD_BTL_ENABLE_EAPD) ? 0 : 1; - } - - if (hdac_hp_switch[i].execsense != -1) - hdac_command(sc, - HDA_CMD_SET_PIN_SENSE(cad, hdac_hp_switch[i].hpnid, - hdac_hp_switch[i].execsense), cad); + as = devinfo->function.audio.as; + for (i = 0; i < devinfo->function.audio.ascnt; i++) { + if (as[i].hpredir < 0) + continue; + + w = hdac_widget_get(devinfo, as[i].pins[15]); + if (w == NULL || w->enable == 0 || w->type != + HDA_PARAM_AUDIO_WIDGET_CAP_TYPE_PIN_COMPLEX) + continue; - timeout = 10000; - do { res = hdac_command(sc, - HDA_CMD_GET_PIN_SENSE(cad, hdac_hp_switch[i].hpnid), - cad); - if (hdac_hp_switch[i].execsense == -1 || res != 0x7fffffff) - break; - DELAY(10); - } while (--timeout != 0); + HDA_CMD_GET_PIN_SENSE(cad, as[i].pins[15]), cad); - HDA_BOOTVERBOSE( - device_printf(sc->dev, - "HDA_DEBUG: Pin sense: nid=%d timeout=%d res=0x%08x\n", - hdac_hp_switch[i].hpnid, timeout, res); - ); + HDA_BOOTVERBOSE( + device_printf(sc->dev, + "Pin sense: nid=%d res=0x%08x\n", + as[i].pins[15], res); + ); - res = HDA_CMD_GET_PIN_SENSE_PRESENCE_DETECT(res); - res ^= hdac_hp_switch[i].inverted; + res = HDA_CMD_GET_PIN_SENSE_PRESENCE_DETECT(res); + if (devinfo->function.audio.quirks & HDA_QUIRK_SENSEINV) + res ^= 1; - switch (hdac_hp_switch[i].type) { - case HDAC_HP_SWITCH_CTL: + /* (Un)Mute headphone pin. */ ctl = hdac_audio_ctl_amp_get(devinfo, - hdac_hp_switch[i].hpnid, 0, 1); - if (ctl != NULL) { - val = (res != 0 && forcemute == 0) ? - HDA_AMP_MUTE_NONE : HDA_AMP_MUTE_ALL; - if (val != ctl->muted) { - ctl->muted = val; + as[i].pins[15], HDA_CTL_IN, -1, 1); + if (ctl != NULL && ctl->mute) { + /* If pin has muter - use it. */ + val = (res != 0) ? 0 : 1; + if (val != ctl->forcemute) { + ctl->forcemute = val; hdac_audio_ctl_amp_set(ctl, - HDA_AMP_MUTE_DEFAULT, ctl->left, - ctl->right); + HDA_AMP_MUTE_DEFAULT, + HDA_AMP_VOL_DEFAULT, HDA_AMP_VOL_DEFAULT); } - } - for (j = 0; hdac_hp_switch[i].spkrnid[j] != -1; j++) { - ctl = hdac_audio_ctl_amp_get(devinfo, - hdac_hp_switch[i].spkrnid[j], 0, 1); - if (ctl == NULL) - continue; - val = (res != 0 || forcemute == 1) ? - HDA_AMP_MUTE_ALL : HDA_AMP_MUTE_NONE; - if (val == ctl->muted) - continue; - ctl->muted = val; - hdac_audio_ctl_amp_set(ctl, HDA_AMP_MUTE_DEFAULT, - ctl->left, ctl->right); - } - break; - case HDAC_HP_SWITCH_CTRL: - if (res != 0) { - /* HP in */ - w = hdac_widget_get(devinfo, hdac_hp_switch[i].hpnid); + } else { + /* If there is no muter - disable pin output. */ + w = hdac_widget_get(devinfo, as[i].pins[15]); if (w != NULL && w->type == HDA_PARAM_AUDIO_WIDGET_CAP_TYPE_PIN_COMPLEX) { - if (forcemute == 0) + if (res != 0) val = w->wclass.pin.ctrl | *** DIFF OUTPUT TRUNCATED AT 1000 LINES ***
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200901071528.n07FSlXM090711>