From patchwork Thu Oct 15 09:31:59 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: AceLan Kao X-Patchwork-Id: 1382521 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (no SPF record) smtp.mailfrom=lists.ubuntu.com (client-ip=91.189.94.19; helo=huckleberry.canonical.com; envelope-from=kernel-team-bounces@lists.ubuntu.com; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=canonical.com Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20161025 header.b=PDOPPkTv; dkim-atps=neutral Received: from huckleberry.canonical.com (huckleberry.canonical.com [91.189.94.19]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4CBkZm4bbzz9sV0; Thu, 15 Oct 2020 20:32:16 +1100 (AEDT) Received: from localhost ([127.0.0.1] helo=huckleberry.canonical.com) by huckleberry.canonical.com with esmtp (Exim 4.86_2) (envelope-from ) id 1kSzcG-0007Jp-CY; Thu, 15 Oct 2020 09:32:08 +0000 Received: from mail-pg1-f194.google.com ([209.85.215.194]) by huckleberry.canonical.com with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.86_2) (envelope-from ) id 1kSzcE-0007JN-0M for kernel-team@lists.ubuntu.com; Thu, 15 Oct 2020 09:32:06 +0000 Received: by mail-pg1-f194.google.com with SMTP id o7so1434314pgv.6 for ; Thu, 15 Oct 2020 02:32:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=ErVOZBvEpJ6Z+x2eZC6+SqicR41zYIrxFxv7S6Kv0/A=; b=PDOPPkTv2GHj+JUAcnhQ1qp6gpQ4gOgtfimZSn+K0K0MuM/oxOHeGwDC0+QG5Mh6/4 xdjr1sCNnJPlHRsGC4iguZM5uLRrhKdUHjlss6Iqvam1tNX1AY5N35JYYXrHP8wv5Zc4 gPxoyvB5yI8/uXBiergKMNrcD2rSrORaf3AyGeAs1jDM6i5MGEo3goaGzAbewuKwyq3o JsBhJ8As9BF6+fpIDmO0k99X6KuO2HRPm4TCM5XczG3f9lTZZa77VLGhsOMRThT60S9f hbRwh91q9cqWtTOaFFoXaYgBj/TPzi5NsH1kIRhSVfv0Bd+64N0e2sbxRfs1TwJt43N8 lb2g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=ErVOZBvEpJ6Z+x2eZC6+SqicR41zYIrxFxv7S6Kv0/A=; b=G1sCUo7hQ1dTVXTd+T53GpC+/Tjqj7mTWoLYzIXv3/e9OzsxUopgN5fG+jVD8NNdef hlgnjGvc+aIr2Urf+mIrlQG4R2hwJutw4evDX0WNam35bTu9WkVJNGMw2OKGYqRBe1NO 3G6moDghhu4bXuBFcfGri3c9PM5WEOWQQWXVP8wSiy0ewryrFB0IYx4qEfHlGsgJOXYG MEysFxpviL/yZX5tAKLJt+12+0sp37cbSWOtQUrgjRUxC04yapD5+S/5UYZ07HYv0BWS FsMfgSeDXMsAxla4kXyI+naukbcYpVyzDC0/JX2A/1md9sZ9Tyyexjs11za2K43pt/bc RHwQ== X-Gm-Message-State: AOAM531++fc55PKUzglFfu1Zp7VL/PLdrpcObLL5GTuFapCnpQrKM+ka t1pZxEHQpOvzdQ6Z/zyFvefOIelgvwr16w== X-Google-Smtp-Source: ABdhPJxJ13MYlh2b1m4pqMJfT5itR4+FinHb0BYmimYiwvCFFriP0BjugnOHJw7f//5xWXq6UpFtQw== X-Received: by 2002:aa7:96f8:0:b029:152:94c0:7e5 with SMTP id i24-20020aa796f80000b029015294c007e5mr3306557pfq.76.1602754323842; Thu, 15 Oct 2020 02:32:03 -0700 (PDT) Received: from localhost (61-220-137-37.HINET-IP.hinet.net. [61.220.137.37]) by smtp.gmail.com with ESMTPSA id lf11sm2582739pjb.57.2020.10.15.02.32.02 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 15 Oct 2020 02:32:03 -0700 (PDT) From: AceLan Kao To: kernel-team@lists.ubuntu.com Subject: [PATCH 1/1][SRU][OEM-5.6] ALSA: hda - let hs_mic be picked ahead of hp_mic Date: Thu, 15 Oct 2020 17:31:59 +0800 Message-Id: <20201015093159.232086-2-acelan.kao@canonical.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20201015093159.232086-1-acelan.kao@canonical.com> References: <20201015093159.232086-1-acelan.kao@canonical.com> MIME-Version: 1.0 Received-SPF: pass client-ip=209.85.215.194; envelope-from=acelan@gmail.com; helo=mail-pg1-f194.google.com X-BeenThere: kernel-team@lists.ubuntu.com X-Mailman-Version: 2.1.20 Precedence: list List-Id: Kernel team discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: kernel-team-bounces@lists.ubuntu.com Sender: "kernel-team" From: Hui Wang BugLink: https://bugs.launchpad.net/bugs/1899586 We have a Dell AIO, there is neither internal speaker nor internal mic, only a multi-function audio jack on it. Users reported that after freshly installing the OS and plug a headset to the audio jack, the headset can't output sound. I reproduced this bug, at that moment, the Input Source is as below: Simple mixer control 'Input Source',0 Capabilities: cenum Items: 'Headphone Mic' 'Headset Mic' Item0: 'Headphone Mic' That is because the patch_realtek will set this audio jack as mic_in mode if Input Source's value is hp_mic. If it is not fresh installing, this issue will not happen since the systemd will run alsactl restore -f /var/lib/alsa/asound.state, this will set the 'Input Source' according to history value. If there is internal speaker or internal mic, this issue will not happen since there is valid sink/source in the pulseaudio, the PA will set the 'Input Source' according to active_port. To fix this issue, change the parser function to let the hs_mic be stored ahead of hp_mic. Cc: stable@vger.kernel.org Signed-off-by: Hui Wang Link: https://lore.kernel.org/r/20200625083833.11264-1-hui.wang@canonical.com Signed-off-by: Takashi Iwai (cherry picked from commit 6a6ca7881b1ab1c13fe0d70bae29211a65dd90de) Signed-off-by: AceLan Kao --- sound/pci/hda/hda_auto_parser.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/sound/pci/hda/hda_auto_parser.c b/sound/pci/hda/hda_auto_parser.c index 2c6d2becfe1a..824f4ac1a8ce 100644 --- a/sound/pci/hda/hda_auto_parser.c +++ b/sound/pci/hda/hda_auto_parser.c @@ -72,6 +72,12 @@ static int compare_input_type(const void *ap, const void *bp) if (a->type != b->type) return (int)(a->type - b->type); + /* If has both hs_mic and hp_mic, pick the hs_mic ahead of hp_mic. */ + if (a->is_headset_mic && b->is_headphone_mic) + return -1; /* don't swap */ + else if (a->is_headphone_mic && b->is_headset_mic) + return 1; /* swap */ + /* In case one has boost and the other one has not, pick the one with boost first. */ return (int)(b->has_boost_on_pin - a->has_boost_on_pin);