Received: by 2002:a05:6a10:af89:0:0:0:0 with SMTP id iu9csp3635872pxb; Mon, 24 Jan 2022 14:04:45 -0800 (PST) X-Google-Smtp-Source: ABdhPJwECs7QPS66BqyZ7wK36YA0Pj6hUoZvC4/Rvu14pP1XTdm7o9boprxwgRrZun5C4qfGoICn X-Received: by 2002:a63:8f5a:: with SMTP id r26mr8756383pgn.438.1643061885400; Mon, 24 Jan 2022 14:04:45 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1643061885; cv=none; d=google.com; s=arc-20160816; b=Uay3v89nqMJIrw7kJxu64gkc886eOGZVOeymuGLa0ZN/4e4wuGKu9WV72NkvYC3rzb lWN6WYpAAteng4BBCjWqLPX4xGettZBvdSAJGEwK/7rUaLPH5ImiQDHNwwVYjgtiLFXw yqY55Hex2P5SzzpPbfA1N8CE9HE/W0epUN3WgyGygElAS7z+zSq0SL5iVxk24ohTw7cw 2UKDvNBtKj+2C2GdQU9xhKotYn+zZj54mY8X2UhGCaL+sQpj3Pc4a1dmlhr4yQAc5cRI y5klRsuUsiyUwYFsAsHCDRtmr1zpizUGgsuMa99ktY+105gRyJ+BlUGmTdEHGpYYim3O nnEg== 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=zUVWNwz+gdH/rGfWRW0j2Ks2NF+7yx+P2Vu0NuqfFdpOTMnMny4XZ46ZPwwcMXrX4d oBZa04w5NhH+9YuikObeIbSQZVURlsNbSgn8KUxX2Nti4XC14JBZusxbtV634UUi+VsS zMrrut2LuYcgXyVoNjAnBE+nCOr44y6t+2S7/lpc1hDbywhLNEhSMlBkW3NfYpR0uNnN RaFzsFOZ/1cgGCbnaY3rjQeYMiO1RjmP6RdJSpAIgUjAjeUzfLA8NY6MULsLzdPZuO/j GWayonivUG3OkAA0qZe5iKss42VX0WTxMppkWTLz8wYZSfE/UQfpdhwtTc47BgWkamFL kADQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=tCgvKrLW; 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 f8si4595804plg.281.2022.01.24.14.04.33; Mon, 24 Jan 2022 14:04:45 -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=tCgvKrLW; 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 S1575850AbiAXVwh (ORCPT + 99 others); Mon, 24 Jan 2022 16:52:37 -0500 Received: from ams.source.kernel.org ([145.40.68.75]:38090 "EHLO ams.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1448683AbiAXVTO (ORCPT ); Mon, 24 Jan 2022 16:19:14 -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 48920B81061; Mon, 24 Jan 2022 21:19:09 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7CF92C340E4; Mon, 24 Jan 2022 21:19:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643059148; bh=HXJV0jhVF0YnUWsRplcUKIX+Ihje/JCzSZtYZ+p4VdI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=tCgvKrLWMc9Wl9xqbOPjcAi9TMATx7qj0HA6RlBSgaOAJfcAgU00Jx4MrIzeMC9+o PFWaesm/UpFhyahH1Oho+kZcJmVjic7CplqK/jj3rA6IFModh+yjctOSb7St+PpQZf LEq3hfk2j+n12NhyfDiRJCUREI0Jh9tLEeY6J9tE= 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.16 0520/1039] ALSA: hda/cs8409: Fix Jack detection after resume Date: Mon, 24 Jan 2022 19:38:29 +0100 Message-Id: <20220124184142.769715347@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@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