Received: by 2002:a05:6a10:af89:0:0:0:0 with SMTP id iu9csp3979039pxb; Tue, 25 Jan 2022 00:31:22 -0800 (PST) X-Google-Smtp-Source: ABdhPJyyckgGXBYg5ZflQcjdcPQf1Zvab0Chq7IcAlVAXxG+dbpVQxp5faL5RwJyQou/L7bV2CMX X-Received: by 2002:a17:902:ab53:b0:149:7902:bc8f with SMTP id ij19-20020a170902ab5300b001497902bc8fmr17938456plb.85.1643099482675; Tue, 25 Jan 2022 00:31:22 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1643099482; cv=none; d=google.com; s=arc-20160816; b=Dex16NRSD6O5kpyb2LwJaWzLUofmUws1MfHDPH1gcA6xnKdt8zCGOu6foadwU4ayeu lIYYJ5NZf5lNDpCdT84x0p9pFQWH3Yy1O+HWQwKtLZYiKdFatL/ZomqsJzoIFEpeOkM1 7pUkXD0KuALbyURXtxMQaE4GK+DorD07n7ovRtBw5/P4xfuQTMo723gSsQsInvG1E0gS hnuDw0ShdsctiESwSEPdSEUzNZp3pgI986oypPNuU3OChLjIQ40J91Q9yPNlr5VuDvOf r/0ntm2HCxuwagEik93B5kKz7mWaMxOgj1o4CFMvCb+jX04Zxsiqr0kcHwMdzvXibTB3 zKYQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=jrAqZQeZLPNKnG7YO0oSfbMypDHglVcIbq5Ayy1lXPs=; b=Y+kL279W30Uh1y0ouzvZgUg77HTXrMsgWmQ6Esvq+E3lP5VwstboZZbjHk/rxnjw0q 8c4qlVf/8cO83hUlfHApgyqDZx/7yBts1zsnYnR1Ha50sAIUesQe+gRVjoy9HGC0yXfq 7dX1p9xd1h0tpDWaVT8jX/7iqT24jF/2qipRJzd5mOYdlaI17hNVHs9m6btb2VGSZXU+ Pj46+lPA/LLUoLrf415xPsoq3qCtOAmmr6DCT7k7IKRG4N+FcnlCiBpnZu92NRVb2GWr 8YPR6XDGC/tQJBs2vaByHtSTIOSYwTjF063QGgdPThPG+zIvKQjWlC5x7Q8JWJuvTiSK kRjQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=2DzxBhkN; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id w17si15270550pll.453.2022.01.25.00.31.10; Tue, 25 Jan 2022 00:31:22 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=2DzxBhkN; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S3407974AbiAYChm (ORCPT + 99 others); Mon, 24 Jan 2022 21:37:42 -0500 Received: from ams.source.kernel.org ([145.40.68.75]:37166 "EHLO ams.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1385295AbiAXUb7 (ORCPT ); Mon, 24 Jan 2022 15:31:59 -0500 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 1CAD7B81239; Mon, 24 Jan 2022 20:31:57 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4CC70C340E5; Mon, 24 Jan 2022 20:31:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643056315; bh=HXJV0jhVF0YnUWsRplcUKIX+Ihje/JCzSZtYZ+p4VdI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=2DzxBhkNCuovzyLMFhQsCURNVb3t6UTFRfnjbKNfieCiZm5YC5vJq+4t3o/jarPfZ 5FdA/wG0dU3Pi6ECTrJsNzkhRzYBaw+vwOZh2iefDNNqtexPwuswWKH8khRJA80MR+ 8KIJ/UvWA7W9b1kmC14GR3lREl5xc1cWcAPtTU7c= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, "Christian A. Ehrhardt" , Takashi Iwai , Sasha Levin Subject: [PATCH 5.15 444/846] ALSA: hda/cs8409: Fix Jack detection after resume Date: Mon, 24 Jan 2022 19:39:21 +0100 Message-Id: <20220124184116.302124918@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184100.867127425@linuxfoundation.org> References: <20220124184100.867127425@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Christian A. Ehrhardt [ Upstream commit 57f234248ff925d88caedf4019ec84e6ecb83909 ] The suspend code unconditionally sets ->hp_jack_in and ->mic_jack_in to zero but without reporting this status change to the HDA core. To compensate for this, always assume a status change on the first unsol event after boot or resume. Fixes: 424e531b47f8 ("ALSA: hda/cs8409: Ensure Type Detection is only run on startup when necessary") Signed-off-by: Christian A. Ehrhardt Link: https://lore.kernel.org/r/20211231134432.atwmuzeceqiklcoa@cae.in-ulm.de Signed-off-by: Takashi Iwai Signed-off-by: Sasha Levin --- sound/pci/hda/patch_cs8409-tables.c | 3 +++ sound/pci/hda/patch_cs8409.c | 5 ++++- sound/pci/hda/patch_cs8409.h | 1 + 3 files changed, 8 insertions(+), 1 deletion(-) diff --git a/sound/pci/hda/patch_cs8409-tables.c b/sound/pci/hda/patch_cs8409-tables.c index 0fb0a428428b4..df0b4522babf7 100644 --- a/sound/pci/hda/patch_cs8409-tables.c +++ b/sound/pci/hda/patch_cs8409-tables.c @@ -252,6 +252,7 @@ struct sub_codec cs8409_cs42l42_codec = { .init_seq_num = ARRAY_SIZE(cs42l42_init_reg_seq), .hp_jack_in = 0, .mic_jack_in = 0, + .force_status_change = 1, .paged = 1, .suspended = 1, .no_type_dect = 0, @@ -443,6 +444,7 @@ struct sub_codec dolphin_cs42l42_0 = { .init_seq_num = ARRAY_SIZE(dolphin_c0_init_reg_seq), .hp_jack_in = 0, .mic_jack_in = 0, + .force_status_change = 1, .paged = 1, .suspended = 1, .no_type_dect = 0, @@ -456,6 +458,7 @@ struct sub_codec dolphin_cs42l42_1 = { .init_seq_num = ARRAY_SIZE(dolphin_c1_init_reg_seq), .hp_jack_in = 0, .mic_jack_in = 0, + .force_status_change = 1, .paged = 1, .suspended = 1, .no_type_dect = 1, diff --git a/sound/pci/hda/patch_cs8409.c b/sound/pci/hda/patch_cs8409.c index bf5d7f0c6ba55..aff2b5abb81ea 100644 --- a/sound/pci/hda/patch_cs8409.c +++ b/sound/pci/hda/patch_cs8409.c @@ -636,7 +636,9 @@ static void cs42l42_run_jack_detect(struct sub_codec *cs42l42) static int cs42l42_handle_tip_sense(struct sub_codec *cs42l42, unsigned int reg_ts_status) { - int status_changed = 0; + int status_changed = cs42l42->force_status_change; + + cs42l42->force_status_change = 0; /* TIP_SENSE INSERT/REMOVE */ switch (reg_ts_status) { @@ -791,6 +793,7 @@ static void cs42l42_suspend(struct sub_codec *cs42l42) cs42l42->last_page = 0; cs42l42->hp_jack_in = 0; cs42l42->mic_jack_in = 0; + cs42l42->force_status_change = 1; /* Put CS42L42 into Reset */ gpio_data = snd_hda_codec_read(codec, CS8409_PIN_AFG, 0, AC_VERB_GET_GPIO_DATA, 0); diff --git a/sound/pci/hda/patch_cs8409.h b/sound/pci/hda/patch_cs8409.h index ade2b838590cf..d0b725c7285b6 100644 --- a/sound/pci/hda/patch_cs8409.h +++ b/sound/pci/hda/patch_cs8409.h @@ -305,6 +305,7 @@ struct sub_codec { unsigned int hp_jack_in:1; unsigned int mic_jack_in:1; + unsigned int force_status_change:1; unsigned int suspended:1; unsigned int paged:1; unsigned int last_page; -- 2.34.1