From 6162552b0de6ba80937c3dd53e084967851cd199 Mon Sep 17 00:00:00 2001 From: Takashi Iwai Date: Wed, 25 Jul 2012 13:54:55 +0200 Subject: ALSA: hda - Fix invalid D3 of headphone DAC on VT202x codecs We've got a bug report about the silent output from the headphone on a mobo with VT2021, and spotted out that this was because of the wrong D3 state on the DAC for the headphone output. The bug is triggered by the incomplete check for this DAC in set_widgets_power_state_vt1718S(). It checks only the connectivity of the primary output (0x27) but doesn't consider the path from the headphone pin (0x28). Now this patch fixes the problem by checking both pins for DAC 0x0b. Cc: Signed-off-by: Takashi Iwai --- sound/pci/hda/patch_via.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/sound/pci/hda/patch_via.c b/sound/pci/hda/patch_via.c index 90645560ed3..80d90cb4285 100644 --- a/sound/pci/hda/patch_via.c +++ b/sound/pci/hda/patch_via.c @@ -3226,7 +3226,7 @@ static void set_widgets_power_state_vt1718S(struct hda_codec *codec) { struct via_spec *spec = codec->spec; int imux_is_smixer; - unsigned int parm; + unsigned int parm, parm2; /* MUX6 (1eh) = stereo mixer */ imux_is_smixer = snd_hda_codec_read(codec, 0x1e, 0, AC_VERB_GET_CONNECT_SEL, 0x00) == 5; @@ -3249,7 +3249,7 @@ static void set_widgets_power_state_vt1718S(struct hda_codec *codec) parm = AC_PWRST_D3; set_pin_power_state(codec, 0x27, &parm); update_power_state(codec, 0x1a, parm); - update_power_state(codec, 0xb, parm); + parm2 = parm; /* for pin 0x0b */ /* PW2 (26h), AOW2 (ah) */ parm = AC_PWRST_D3; @@ -3264,6 +3264,9 @@ static void set_widgets_power_state_vt1718S(struct hda_codec *codec) if (!spec->hp_independent_mode) /* check for redirected HP */ set_pin_power_state(codec, 0x28, &parm); update_power_state(codec, 0x8, parm); + if (!spec->hp_independent_mode && parm2 != AC_PWRST_D3) + parm = parm2; + update_power_state(codec, 0xb, parm); /* MW9 (21h), Mw2 (1ah), AOW0 (8h) */ update_power_state(codec, 0x21, imux_is_smixer ? AC_PWRST_D0 : parm); -- cgit v1.2.3-18-g5258 From bc733d495267a23ef8660220d696c6e549ce30b3 Mon Sep 17 00:00:00 2001 From: Takashi Iwai Date: Mon, 23 Jul 2012 11:35:55 +0200 Subject: ALSA: mpu401: Fix missing initialization of irq field The irq field of struct snd_mpu401 is supposed to be initialized to -1. Since it's set to zero as of now, a probing error before the irq installation results in a kernel warning "Trying to free already-free IRQ 0". Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=44821 Cc: Signed-off-by: Takashi Iwai --- sound/drivers/mpu401/mpu401_uart.c | 1 + 1 file changed, 1 insertion(+) diff --git a/sound/drivers/mpu401/mpu401_uart.c b/sound/drivers/mpu401/mpu401_uart.c index 1cff331a228..4608c2ca43f 100644 --- a/sound/drivers/mpu401/mpu401_uart.c +++ b/sound/drivers/mpu401/mpu401_uart.c @@ -554,6 +554,7 @@ int snd_mpu401_uart_new(struct snd_card *card, int device, spin_lock_init(&mpu->output_lock); spin_lock_init(&mpu->timer_lock); mpu->hardware = hardware; + mpu->irq = -1; if (! (info_flags & MPU401_INFO_INTEGRATED)) { int res_size = hardware == MPU401_HW_PC98II ? 4 : 2; mpu->res = request_region(port, res_size, "MPU401 UART"); -- cgit v1.2.3-18-g5258 From a3e199732b8e2b272e82cc1ccc49c35239ed6c5a Mon Sep 17 00:00:00 2001 From: Takashi Iwai Date: Thu, 26 Jul 2012 08:17:20 +0200 Subject: ALSA: hda - Fix mute-LED GPIO setup for HP Mini 210 BIOS on HP Mini 210 doesn't provide the proper "HP_Mute_LED" DMI string, thus the driver doesn't initialize the GPIO, too. In the earlier kernel, the driver falls back to GPIO1, but since 3.3 we've stopped this due to other wrongly advertised machines. For fixing this particular case, add a new model type to specify the default polarity explicitly so that the fallback to GPIO1 is handled. Bugzilla: https://bugzilla.novell.com/show_bug.cgi?id=772923 Cc: [v3.3+] Signed-off-by: Takashi Iwai --- sound/pci/hda/patch_sigmatel.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/sound/pci/hda/patch_sigmatel.c b/sound/pci/hda/patch_sigmatel.c index a1596a3b171..217ee1f344b 100644 --- a/sound/pci/hda/patch_sigmatel.c +++ b/sound/pci/hda/patch_sigmatel.c @@ -101,6 +101,7 @@ enum { STAC_92HD83XXX_HP_cNB11_INTQUAD, STAC_HP_DV7_4000, STAC_HP_ZEPHYR, + STAC_92HD83XXX_HP_LED, STAC_92HD83XXX_MODELS }; @@ -1675,6 +1676,7 @@ static const char * const stac92hd83xxx_models[STAC_92HD83XXX_MODELS] = { [STAC_92HD83XXX_HP_cNB11_INTQUAD] = "hp_cNB11_intquad", [STAC_HP_DV7_4000] = "hp-dv7-4000", [STAC_HP_ZEPHYR] = "hp-zephyr", + [STAC_92HD83XXX_HP_LED] = "hp-led", }; static const struct snd_pci_quirk stac92hd83xxx_cfg_tbl[] = { @@ -1729,6 +1731,8 @@ static const struct snd_pci_quirk stac92hd83xxx_cfg_tbl[] = { "HP", STAC_92HD83XXX_HP_cNB11_INTQUAD), SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x3561, "HP", STAC_HP_ZEPHYR), + SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x3660, + "HP Mini", STAC_92HD83XXX_HP_LED), {} /* terminator */ }; @@ -5507,6 +5511,7 @@ static void stac92hd8x_fill_auto_spec(struct hda_codec *codec) static int patch_stac92hd83xxx(struct hda_codec *codec) { struct sigmatel_spec *spec; + int default_polarity = -1; /* no default cfg */ int err; spec = kzalloc(sizeof(*spec), GFP_KERNEL); @@ -5555,9 +5560,12 @@ again: case STAC_HP_ZEPHYR: spec->init = stac92hd83xxx_hp_zephyr_init; break; + case STAC_92HD83XXX_HP_LED: + default_polarity = 1; + break; } - if (find_mute_led_cfg(codec, -1/*no default cfg*/)) + if (find_mute_led_cfg(codec, default_polarity)) snd_printd("mute LED gpio %d polarity %d\n", spec->gpio_led, spec->gpio_led_polarity); -- cgit v1.2.3-18-g5258 From f2ad24fa575dd4b392f123744f7c80c82c079ef9 Mon Sep 17 00:00:00 2001 From: Takashi Iwai Date: Thu, 26 Jul 2012 18:08:14 +0200 Subject: ALSA: hda - Detach from converter at closing in patch_hdmi.c The generic HDMI code detaches the converter from the stream when unused, but it must be done rather in the close callback instead of the cleanup callback. Signed-off-by: Takashi Iwai --- sound/pci/hda/patch_hdmi.c | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/sound/pci/hda/patch_hdmi.c b/sound/pci/hda/patch_hdmi.c index 641408dc28c..85853b4e42d 100644 --- a/sound/pci/hda/patch_hdmi.c +++ b/sound/pci/hda/patch_hdmi.c @@ -1161,9 +1161,9 @@ static int generic_hdmi_playback_pcm_prepare(struct hda_pcm_stream *hinfo, return hdmi_setup_stream(codec, cvt_nid, pin_nid, stream_tag, format); } -static int generic_hdmi_playback_pcm_cleanup(struct hda_pcm_stream *hinfo, - struct hda_codec *codec, - struct snd_pcm_substream *substream) +static int hdmi_pcm_close(struct hda_pcm_stream *hinfo, + struct hda_codec *codec, + struct snd_pcm_substream *substream) { struct hdmi_spec *spec = codec->spec; int cvt_idx, pin_idx; @@ -1171,8 +1171,6 @@ static int generic_hdmi_playback_pcm_cleanup(struct hda_pcm_stream *hinfo, struct hdmi_spec_per_pin *per_pin; int pinctl; - snd_hda_codec_cleanup_stream(codec, hinfo->nid); - if (hinfo->nid) { cvt_idx = cvt_nid_to_cvt_index(spec, hinfo->nid); if (snd_BUG_ON(cvt_idx < 0)) @@ -1195,14 +1193,13 @@ static int generic_hdmi_playback_pcm_cleanup(struct hda_pcm_stream *hinfo, pinctl & ~PIN_OUT); snd_hda_spdif_ctls_unassign(codec, pin_idx); } - return 0; } static const struct hda_pcm_ops generic_ops = { .open = hdmi_pcm_open, + .close = hdmi_pcm_close, .prepare = generic_hdmi_playback_pcm_prepare, - .cleanup = generic_hdmi_playback_pcm_cleanup, }; static int generic_hdmi_build_pcms(struct hda_codec *codec) -- cgit v1.2.3-18-g5258 From c4bfe94a8b0670a272d3f7092cc8533bb047e33a Mon Sep 17 00:00:00 2001 From: Takashi Iwai Date: Fri, 27 Jul 2012 16:01:54 +0200 Subject: ALSA: hda - Fix WARNING from HDMI/DP parser The recent fix to converter detaching timing in patch_hdmi.c leads to a kernel WARNING due to a sanity check when the debug option is set. Add a workaround by setting a dummy hinfo->nid. Signed-off-by: Takashi Iwai --- sound/pci/hda/patch_hdmi.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/sound/pci/hda/patch_hdmi.c b/sound/pci/hda/patch_hdmi.c index 85853b4e42d..69b92844978 100644 --- a/sound/pci/hda/patch_hdmi.c +++ b/sound/pci/hda/patch_hdmi.c @@ -877,6 +877,8 @@ static int hdmi_pcm_open(struct hda_pcm_stream *hinfo, struct hdmi_eld *eld; struct hdmi_spec_per_cvt *per_cvt = NULL; + hinfo->nid = 0; /* clear the leftover value */ + /* Validate hinfo */ pin_idx = hinfo_to_pin_index(spec, hinfo); if (snd_BUG_ON(pin_idx < 0)) @@ -1218,6 +1220,7 @@ static int generic_hdmi_build_pcms(struct hda_codec *codec) pstr = &info->stream[SNDRV_PCM_STREAM_PLAYBACK]; pstr->substreams = 1; pstr->ops = generic_ops; + pstr->nid = 1; /* FIXME: just for avoiding a debug WARNING */ /* other pstr fields are set in open */ } -- cgit v1.2.3-18-g5258 From e427c2375646789ecd0ccaef1a1e41458559ab2d Mon Sep 17 00:00:00 2001 From: Takashi Iwai Date: Sun, 29 Jul 2012 10:04:08 +0200 Subject: ALSA: hda - Workaround for silent output on VAIO Z with ALC889 On recent kernels, Realtek codec parser tries to optimize the routing aggressively and take the headphone output as primary at first. This caused a regression on VAIO Z with ALC889, the silent output from the speaker. The problem seems that the speaker pin must be connected to the first DAC (0x02) on this machine by some reason although the codec itself advertises the flexible routing with any DACs. This patch adds a fix-up for choosing the speaker pin as the primary so that the right DAC is assigned on this device. Reported-and-tested-by: Adam Williamson Signed-off-by: Takashi Iwai --- Documentation/sound/alsa/HD-Audio-Models.txt | 1 + sound/pci/hda/patch_realtek.c | 22 +++++++++++++++++++++- 2 files changed, 22 insertions(+), 1 deletion(-) diff --git a/Documentation/sound/alsa/HD-Audio-Models.txt b/Documentation/sound/alsa/HD-Audio-Models.txt index 7456360e161..0a2cdac96c2 100644 --- a/Documentation/sound/alsa/HD-Audio-Models.txt +++ b/Documentation/sound/alsa/HD-Audio-Models.txt @@ -53,6 +53,7 @@ ALC882/883/885/888/889 acer-aspire-8930g Acer Aspire 8330G/6935G acer-aspire Acer Aspire others inv-dmic Inverted internal mic workaround + no-primary-hp VAIO Z workaround (for fixed speaker DAC) ALC861/660 ========== diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c index f141395dfee..344b221d210 100644 --- a/sound/pci/hda/patch_realtek.c +++ b/sound/pci/hda/patch_realtek.c @@ -203,6 +203,7 @@ struct alc_spec { unsigned int shared_mic_hp:1; /* HP/Mic-in sharing */ unsigned int inv_dmic_fixup:1; /* has inverted digital-mic workaround */ unsigned int inv_dmic_muted:1; /* R-ch of inv d-mic is muted? */ + unsigned int no_primary_hp:1; /* Don't prefer HP pins to speaker pins */ /* auto-mute control */ int automute_mode; @@ -4323,7 +4324,8 @@ static int alc_parse_auto_config(struct hda_codec *codec, return 0; /* can't find valid BIOS pin config */ } - if (cfg->line_out_type == AUTO_PIN_SPEAKER_OUT && + if (!spec->no_primary_hp && + cfg->line_out_type == AUTO_PIN_SPEAKER_OUT && cfg->line_outs <= cfg->hp_outs) { /* use HP as primary out */ cfg->speaker_outs = cfg->line_outs; @@ -5050,6 +5052,7 @@ enum { ALC889_FIXUP_MBP_VREF, ALC889_FIXUP_IMAC91_VREF, ALC882_FIXUP_INV_DMIC, + ALC882_FIXUP_NO_PRIMARY_HP, }; static void alc889_fixup_coef(struct hda_codec *codec, @@ -5171,6 +5174,17 @@ static void alc889_fixup_imac91_vref(struct hda_codec *codec, spec->keep_vref_in_automute = 1; } +/* Don't take HP output as primary + * strangely, the speaker output doesn't work on VAIO Z through DAC 0x05 + */ +static void alc882_fixup_no_primary_hp(struct hda_codec *codec, + const struct alc_fixup *fix, int action) +{ + struct alc_spec *spec = codec->spec; + if (action == ALC_FIXUP_ACT_PRE_PROBE) + spec->no_primary_hp = 1; +} + static const struct alc_fixup alc882_fixups[] = { [ALC882_FIXUP_ABIT_AW9D_MAX] = { .type = ALC_FIXUP_PINS, @@ -5357,6 +5371,10 @@ static const struct alc_fixup alc882_fixups[] = { .type = ALC_FIXUP_FUNC, .v.func = alc_fixup_inv_dmic_0x12, }, + [ALC882_FIXUP_NO_PRIMARY_HP] = { + .type = ALC_FIXUP_FUNC, + .v.func = alc882_fixup_no_primary_hp, + }, }; static const struct snd_pci_quirk alc882_fixup_tbl[] = { @@ -5391,6 +5409,7 @@ static const struct snd_pci_quirk alc882_fixup_tbl[] = { SND_PCI_QUIRK(0x1043, 0x1971, "Asus W2JC", ALC882_FIXUP_ASUS_W2JC), SND_PCI_QUIRK(0x1043, 0x835f, "Asus Eee 1601", ALC888_FIXUP_EEE1601), SND_PCI_QUIRK(0x104d, 0x9047, "Sony Vaio TT", ALC889_FIXUP_VAIO_TT), + SND_PCI_QUIRK(0x104d, 0x905a, "Sony Vaio Z", ALC882_FIXUP_NO_PRIMARY_HP), /* All Apple entries are in codec SSIDs */ SND_PCI_QUIRK(0x106b, 0x00a0, "MacBookPro 3,1", ALC889_FIXUP_MBP_VREF), @@ -5432,6 +5451,7 @@ static const struct alc_model_fixup alc882_fixup_models[] = { {.id = ALC882_FIXUP_ACER_ASPIRE_8930G, .name = "acer-aspire-8930g"}, {.id = ALC883_FIXUP_ACER_EAPD, .name = "acer-aspire"}, {.id = ALC882_FIXUP_INV_DMIC, .name = "inv-dmic"}, + {.id = ALC882_FIXUP_NO_PRIMARY_HP, .name = "no-primary-hp"}, {} }; -- cgit v1.2.3-18-g5258 From e5b35420ef7e6dc92a6cc5914bc9e5e5c1d48819 Mon Sep 17 00:00:00 2001 From: Fengguang Wu Date: Sun, 29 Jul 2012 19:39:09 +0800 Subject: ALSA: es1688 - freeup resources on init failure This will fix the following oops: [ 6.169981] genirq: Flags mismatch irq 5. 00000000 (ES1688) vs. 00000000 (ES1688) [ 6.170851] Pid: 1, comm: swapper Not tainted 3.5.0-00004-gceee0e9 #14 [ 6.170851] Call Trace: [ 6.170851] [] ? __setup_irq+0x3c7/0x420 [ 6.170851] [] ? request_threaded_irq+0x76/0x140 [ 6.170851] [] ? snd_es1688_ioctl+0x10/0x10 [ 6.170851] [] ? request_threaded_irq+0xb2/0x140 [ 6.170851] [] ? snd_es1688_create+0x96/0x330 [ 6.170851] [] ? snd_gusextreme_probe+0x18d/0x5a2 [ 6.170851] [] ? __driver_attach+0x80/0x80 [ 6.170851] [] ? sysfs_create_link+0xf/0x20 [ 6.170851] [] ? __driver_attach+0x80/0x80 [ 6.170851] [] ? isa_bus_probe+0x12/0x20 [ 6.170851] [] ? driver_probe_device+0x55/0x1c0 [ 6.170851] [] ? _raw_spin_unlock+0xf/0x30 [ 6.170851] [] ? klist_next+0x6a/0xe0 [ 6.170851] [] ? isa_bus_match+0x21/0x40 [ 6.170851] [] ? bus_for_each_drv+0x34/0x70 [ 6.170851] [] ? device_attach+0x7b/0x90 [ 6.170851] [] ? __driver_attach+0x80/0x80 [ 6.170851] [] ? bus_probe_device+0x5f/0x80 [ 6.170851] [] ? device_add+0x573/0x620 [ 6.170851] [] ? complete_all+0x40/0x60 [ 6.170851] [] ? _raw_spin_unlock_irqrestore+0x1a/0x30 [ 6.170851] [] ? isa_register_driver+0xb6/0x150 [ 6.170851] [] ? alsa_card_gusmax_init+0xf/0xf [ 6.170851] [] ? do_one_initcall+0x7f/0x12b [ 6.170851] [] ? kernel_init+0x112/0x1a9 [ 6.170851] [] ? do_early_param+0x77/0x77 [ 6.170851] [] ? do_one_initcall+0x12b/0x12b [ 6.170851] [] ? kernel_thread_helper+0x6/0xd [ 6.190170] es1688: can't grab IRQ 5 [ 6.190613] genirq: Flags mismatch irq 5. 00000000 (ES1688) vs. 00000000 (ES1688) [ 6.191566] Pid: 1, comm: swapper Not tainted 3.5.0-00004-gceee0e9 #14 [ 6.192394] Call Trace: [ 6.192685] [] ? __setup_irq+0x3c7/0x420 [ 6.193342] [] ? request_threaded_irq+0x76/0x140 [ 6.194081] [] ? snd_es1688_ioctl+0x10/0x10 [ 6.194607] [] ? request_threaded_irq+0xb2/0x140 [ 6.194607] [] ? snd_es1688_create+0x96/0x330 [ 6.194607] [] ? snd_gusextreme_probe+0x18d/0x5a2 [ 6.194607] [] ? __driver_attach+0x80/0x80 [ 6.194607] [] ? sysfs_create_link+0xf/0x20 [ 6.194607] [] ? __driver_attach+0x80/0x80 [ 6.194607] [] ? isa_bus_probe+0x12/0x20 [ 6.194607] [] ? driver_probe_device+0x55/0x1c0 [ 6.194607] [] ? _raw_spin_unlock+0xf/0x30 [ 6.194607] [] ? klist_next+0x6a/0xe0 [ 6.194607] [] ? isa_bus_match+0x21/0x40 [ 6.194607] [] ? bus_for_each_drv+0x34/0x70 [ 6.194607] [] ? device_attach+0x7b/0x90 [ 6.194607] [] ? __driver_attach+0x80/0x80 [ 6.194607] [] ? bus_probe_device+0x5f/0x80 [ 6.194607] [] ? device_add+0x573/0x620 [ 6.194607] [] ? complete_all+0x40/0x60 [ 6.194607] [] ? _raw_spin_unlock_irqrestore+0x1a/0x30 [ 6.194607] [] ? isa_register_driver+0xb6/0x150 [ 6.194607] [] ? alsa_card_gusmax_init+0xf/0xf [ 6.194607] [] ? do_one_initcall+0x7f/0x12b [ 6.194607] [] ? kernel_init+0x112/0x1a9 [ 6.194607] [] ? do_early_param+0x77/0x77 [ 6.194607] [] ? do_one_initcall+0x12b/0x12b [ 6.194607] [] ? kernel_thread_helper+0x6/0xd [ 6.210779] es1688: can't grab IRQ 5 [ 6.211305] gusextreme: probe of gusextreme.0 failed with error -16 Signed-off-by: Daniel Mack Signed-off-by: Fengguang Wu Signed-off-by: Takashi Iwai --- include/sound/es1688.h | 1 + sound/isa/es1688/es1688_lib.c | 34 +++++++++++++++++++++++----------- 2 files changed, 24 insertions(+), 11 deletions(-) diff --git a/include/sound/es1688.h b/include/sound/es1688.h index 3ec7ecbe250..f752dd33dfa 100644 --- a/include/sound/es1688.h +++ b/include/sound/es1688.h @@ -29,6 +29,7 @@ #define ES1688_HW_AUTO 0x0000 #define ES1688_HW_688 0x0001 #define ES1688_HW_1688 0x0002 +#define ES1688_HW_UNDEF 0x0003 struct snd_es1688 { unsigned long port; /* port of ESS chip */ diff --git a/sound/isa/es1688/es1688_lib.c b/sound/isa/es1688/es1688_lib.c index 1d47be8170b..b3b4f15e45b 100644 --- a/sound/isa/es1688/es1688_lib.c +++ b/sound/isa/es1688/es1688_lib.c @@ -612,10 +612,10 @@ static int snd_es1688_capture_close(struct snd_pcm_substream *substream) static int snd_es1688_free(struct snd_es1688 *chip) { - if (chip->res_port) { + if (chip->hardware != ES1688_HW_UNDEF) snd_es1688_init(chip, 0); + if (chip->res_port) release_and_free_resource(chip->res_port); - } if (chip->irq >= 0) free_irq(chip->irq, (void *) chip); if (chip->dma8 >= 0) { @@ -657,19 +657,27 @@ int snd_es1688_create(struct snd_card *card, return -ENOMEM; chip->irq = -1; chip->dma8 = -1; + chip->hardware = ES1688_HW_UNDEF; - if ((chip->res_port = request_region(port + 4, 12, "ES1688")) == NULL) { + chip->res_port = request_region(port + 4, 12, "ES1688"); + if (chip->res_port == NULL) { snd_printk(KERN_ERR "es1688: can't grab port 0x%lx\n", port + 4); - return -EBUSY; + err = -EBUSY; + goto exit; } - if (request_irq(irq, snd_es1688_interrupt, 0, "ES1688", (void *) chip)) { + + err = request_irq(irq, snd_es1688_interrupt, 0, "ES1688", (void *) chip); + if (err < 0) { snd_printk(KERN_ERR "es1688: can't grab IRQ %d\n", irq); - return -EBUSY; + goto exit; } + chip->irq = irq; - if (request_dma(dma8, "ES1688")) { + err = request_dma(dma8, "ES1688"); + + if (err < 0) { snd_printk(KERN_ERR "es1688: can't grab DMA8 %d\n", dma8); - return -EBUSY; + goto exit; } chip->dma8 = dma8; @@ -685,14 +693,18 @@ int snd_es1688_create(struct snd_card *card, err = snd_es1688_probe(chip); if (err < 0) - return err; + goto exit; err = snd_es1688_init(chip, 1); if (err < 0) - return err; + goto exit; /* Register device */ - return snd_device_new(card, SNDRV_DEV_LOWLEVEL, chip, &ops); + err = snd_device_new(card, SNDRV_DEV_LOWLEVEL, chip, &ops); +exit: + if (err) + snd_es1688_free(chip); + return err; } static struct snd_pcm_ops snd_es1688_playback_ops = { -- cgit v1.2.3-18-g5258 From ff8a1e274cbc11da6b57849f925b895a212b56c9 Mon Sep 17 00:00:00 2001 From: Takashi Iwai Date: Tue, 31 Jul 2012 10:16:59 +0200 Subject: ALSA: hda - Fix polarity of mute LED on HP Mini 210 The commit a3e199732b made the LED working again on HP Mini 210 but with a wrong polarity. This patch fixes the polarity for this machine, and also introduce a new model string "hp-inv-led". Bugzilla: https://bugzilla.novell.com/show_bug.cgi?id=772923 Cc: [v3.3+] Signed-off-by: Takashi Iwai --- sound/pci/hda/patch_sigmatel.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/sound/pci/hda/patch_sigmatel.c b/sound/pci/hda/patch_sigmatel.c index 217ee1f344b..a760c30f1ca 100644 --- a/sound/pci/hda/patch_sigmatel.c +++ b/sound/pci/hda/patch_sigmatel.c @@ -102,6 +102,7 @@ enum { STAC_HP_DV7_4000, STAC_HP_ZEPHYR, STAC_92HD83XXX_HP_LED, + STAC_92HD83XXX_HP_INV_LED, STAC_92HD83XXX_MODELS }; @@ -1677,6 +1678,7 @@ static const char * const stac92hd83xxx_models[STAC_92HD83XXX_MODELS] = { [STAC_HP_DV7_4000] = "hp-dv7-4000", [STAC_HP_ZEPHYR] = "hp-zephyr", [STAC_92HD83XXX_HP_LED] = "hp-led", + [STAC_92HD83XXX_HP_INV_LED] = "hp-inv-led", }; static const struct snd_pci_quirk stac92hd83xxx_cfg_tbl[] = { @@ -5561,6 +5563,9 @@ again: spec->init = stac92hd83xxx_hp_zephyr_init; break; case STAC_92HD83XXX_HP_LED: + default_polarity = 0; + break; + case STAC_92HD83XXX_HP_INV_LED: default_polarity = 1; break; } -- cgit v1.2.3-18-g5258 From c9dbc4802b413e2d0b08fc483cbf5db7f8e2f360 Mon Sep 17 00:00:00 2001 From: Takashi Iwai Date: Tue, 31 Jul 2012 10:26:34 +0200 Subject: ALSA: hda - Add descriptions for missing IDT 92HD83x models Signed-off-by: Takashi Iwai --- Documentation/sound/alsa/HD-Audio-Models.txt | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Documentation/sound/alsa/HD-Audio-Models.txt b/Documentation/sound/alsa/HD-Audio-Models.txt index 0a2cdac96c2..a92bba81684 100644 --- a/Documentation/sound/alsa/HD-Audio-Models.txt +++ b/Documentation/sound/alsa/HD-Audio-Models.txt @@ -274,6 +274,10 @@ STAC92HD83* dell-s14 Dell laptop dell-vostro-3500 Dell Vostro 3500 laptop hp-dv7-4000 HP dv-7 4000 + hp_cNB11_intquad HP CNB models with 4 speakers + hp-zephyr HP Zephyr + hp-led HP with broken BIOS for mute LED + hp-inv-led HP with broken BIOS for inverted mute LED auto BIOS setup (default) STAC9872 -- cgit v1.2.3-18-g5258 From 1f43f6c1bc8d740e75b4177eb29110858bb5fea2 Mon Sep 17 00:00:00 2001 From: Takashi Iwai Date: Tue, 31 Jul 2012 10:40:05 +0200 Subject: ALSA: hda - Fix mute-LED GPIO initialization for IDT codecs The IDT codecs initializes the GPIO setup for mute LEDs via snd_hda_sync_vmaster_hook(). This works in most cases except for the very first call, which is called before PCM and control creations. Thus before Master switch is set manually via alsactl, the mute LED may show the wrong state, depending on the polarity. Now it's fixed by calling the LED-status update function manually when no vmaster is set yet. Cc: [v3.4+] Signed-off-by: Takashi Iwai --- sound/pci/hda/patch_sigmatel.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/sound/pci/hda/patch_sigmatel.c b/sound/pci/hda/patch_sigmatel.c index a760c30f1ca..94040ccf8e8 100644 --- a/sound/pci/hda/patch_sigmatel.c +++ b/sound/pci/hda/patch_sigmatel.c @@ -4420,7 +4420,12 @@ static int stac92xx_init(struct hda_codec *codec) snd_hda_jack_report_sync(codec); /* sync mute LED */ - snd_hda_sync_vmaster_hook(&spec->vmaster_mute); + if (spec->gpio_led) { + if (spec->vmaster_mute.hook) + snd_hda_sync_vmaster_hook(&spec->vmaster_mute); + else /* the very first init call doesn't have vmaster yet */ + stac92xx_update_led_status(codec, false); + } /* sync the power-map */ if (spec->num_pwrs) -- cgit v1.2.3-18-g5258 From aff252a848ce21b431ba822de3dab9c4c94571cb Mon Sep 17 00:00:00 2001 From: Daniel Mack Date: Wed, 1 Aug 2012 10:16:53 +0200 Subject: ALSA: snd-usb: fix clock source validity index uac_clock_source_is_valid() uses the control selector value to access the bmControls bitmap of the clock source unit. This is wrong, as control selector values start from 1, while the bitmap uses all available bits. In other words, "Clock Validity Control" is stored in D3..2, not D5..4 of the clock selector unit's bmControls. Signed-off-by: Daniel Mack Reported-by: Andreas Koch Cc: stable@kernel.org Signed-off-by: Takashi Iwai --- sound/usb/clock.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/sound/usb/clock.c b/sound/usb/clock.c index 379baad3d5a..5e634a2eb28 100644 --- a/sound/usb/clock.c +++ b/sound/usb/clock.c @@ -111,7 +111,8 @@ static bool uac_clock_source_is_valid(struct snd_usb_audio *chip, int source_id) return 0; /* If a clock source can't tell us whether it's valid, we assume it is */ - if (!uac2_control_is_readable(cs_desc->bmControls, UAC2_CS_CONTROL_CLOCK_VALID)) + if (!uac2_control_is_readable(cs_desc->bmControls, + UAC2_CS_CONTROL_CLOCK_VALID - 1)) return 1; err = snd_usb_ctl_msg(dev, usb_rcvctrlpipe(dev, 0), UAC2_CS_CUR, -- cgit v1.2.3-18-g5258