From patchwork Mon Nov 6 10:40:11 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jerome Brunet X-Patchwork-Id: 161937 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:8f47:0:b0:403:3b70:6f57 with SMTP id j7csp2567042vqu; Mon, 6 Nov 2023 02:41:07 -0800 (PST) X-Google-Smtp-Source: AGHT+IG1nQWqTunq5/iIWOSGJjKf1pOT6JsKmE+dbkvBbwq/YPCYmqg7RcMM/jUb+JAX+T6wGYvU X-Received: by 2002:a05:6358:1203:b0:168:ff1a:8804 with SMTP id h3-20020a056358120300b00168ff1a8804mr28175781rwi.20.1699267267284; Mon, 06 Nov 2023 02:41:07 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1699267266; cv=none; d=google.com; s=arc-20160816; b=o7AWNCV0Ct3x3x7KDf1Ow4RiXcrIsZrJDaLf1o+ILoJZIotEX23ySBNkOyrKf1irQa hc10xCVEs5RkhKM3ZE/1pbUIpXy8nHN/wbgoz7/kTBM6qzjzzx5pRHvkjOLB4kQg0MWH V85ZT1dE4CsFKJIvg3mRPzAvEg571qXb+RcTybyzDCOs7VRw8at0vDfrBMLX6oG4Fcxr dBQLGBtLsf2KppmqJ7juX5gf2Mi3s9yBv6Ox3JMEWvzsrcQ9j3eFNBC4yc7/2tW/G3yO oXpz2nQyoV47Fz5Inm55wOOqZ2HMuipbDW2sBTfCV7Mn3H3KOSdEfOy0wPOemDagy0Yz Mvmg== 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 :message-id:date:subject:cc:to:from:dkim-signature; bh=Nbjwm+H7hl2EuKWl07XyZwpvz3KlHSIgvjF5mlsdjpY=; fh=2iCxWoL4OHRTYWxOu09ZXK1Hw9S9eoIvoOrUzdkRCpQ=; b=gPr0ihVsdFVd0jTqUBmwnENhCUgEXzmp7CvTUMcKCywEvvimkBtPhe2HYuOdMJVhcz CH1U9e5b6u9OKrqZ7JDEsUoahdoLxGeMlQOxbUeYdzg3C2XULbB/zEMOxSs1Xj8gAhTX wrpCqzxcBGMiyyRJEZYCAdkG6TLELcODWEiFWS/D5yQCVTeu3ENAr4ewAHgtRj4RP0A3 3ioQ2665zeqqnidDgPvIIZwR606zmCPc2Gk2YgaCayM6QeFQDYFufDK7XGApcGCmJBjq dPHMBo2yqt+CeyHpsKZhWdTpZOE7y8e008b1EuPAy/K8wwaxhHjB3mEXWG9eKekLA8Tu CB/Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@baylibre-com.20230601.gappssmtp.com header.s=20230601 header.b=HzgAQoRe; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.33 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from lipwig.vger.email (lipwig.vger.email. [23.128.96.33]) by mx.google.com with ESMTPS id l196-20020a633ecd000000b005acf0458523si7375807pga.612.2023.11.06.02.41.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 06 Nov 2023 02:41:06 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.33 as permitted sender) client-ip=23.128.96.33; Authentication-Results: mx.google.com; dkim=pass header.i=@baylibre-com.20230601.gappssmtp.com header.s=20230601 header.b=HzgAQoRe; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.33 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by lipwig.vger.email (Postfix) with ESMTP id 4DEB2808A90B; Mon, 6 Nov 2023 02:40:46 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at lipwig.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231215AbjKFKk1 (ORCPT + 36 others); Mon, 6 Nov 2023 05:40:27 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46010 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229478AbjKFKkZ (ORCPT ); Mon, 6 Nov 2023 05:40:25 -0500 Received: from mail-ej1-x62a.google.com (mail-ej1-x62a.google.com [IPv6:2a00:1450:4864:20::62a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BDD78123 for ; Mon, 6 Nov 2023 02:40:22 -0800 (PST) Received: by mail-ej1-x62a.google.com with SMTP id a640c23a62f3a-9d0b4dfd60dso630841366b.1 for ; Mon, 06 Nov 2023 02:40:22 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre-com.20230601.gappssmtp.com; s=20230601; t=1699267221; x=1699872021; 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=Nbjwm+H7hl2EuKWl07XyZwpvz3KlHSIgvjF5mlsdjpY=; b=HzgAQoReIO7E2ynjMLhUeBp/tgKupCoSNcnxbeOi+O9/8kI+0PZNPwWGK1Nag+gc18 I1tsN4syUu33mGGZ4/Jdsjy7Ibc8wOGvHRXgZDPgJt4LIuwlUfPbJTTK13ldn3BvH07Z ArqHF9AeaHWwWai8zVdxdiAshy678NmRAAz1lFU2oFzF4lITWRwD5Q3pBKy8Ej2AxedY 0PigVGF+ju5g9qDw+DK/oGwGgEoO0Fp5x3P/sCSeK1o/wAm8FOd2ThE0kzYLnNXgQC87 kYNTi8RXKFWNpL08R5aO20Twxhf5aW+6PRJWZMnd9XZsAjZ9koORHrWwUjhSG9qtRbY7 IXbQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1699267221; x=1699872021; 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=Nbjwm+H7hl2EuKWl07XyZwpvz3KlHSIgvjF5mlsdjpY=; b=RyYcSnWyCcR9Qx2Kd6yLCX4+MoP/zFDkPvnrleH3ftKqNwKc4v4t1X3avNdDnDh8Jo 3wC3ftiSCmcc3B1bLwVHzK+hhUPZgBCI7R62GsXdBZJZmsVS/8EB2obBTL12W8mtq8jN Ft1ITiS18257uxbV/AM1UEw0NoINLfhjESakPKOTQWXPVAfApEv3KYuvLJwY7VItvjD7 NTyT6WSbGUQAyXJ4zsBDGoAaAoQn8Q+lPB62/1YXvLK+EOfL7OD6AlDu3GObpJoX7mLC +2XUIcQ9z0+yXnWZgtSbWTbcugjJC46S9KbCHBhqTfmFjCo6m8Gx7G6skwU1vzI0PqPb DdfQ== X-Gm-Message-State: AOJu0YyA7IkQxmVFVKgFAeeoiV1kzh29zd3UWyyAoDXzpeh1gSbzR7fN 6oAMCdxKMaeCRQZcIkxFL5hNho1hCJ5I1Q/Uq/A= X-Received: by 2002:a17:906:d554:b0:9ae:5db5:13d with SMTP id cr20-20020a170906d55400b009ae5db5013dmr14948952ejc.72.1699267221002; Mon, 06 Nov 2023 02:40:21 -0800 (PST) Received: from toaster.lan ([2a01:e0a:3c5:5fb1:fabf:ec8c:b644:5d3]) by smtp.googlemail.com with ESMTPSA id jg2-20020a05600ca00200b004065daba6casm11876137wmb.46.2023.11.06.02.40.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 06 Nov 2023 02:40:20 -0800 (PST) From: Jerome Brunet To: Mark Brown Cc: Jerome Brunet , alsa-devel@alsa-project.org, linux-kernel@vger.kernel.org Subject: [PATCH] ASoC: hdmi-codec: register hpd callback on component probe Date: Mon, 6 Nov 2023 11:40:11 +0100 Message-ID: <20231106104013.704356-1-jbrunet@baylibre.com> X-Mailer: git-send-email 2.42.0 MIME-Version: 1.0 X-Patchwork-Bot: notify X-Spam-Status: No, score=-0.8 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lipwig.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (lipwig.vger.email [0.0.0.0]); Mon, 06 Nov 2023 02:40:46 -0800 (PST) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1781810873559223863 X-GMAIL-MSGID: 1781810873559223863 The HDMI hotplug callback to the hdmi-codec is currently registered when jack is set. The hotplug not only serves to report the ASoC jack state but also to get the ELD. It should be registered when the component probes instead, so it does not depend on the card driver registering a jack for the HDMI to properly report the ELD. Fixes: 25ce4f2b3593 ("ASoC: hdmi-codec: Get ELD in before reporting plugged event") Signed-off-by: Jerome Brunet --- sound/soc/codecs/hdmi-codec.c | 27 +++++++++++++++++++-------- 1 file changed, 19 insertions(+), 8 deletions(-) diff --git a/sound/soc/codecs/hdmi-codec.c b/sound/soc/codecs/hdmi-codec.c index 09eef6042aad..20da1eaa4f1c 100644 --- a/sound/soc/codecs/hdmi-codec.c +++ b/sound/soc/codecs/hdmi-codec.c @@ -877,18 +877,13 @@ static int hdmi_codec_set_jack(struct snd_soc_component *component, void *data) { struct hdmi_codec_priv *hcp = snd_soc_component_get_drvdata(component); - int ret = -ENOTSUPP; if (hcp->hcd.ops->hook_plugged_cb) { hcp->jack = jack; - ret = hcp->hcd.ops->hook_plugged_cb(component->dev->parent, - hcp->hcd.data, - plugged_cb, - component->dev); - if (ret) - hcp->jack = NULL; + return 0; } - return ret; + + return -ENOTSUPP; } static int hdmi_dai_spdif_probe(struct snd_soc_dai *dai) @@ -982,6 +977,21 @@ static int hdmi_of_xlate_dai_id(struct snd_soc_component *component, return ret; } +static int hdmi_probe(struct snd_soc_component *component) +{ + struct hdmi_codec_priv *hcp = snd_soc_component_get_drvdata(component); + int ret = 0; + + if (hcp->hcd.ops->hook_plugged_cb) { + ret = hcp->hcd.ops->hook_plugged_cb(component->dev->parent, + hcp->hcd.data, + plugged_cb, + component->dev); + } + + return ret; +} + static void hdmi_remove(struct snd_soc_component *component) { struct hdmi_codec_priv *hcp = snd_soc_component_get_drvdata(component); @@ -992,6 +1002,7 @@ static void hdmi_remove(struct snd_soc_component *component) } static const struct snd_soc_component_driver hdmi_driver = { + .probe = hdmi_probe, .remove = hdmi_remove, .dapm_widgets = hdmi_widgets, .num_dapm_widgets = ARRAY_SIZE(hdmi_widgets),