From 26acaf08556a3c64ebf8ea3654b51e6acbb0a26c Mon Sep 17 00:00:00 2001 From: Takashi Iwai Date: Thu, 22 Mar 2012 14:36:50 +0100 Subject: ALSA: hda/realtek - Fix ADC assignment with a shared HP/Mic pin The recent Realtek driver tries to assign an extra input via the headphone plug when only a single input source is found. The code worked on Samsung Q1, but it broke ASUS 1015 where the mic is a digital-mic and only a specific ADC works. This patch fixes the assignment of ADC in the shared mic/hp case. Instead of assuming the single ADC at first, reduce the ADCs after trying to assign both mic and HP pins. Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=42973 Cc: Signed-off-by: Takashi Iwai --- sound/pci/hda/patch_realtek.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) (limited to 'sound/pci') diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c index 8ea2fd65432..9917e55d6f1 100644 --- a/sound/pci/hda/patch_realtek.c +++ b/sound/pci/hda/patch_realtek.c @@ -2717,9 +2717,6 @@ static int alc_auto_fill_adc_caps(struct hda_codec *codec) int max_nums = ARRAY_SIZE(spec->private_adc_nids); int i, nums = 0; - if (spec->shared_mic_hp) - max_nums = 1; /* no multi streams with the shared HP/mic */ - nid = codec->start_nid; for (i = 0; i < codec->num_nodes; i++, nid++) { hda_nid_t src; @@ -4076,6 +4073,7 @@ static void alc_remove_invalid_adc_nids(struct hda_codec *codec) if (spec->dyn_adc_switch) return; + again: nums = 0; for (n = 0; n < spec->num_adc_nids; n++) { hda_nid_t cap = spec->private_capsrc_nids[n]; @@ -4096,6 +4094,11 @@ static void alc_remove_invalid_adc_nids(struct hda_codec *codec) if (!nums) { /* check whether ADC-switch is possible */ if (!alc_check_dyn_adc_switch(codec)) { + if (spec->shared_mic_hp) { + spec->shared_mic_hp = 0; + spec->private_imux[0].num_items = 1; + goto again; + } printk(KERN_WARNING "hda_codec: %s: no valid ADC found;" " using fallback 0x%x\n", codec->chip_name, spec->private_adc_nids[0]); @@ -4113,7 +4116,7 @@ static void alc_remove_invalid_adc_nids(struct hda_codec *codec) if (spec->auto_mic) alc_auto_mic_check_imux(codec); /* check auto-mic setups */ - else if (spec->input_mux->num_items == 1) + else if (spec->input_mux->num_items == 1 || spec->shared_mic_hp) spec->num_adc_nids = 1; /* reduce to a single ADC */ } -- cgit v1.2.3 From a938fb1ef600c885f80e59b840a60894d16efb77 Mon Sep 17 00:00:00 2001 From: Dan Carpenter Date: Wed, 28 Mar 2012 09:57:02 +0300 Subject: ALSA: asihpi - fix return type of hpios_locked_mem_alloc() This function returns zero or -ENOMEM, but because it's type is u16, the -ENOMEM gets changed to 65524. None of the callers care, but lets fix it anyway as a cleanup. Signed-off-by: Dan Carpenter Signed-off-by: Takashi Iwai --- sound/pci/asihpi/hpi_internal.h | 2 +- sound/pci/asihpi/hpios.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'sound/pci') diff --git a/sound/pci/asihpi/hpi_internal.h b/sound/pci/asihpi/hpi_internal.h index 4cc315daeda..8c63200cf33 100644 --- a/sound/pci/asihpi/hpi_internal.h +++ b/sound/pci/asihpi/hpi_internal.h @@ -42,7 +42,7 @@ On error *pLockedMemHandle marked invalid, non-zero returned. If this function succeeds, then HpiOs_LockedMem_GetVirtAddr() and HpiOs_LockedMem_GetPyhsAddr() will always succed on the returned handle. */ -u16 hpios_locked_mem_alloc(struct consistent_dma_area *p_locked_mem_handle, +int hpios_locked_mem_alloc(struct consistent_dma_area *p_locked_mem_handle, /**< memory handle */ u32 size, /**< Size in bytes to allocate */ struct pci_dev *p_os_reference diff --git a/sound/pci/asihpi/hpios.c b/sound/pci/asihpi/hpios.c index 2d7d1c2e1d0..87f4385fe8c 100644 --- a/sound/pci/asihpi/hpios.c +++ b/sound/pci/asihpi/hpios.c @@ -43,7 +43,7 @@ void hpios_delay_micro_seconds(u32 num_micro_sec) On error, return -ENOMEM, and *pMemArea.size = 0 */ -u16 hpios_locked_mem_alloc(struct consistent_dma_area *p_mem_area, u32 size, +int hpios_locked_mem_alloc(struct consistent_dma_area *p_mem_area, u32 size, struct pci_dev *pdev) { /*?? any benefit in using managed dmam_alloc_coherent? */ -- cgit v1.2.3