diff --git a/include/sound/soc.h b/include/sound/soc.h index b1dc364b8f74cca36aa4ec4850d1675accf9d1ee..db6edba8ef08c1de709bfbb60e591a7e80c7353b 100644 --- a/include/sound/soc.h +++ b/include/sound/soc.h @@ -22,7 +22,7 @@ #include #include -#define SND_SOC_VERSION "0.13.0" +#define SND_SOC_VERSION "0.13.1" /* * Convenience kcontrol builders @@ -83,6 +83,7 @@ #define SND_SOC_DAI_AC97 0x1 #define SND_SOC_DAI_I2S 0x2 #define SND_SOC_DAI_PCM 0x4 +#define SND_SOC_DAI_AC97_BUS 0x8 /* for custom i.e. non ac97_codec.c */ /* * DAI hardware audio formats @@ -278,6 +279,7 @@ struct snd_soc_cpu_ops { struct snd_soc_codec_dai { char *name; int id; + unsigned char type; /* DAI capabilities */ struct snd_soc_pcm_stream playback; diff --git a/include/sound/version.h b/include/sound/version.h index e820f0e7bdd32b807375a64fbf0110994632df14..50ee4fd420fa3b0ec19d7155c9e8e663360253b4 100644 --- a/include/sound/version.h +++ b/include/sound/version.h @@ -1,3 +1,3 @@ /* include/version.h. Generated by alsa/ksync script. */ #define CONFIG_SND_VERSION "1.0.14rc4" -#define CONFIG_SND_DATE " (Wed May 09 09:51:39 2007 UTC)" +#define CONFIG_SND_DATE " (Wed May 16 09:45:46 2007 UTC)" diff --git a/sound/isa/cmi8330.c b/sound/isa/cmi8330.c index 214d65d94c4538541af52fdc6be4dc00d35ab7c3..f471f8ad68852d1dbbe09b684668be39a8511cbd 100644 --- a/sound/isa/cmi8330.c +++ b/sound/isa/cmi8330.c @@ -109,6 +109,7 @@ module_param_array(wssdma, int, NULL, 0444); MODULE_PARM_DESC(wssdma, "DMA for CMI8330 WSS driver."); #ifdef CONFIG_PNP +static int isa_registered; static int pnp_registered; #endif @@ -686,14 +687,18 @@ static int __init alsa_card_cmi8330_init(void) int err; err = isa_register_driver(&snd_cmi8330_driver, SNDRV_CARDS); - if (err < 0) - return err; #ifdef CONFIG_PNP + if (!err) + isa_registered = 1; + err = pnp_register_card_driver(&cmi8330_pnpc_driver); if (!err) pnp_registered = 1; + + if (isa_registered) + err = 0; #endif - return 0; + return err; } static void __exit alsa_card_cmi8330_exit(void) @@ -701,8 +706,10 @@ static void __exit alsa_card_cmi8330_exit(void) #ifdef CONFIG_PNP if (pnp_registered) pnp_unregister_card_driver(&cmi8330_pnpc_driver); + + if (isa_registered) #endif - isa_unregister_driver(&snd_cmi8330_driver); + isa_unregister_driver(&snd_cmi8330_driver); } module_init(alsa_card_cmi8330_init) diff --git a/sound/isa/cs423x/cs4236.c b/sound/isa/cs423x/cs4236.c index 87f1392a2fa79f4310e6ced4e3829070af372840..1a14f33b6ab05299820b280cd825a8ae928fd19d 100644 --- a/sound/isa/cs423x/cs4236.c +++ b/sound/isa/cs423x/cs4236.c @@ -127,6 +127,7 @@ module_param_array(dma2, int, NULL, 0444); MODULE_PARM_DESC(dma2, "DMA2 # for " IDENT " driver."); #ifdef CONFIG_PNP +static int isa_registered; static int pnpc_registered; #ifdef CS4232 static int pnp_registered; @@ -770,9 +771,9 @@ static int __init alsa_card_cs423x_init(void) int err; err = isa_register_driver(&cs423x_isa_driver, SNDRV_CARDS); - if (err < 0) - return err; #ifdef CONFIG_PNP + if (!err) + isa_registered = 1; #ifdef CS4232 err = pnp_register_driver(&cs4232_pnp_driver); if (!err) @@ -781,8 +782,14 @@ static int __init alsa_card_cs423x_init(void) err = pnp_register_card_driver(&cs423x_pnpc_driver); if (!err) pnpc_registered = 1; -#endif /* CONFIG_PNP */ - return 0; +#ifdef CS4232 + if (pnp_registered) + err = 0; +#endif + if (isa_registered) + err = 0; +#endif + return err; } static void __exit alsa_card_cs423x_exit(void) @@ -794,8 +801,9 @@ static void __exit alsa_card_cs423x_exit(void) if (pnp_registered) pnp_unregister_driver(&cs4232_pnp_driver); #endif -#endif /* CONFIG_PNP */ - isa_unregister_driver(&cs423x_isa_driver); + if (isa_registered) +#endif + isa_unregister_driver(&cs423x_isa_driver); } module_init(alsa_card_cs423x_init) diff --git a/sound/isa/es18xx.c b/sound/isa/es18xx.c index d2a9c7df0ce5100a6a6cc4a9caaa5260d97f1202..f7732bf90be3a99742d48296b45bd17396b1d92a 100644 --- a/sound/isa/es18xx.c +++ b/sound/isa/es18xx.c @@ -2036,7 +2036,9 @@ module_param_array(dma2, int, NULL, 0444); MODULE_PARM_DESC(dma2, "DMA 2 # for ES18xx driver."); #ifdef CONFIG_PNP -static int pnp_registered, pnpc_registered; +static int isa_registered; +static int pnp_registered; +static int pnpc_registered; static struct pnp_device_id snd_audiodrive_pnpbiosids[] = { { .id = "ESS1869" }, @@ -2466,18 +2468,22 @@ static int __init alsa_card_es18xx_init(void) int err; err = isa_register_driver(&snd_es18xx_isa_driver, SNDRV_CARDS); - if (err < 0) - return err; - #ifdef CONFIG_PNP + if (!err) + isa_registered = 1; + err = pnp_register_driver(&es18xx_pnp_driver); if (!err) pnp_registered = 1; + err = pnp_register_card_driver(&es18xx_pnpc_driver); if (!err) pnpc_registered = 1; + + if (isa_registered || pnp_registered) + err = 0; #endif - return 0; + return err; } static void __exit alsa_card_es18xx_exit(void) @@ -2487,8 +2493,9 @@ static void __exit alsa_card_es18xx_exit(void) pnp_unregister_card_driver(&es18xx_pnpc_driver); if (pnp_registered) pnp_unregister_driver(&es18xx_pnp_driver); + if (isa_registered) #endif - isa_unregister_driver(&snd_es18xx_isa_driver); + isa_unregister_driver(&snd_es18xx_isa_driver); } module_init(alsa_card_es18xx_init) diff --git a/sound/isa/gus/interwave.c b/sound/isa/gus/interwave.c index 3e46572555361d48fd7331de7a9996f574be37e2..0220cdbe1a2a3866d38d52c5ed81a1b4f6ec5c94 100644 --- a/sound/isa/gus/interwave.c +++ b/sound/isa/gus/interwave.c @@ -135,6 +135,7 @@ struct snd_interwave { #ifdef CONFIG_PNP +static int isa_registered; static int pnp_registered; static struct pnp_card_device_id snd_interwave_pnpids[] = { @@ -934,15 +935,18 @@ static int __init alsa_card_interwave_init(void) int err; err = isa_register_driver(&snd_interwave_driver, SNDRV_CARDS); - if (err < 0) - return err; #ifdef CONFIG_PNP - /* ISA PnP cards */ + if (!err) + isa_registered = 1; + err = pnp_register_card_driver(&interwave_pnpc_driver); if (!err) pnp_registered = 1; + + if (isa_registered) + err = 0; #endif - return 0; + return err; } static void __exit alsa_card_interwave_exit(void) @@ -950,8 +954,9 @@ static void __exit alsa_card_interwave_exit(void) #ifdef CONFIG_PNP if (pnp_registered) pnp_unregister_card_driver(&interwave_pnpc_driver); + if (isa_registered) #endif - isa_unregister_driver(&snd_interwave_driver); + isa_unregister_driver(&snd_interwave_driver); } module_init(alsa_card_interwave_init) diff --git a/sound/isa/opl3sa2.c b/sound/isa/opl3sa2.c index 48743eb85fb64cf2b3a8650dfdbf7b7f6056f10b..61a323cc0e49adee9bf73178adb09e590a76b780 100644 --- a/sound/isa/opl3sa2.c +++ b/sound/isa/opl3sa2.c @@ -92,6 +92,7 @@ module_param_array(opl3sa3_ymode, int, NULL, 0444); MODULE_PARM_DESC(opl3sa3_ymode, "Speaker size selection for 3D Enhancement mode: Desktop/Large Notebook/Small Notebook/HiFi."); #ifdef CONFIG_PNP +static int isa_registered; static int pnp_registered; static int pnpc_registered; #endif @@ -967,17 +968,22 @@ static int __init alsa_card_opl3sa2_init(void) int err; err = isa_register_driver(&snd_opl3sa2_isa_driver, SNDRV_CARDS); - if (err < 0) - return err; #ifdef CONFIG_PNP + if (!err) + isa_registered = 1; + err = pnp_register_driver(&opl3sa2_pnp_driver); if (!err) pnp_registered = 1; + err = pnp_register_card_driver(&opl3sa2_pnpc_driver); if (!err) pnpc_registered = 1; + + if (isa_registered || pnp_registered) + err = 0; #endif - return 0; + return err; } static void __exit alsa_card_opl3sa2_exit(void) @@ -987,8 +993,9 @@ static void __exit alsa_card_opl3sa2_exit(void) pnp_unregister_card_driver(&opl3sa2_pnpc_driver); if (pnp_registered) pnp_unregister_driver(&opl3sa2_pnp_driver); + if (isa_registered) #endif - isa_unregister_driver(&snd_opl3sa2_isa_driver); + isa_unregister_driver(&snd_opl3sa2_isa_driver); } module_init(alsa_card_opl3sa2_init) diff --git a/sound/isa/sb/sb16.c b/sound/isa/sb/sb16.c index 2a19b0a39eda1ff139cabbfc042b5ad6b9d63708..c4ba24bfd27c76d2519ddea091c18d64adf030c6 100644 --- a/sound/isa/sb/sb16.c +++ b/sound/isa/sb/sb16.c @@ -129,6 +129,7 @@ MODULE_PARM_DESC(seq_ports, "Number of sequencer ports for WaveTable synth."); #endif #ifdef CONFIG_PNP +static int isa_registered; static int pnp_registered; #endif @@ -702,15 +703,18 @@ static int __init alsa_card_sb16_init(void) int err; err = isa_register_driver(&snd_sb16_isa_driver, SNDRV_CARDS); - if (err < 0) - return err; #ifdef CONFIG_PNP - /* PnP cards at last */ + if (!err) + isa_registered = 1; + err = pnp_register_card_driver(&sb16_pnpc_driver); if (!err) pnp_registered = 1; + + if (isa_registered) + err = 0; #endif - return 0; + return err; } static void __exit alsa_card_sb16_exit(void) @@ -718,8 +722,9 @@ static void __exit alsa_card_sb16_exit(void) #ifdef CONFIG_PNP if (pnp_registered) pnp_unregister_card_driver(&sb16_pnpc_driver); + if (isa_registered) #endif - isa_unregister_driver(&snd_sb16_isa_driver); + isa_unregister_driver(&snd_sb16_isa_driver); } module_init(alsa_card_sb16_init) diff --git a/sound/isa/sscape.c b/sound/isa/sscape.c index 08c14978558ce20ed9dc69ae515421f79e969ed4..9ea417bcf3e593da7fd9cd4b7724a7ebbd090671 100644 --- a/sound/isa/sscape.c +++ b/sound/isa/sscape.c @@ -69,7 +69,9 @@ module_param_array(dma, int, NULL, 0444); MODULE_PARM_DESC(dma, "DMA # for SoundScape driver."); #ifdef CONFIG_PNP +static int isa_registered; static int pnp_registered; + static struct pnp_card_device_id sscape_pnpids[] = { { .id = "ENS3081", .devs = { { "ENS0000" } } }, { .id = "" } /* end */ @@ -1405,22 +1407,21 @@ static struct pnp_card_driver sscape_pnpc_driver = { static int __init sscape_init(void) { - int ret; + int err; - /* - * First check whether we were passed any parameters. - * These MUST take precedence over ANY automatic way - * of allocating cards, because the operator is - * S-P-E-L-L-I-N-G it out for us... - */ - ret = isa_register_driver(&snd_sscape_driver, SNDRV_CARDS); - if (ret < 0) - return ret; + err = isa_register_driver(&snd_sscape_driver, SNDRV_CARDS); #ifdef CONFIG_PNP - if (pnp_register_card_driver(&sscape_pnpc_driver) == 0) + if (!err) + isa_registered = 1; + + err = pnp_register_card_driver(&sscape_pnpc_driver); + if (!err) pnp_registered = 1; + + if (isa_registered) + err = 0; #endif - return 0; + return err; } static void __exit sscape_exit(void) @@ -1428,8 +1429,9 @@ static void __exit sscape_exit(void) #ifdef CONFIG_PNP if (pnp_registered) pnp_unregister_card_driver(&sscape_pnpc_driver); + if (isa_registered) #endif - isa_unregister_driver(&snd_sscape_driver); + isa_unregister_driver(&snd_sscape_driver); } module_init(sscape_init); diff --git a/sound/isa/wavefront/wavefront.c b/sound/isa/wavefront/wavefront.c index 75673f723857c3190025a4be7d9bc8087cb75458..83c2fc4cfc64fb1bfc7bdde14e4f3623927ce452 100644 --- a/sound/isa/wavefront/wavefront.c +++ b/sound/isa/wavefront/wavefront.c @@ -86,6 +86,7 @@ module_param_array(use_cs4232_midi, bool, NULL, 0444); MODULE_PARM_DESC(use_cs4232_midi, "Use CS4232 MPU-401 interface (inaccessibly located inside your computer)"); #ifdef CONFIG_PNP +static int isa_registered; static int pnp_registered; static struct pnp_card_device_id snd_wavefront_pnpids[] = { @@ -706,14 +707,18 @@ static int __init alsa_card_wavefront_init(void) int err; err = isa_register_driver(&snd_wavefront_driver, SNDRV_CARDS); - if (err < 0) - return err; #ifdef CONFIG_PNP + if (!err) + isa_registered = 1; + err = pnp_register_card_driver(&wavefront_pnpc_driver); if (!err) pnp_registered = 1; + + if (isa_registered) + err = 0; #endif - return 0; + return err; } static void __exit alsa_card_wavefront_exit(void) @@ -721,8 +726,9 @@ static void __exit alsa_card_wavefront_exit(void) #ifdef CONFIG_PNP if (pnp_registered) pnp_unregister_card_driver(&wavefront_pnpc_driver); + if (isa_registered) #endif - isa_unregister_driver(&snd_wavefront_driver); + isa_unregister_driver(&snd_wavefront_driver); } module_init(alsa_card_wavefront_init) diff --git a/sound/pci/ac97/ac97_patch.c b/sound/pci/ac97/ac97_patch.c index 3eac0f86266ce54e0bd3a0ff2aa26bc07038081b..581ebba4d1a7e068e1f0c023720241cd012d8423 100644 --- a/sound/pci/ac97/ac97_patch.c +++ b/sound/pci/ac97/ac97_patch.c @@ -1782,6 +1782,11 @@ static unsigned int ad1981_jacks_blacklist[] = { 0x10140534, /* Thinkpad X31 */ 0x10140537, /* Thinkpad T41p */ 0x10140554, /* Thinkpad T42p/R50p */ + 0x10140567, /* Thinkpad T43p 2668-G7U */ + 0x10140581, /* Thinkpad X41-2527 */ + 0x104380b0, /* Asus A7V8X-MX */ + 0x11790241, /* Toshiba Satellite A-15 S127 */ + 0x144dc01a, /* Samsung NP-X20C004/SEG */ 0 /* end */ }; diff --git a/sound/pci/hda/hda_codec.c b/sound/pci/hda/hda_codec.c index 14649d54b49342bc55b5636fd63c75c1a522a585..8e89d56b6400d2721a6d68e505aa11358c47113e 100644 --- a/sound/pci/hda/hda_codec.c +++ b/sound/pci/hda/hda_codec.c @@ -707,7 +707,8 @@ static u32 query_amp_caps(struct hda_codec *codec, hda_nid_t nid, int direction) direction == HDA_OUTPUT ? AC_PAR_AMP_OUT_CAP : AC_PAR_AMP_IN_CAP); - info->status |= INFO_AMP_CAPS; + if (info->amp_caps) + info->status |= INFO_AMP_CAPS; } return info->amp_caps; } diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c index a4ede27af021bd01d8e6ea2bca14fbcb724ff267..34ac634695328c2ddedb780101f1c8545deef666 100644 --- a/sound/pci/hda/patch_realtek.c +++ b/sound/pci/hda/patch_realtek.c @@ -93,6 +93,7 @@ enum { ALC262_HP_BPC_D7000_WL, ALC262_HP_BPC_D7000_WF, ALC262_BENQ_ED8, + ALC262_SONY_ASSAMD, ALC262_AUTO, ALC262_MODEL_LAST /* last tag */ }; @@ -118,6 +119,7 @@ enum { ALC861VD_3ST_DIG, ALC861VD_6ST_DIG, ALC861VD_LENOVO, + ALC861VD_DALLAS, ALC861VD_AUTO, ALC861VD_MODEL_LAST, }; @@ -139,8 +141,10 @@ enum { ALC882_6ST_DIG, ALC882_ARIMA, ALC882_W2JC, - ALC882_AUTO, + ALC882_TARGA, + ALC882_ASUS_A7J, ALC885_MACPRO, + ALC882_AUTO, ALC882_MODEL_LAST, }; @@ -152,11 +156,13 @@ enum { ALC883_6ST_DIG, ALC883_TARGA_DIG, ALC883_TARGA_2ch_DIG, - ALC888_DEMO_BOARD, ALC883_ACER, ALC883_MEDION, + ALC883_MEDION_MD2, ALC883_LAPTOP_EAPD, ALC883_LENOVO_101E_2ch, + ALC883_LENOVO_NB0763, + ALC888_LENOVO_MS7195_DIG, ALC883_AUTO, ALC883_MODEL_LAST, }; @@ -4752,6 +4758,35 @@ static int alc882_mux_enum_put(struct snd_kcontrol *kcontrol, return 1; } +/* + * 2ch mode + */ +static struct hda_verb alc882_3ST_ch2_init[] = { + { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, + { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, + { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, + { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, + { } /* end */ +}; + +/* + * 6ch mode + */ +static struct hda_verb alc882_3ST_ch6_init[] = { + { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, + { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, + { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 }, + { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, + { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, + { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, + { } /* end */ +}; + +static struct hda_channel_mode alc882_3ST_6ch_modes[2] = { + { 2, alc882_3ST_ch2_init }, + { 6, alc882_3ST_ch6_init }, +}; + /* * 6ch mode */ @@ -4824,6 +4859,40 @@ static struct snd_kcontrol_new alc882_w2jc_mixer[] = { { } /* end */ }; +static struct snd_kcontrol_new alc882_targa_mixer[] = { + HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), + HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), + HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), + HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), + HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), + HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), + HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), + HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), + HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), + HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), + HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), + { } /* end */ +}; + +/* Pin assignment: Front=0x14, HP = 0x15, Front = 0x16, ??? + * Front Mic=0x18, Line In = 0x1a, Line In = 0x1b, CD = 0x1c + */ +static struct snd_kcontrol_new alc882_asus_a7j_mixer[] = { + HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), + HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT), + HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), + HDA_CODEC_MUTE("Mobile Front Playback Switch", 0x16, 0x0, HDA_OUTPUT), + HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), + HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), + HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), + HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), + HDA_CODEC_VOLUME("Mobile Line Playback Volume", 0x0b, 0x03, HDA_INPUT), + HDA_CODEC_MUTE("Mobile Line Playback Switch", 0x0b, 0x03, HDA_INPUT), + HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), + HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), + { } /* end */ +}; + static struct snd_kcontrol_new alc882_chmode_mixer[] = { { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, @@ -4985,6 +5054,66 @@ static struct hda_verb alc882_macpro_init_verbs[] = { { } }; +static struct hda_verb alc882_targa_verbs[] = { + {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, + {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, + + {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, + {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, + + {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */ + {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */ + {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ + + {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, + {0x01, AC_VERB_SET_GPIO_MASK, 0x03}, + {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x03}, + {0x01, AC_VERB_SET_GPIO_DATA, 0x03}, + { } /* end */ +}; + +/* toggle speaker-output according to the hp-jack state */ +static void alc882_targa_automute(struct hda_codec *codec) +{ + unsigned int present; + + present = snd_hda_codec_read(codec, 0x14, 0, + AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; + snd_hda_codec_amp_update(codec, 0x1b, 0, HDA_OUTPUT, 0, + 0x80, present ? 0x80 : 0); + snd_hda_codec_amp_update(codec, 0x1b, 1, HDA_OUTPUT, 0, + 0x80, present ? 0x80 : 0); + snd_hda_codec_write(codec, 1, 0, AC_VERB_SET_GPIO_DATA, present ? 1 : 3); +} + +static void alc882_targa_unsol_event(struct hda_codec *codec, unsigned int res) +{ + /* Looks like the unsol event is incompatible with the standard + * definition. 4bit tag is placed at 26 bit! + */ + if (((res >> 26) == ALC880_HP_EVENT)) { + alc882_targa_automute(codec); + } +} + +static struct hda_verb alc882_asus_a7j_verbs[] = { + {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, + {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, + + {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, + {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, + {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, + + {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */ + {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ + {0x16, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */ + + {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */ + {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */ + {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ + { } /* end */ +}; + static void alc882_gpio_mute(struct hda_codec *codec, int pin, int muted) { unsigned int gpiostate, gpiomask, gpiodir; @@ -5152,7 +5281,9 @@ static struct snd_pci_quirk alc882_cfg_tbl[] = { SND_PCI_QUIRK(0x1019, 0x6668, "ECS", ALC882_6ST_DIG), SND_PCI_QUIRK(0x105b, 0x6668, "Foxconn", ALC882_6ST_DIG), SND_PCI_QUIRK(0x1462, 0x6668, "MSI", ALC882_6ST_DIG), + SND_PCI_QUIRK(0x1462, 0x28fb, "Targa T8", ALC882_TARGA), /* MSI-1049 T8 */ SND_PCI_QUIRK(0x161f, 0x2054, "Arima W820", ALC882_ARIMA), + SND_PCI_QUIRK(0x1043, 0x060d, "Asus A7J", ALC882_ASUS_A7J), SND_PCI_QUIRK(0x1043, 0x81d8, "Asus P5WD", ALC882_6ST_DIG), SND_PCI_QUIRK(0x1043, 0x1971, "Asus W2JC", ALC882_W2JC), {} @@ -5214,6 +5345,36 @@ static struct alc_config_preset alc882_presets[] = { .channel_mode = alc882_ch_modes, .input_mux = &alc882_capture_source, }, + [ALC882_TARGA] = { + .mixers = { alc882_targa_mixer, alc882_chmode_mixer, + alc882_capture_mixer }, + .init_verbs = { alc882_init_verbs, alc882_targa_verbs}, + .num_dacs = ARRAY_SIZE(alc882_dac_nids), + .dac_nids = alc882_dac_nids, + .dig_out_nid = ALC882_DIGOUT_NID, + .num_adc_nids = ARRAY_SIZE(alc882_adc_nids), + .adc_nids = alc882_adc_nids, + .num_channel_mode = ARRAY_SIZE(alc882_3ST_6ch_modes), + .channel_mode = alc882_3ST_6ch_modes, + .need_dac_fix = 1, + .input_mux = &alc882_capture_source, + .unsol_event = alc882_targa_unsol_event, + .init_hook = alc882_targa_automute, + }, + [ALC882_ASUS_A7J] = { + .mixers = { alc882_asus_a7j_mixer, alc882_chmode_mixer, + alc882_capture_mixer }, + .init_verbs = { alc882_init_verbs, alc882_asus_a7j_verbs}, + .num_dacs = ARRAY_SIZE(alc882_dac_nids), + .dac_nids = alc882_dac_nids, + .dig_out_nid = ALC882_DIGOUT_NID, + .num_adc_nids = ARRAY_SIZE(alc882_adc_nids), + .adc_nids = alc882_adc_nids, + .num_channel_mode = ARRAY_SIZE(alc882_3ST_6ch_modes), + .channel_mode = alc882_3ST_6ch_modes, + .need_dac_fix = 1, + .input_mux = &alc882_capture_source, + }, }; @@ -5441,6 +5602,16 @@ static struct hda_input_mux alc883_lenovo_101e_capture_source = { }, }; +static struct hda_input_mux alc883_lenovo_nb0763_capture_source = { + .num_items = 4, + .items = { + { "Mic", 0x0 }, + { "iMic", 0x1 }, + { "Line", 0x2 }, + { "CD", 0x4 }, + }, +}; + #define alc883_mux_enum_info alc_mux_enum_info #define alc883_mux_enum_get alc_mux_enum_get @@ -5772,6 +5943,58 @@ static struct snd_kcontrol_new alc883_lenovo_101e_2ch_mixer[] = { { } /* end */ }; +static struct snd_kcontrol_new alc883_lenovo_nb0763_mixer[] = { + HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT), + HDA_BIND_MUTE("Speaker Playback Switch", 0x0c, 2, HDA_INPUT), + HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT), + HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), + HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), + HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), + HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), + HDA_CODEC_VOLUME("iMic Playback Volume", 0x0b, 0x1, HDA_INPUT), + HDA_CODEC_MUTE("iMic Playback Switch", 0x0b, 0x1, HDA_INPUT), + HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), + HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), + HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT), + HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT), + { + .iface = SNDRV_CTL_ELEM_IFACE_MIXER, + /* .name = "Capture Source", */ + .name = "Input Source", + .count = 2, + .info = alc883_mux_enum_info, + .get = alc883_mux_enum_get, + .put = alc883_mux_enum_put, + }, + { } /* end */ +}; + +static struct snd_kcontrol_new alc883_medion_md2_mixer[] = { + HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), + HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT), + HDA_CODEC_MUTE("Front Playback Switch", 0x15, 0x0, HDA_OUTPUT), + HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), + HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), + HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), + HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), + HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), + HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), + HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), + HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), + HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT), + HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT), + { + .iface = SNDRV_CTL_ELEM_IFACE_MIXER, + /* .name = "Capture Source", */ + .name = "Input Source", + .count = 2, + .info = alc883_mux_enum_info, + .get = alc883_mux_enum_get, + .put = alc883_mux_enum_put, + }, + { } /* end */ +}; + static struct snd_kcontrol_new alc883_chmode_mixer[] = { { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, @@ -5886,6 +6109,93 @@ static struct hda_verb alc883_lenovo_101e_verbs[] = { { } /* end */ }; +static struct hda_verb alc883_lenovo_nb0763_verbs[] = { + {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, + {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, + {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, + {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, + { } /* end */ +}; + +static struct hda_verb alc888_lenovo_ms7195_verbs[] = { + {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, + {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, + {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, + {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_FRONT_EVENT | AC_USRSP_EN}, + {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, + { } /* end */ +}; + +/* toggle front-jack and RCA according to the hp-jack state */ +static void alc888_lenovo_ms7195_front_automute(struct hda_codec *codec) +{ + unsigned int present; + + present = snd_hda_codec_read(codec, 0x1b, 0, + AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; + snd_hda_codec_amp_update(codec, 0x14, 0, HDA_OUTPUT, 0, + 0x80, present ? 0x80 : 0); + snd_hda_codec_amp_update(codec, 0x14, 1, HDA_OUTPUT, 0, + 0x80, present ? 0x80 : 0); + snd_hda_codec_amp_update(codec, 0x15, 0, HDA_OUTPUT, 0, + 0x80, present ? 0x80 : 0); + snd_hda_codec_amp_update(codec, 0x15, 1, HDA_OUTPUT, 0, + 0x80, present ? 0x80 : 0); + +} + +/* toggle RCA according to the front-jack state */ +static void alc888_lenovo_ms7195_rca_automute(struct hda_codec *codec) +{ + unsigned int present; + + present = snd_hda_codec_read(codec, 0x14, 0, + AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; + snd_hda_codec_amp_update(codec, 0x15, 0, HDA_OUTPUT, 0, + 0x80, present ? 0x80 : 0); + snd_hda_codec_amp_update(codec, 0x15, 1, HDA_OUTPUT, 0, + 0x80, present ? 0x80 : 0); + +} +static void alc883_lenovo_ms7195_unsol_event(struct hda_codec *codec, + unsigned int res) +{ + if ((res >> 26) == ALC880_HP_EVENT) + alc888_lenovo_ms7195_front_automute(codec); + if ((res >> 26) == ALC880_FRONT_EVENT) + alc888_lenovo_ms7195_rca_automute(codec); +} + +static struct hda_verb alc883_medion_md2_verbs[] = { + {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, + {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, + + {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, + + {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, + { } /* end */ +}; + +/* toggle speaker-output according to the hp-jack state */ +static void alc883_medion_md2_automute(struct hda_codec *codec) +{ + unsigned int present; + + present = snd_hda_codec_read(codec, 0x14, 0, + AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; + snd_hda_codec_amp_update(codec, 0x15, 0, HDA_OUTPUT, 0, + 0x80, present ? 0x80 : 0); + snd_hda_codec_amp_update(codec, 0x15, 1, HDA_OUTPUT, 0, + 0x80, present ? 0x80 : 0); +} + +static void alc883_medion_md2_unsol_event(struct hda_codec *codec, + unsigned int res) +{ + if ((res >> 26) == ALC880_HP_EVENT) + alc883_medion_md2_automute(codec); +} + /* toggle speaker-output according to the hp-jack state */ static void alc883_tagra_automute(struct hda_codec *codec) { @@ -6051,11 +6361,13 @@ static const char *alc883_models[ALC883_MODEL_LAST] = { [ALC883_6ST_DIG] = "6stack-dig", [ALC883_TARGA_DIG] = "targa-dig", [ALC883_TARGA_2ch_DIG] = "targa-2ch-dig", - [ALC888_DEMO_BOARD] = "6stack-dig-demo", [ALC883_ACER] = "acer", [ALC883_MEDION] = "medion", + [ALC883_MEDION_MD2] = "medion-md2", [ALC883_LAPTOP_EAPD] = "laptop-eapd", [ALC883_LENOVO_101E_2ch] = "lenovo-101e", + [ALC883_LENOVO_NB0763] = "lenovo-nb0763", + [ALC888_LENOVO_MS7195_DIG] = "lenovo-ms7195-dig", [ALC883_AUTO] = "auto", }; @@ -6082,7 +6394,10 @@ static struct snd_pci_quirk alc883_cfg_tbl[] = { SND_PCI_QUIRK(0x161f, 0x2054, "Medion laptop", ALC883_MEDION), SND_PCI_QUIRK(0x1071, 0x8258, "Evesham Voyaeger", ALC883_LAPTOP_EAPD), SND_PCI_QUIRK(0x8086, 0xd601, "D102GGC", ALC883_3ST_6ch), - SND_PCI_QUIRK(0x17aa, 0x101e, "lenovo 101e", ALC883_LENOVO_101E_2ch), + SND_PCI_QUIRK(0x17aa, 0x101e, "Lenovo 101e", ALC883_LENOVO_101E_2ch), + SND_PCI_QUIRK(0x17aa, 0x3bfd, "Lenovo NB0763", ALC883_LENOVO_NB0763), + SND_PCI_QUIRK(0x17aa, 0x2085, "Lenovo NB0763", ALC883_LENOVO_NB0763), + SND_PCI_QUIRK(0x17c0, 0x4071, "MEDION MD2", ALC883_MEDION_MD2), {} }; @@ -6168,19 +6483,6 @@ static struct alc_config_preset alc883_presets[] = { .unsol_event = alc883_tagra_unsol_event, .init_hook = alc883_tagra_automute, }, - [ALC888_DEMO_BOARD] = { - .mixers = { alc883_base_mixer, alc883_chmode_mixer }, - .init_verbs = { alc883_init_verbs }, - .num_dacs = ARRAY_SIZE(alc883_dac_nids), - .dac_nids = alc883_dac_nids, - .dig_out_nid = ALC883_DIGOUT_NID, - .num_adc_nids = ARRAY_SIZE(alc883_adc_nids), - .adc_nids = alc883_adc_nids, - .dig_in_nid = ALC883_DIGIN_NID, - .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes), - .channel_mode = alc883_sixstack_modes, - .input_mux = &alc883_capture_source, - }, [ALC883_ACER] = { .mixers = { alc883_base_mixer, alc883_chmode_mixer }, @@ -6211,6 +6513,20 @@ static struct alc_config_preset alc883_presets[] = { .channel_mode = alc883_sixstack_modes, .input_mux = &alc883_capture_source, }, + [ALC883_MEDION_MD2] = { + .mixers = { alc883_medion_md2_mixer}, + .init_verbs = { alc883_init_verbs, alc883_medion_md2_verbs}, + .num_dacs = ARRAY_SIZE(alc883_dac_nids), + .dac_nids = alc883_dac_nids, + .dig_out_nid = ALC883_DIGOUT_NID, + .num_adc_nids = ARRAY_SIZE(alc883_adc_nids), + .adc_nids = alc883_adc_nids, + .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), + .channel_mode = alc883_3ST_2ch_modes, + .input_mux = &alc883_capture_source, + .unsol_event = alc883_medion_md2_unsol_event, + .init_hook = alc883_medion_md2_automute, + }, [ALC883_LAPTOP_EAPD] = { .mixers = { alc883_base_mixer, alc883_chmode_mixer }, @@ -6236,6 +6552,35 @@ static struct alc_config_preset alc883_presets[] = { .unsol_event = alc883_lenovo_101e_unsol_event, .init_hook = alc883_lenovo_101e_all_automute, }, + [ALC883_LENOVO_NB0763] = { + .mixers = { alc883_lenovo_nb0763_mixer }, + .init_verbs = { alc883_init_verbs, alc883_lenovo_nb0763_verbs}, + .num_dacs = ARRAY_SIZE(alc883_dac_nids), + .dac_nids = alc883_dac_nids, + .num_adc_nids = ARRAY_SIZE(alc883_adc_nids), + .adc_nids = alc883_adc_nids, + .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), + .channel_mode = alc883_3ST_2ch_modes, + .need_dac_fix = 1, + .input_mux = &alc883_lenovo_nb0763_capture_source, + .unsol_event = alc883_medion_md2_unsol_event, + .init_hook = alc883_medion_md2_automute, + }, + [ALC888_LENOVO_MS7195_DIG] = { + .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer }, + .init_verbs = { alc883_init_verbs, alc888_lenovo_ms7195_verbs}, + .num_dacs = ARRAY_SIZE(alc883_dac_nids), + .dac_nids = alc883_dac_nids, + .dig_out_nid = ALC883_DIGOUT_NID, + .num_adc_nids = ARRAY_SIZE(alc883_adc_nids), + .adc_nids = alc883_adc_nids, + .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes), + .channel_mode = alc883_3ST_6ch_modes, + .need_dac_fix = 1, + .input_mux = &alc883_capture_source, + .unsol_event = alc883_lenovo_ms7195_unsol_event, + .init_hook = alc888_lenovo_ms7195_front_automute, + }, }; @@ -6499,6 +6844,18 @@ static struct snd_kcontrol_new alc262_HP_BPC_WildWest_option_mixer[] = { { } /* end */ }; +static struct snd_kcontrol_new alc262_sony_mixer[] = { + HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), + HDA_CODEC_MUTE("Front Playback Switch", 0x15, 0x0, HDA_OUTPUT), + HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), + HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), + HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), + HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), + { } /* end */ +}; + + + #define alc262_capture_mixer alc882_capture_mixer #define alc262_capture_alt_mixer alc882_capture_alt_mixer @@ -6597,6 +6954,15 @@ static struct hda_verb alc262_hippo1_unsol_verbs[] = { {} }; +static struct hda_verb alc262_sony_unsol_verbs[] = { + {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0}, + {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, + {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, // Front Mic + + {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, + {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, +}; + /* mute/unmute internal speaker according to the hp jack and mute state */ static void alc262_hippo_automute(struct hda_codec *codec, int force) { @@ -7215,6 +7581,7 @@ static const char *alc262_models[ALC262_MODEL_LAST] = { [ALC262_HP_BPC] = "hp-bpc", [ALC262_HP_BPC_D7000_WL]= "hp-bpc-d7000", [ALC262_BENQ_ED8] = "benq", + [ALC262_BENQ_ED8] = "sony-assamd", [ALC262_AUTO] = "auto", }; @@ -7236,6 +7603,9 @@ static struct snd_pci_quirk alc262_cfg_tbl[] = { SND_PCI_QUIRK(0x10cf, 0x1397, "Fujitsu", ALC262_FUJITSU), SND_PCI_QUIRK(0x17ff, 0x058f, "Benq Hippo", ALC262_HIPPO_1), SND_PCI_QUIRK(0x17ff, 0x0560, "Benq ED8", ALC262_BENQ_ED8), + SND_PCI_QUIRK(0x104d, 0x9015, "Sony 0x9015", ALC262_SONY_ASSAMD), + SND_PCI_QUIRK(0x104d, 0x900e, "Sony ASSAMD", ALC262_SONY_ASSAMD), + SND_PCI_QUIRK(0x104d, 0x1f00, "Sony ASSAMD", ALC262_SONY_ASSAMD), {} }; @@ -7327,6 +7697,17 @@ static struct alc_config_preset alc262_presets[] = { .channel_mode = alc262_modes, .input_mux = &alc262_capture_source, }, + [ALC262_SONY_ASSAMD] = { + .mixers = { alc262_sony_mixer }, + .init_verbs = { alc262_init_verbs, alc262_sony_unsol_verbs}, + .num_dacs = ARRAY_SIZE(alc262_dac_nids), + .dac_nids = alc262_dac_nids, + .hp_nid = 0x02, + .num_channel_mode = ARRAY_SIZE(alc262_modes), + .channel_mode = alc262_modes, + .input_mux = &alc262_capture_source, + .unsol_event = alc262_hippo_unsol_event, + }, }; static int patch_alc262(struct hda_codec *codec) @@ -8599,6 +8980,15 @@ static struct hda_input_mux alc861vd_capture_source = { }, }; +static struct hda_input_mux alc861vd_dallas_capture_source = { + .num_items = 3, + .items = { + { "Front Mic", 0x0 }, + { "ATAPI Mic", 0x1 }, + { "Line In", 0x5 }, + }, +}; + #define alc861vd_mux_enum_info alc_mux_enum_info #define alc861vd_mux_enum_get alc_mux_enum_get @@ -8782,6 +9172,34 @@ static struct snd_kcontrol_new alc861vd_lenovo_mixer[] = { { } /* end */ }; +/* Pin assignment: Front=0x14, HP = 0x15, + * Front Mic=0x18, ATAPI Mic = 0x19, Line In = 0x1d + */ +static struct snd_kcontrol_new alc861vd_dallas_mixer[] = { + HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), + HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), + HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT), + HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT), + HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), + HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), + HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), + HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), + HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x05, HDA_INPUT), + HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x05, HDA_INPUT), + HDA_CODEC_VOLUME("Capture Volume", 0x09, 0x0, HDA_INPUT), + HDA_CODEC_MUTE("Capture Switch", 0x09, 0x0, HDA_INPUT), + { + .iface = SNDRV_CTL_ELEM_IFACE_MIXER, + /* .name = "Capture Source", */ + .name = "Input Source", + .count = 1, + .info = alc882_mux_enum_info, + .get = alc882_mux_enum_get, + .put = alc882_mux_enum_put, + }, + { } /* end */ +}; + /* * generic initialization of ADC, input mixers and output mixers */ @@ -8969,6 +9387,70 @@ static void alc861vd_lenovo_unsol_event(struct hda_codec *codec, } } +static struct hda_verb alc861vd_dallas_verbs[] = { + {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, + {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, + {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, + {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, + + {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, + {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, + {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, + {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, + {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, + {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, + {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, + {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, + + {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, + {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, + {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, + {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, + {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, + {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, + {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, + {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, + + {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50}, + {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, + {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50}, + {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, + {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, + {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, + {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, + {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, + + {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, + {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, + {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, + {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, + + {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, + {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, + {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, + + { } /* end */ +}; + +/* toggle speaker-output according to the hp-jack state */ +static void alc861vd_dallas_automute(struct hda_codec *codec) +{ + unsigned int present; + + present = snd_hda_codec_read(codec, 0x15, 0, + AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; + snd_hda_codec_amp_update(codec, 0x14, 0, HDA_OUTPUT, 0, + 0x80, present ? 0x80 : 0); + snd_hda_codec_amp_update(codec, 0x14, 1, HDA_OUTPUT, 0, + 0x80, present ? 0x80 : 0); +} + +static void alc861vd_dallas_unsol_event(struct hda_codec *codec, unsigned int res) +{ + if ((res >> 26) == ALC880_HP_EVENT) + alc861vd_dallas_automute(codec); +} + /* pcm configuration: identiacal with ALC880 */ #define alc861vd_pcm_analog_playback alc880_pcm_analog_playback #define alc861vd_pcm_analog_capture alc880_pcm_analog_capture @@ -8984,6 +9466,7 @@ static const char *alc861vd_models[ALC861VD_MODEL_LAST] = { [ALC861VD_3ST_DIG] = "3stack-digout", [ALC861VD_6ST_DIG] = "6stack-digout", [ALC861VD_LENOVO] = "lenovo", + [ALC861VD_DALLAS] = "dallas", [ALC861VD_AUTO] = "auto", }; @@ -8993,6 +9476,8 @@ static struct snd_pci_quirk alc861vd_cfg_tbl[] = { SND_PCI_QUIRK(0x10de, 0x03f0, "Realtek ALC660 demo", ALC660VD_3ST), SND_PCI_QUIRK(0x1019, 0xa88d, "Realtek ALC660 demo", ALC660VD_3ST), + SND_PCI_QUIRK(0x1179, 0xff00, "DALLAS", ALC861VD_DALLAS), + SND_PCI_QUIRK(0x1179, 0xff01, "DALLAS", ALC861VD_DALLAS), SND_PCI_QUIRK(0x17aa, 0x3802, "Lenovo 3000 C200", ALC861VD_LENOVO), SND_PCI_QUIRK(0x17aa, 0x2066, "Lenovo", ALC861VD_LENOVO), {} @@ -9059,6 +9544,19 @@ static struct alc_config_preset alc861vd_presets[] = { .unsol_event = alc861vd_lenovo_unsol_event, .init_hook = alc861vd_lenovo_automute, }, + [ALC861VD_DALLAS] = { + .mixers = { alc861vd_dallas_mixer }, + .init_verbs = { alc861vd_dallas_verbs }, + .num_dacs = ARRAY_SIZE(alc861vd_dac_nids), + .dac_nids = alc861vd_dac_nids, + .num_adc_nids = ARRAY_SIZE(alc861vd_adc_nids), + .adc_nids = alc861vd_adc_nids, + .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), + .channel_mode = alc861vd_3stack_2ch_modes, + .input_mux = &alc861vd_dallas_capture_source, + .unsol_event = alc861vd_dallas_unsol_event, + .init_hook = alc861vd_dallas_automute, + }, }; /* diff --git a/sound/pci/hda/patch_sigmatel.c b/sound/pci/hda/patch_sigmatel.c index 93ae9c2507677c4e75837c8357dafc32aa799cdf..a6a0a80edc3b19860f781595b84d300aab4de5bd 100644 --- a/sound/pci/hda/patch_sigmatel.c +++ b/sound/pci/hda/patch_sigmatel.c @@ -467,6 +467,8 @@ static struct snd_pci_quirk stac9200_cfg_tbl[] = { "Dell XPS M1710", STAC_REF), SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01cf, "Dell Precision M90", STAC_REF), + SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01d6, + "unknown Dell", STAC_REF), {} /* terminator */ }; diff --git a/sound/pci/intel8x0.c b/sound/pci/intel8x0.c index 202f720b34b9b4116848b9d8888912657d348dcd..da9734073dba546cbe439e359f4dc1c40ca4c79b 100644 --- a/sound/pci/intel8x0.c +++ b/sound/pci/intel8x0.c @@ -1797,6 +1797,18 @@ static struct ac97_quirk ac97_quirks[] __devinitdata = { .name = "Dell Unknown", /* STAC9750/51 */ .type = AC97_TUNE_HP_ONLY }, + { + .subvendor = 0x1028, + .subdevice = 0x0186, + .name = "Dell Latitude D810", /* cf. Malone #41015 */ + .type = AC97_TUNE_HP_MUTE_LED + }, + { + .subvendor = 0x1028, + .subdevice = 0x0188, + .name = "Dell Inspiron 6000", + .type = AC97_TUNE_HP_MUTE_LED /* cf. Malone #41015 */ + }, { .subvendor = 0x1028, .subdevice = 0x0191, @@ -1819,7 +1831,7 @@ static struct ac97_quirk ac97_quirks[] __devinitdata = { .subvendor = 0x103c, .subdevice = 0x088c, .name = "HP nc8000", - .type = AC97_TUNE_MUTE_LED + .type = AC97_TUNE_HP_MUTE_LED }, { .subvendor = 0x103c, @@ -1911,6 +1923,12 @@ static struct ac97_quirk ac97_quirks[] __devinitdata = { .name = "Fujitsu S6210", /* STAC9750/51 */ .type = AC97_TUNE_HP_ONLY }, + { + .subvendor = 0x10cf, + .subdevice = 0x127e, + .name = "Fujitsu Lifebook C1211D", + .type = AC97_TUNE_HP_ONLY + }, { .subvendor = 0x10cf, .subdevice = 0x12ec, diff --git a/sound/soc/codecs/ac97.c b/sound/soc/codecs/ac97.c index 0cdef971cbd395158932289f8dd743637afd9c34..0b8a6f8b3668a5789ff6ae9492327f3b4e558210 100644 --- a/sound/soc/codecs/ac97.c +++ b/sound/soc/codecs/ac97.c @@ -43,8 +43,9 @@ static int ac97_prepare(struct snd_pcm_substream *substream) #define STD_AC97_RATES (SNDRV_PCM_RATE_8000 | SNDRV_PCM_RATE_11025 |\ SNDRV_PCM_RATE_22050 | SNDRV_PCM_RATE_44100 | SNDRV_PCM_RATE_48000) -static struct snd_soc_codec_dai ac97_dai = { +struct snd_soc_codec_dai ac97_dai = { .name = "AC97 HiFi", + .type = SND_SOC_DAI_AC97, .playback = { .stream_name = "AC97 Playback", .channels_min = 1, diff --git a/sound/soc/codecs/wm9712.c b/sound/soc/codecs/wm9712.c index 264413a00cac530b907b2e1959a893f0dde8d4d7..986b5d59cefaccd618a4f44d51266c832fb131c6 100644 --- a/sound/soc/codecs/wm9712.c +++ b/sound/soc/codecs/wm9712.c @@ -544,6 +544,7 @@ static int ac97_aux_prepare(struct snd_pcm_substream *substream) struct snd_soc_codec_dai wm9712_dai[] = { { .name = "AC97 HiFi", + .type = SND_SOC_DAI_AC97_BUS, .playback = { .stream_name = "HiFi Playback", .channels_min = 1, diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c index 36519aef55d9327908e9fd1e06495c1e5c686679..92d5d917b73bc64efc4ada4ecbe914748bca4789 100644 --- a/sound/soc/soc-core.c +++ b/sound/soc/soc-core.c @@ -116,6 +116,7 @@ static int soc_ac97_dev_register(struct snd_soc_codec *codec) static inline const char* get_dai_name(int type) { switch(type) { + case SND_SOC_DAI_AC97_BUS: case SND_SOC_DAI_AC97: return "AC97"; case SND_SOC_DAI_I2S: @@ -1099,7 +1100,8 @@ int snd_soc_register_card(struct snd_soc_device *socdev) continue; } } - if (socdev->machine->dai_link[i].cpu_dai->type == SND_SOC_DAI_AC97) + if (socdev->machine->dai_link[i].codec_dai->type == + SND_SOC_DAI_AC97_BUS) ac97 = 1; } snprintf(codec->card->shortname, sizeof(codec->card->shortname), @@ -1148,11 +1150,21 @@ EXPORT_SYMBOL_GPL(snd_soc_register_card); void snd_soc_free_pcms(struct snd_soc_device *socdev) { struct snd_soc_codec *codec = socdev->codec; +#ifdef CONFIG_SND_SOC_AC97_BUS + struct snd_soc_codec_dai *codec_dai; + int i; +#endif mutex_lock(&codec->mutex); #ifdef CONFIG_SND_SOC_AC97_BUS - if (codec->ac97) - soc_ac97_dev_unregister(codec); + for(i = 0; i < codec->num_dai; i++) { + codec_dai = &codec->dai[i]; + if (codec_dai->type == SND_SOC_DAI_AC97_BUS && codec->ac97) { + soc_ac97_dev_unregister(codec); + goto free_card; + } + } +free_card: #endif if (codec->card) diff --git a/sound/usb/usbmixer.c b/sound/usb/usbmixer.c index 7b3bf3545a3bd880cf911d4c39756aac93f1586e..325d4b6b54aafd7d4b942e9cf513b63cf393b534 100644 --- a/sound/usb/usbmixer.c +++ b/sound/usb/usbmixer.c @@ -360,7 +360,7 @@ static int get_ctl_value(struct usb_mixer_elem_info *cval, int request, int vali request, USB_RECIP_INTERFACE | USB_TYPE_CLASS | USB_DIR_IN, validx, cval->mixer->ctrlif | (cval->id << 8), - buf, val_len, 100) >= 0) { + buf, val_len, 100) >= val_len) { *value_ret = convert_signed_value(cval, snd_usb_combine_bytes(buf, val_len)); return 0; } diff --git a/sound/usb/usbquirks.h b/sound/usb/usbquirks.h index 8fcbe93b258927c5ffb45440cc4663ff10548163..374fbf657a2de382f0ad6c26c95bd019e58b104b 100644 --- a/sound/usb/usbquirks.h +++ b/sound/usb/usbquirks.h @@ -43,6 +43,15 @@ * Logitech QuickCam: bDeviceClass is vendor-specific, so generic interface * class matches do not take effect without an explicit ID match. */ +{ + .match_flags = USB_DEVICE_ID_MATCH_DEVICE | + USB_DEVICE_ID_MATCH_INT_CLASS | + USB_DEVICE_ID_MATCH_INT_SUBCLASS, + .idVendor = 0x046d, + .idProduct = 0x0850, + .bInterfaceClass = USB_CLASS_AUDIO, + .bInterfaceSubClass = USB_SUBCLASS_AUDIO_CONTROL +}, { .match_flags = USB_DEVICE_ID_MATCH_DEVICE | USB_DEVICE_ID_MATCH_INT_CLASS |