From patchwork Fri Jan 14 20:16:50 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Brian Norris X-Patchwork-Id: 12713942 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 bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 05B1AC433F5 for ; Fri, 14 Jan 2022 20:17:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=vQp3ATiPUUB3fDnWmfL6F3T2MX4rD/MSfw99+le4TDA=; b=i7zolALTzohjuJ tDCpbSskI3qKnIyD7+xGjacS6YpYmUvENm+oS9srAbCrlSn5MPNhaOMRI/AxEb1UMPdymGg35vdxn xUNZEZ753wM6l6s2XkIik/4rvCQ3qdWPgH+2l6F+kZM7XRcJz7ln+wB9697ea7/6d5tKmqIVbrrrw bYhIq2HhRSWTyImGky0ru8qOlfbQJT3o3dRnXDZdzEjFOAzjWcwkiA2rTgxH/fjDnI8prZMrFhuU8 URFUF8SWTRzX04Nfbvs+4AggbsdS7kfXrcPvZTb4277CjiLmeYqMxOlFI7j1mSHe9NZpTrioEtWw9 8pQ/0Wc5xeCSNOzHq2aA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1n8T0x-00A9wL-C2; Fri, 14 Jan 2022 20:17:35 +0000 Received: from mail-pl1-x62c.google.com ([2607:f8b0:4864:20::62c]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1n8T0b-00A9ns-86 for linux-rockchip@lists.infradead.org; Fri, 14 Jan 2022 20:17:14 +0000 Received: by mail-pl1-x62c.google.com with SMTP id c3so14041638pls.5 for ; Fri, 14 Jan 2022 12:17:12 -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=NHI4YdJkg3blWqPelJAYTO4ml6hVxIePrSWCG1B/xFA=; b=EEigY38b1fTu+aiEP3SmQ0r0AcAMPN99i8wrAOaTvKy4ytD/0GOOBLLlpl+WXnajij X3Nu9yfWhzPIYpKmaOpgO0vwkP1Y7RDErmL2kBD1EAZt9n3wXWYMtNw602JoVR5bLHN4 vUF+EV32uGddQTHPmX5WBu3o20sB8//KqZoXE= 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=NHI4YdJkg3blWqPelJAYTO4ml6hVxIePrSWCG1B/xFA=; b=6sY7Lhp6DIlC85ldnAr9dBMFCTBCLHz7lvhgCi5jOhBWZIaZNbEFkY1oJ12ShwBB/h U/GveMUzZ1kWcqgH3cJjaGAznkLwCdP99P53fIAdDSh7U13dOUKmx+cqw3dW3RIGC/Si OPefsqHalTYodqcG3jUtey/rQgSfH1zMmzJLVyamt5MLjbhCqQ/0TXDLdEasSJr2eEwD 0WpxrnTT58rsiummNlroN3Y2wv45s7uOaNIjxmA3Ch+3NN1UX1UgdMfteeIinfM7UpPh dEawaNGSJvOaEpBpzzUMSy92oPULqSQIn+6yr5jkGu8qZdubZSJvik8279isQZfqJEMQ kRhg== X-Gm-Message-State: AOAM532P0hpecQ4jI/ITcB4cRcmV+SSGTUaodNLhLgRRiDSf8LvUltoQ Kd5uj7S7bB/14Fqotk7TRXn66g== X-Google-Smtp-Source: ABdhPJyANqLFSMw/ah46py8E9k5uIE2DiLUf4ryo5wQMT8muBxJU4jdXvlE8Hx0LhnJYKQTgOC1SiQ== X-Received: by 2002:a17:90b:4a92:: with SMTP id lp18mr12273149pjb.123.1642191432492; Fri, 14 Jan 2022 12:17:12 -0800 (PST) Received: from localhost ([2620:15c:202:201:76ab:ede1:503d:1c39]) by smtp.gmail.com with UTF8SMTPSA id l13sm5300187pgq.34.2022.01.14.12.17.11 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 14 Jan 2022 12:17:12 -0800 (PST) From: Brian Norris To: Heiko Stuebner , Liam Girdwood , Mark Brown , David Airlie , Daniel Vetter Cc: alsa-devel@alsa-project.org, linux-arm-kernel@lists.infradead.org, dri-devel@lists.freedesktop.org, Sandy Huang , linux-rockchip@lists.infradead.org, devicetree@vger.kernel.org, Rob Herring , linux-kernel@vger.kernel.org, Lin Huang , Brian Norris Subject: [PATCH 1/3] arm64: dts: rockchip: Switch RK3399-Gru DP to SPDIF output Date: Fri, 14 Jan 2022 12:16:50 -0800 Message-Id: <20220114121515.1.I46f64b00508d9dff34abe1c3e8d2defdab4ea1e5@changeid> X-Mailer: git-send-email 2.34.1.703.g22d0c6ccf7-goog In-Reply-To: <20220114201652.3875838-1-briannorris@chromium.org> References: <20220114201652.3875838-1-briannorris@chromium.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220114_121713_308588_DD872DAD X-CRM114-Status: GOOD ( 13.43 ) X-BeenThere: linux-rockchip@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Upstream kernel work for Rockchip platforms List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "Linux-rockchip" Errors-To: linux-rockchip-bounces+linux-rockchip=archiver.kernel.org@lists.infradead.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. Fixes: b18c6c3c7768 ("ASoC: rockchip: cdn-dp sound output use spdif") Signed-off-by: Brian Norris --- arch/arm64/boot/dts/rockchip/rk3399-gru.dtsi | 10 +++++----- 1 file changed, 5 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..21ec073f4d51 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,10 @@ &sdmmc { vqmmc-supply = <&ppvar_sd_card_io>; }; +&spdif { + status = "okay"; +}; + &spi1 { status = "okay"; From patchwork Fri Jan 14 20:16:51 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Brian Norris X-Patchwork-Id: 12713943 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 bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id B8B9EC433FE for ; Fri, 14 Jan 2022 20:17:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=LUgnCyoVp8Ri/cJVsqK0J2AmR5qUJIJJGSJvNbGqPts=; b=ie/x1STf+ocVIm 2hVyyELyFVdNhdQKBxYkK7ChYtPsNza22vKvJ8woPtUdJ3ruj+VueY0j/EFx2+3xM0i1wxjOf13KH NOn0G/UHJOThzQaKXiLeTx3Q1NWDVtriDy4cKlBQ8yNrqVLR9kE+dSZSDFTimrNKerQnEP95jES4k yHv+JqyNt4yDR6pWmS45AFvwRY35rybEMGRU3RbX5+lEmSZk9Cgcqfn6skg5vfKn3G1GwBZTQA3JB A0qB4oF4Xz+Hoc2bviHUbnb8zo4cC2WKLoKlt4aimuujdh7kf+0qE6XfinUpENamxNeaVT5GXLs5q oxYs9Jl0LBRwhR43c2fQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1n8T17-00A9za-FU; Fri, 14 Jan 2022 20:17:45 +0000 Received: from mail-pf1-x42b.google.com ([2607:f8b0:4864:20::42b]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1n8T0d-00A9pM-Pc for linux-rockchip@lists.infradead.org; Fri, 14 Jan 2022 20:17:17 +0000 Received: by mail-pf1-x42b.google.com with SMTP id i129so3726446pfe.13 for ; Fri, 14 Jan 2022 12:17:15 -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=WzNR7uSNnSdg4hsXrt3ZJe57Rjz9RsU1uoLFUYgup5s=; b=CrBAAcV6rcqYR96Cru/pA8UOx2tnvMIIOfcqFcAownzSFPyuPgvkhzfxi/+POTmI6F s3dystHa98fH+SbgMv8XKpF0nN2hyQmJRb/usWgQVAeEMKkFbOl1RLbU6G0QKyJYa1cp atbPBFu4vpIdYe+oAsO4YZx7Pu3BhgN/ev32M= 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=WzNR7uSNnSdg4hsXrt3ZJe57Rjz9RsU1uoLFUYgup5s=; b=jRwRznaaD0vZqNfCA9rf5Xy0p0MfHHulAqA/ZGHs2hlsXd+2JquE3KTfwiBWD52ehC f2wQMnkKiuO2JZ5Tgq3930khDcR7wybvSf91qRtcwD1YAwf5hLeEnDVowCllqNyDfzjK Ryvvc9w10kW7qqpv0ix4iB+NGvwc/Ht1856wU9/+siB1o7cbnchbv+RqDZCsEdBbYLLq f/JfggeUQE6ZNWvKQy7i/7kr6nryxQMIHBJMycGAuSBeJGnbTbtiR0vYx96VQGwMCDkk cm9HDndYj8wggJ/3qr9LSG6n1v/57zPOVKBv0tjnpiXnj0LhnccV8ihvEIZyk1ckQQrG Oz9w== X-Gm-Message-State: AOAM532xzdI4ykhjXN+fLZDRhA+WHfuGjS27ssZMp1HNXEeS999TCXZ5 Y0MyIAFUHDyleMsMveJlLgPm+wUq4Iklrw== X-Google-Smtp-Source: ABdhPJyHj22cXTGtfbh2J7pBTC9HY1zTyXX803MbP2uAPR8gM88DcF40tdq9nbUgQqifT6xthI1Ncw== X-Received: by 2002:a63:4620:: with SMTP id t32mr3538422pga.531.1642191435052; Fri, 14 Jan 2022 12:17:15 -0800 (PST) Received: from localhost ([2620:15c:202:201:76ab:ede1:503d:1c39]) by smtp.gmail.com with UTF8SMTPSA id p50sm5982690pfw.51.2022.01.14.12.17.13 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 14 Jan 2022 12:17:14 -0800 (PST) From: Brian Norris To: Heiko Stuebner , Liam Girdwood , Mark Brown , David Airlie , Daniel Vetter Cc: alsa-devel@alsa-project.org, linux-arm-kernel@lists.infradead.org, dri-devel@lists.freedesktop.org, Sandy Huang , linux-rockchip@lists.infradead.org, devicetree@vger.kernel.org, Rob Herring , linux-kernel@vger.kernel.org, Lin Huang , Brian Norris Subject: [PATCH 2/3] drm/rockchip: cdn-dp: Support HDMI codec plug-change callback Date: Fri, 14 Jan 2022 12:16:51 -0800 Message-Id: <20220114121515.2.I20d754a1228aa5c51a18c8eb15a2c60dec25b639@changeid> X-Mailer: git-send-email 2.34.1.703.g22d0c6ccf7-goog In-Reply-To: <20220114201652.3875838-1-briannorris@chromium.org> References: <20220114201652.3875838-1-briannorris@chromium.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220114_121715_914384_F1454400 X-CRM114-Status: GOOD ( 15.16 ) X-BeenThere: linux-rockchip@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Upstream kernel work for Rockchip platforms List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "Linux-rockchip" Errors-To: linux-rockchip-bounces+linux-rockchip=archiver.kernel.org@lists.infradead.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 --- 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 20:16:52 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Brian Norris X-Patchwork-Id: 12713944 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 bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 07869C4332F for ; Fri, 14 Jan 2022 20:17:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=zRwjqRjAdrnMTAJGZZy/0rdzZnH0LdzRRUYqWJWTh8w=; b=NrLRm+QX7jXPUD LeWmmkktYBq0W/pDI0++raNocQE3qrJrXOnpQ4Ra/MTKt9bIKR5LUatHqlq8teuwmacehnqQb31W9 Bf06da7FI8Raovvc5D2hFDe1YeYLv2Ji6KO1rHXrBvREMHd4iShNBmtg19/EbatShjHzdPb4STFi6 /yI2NExrM56wAhVgouBQX9NgYRzias1jktqgCgs/bru4kmi/+G+6U1yRf1KpGvTPIgN+I7KTWlpja DuWsshu4vE79r2ZdPtslCJzZ8wg9f5uZBbWRZE9rm2Bmnh0WmIp+y1g6hS1bHMhu6wiT5NT7YlSvA A5cHZN5jGm7LgbTmP9Zw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1n8T18-00A9zo-3a; Fri, 14 Jan 2022 20:17:46 +0000 Received: from mail-pf1-x42c.google.com ([2607:f8b0:4864:20::42c]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1n8T0g-00A9qq-16 for linux-rockchip@lists.infradead.org; Fri, 14 Jan 2022 20:17:19 +0000 Received: by mail-pf1-x42c.google.com with SMTP id i129so3726622pfe.13 for ; Fri, 14 Jan 2022 12:17:17 -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=10U/YKtex+AND9dtDxjk3FYBvBwLFUl9f2fbhlUXUs0=; b=XQy4pyO/wUwsYqGsKtflTgY0GMz4pfjd2qpY31JHWTpxrdp5kycdY6uXSFa3MXVWe6 wq/hlaXeACBG7Euq/bmzfc3SM6AC4Pu4laUwxAAWlVJsx2bVy0Izg+KtkO5gPiaBeCOw LsILH7rVPeqwj+OUGJjnT/KYlOKhVhKT8tdiA= 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=10U/YKtex+AND9dtDxjk3FYBvBwLFUl9f2fbhlUXUs0=; b=42RXnIoiygEv8Op1rjVMkinqyK8xD2nDzRJR5u1jasFGGxZZesqHVyParHMSBRi1ob 2/NbrviipHG54mgBTN2zuNq1Rez5A95nnGvvYIdsxI+3SQgJtVbUaOSohDtxbN4LbySZ zkgb25OofY+9muZeiSh91oVmiBJtjClYU9hMXnJY6UYW6ziInOrFAzVt7fNUSe10Nh0Z x+VPDCpnAqgy4vQMI21BMluimQ7y09hiq8kvPexn6+s90a01LZDTs5N2aciN1BblPNHR oPTtQtq9YPpCAv6idIVvu/dAgq+RMnQAltJvClg1n4edD+LY/PHvL19XIhFUKY1HR1rk MUtQ== X-Gm-Message-State: AOAM530p0QPKHANFV9VzpjYL0e7/v5OUoEJWKNHLUvgGlrwIpdNnvz+I rVySV+FwzyOBxXmxnPXLSaqsV5dcc1lmCQ== X-Google-Smtp-Source: ABdhPJxqbQOjbira1atGPpNHzh9Q82DXtSjtZWs+75WZcndu3r13+lzxdf+ODqr/TYUZIBqpyhshZg== X-Received: by 2002:a63:6b81:: with SMTP id g123mr9615156pgc.140.1642191437321; Fri, 14 Jan 2022 12:17:17 -0800 (PST) Received: from localhost ([2620:15c:202:201:76ab:ede1:503d:1c39]) by smtp.gmail.com with UTF8SMTPSA id g15sm2354365pfm.142.2022.01.14.12.17.15 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 14 Jan 2022 12:17:16 -0800 (PST) From: Brian Norris To: Heiko Stuebner , Liam Girdwood , Mark Brown , David Airlie , Daniel Vetter Cc: alsa-devel@alsa-project.org, linux-arm-kernel@lists.infradead.org, dri-devel@lists.freedesktop.org, Sandy Huang , linux-rockchip@lists.infradead.org, devicetree@vger.kernel.org, Rob Herring , linux-kernel@vger.kernel.org, Lin Huang , Brian Norris Subject: [PATCH 3/3] ASoC: rk3399_gru_sound: Wire up DP jack detection Date: Fri, 14 Jan 2022 12:16:52 -0800 Message-Id: <20220114121515.3.I3c79b1466c14b02980071221e5b99283cd26ec77@changeid> X-Mailer: git-send-email 2.34.1.703.g22d0c6ccf7-goog In-Reply-To: <20220114201652.3875838-1-briannorris@chromium.org> References: <20220114201652.3875838-1-briannorris@chromium.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220114_121718_098514_66829BE9 X-CRM114-Status: GOOD ( 13.46 ) X-BeenThere: linux-rockchip@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Upstream kernel work for Rockchip platforms List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "Linux-rockchip" Errors-To: linux-rockchip-bounces+linux-rockchip=archiver.kernel.org@lists.infradead.org Now that the cdn-dp driver supports plug-change callbacks, let's wire it up. Signed-off-by: Brian Norris --- 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),