From patchwork Fri Jan 14 23:02:07 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Brian Norris X-Patchwork-Id: 532103 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id D2473C433EF for ; Fri, 14 Jan 2022 23:02:29 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231239AbiANXC3 (ORCPT ); Fri, 14 Jan 2022 18:02:29 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55022 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231256AbiANXC2 (ORCPT ); Fri, 14 Jan 2022 18:02:28 -0500 Received: from mail-pg1-x533.google.com (mail-pg1-x533.google.com [IPv6:2607:f8b0:4864:20::533]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8E7CAC06173F for ; Fri, 14 Jan 2022 15:02:28 -0800 (PST) Received: by mail-pg1-x533.google.com with SMTP id i8so3901695pgt.13 for ; Fri, 14 Jan 2022 15:02:28 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=o2h9cZxYJ3emYpUIj++uO1rilt4TStZ87q6578VwqZA=; b=htS6cflFJn1ZL5Y0EPBeN6hbyK7QvRLQG6rL5+hf+Wyp/p/OwvwAl+Evj2ZQ1THw8U UC6WEz/EhH69UAKuS4Z7gffz1k2LATR0EJgozsv2LnARXXrqxKBBQ4ABYZcLLxPDoo6k 9jAJ1rcvLoaJTprwBOkTnDB9oHf7Sk8iuKDJE= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=o2h9cZxYJ3emYpUIj++uO1rilt4TStZ87q6578VwqZA=; b=mOn5mmmKc5+Gjx6e5ZCMq8TCG5/D+re7ri2wokohPqo9q/1YleCRrNVmXsv/qaiw13 FeOwR02Y53cbOK3zgUSmlhRoElMnPqtk5yyUpzl1ucF0vrdeMnbhyYd018CuebgA5jkY YgOl4gJeOAn/EKaqf0VLF3YCstRYgyfxU6XkXswrfZidrhPNnyOqPbQSwlwEak4pyCIM k0Gd0LgyHBAxyT/tq9SSBB5M1/XA26zy1eufMbNvoidwifviXoKnh/XhCgJ1ariULSjf eFUjC0/rzJlH1srn5XvDjJv++V6iVxglWDXPUEg2Qab8clEoDdNO4K9bP8hZRJaKDOlT QO8Q== X-Gm-Message-State: AOAM532JdA9I9ZQB9F6RS7PXfdECRl/xxqQrPBRmMLd7QFFSagIpSfGH /BOlQbzVrJBg4alhZv8QPzzYvg== X-Google-Smtp-Source: ABdhPJyUUCEgb915ys8+J2HAqJSVrMJLFjTcoRKHgsU+KV+w14oykK1ZzYgHLlzxpYzPiETOK+okYA== X-Received: by 2002:a05:6a00:2408:b0:4c1:e1a1:770 with SMTP id z8-20020a056a00240800b004c1e1a10770mr10548879pfh.70.1642201348060; Fri, 14 Jan 2022 15:02:28 -0800 (PST) Received: from localhost ([2620:15c:202:201:76ab:ede1:503d:1c39]) by smtp.gmail.com with UTF8SMTPSA id h11sm6161656pjs.10.2022.01.14.15.02.26 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 14 Jan 2022 15:02:27 -0800 (PST) From: Brian Norris To: Heiko Stuebner , Liam Girdwood , Mark Brown , David Airlie , Daniel Vetter Cc: linux-rockchip@lists.infradead.org, Lin Huang , linux-arm-kernel@lists.infradead.org, dri-devel@lists.freedesktop.org, Rob Herring , Sandy Huang , linux-kernel@vger.kernel.org, alsa-devel@alsa-project.org, devicetree@vger.kernel.org, Brian Norris Subject: [PATCH v2 1/3] arm64: dts: rockchip: Switch RK3399-Gru DP to SPDIF output Date: Fri, 14 Jan 2022 15:02:07 -0800 Message-Id: <20220114150129.v2.1.I46f64b00508d9dff34abe1c3e8d2defdab4ea1e5@changeid> X-Mailer: git-send-email 2.34.1.703.g22d0c6ccf7-goog In-Reply-To: <20220114230209.4091727-1-briannorris@chromium.org> References: <20220114230209.4091727-1-briannorris@chromium.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: devicetree@vger.kernel.org Commit b18c6c3c7768 ("ASoC: rockchip: cdn-dp sound output use spdif") switched the platform to SPDIF, but we didn't fix up the device tree. Drop the pinctrl settings, because the 'spdif_bus' pins are either: * unused (on kevin, bob), so the settings is ~harmless * used by a different function (on scarlet), which causes probe failures (!!) Fixes: b18c6c3c7768 ("ASoC: rockchip: cdn-dp sound output use spdif") Signed-off-by: Brian Norris --- Changes in v2: - (Un)set pinctrl, because the default assumes we're routing out to external pins arch/arm64/boot/dts/rockchip/rk3399-gru.dtsi | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/arch/arm64/boot/dts/rockchip/rk3399-gru.dtsi b/arch/arm64/boot/dts/rockchip/rk3399-gru.dtsi index 45a5ae5d2027..162f08bca0d4 100644 --- a/arch/arm64/boot/dts/rockchip/rk3399-gru.dtsi +++ b/arch/arm64/boot/dts/rockchip/rk3399-gru.dtsi @@ -286,7 +286,7 @@ max98357a: max98357a { sound: sound { compatible = "rockchip,rk3399-gru-sound"; - rockchip,cpu = <&i2s0 &i2s2>; + rockchip,cpu = <&i2s0 &spdif>; }; }; @@ -437,10 +437,6 @@ &i2s0 { status = "okay"; }; -&i2s2 { - status = "okay"; -}; - &io_domains { status = "okay"; @@ -537,6 +533,17 @@ &sdmmc { vqmmc-supply = <&ppvar_sd_card_io>; }; +&spdif { + status = "okay"; + + /* + * SPDIF is routed internally to DP; we either don't use these pins, or + * mux them to something else. + */ + /delete-property/ pinctrl-0; + /delete-property/ pinctrl-names; +}; + &spi1 { status = "okay"; From patchwork Fri Jan 14 23:02:08 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Brian Norris X-Patchwork-Id: 532326 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4A419C433EF for ; Fri, 14 Jan 2022 23:02:34 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231300AbiANXCd (ORCPT ); Fri, 14 Jan 2022 18:02:33 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55032 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231279AbiANXCb (ORCPT ); Fri, 14 Jan 2022 18:02:31 -0500 Received: from mail-pf1-x42b.google.com (mail-pf1-x42b.google.com [IPv6:2607:f8b0:4864:20::42b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DE6BEC061574 for ; Fri, 14 Jan 2022 15:02:30 -0800 (PST) Received: by mail-pf1-x42b.google.com with SMTP id a5so4059651pfo.5 for ; Fri, 14 Jan 2022 15:02:30 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=X0lN8KgwngdIWQtX+1YBYkcWtXacsAROFK0Re0Isayk=; b=JVAC7svkA82CIskoX9XxpEfg+B8GFkTpb3ivSbFZgI/HPbD7sY7z1Mp2/N0DGlMyj1 4kRKb6WX3EXTB1GWlBwz1HHIo/SBYne1AVVReufn7082hSWgZV8LusfLssbZ+nO+QZMF zfKkrjxjOuZUoKGjf2YwUeV1EFcNl2i1ZeX5o= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=X0lN8KgwngdIWQtX+1YBYkcWtXacsAROFK0Re0Isayk=; b=Rv1NkKCpknaEtkFEczJeSu1Trh5tY7+Y9Ciy6o6nCV51AkBb9d9OdO0vLFF8Kgg/hI M1LmlE476RGcqU9cPXKrrqxqm4g9trsH+qaX8vrr3xQzo9pB8w3g9i2OVs9DSQVSA5G/ 9yyIfsioxFScEfMMLw8fj4gG0qK1IOgPiQG6+hqPORgKHNrkfeEGi7tyj9KkjDZGHMlr rtKtKEix9iCFLY30ZzrxfBfsyx3rAaUjaGfYeZghHjm14u5SpwHmQ0KMsdQ92Q9wp55b 4mewoonJq5kK2VPzdZExMOlJQ2qCJnIIxXwVM1WmSasqKN0xdHKiMrjm6l/kIlwGrG3B mDnA== X-Gm-Message-State: AOAM531wVQCWkRrM7UsQjHLAm1vTDigmT+f9Tbl1tY1h+qyg3VNOyvNH GrFl1XFXGW4ev8vDZ+58oXJgsQ== X-Google-Smtp-Source: ABdhPJxEEE2CEn37OnjZYtyIw2or9NSfWoMKhSqZ32s/6jckTLsVQCguVm+8geqnseEdUH1GvQWwKw== X-Received: by 2002:a62:1b49:0:b0:4be:f4a5:14a6 with SMTP id b70-20020a621b49000000b004bef4a514a6mr10888650pfb.31.1642201350433; Fri, 14 Jan 2022 15:02:30 -0800 (PST) Received: from localhost ([2620:15c:202:201:76ab:ede1:503d:1c39]) by smtp.gmail.com with UTF8SMTPSA id j14sm6719717pfu.15.2022.01.14.15.02.28 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 14 Jan 2022 15:02:29 -0800 (PST) From: Brian Norris To: Heiko Stuebner , Liam Girdwood , Mark Brown , David Airlie , Daniel Vetter Cc: linux-rockchip@lists.infradead.org, Lin Huang , linux-arm-kernel@lists.infradead.org, dri-devel@lists.freedesktop.org, Rob Herring , Sandy Huang , linux-kernel@vger.kernel.org, alsa-devel@alsa-project.org, devicetree@vger.kernel.org, Brian Norris Subject: [PATCH v2 2/3] drm/rockchip: cdn-dp: Support HDMI codec plug-change callback Date: Fri, 14 Jan 2022 15:02:08 -0800 Message-Id: <20220114150129.v2.2.I20d754a1228aa5c51a18c8eb15a2c60dec25b639@changeid> X-Mailer: git-send-email 2.34.1.703.g22d0c6ccf7-goog In-Reply-To: <20220114230209.4091727-1-briannorris@chromium.org> References: <20220114230209.4091727-1-briannorris@chromium.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: devicetree@vger.kernel.org Some audio servers like to monitor a jack device (perhaps combined with EDID, for audio-presence info) to determine DP/HDMI audio presence. Signed-off-by: Brian Norris --- (no changes since v1) drivers/gpu/drm/rockchip/cdn-dp-core.c | 28 ++++++++++++++++++++++++++ drivers/gpu/drm/rockchip/cdn-dp-core.h | 4 ++++ 2 files changed, 32 insertions(+) diff --git a/drivers/gpu/drm/rockchip/cdn-dp-core.c b/drivers/gpu/drm/rockchip/cdn-dp-core.c index 16497c31d9f9..edd6a1fc46cd 100644 --- a/drivers/gpu/drm/rockchip/cdn-dp-core.c +++ b/drivers/gpu/drm/rockchip/cdn-dp-core.c @@ -586,6 +586,13 @@ static bool cdn_dp_check_link_status(struct cdn_dp_device *dp) return drm_dp_channel_eq_ok(link_status, min(port->lanes, sink_lanes)); } +static void cdn_dp_audio_handle_plugged_change(struct cdn_dp_device *dp, + bool plugged) +{ + if (dp->codec_dev) + dp->plugged_cb(dp->codec_dev, plugged); +} + static void cdn_dp_encoder_enable(struct drm_encoder *encoder) { struct cdn_dp_device *dp = encoder_to_dp(encoder); @@ -641,6 +648,9 @@ static void cdn_dp_encoder_enable(struct drm_encoder *encoder) DRM_DEV_ERROR(dp->dev, "Failed to valid video %d\n", ret); goto out; } + + cdn_dp_audio_handle_plugged_change(dp, true); + out: mutex_unlock(&dp->lock); } @@ -651,6 +661,8 @@ static void cdn_dp_encoder_disable(struct drm_encoder *encoder) int ret; mutex_lock(&dp->lock); + cdn_dp_audio_handle_plugged_change(dp, false); + if (dp->active) { ret = cdn_dp_disable(dp); if (ret) { @@ -846,11 +858,27 @@ static int cdn_dp_audio_get_eld(struct device *dev, void *data, return 0; } +static int cdn_dp_audio_hook_plugged_cb(struct device *dev, void *data, + hdmi_codec_plugged_cb fn, + struct device *codec_dev) +{ + struct cdn_dp_device *dp = dev_get_drvdata(dev); + + mutex_lock(&dp->lock); + dp->plugged_cb = fn; + dp->codec_dev = codec_dev; + cdn_dp_audio_handle_plugged_change(dp, dp->connected); + mutex_unlock(&dp->lock); + + return 0; +} + static const struct hdmi_codec_ops audio_codec_ops = { .hw_params = cdn_dp_audio_hw_params, .audio_shutdown = cdn_dp_audio_shutdown, .mute_stream = cdn_dp_audio_mute_stream, .get_eld = cdn_dp_audio_get_eld, + .hook_plugged_cb = cdn_dp_audio_hook_plugged_cb, .no_capture_mute = 1, }; diff --git a/drivers/gpu/drm/rockchip/cdn-dp-core.h b/drivers/gpu/drm/rockchip/cdn-dp-core.h index 81ac9b658a70..d808a9de45ed 100644 --- a/drivers/gpu/drm/rockchip/cdn-dp-core.h +++ b/drivers/gpu/drm/rockchip/cdn-dp-core.h @@ -10,6 +10,7 @@ #include #include #include +#include #include "rockchip_drm_drv.h" @@ -101,5 +102,8 @@ struct cdn_dp_device { u8 dpcd[DP_RECEIVER_CAP_SIZE]; bool sink_has_audio; + + hdmi_codec_plugged_cb plugged_cb; + struct device *codec_dev; }; #endif /* _CDN_DP_CORE_H */ From patchwork Fri Jan 14 23:02:09 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Brian Norris X-Patchwork-Id: 532102 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id F041BC433FE for ; Fri, 14 Jan 2022 23:02:36 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231312AbiANXCf (ORCPT ); Fri, 14 Jan 2022 18:02:35 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55052 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231296AbiANXCd (ORCPT ); Fri, 14 Jan 2022 18:02:33 -0500 Received: from mail-pf1-x430.google.com (mail-pf1-x430.google.com [IPv6:2607:f8b0:4864:20::430]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 72D1BC061747 for ; Fri, 14 Jan 2022 15:02:33 -0800 (PST) Received: by mail-pf1-x430.google.com with SMTP id i129so4048083pfe.13 for ; Fri, 14 Jan 2022 15:02:33 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=K2v+tf3/coBADjHlh/X456ouYdTDi9mxyKcdvb4sAww=; b=VoKx/O+RdQ97dNYCMkBu/pvrz+/Fne9QTD5/ufOzQc2tIbl2VwuKirYICxRUmOaxU7 bzMP9wvZcj0rii2XVRaGz2CB77+ByOkbDWFdmqSt03chP8478o1isqsZ72dK5ERh1qCg ZD1l5mA8b+oYH1T/dEcNRmhZAhXZfQvq12+jI= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=K2v+tf3/coBADjHlh/X456ouYdTDi9mxyKcdvb4sAww=; b=TeoIkWCzk3LJHt5mwyQ7MyptVUywGFDNHixR+6DFBlJ2ziYFN+w5ktFFZ2KjOEc6+b 5UvYeeXVHepKSrnAyykjV0PP5nzeEpdtgBXZ2ehnhKFXgYrYN2rwr1V+ecmt31NXbwqh ZjK1466/vlDDyRbHf+D4ZyticF2Y1ZJo1aVj6cHnOa4qQzT8wqF8P8H0xkAZDHOmyP1s ++m2Axpq7huOLnxjfyo2vGCWR9mLBa0MEqp3ccjqn5aMn7wLxVtUDP7ID5Dz8ouKaJYm 6alN2kHO5UaVX9/03Hcb2qbdXbePIEdM3tEEgALQPYlHNt/tII/P1eVAUnD/DXSCJtZX DC+w== X-Gm-Message-State: AOAM530d8PZaynmg6Xc5NcD4+dfE/GNS0OPZpU1jiV55N85NtGap8P8u zc3wecNKNFBqbV4tCVZd5uJ4sQ== X-Google-Smtp-Source: ABdhPJyJxad9FH/It6rpaHOKDPCSlkdbKW/X7HtmB2tbRUwLIpcP+QTk8BQyjl2RIOc9OttHVlG6qw== X-Received: by 2002:a05:6a00:1413:b0:4bf:a0d7:1f55 with SMTP id l19-20020a056a00141300b004bfa0d71f55mr10925475pfu.13.1642201353019; Fri, 14 Jan 2022 15:02:33 -0800 (PST) Received: from localhost ([2620:15c:202:201:76ab:ede1:503d:1c39]) by smtp.gmail.com with UTF8SMTPSA id l27sm5307598pgb.0.2022.01.14.15.02.31 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 14 Jan 2022 15:02:32 -0800 (PST) From: Brian Norris To: Heiko Stuebner , Liam Girdwood , Mark Brown , David Airlie , Daniel Vetter Cc: linux-rockchip@lists.infradead.org, Lin Huang , linux-arm-kernel@lists.infradead.org, dri-devel@lists.freedesktop.org, Rob Herring , Sandy Huang , linux-kernel@vger.kernel.org, alsa-devel@alsa-project.org, devicetree@vger.kernel.org, Brian Norris Subject: [PATCH v2 3/3] ASoC: rk3399_gru_sound: Wire up DP jack detection Date: Fri, 14 Jan 2022 15:02:09 -0800 Message-Id: <20220114150129.v2.3.I3c79b1466c14b02980071221e5b99283cd26ec77@changeid> X-Mailer: git-send-email 2.34.1.703.g22d0c6ccf7-goog In-Reply-To: <20220114230209.4091727-1-briannorris@chromium.org> References: <20220114230209.4091727-1-briannorris@chromium.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: devicetree@vger.kernel.org Now that the cdn-dp driver supports plug-change callbacks, let's wire it up. Signed-off-by: Brian Norris --- (no changes since v1) sound/soc/rockchip/rk3399_gru_sound.c | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/sound/soc/rockchip/rk3399_gru_sound.c b/sound/soc/rockchip/rk3399_gru_sound.c index e2d52d8d0ff9..eeef3ed70037 100644 --- a/sound/soc/rockchip/rk3399_gru_sound.c +++ b/sound/soc/rockchip/rk3399_gru_sound.c @@ -164,6 +164,25 @@ static int rockchip_sound_da7219_hw_params(struct snd_pcm_substream *substream, return 0; } +static struct snd_soc_jack cdn_dp_card_jack; + +static int rockchip_sound_cdndp_init(struct snd_soc_pcm_runtime *rtd) +{ + struct snd_soc_component *component = asoc_rtd_to_codec(rtd, 0)->component; + struct snd_soc_card *card = rtd->card; + int ret; + + /* Enable jack detection. */ + ret = snd_soc_card_jack_new(card, "DP Jack", SND_JACK_LINEOUT, + &cdn_dp_card_jack, NULL, 0); + if (ret) { + dev_err(card->dev, "Can't create DP Jack %d\n", ret); + return ret; + } + + return snd_soc_component_set_jack(component, &cdn_dp_card_jack, NULL); +} + static int rockchip_sound_da7219_init(struct snd_soc_pcm_runtime *rtd) { struct snd_soc_component *component = asoc_rtd_to_codec(rtd, 0)->component; @@ -315,6 +334,7 @@ static const struct snd_soc_dai_link rockchip_dais[] = { [DAILINK_CDNDP] = { .name = "DP", .stream_name = "DP PCM", + .init = rockchip_sound_cdndp_init, .dai_fmt = SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_NB_NF | SND_SOC_DAIFMT_CBS_CFS, SND_SOC_DAILINK_REG(cdndp),