From patchwork Sun Aug 2 15:42:31 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Katsuhiro Suzuki X-Patchwork-Id: 11696551 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 3F19214B7 for ; Sun, 2 Aug 2020 15:42:54 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 079812072A for ; Sun, 2 Aug 2020 15:42:53 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="CwmwwmQ+" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 079812072A Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=katsuster.net Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-rockchip-bounces+patchwork-linux-rockchip=patchwork.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:MIME-Version:Message-Id:Date:Subject:To:From: Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender :Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References:List-Owner; bh=yYyi76x6snt+kyihFiG9uOt+Lty4Yb93qGU2xcnI7vo=; b=CwmwwmQ+ecrm1o9jQippLqiRoa 0zloXuTpcFgADniX+4DH5Hdc8YhMrL7T8c7CepuNXUlWDbxOAnNTAT8TAFxe6foXQpwmb1BoBC9dH 9tBDaWH9HGicRJQq5YY8zasjp2zh+80SQELf3He7ZK1/6lg3QbNZaMgtwthZLKv52iKPcCdgqcNUq L2VgCoF/K3HnpM31jbXGveosmd8MBeHEsNDVXGBMlDptSgz1+7qdGHh5Xl0GSsPpheL1eXDuQlV93 sY6hDJvpX88NAnHfrJsPaVlgUWCcWzybiE5QU33WFJZaCjPyk80j6/JMC+afgetDAIKfK8OrETuYM aYNRF2ew==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1k2G8P-0004Uw-4r; Sun, 02 Aug 2020 15:42:49 +0000 Received: from www1102.sakura.ne.jp ([219.94.129.142]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1k2G8M-0004UU-9u; Sun, 02 Aug 2020 15:42:47 +0000 Received: from fsav105.sakura.ne.jp (fsav105.sakura.ne.jp [27.133.134.232]) by www1102.sakura.ne.jp (8.15.2/8.15.2) with ESMTP id 072Fgb3C098877; Mon, 3 Aug 2020 00:42:37 +0900 (JST) (envelope-from katsuhiro@katsuster.net) Received: from www1102.sakura.ne.jp (219.94.129.142) by fsav105.sakura.ne.jp (F-Secure/fsigk_smtp/550/fsav105.sakura.ne.jp); Mon, 03 Aug 2020 00:42:37 +0900 (JST) X-Virus-Status: clean(F-Secure/fsigk_smtp/550/fsav105.sakura.ne.jp) Received: from localhost.localdomain (121.252.232.153.ap.dti.ne.jp [153.232.252.121]) (authenticated bits=0) by www1102.sakura.ne.jp (8.15.2/8.15.2) with ESMTPSA id 072FgW67098844 (version=TLSv1.2 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Mon, 3 Aug 2020 00:42:37 +0900 (JST) (envelope-from katsuhiro@katsuster.net) From: Katsuhiro Suzuki To: Heiko Stuebner Subject: [PATCH v2] arm64: dts: rockchip: enable HDMI sound nodes for rk3328-rock64 Date: Mon, 3 Aug 2020 00:42:31 +0900 Message-Id: <20200802154231.2639186-1-katsuhiro@katsuster.net> X-Mailer: git-send-email 2.27.0 MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200802_114246_743554_2948496C X-CRM114-Status: GOOD ( 17.02 ) X-Spam-Score: 0.0 (/) X-Spam-Report: SpamAssassin version 3.4.4 on merlin.infradead.org summary: Content analysis details: (0.0 points) pts rule name description ---- ---------------------- -------------------------------------------------- 0.0 SPF_NONE SPF: sender does not publish an SPF Record 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record X-BeenThere: linux-rockchip@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Upstream kernel work for Rockchip platforms List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Katsuhiro Suzuki , linux-rockchip@lists.infradead.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org Sender: "Linux-rockchip" Errors-To: linux-rockchip-bounces+patchwork-linux-rockchip=patchwork.kernel.org@lists.infradead.org This patch enables HDMI sound (I2S0) and Analog sound (I2S1) which are defined in rk3328.dtsi, and replace SPDIF nodes. We can use SPDIF pass-through with suitable ALSA settings and on mpv or other media players. - Settings: https://github.com/LibreELEC/LibreELEC.tv/blob/master/projects/Rockchip/filesystem/usr/share/alsa/cards/SPDIF.conf - Ex.: mpv foo.ac3 --audio-spdif=ac3 --audio-device='alsa/SPDIF.pcm.iec958.0:SPDIF' [Why use simple-audio-card for SPDIF?] For newly adding nodes, ASoC guys recommend to use audio-graph-card. But all other sound nodes for rk3328 have already been defined by simple-audio-card. In this time, I chose for consistent sound nodes. [DMA allocation problem] After this patch is applied, UART2 will fail to allocate DMA resources but UART driver can work fine without DMA. This error is related to the DMAC of rk3328 (pl330 or compatible). DMAC connected to 16 DMA sources. Each sources have ID number that is called 'Req number' in rk3328 TRM. After this patch is applied total 7 of DMA sources will be activated as follows: | Req number | Source | Required | | | | channels | |------------+--------+-----------| | 8, 9 | SPI0 | 2ch | | 11, 12 | I2S0 | 2ch | | 14, 15 | I2S1 | 2ch | | 10 | SPDIF | 1ch | |------------+--------+-----------| | | Total | 7ch | |------------+--------+-----------| | 6, 7 | UART2 | 2ch | -> cannot get DMA channels Due to rk3328 DMAC specification we can use max 8 channels at same time. If SPI0/I2S0/I2S1/SPDIF will be activated by this patch, required DMAC channels reach to 7. So the last two channels (for UART2) cannot get DMA resources. Virt-dma mechanism for pl0330 DMAC driver is needed to fix this problem. Signed-off-by: Katsuhiro Suzuki --- .../arm64/boot/dts/rockchip/rk3328-rock64.dts | 56 ++++++++----------- 1 file changed, 24 insertions(+), 32 deletions(-) diff --git a/arch/arm64/boot/dts/rockchip/rk3328-rock64.dts b/arch/arm64/boot/dts/rockchip/rk3328-rock64.dts index 86cfb5c50a94..c984662043da 100644 --- a/arch/arm64/boot/dts/rockchip/rk3328-rock64.dts +++ b/arch/arm64/boot/dts/rockchip/rk3328-rock64.dts @@ -84,34 +84,32 @@ standby_led: led-1 { }; }; - sound { - compatible = "audio-graph-card"; - label = "rockchip,rk3328"; - dais = <&i2s1_p0 - &spdif_p0>; + spdif_sound: spdif-sound { + compatible = "simple-audio-card"; + simple-audio-card,name = "SPDIF"; + + simple-audio-card,cpu { + sound-dai = <&spdif>; + }; + + simple-audio-card,codec { + sound-dai = <&spdif_dit>; + }; }; - spdif-dit { + spdif_dit: spdif-dit { compatible = "linux,spdif-dit"; #sound-dai-cells = <0>; - - port { - dit_p0_0: endpoint { - remote-endpoint = <&spdif_p0_0>; - }; - }; }; }; +&analog_sound { + status = "okay"; +}; + &codec { mute-gpios = <&grf_gpio 0 GPIO_ACTIVE_LOW>; status = "okay"; - - port@0 { - codec_p0_0: endpoint { - remote-endpoint = <&i2s1_p0_0>; - }; - }; }; &cpu0 { @@ -163,6 +161,10 @@ &hdmi { status = "okay"; }; +&hdmi_sound { + status = "okay"; +}; + &hdmiphy { status = "okay"; }; @@ -278,16 +280,12 @@ regulator-state-mem { }; }; -&i2s1 { +&i2s0 { status = "okay"; +}; - i2s1_p0: port { - i2s1_p0_0: endpoint { - dai-format = "i2s"; - mclk-fs = <256>; - remote-endpoint = <&codec_p0_0>; - }; - }; +&i2s1 { + status = "okay"; }; &io_domains { @@ -337,12 +335,6 @@ &sdmmc { &spdif { pinctrl-0 = <&spdifm0_tx>; status = "okay"; - - spdif_p0: port { - spdif_p0_0: endpoint { - remote-endpoint = <&dit_p0_0>; - }; - }; }; &spi0 {