From patchwork Mon Dec 18 14:56:52 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jerome Brunet X-Patchwork-Id: 180463 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:24d3:b0:fb:cd0c:d3e with SMTP id r19csp1297372dyi; Mon, 18 Dec 2023 06:57:31 -0800 (PST) X-Google-Smtp-Source: AGHT+IFdPDUH4tYqBxQi34ZC3+MlHJLqr/p6efobMbbWggPA2JJs4ZQ+YRK0IrxD+WbnjNji1IWG X-Received: by 2002:a05:6512:118a:b0:50b:ec8c:669d with SMTP id g10-20020a056512118a00b0050bec8c669dmr8901889lfr.81.1702911451281; Mon, 18 Dec 2023 06:57:31 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1702911451; cv=none; d=google.com; s=arc-20160816; b=Au1xEoZkfFvveYP/hhbNJbWuh6cqKtcD+qQhdVeS3SIXqLGoFud6paeOInCE7iXAso 03wp2KmusiBNgNJxaFyMDGcWIlgDgzbH07oIeh4dPwI35w08f1THQVKCCcwICMAQCER3 Y/ASi2z0/FLtEF/LKSMZX5nO+dNImTOg2uAlrxJPcfOXc4Vlqhh9dVwO2b0ob68hk4BY AwZ6K/N/rMiIQ55RiJB9VvEMfyFY1KD10AFFu/E70o2Dx7SxhhHVDtrW/ONvDAqsPX6f GJ28krsyboNHhWyaAKLyxDs9q+pCwzIMir3C1rG2DrXgbSFQBddIPtJz2HO7kZquRRsq gEjA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:message-id:date:subject:cc:to :from:dkim-signature; bh=ejW8mYTHsaSP2x9nTPGi1Vc36flABAG/m92kKNfgtE0=; fh=tJpmRJdSxMlQ4hKTDWlEm0p9W893XIG3jXTgQ44lumM=; b=cW349iyhQZumG96XadrGljgnsHSNEY3SFs2h2y9XByuePB4n9mOdD3xbqmUr2yDQ7E xPceRys1TNx29+djwZ0vzPoKDSdLJnM2yG+VGiW612UsFaIAizA2DSbjw8qe/BOTVuuv SEwdbXk3aKseGiWu+lKMXiHp7QO+KicimnN1kxMNgwz1VhIyzhFWq6l8AUjU43NxmSx/ XwtX+slV/HsvY2fslpo3wyYUTlLfT1KyntXKn39mlkDtXIiJR8hIxG0xUIXzn+612MQF gn7shFlly1+ZsqiLv6hGMGqdUn7ha/0Qop0epOVX4fm779gL2a2+oG4/3cGBhpHrAQH7 ejEw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@baylibre-com.20230601.gappssmtp.com header.s=20230601 header.b=sS0yFIh4; spf=pass (google.com: domain of linux-kernel+bounces-3868-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-3868-ouuuleilei=gmail.com@vger.kernel.org" Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id va1-20020a17090711c100b00a2340c7f08csi1500574ejb.955.2023.12.18.06.57.31 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 18 Dec 2023 06:57:31 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-3868-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; dkim=pass header.i=@baylibre-com.20230601.gappssmtp.com header.s=20230601 header.b=sS0yFIh4; spf=pass (google.com: domain of linux-kernel+bounces-3868-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-3868-ouuuleilei=gmail.com@vger.kernel.org" Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id D11AE1F23465 for ; Mon, 18 Dec 2023 14:57:30 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 85DB43A1AC; Mon, 18 Dec 2023 14:57:18 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=baylibre-com.20230601.gappssmtp.com header.i=@baylibre-com.20230601.gappssmtp.com header.b="sS0yFIh4" X-Original-To: linux-kernel@vger.kernel.org Received: from mail-wm1-f49.google.com (mail-wm1-f49.google.com [209.85.128.49]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 637EC1D15F for ; Mon, 18 Dec 2023 14:57:13 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=baylibre.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=baylibre.com Received: by mail-wm1-f49.google.com with SMTP id 5b1f17b1804b1-40c3ceded81so31217985e9.1 for ; Mon, 18 Dec 2023 06:57:13 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre-com.20230601.gappssmtp.com; s=20230601; t=1702911431; x=1703516231; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=ejW8mYTHsaSP2x9nTPGi1Vc36flABAG/m92kKNfgtE0=; b=sS0yFIh4aMOJF52M1eZFoUnOZ+8uDkKCEnUpBsiNZR8FioNQ+TiCANkpCmwVxgiVvU NB+1Tnsii1UwyHtlO6SZzWQMaIEwoeDWSjR94n17YVX7akSV7wHUtpx7lX9QDLS/EDWe rhJMFj6iJQlswMozfPuIV8qe82/iT+jn3u8AugmjSLH7RnZn/AdK7GlVmwsP0j+g9Wwp nkC65Eexes1OBfha3aBU7Q2+oV5870lREInFH1RTkOHeLxRTUMhpbpNt//LFoZnMgX6H dhhRwVi8CGoE/EjrWRNOUwIA7cTts3dO+P2G+PZ32HRbDcX1DM4HhgCtBD64onaTLUU/ annQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1702911431; x=1703516231; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=ejW8mYTHsaSP2x9nTPGi1Vc36flABAG/m92kKNfgtE0=; b=tssNKseqZG6XoiuIbY2UQ5utNSaEuqKCoUl0ug8r/zGKB2hkokJDTjroy18qnaXdGd 8DdBqxhGQMDxpd2aeILTNyeOrcjZBtxig68Kxl+NXMK4GqLEoyiIQCJdwUHQQIEpVLHg lgQh3xSKD3BpEklAkT77Zx62fTVsyUc82ohjoHV5gxOB5dtslTwuJ75287iw9INqc1cw CF8iJeZ8Sqi63MWYoH4y8YS4ba3Vm6ulAhjgpQ7rQC9+SxcH4JG1o3RMkVdRqef9hauk MFhA7FC+M4c46KaA0fVAFW648D6xDD4M6sql6uM5Y4sBPLkwhvvlz3yUShMjis6iz8It P/Lw== X-Gm-Message-State: AOJu0Yxil2ssMLq+KC18g8xfN6YACX/nO8SCWvupVEdQsNys0/i1aOjO CwdnLeCt4JwifoPG5MkxZaYlPA== X-Received: by 2002:a05:600c:46cf:b0:40c:3d90:49f1 with SMTP id q15-20020a05600c46cf00b0040c3d9049f1mr7972031wmo.125.1702911431628; Mon, 18 Dec 2023 06:57:11 -0800 (PST) Received: from toaster.lan ([2a01:e0a:3c5:5fb1:29f2:94ce:d35d:aa25]) by smtp.googlemail.com with ESMTPSA id fc17-20020a05600c525100b0040c42681fcesm35465477wmb.15.2023.12.18.06.57.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 18 Dec 2023 06:57:11 -0800 (PST) From: Jerome Brunet To: Mark Brown Cc: Jerome Brunet , alsa-devel@alsa-project.org, linux-kernel@vger.kernel.org, Zhengqiao Xia , Hsin-Yi Wang Subject: [PATCH] ASoC: hdmi-codec: fix missing report for jack initial status Date: Mon, 18 Dec 2023 15:56:52 +0100 Message-ID: <20231218145655.134929-1-jbrunet@baylibre.com> X-Mailer: git-send-email 2.42.0 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Patchwork-Bot: notify X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1785632077824649558 X-GMAIL-MSGID: 1785632077824649558 This fixes a problem introduced while fixing ELD reporting with no jack set. Most driver using the hdmi-codec will call the 'plugged_cb' callback directly when registered to report the initial state of the HDMI connector. With the commit mentionned, this occurs before jack is ready and the initial report is lost for platforms actually providing a jack for HDMI. Fix this by storing the hdmi connector status regardless of jack being set or not and report the last status when jack gets set. With this, the initial state is reported correctly even if it is disconnected. This was not done initially and is also a fix. Fixes: 15be353d55f9 ("ASoC: hdmi-codec: register hpd callback on component probe") Reported-by: Zhengqiao Xia Closes: https://lore.kernel.org/alsa-devel/CADYyEwTNyY+fR9SgfDa-g6iiDwkU3MUdPVCYexs2_3wbcM8_vg@mail.gmail.com/ Cc: Hsin-Yi Wang Signed-off-by: Jerome Brunet --- sound/soc/codecs/hdmi-codec.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/sound/soc/codecs/hdmi-codec.c b/sound/soc/codecs/hdmi-codec.c index 20da1eaa4f1c..0938671700c6 100644 --- a/sound/soc/codecs/hdmi-codec.c +++ b/sound/soc/codecs/hdmi-codec.c @@ -850,8 +850,9 @@ static int hdmi_dai_probe(struct snd_soc_dai *dai) static void hdmi_codec_jack_report(struct hdmi_codec_priv *hcp, unsigned int jack_status) { - if (hcp->jack && jack_status != hcp->jack_status) { - snd_soc_jack_report(hcp->jack, jack_status, SND_JACK_LINEOUT); + if (jack_status != hcp->jack_status) { + if (hcp->jack) + snd_soc_jack_report(hcp->jack, jack_status, SND_JACK_LINEOUT); hcp->jack_status = jack_status; } } @@ -880,6 +881,13 @@ static int hdmi_codec_set_jack(struct snd_soc_component *component, if (hcp->hcd.ops->hook_plugged_cb) { hcp->jack = jack; + + /* + * Report the initial jack status which may have been provided + * by the parent hdmi driver while the hpd hook was registered. + */ + snd_soc_jack_report(jack, hcp->jack_status, SND_JACK_LINEOUT); + return 0; }