From nobody Wed Jul 1 17:37:44 2026 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 F0B53C4332F for ; Fri, 17 Dec 2021 17:58:19 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240068AbhLQR6R (ORCPT ); Fri, 17 Dec 2021 12:58:17 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36528 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240006AbhLQR6G (ORCPT ); Fri, 17 Dec 2021 12:58:06 -0500 Received: from mail-lj1-x22b.google.com (mail-lj1-x22b.google.com [IPv6:2a00:1450:4864:20::22b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 65D89C061574; Fri, 17 Dec 2021 09:58:06 -0800 (PST) Received: by mail-lj1-x22b.google.com with SMTP id b19so4544819ljr.12; Fri, 17 Dec 2021 09:58:06 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=FB8NrCq6c0f8jOXV4dsj1D+bh3p8PUaX1SHo3nADxp4=; b=DTTzqDWsrj8mQnQqF5bFz1nJoz4ryQ+TBjJ62UPxuqmU1c6lfqA3zhDCj1aI/J8Yqs u4gpHSQ6WBL0e3X2bV4yz+uI+C+cGQ2tJp14M5lESuw6+Z7rfVgI3VBVB52dUxtP3TrB ycu4MtjczH4KO5DLTU3GZCi2sqDRm6qlWUmhyDljTVdpxNNxVrtzG9G6Kr57lYOrljZd ElKFgEBwiQalsAuX1UslJcbh/5/cy91pl83mFMkqKhXvvbwzf6fyDCkxPIR4gTeo3VY7 YSdMIVQ5vGG0fRJvKVjCe7wEnOO28+SvkBQhWLrjsb8iO0qKdgxU5OB+YHlQcu1oBgwf S8/Q== 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=FB8NrCq6c0f8jOXV4dsj1D+bh3p8PUaX1SHo3nADxp4=; b=53B2JX10QtW241Ew6eWWbRuK4HT4+se9vsXmPKlAM+yp9JB/Wmgel9GUTEGgxXuDKN MMh5MtcgyMNG7waTree8YCEsIQZT7j7g0ysvAiDueWFibVUUI0GC9Lkbh2voTRVug/P7 SIzTio1RDwTOAwu5SpZbtJOWg6dYoUgDKjCU2pw88vr5BcYaQcVRVQYfh6iNPU9aIsx8 WfAvg7di66AnBFVWnCycoi+pH/1WucFQKnQQSzTo+9AONpIMYeNZ+vRwPj/GyCSU6pG9 /PKxkVtoaZ9glnHWb0piEAvAKmqRTi/450zL5efElQUqS7UZMjX0iehYWCJQxUaaHLRh t8jw== X-Gm-Message-State: AOAM533OkY21eAP2H48NKFR/5CsTpIs6pPh4qLwy24jFbflpXkgUC+uG 9iXg0+LjdxfATkN5fC9Rxaw= X-Google-Smtp-Source: ABdhPJw5GliGY6dDen834MJOvCLphrGd/gm1fsIvCdMW/uW2lbBnsZTOwSnfyo+8Q8xQqR2DeFRK5A== X-Received: by 2002:a2e:8691:: with SMTP id l17mr3559188lji.119.1639763884754; Fri, 17 Dec 2021 09:58:04 -0800 (PST) Received: from localhost.localdomain (94-29-63-156.dynamic.spd-mgts.ru. [94.29.63.156]) by smtp.gmail.com with ESMTPSA id w23sm1479244lfa.191.2021.12.17.09.58.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 17 Dec 2021 09:58:04 -0800 (PST) From: Dmitry Osipenko To: Thierry Reding , Jonathan Hunter , Mark Brown , Takashi Iwai , Jaroslav Kysela , Liam Girdwood , Agneli Cc: linux-tegra@vger.kernel.org, alsa-devel@alsa-project.org, linux-kernel@vger.kernel.org, devicetree@vger.kernel.org Subject: [PATCH v5 01/11] ASoC: dt-bindings: Add binding for Tegra20 S/PDIF Date: Fri, 17 Dec 2021 20:55:56 +0300 Message-Id: <20211217175606.22645-2-digetx@gmail.com> X-Mailer: git-send-email 2.33.1 In-Reply-To: <20211217175606.22645-1-digetx@gmail.com> References: <20211217175606.22645-1-digetx@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" Add device-tree binding for Tegra20 S/PDIF controller. Reviewed-by: Rob Herring Acked-by: Thierry Reding Signed-off-by: Dmitry Osipenko --- .../bindings/sound/nvidia,tegra20-spdif.yaml | 85 +++++++++++++++++++ 1 file changed, 85 insertions(+) create mode 100644 Documentation/devicetree/bindings/sound/nvidia,tegra20-= spdif.yaml diff --git a/Documentation/devicetree/bindings/sound/nvidia,tegra20-spdif.y= aml b/Documentation/devicetree/bindings/sound/nvidia,tegra20-spdif.yaml new file mode 100644 index 000000000000..296248eed0ee --- /dev/null +++ b/Documentation/devicetree/bindings/sound/nvidia,tegra20-spdif.yaml @@ -0,0 +1,85 @@ +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/sound/nvidia,tegra20-spdif.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: NVIDIA Tegra20 S/PDIF Controller + +description: | + The S/PDIF controller supports both input and output in serial audio + digital interface format. The input controller can digitally recover + a clock from the received stream. The S/PDIF controller is also used + to generate the embedded audio for HDMI output channel. + +maintainers: + - Thierry Reding + - Jon Hunter + +properties: + compatible: + const: nvidia,tegra20-spdif + + reg: + maxItems: 1 + + interrupts: + maxItems: 1 + + clocks: + minItems: 2 + + clock-names: + items: + - const: out + - const: in + + resets: + maxItems: 1 + + dmas: + minItems: 2 + + dma-names: + items: + - const: rx + - const: tx + + "#sound-dai-cells": + const: 0 + + nvidia,fixed-parent-rate: + description: | + Specifies whether board prefers parent clock to stay at a fixed rate. + This allows multiple Tegra20 audio components work simultaneously by + limiting number of supportable audio rates. + type: boolean + +required: + - compatible + - reg + - interrupts + - clocks + - clock-names + - resets + - dmas + - dma-names + - "#sound-dai-cells" + +additionalProperties: false + +examples: + - | + spdif@70002400 { + compatible =3D "nvidia,tegra20-spdif"; + reg =3D <0x70002400 0x200>; + interrupts =3D <77>; + clocks =3D <&clk 99>, <&clk 98>; + clock-names =3D "out", "in"; + resets =3D <&rst 10>; + dmas =3D <&apbdma 3>, <&apbdma 3>; + dma-names =3D "rx", "tx"; + #sound-dai-cells =3D <0>; + }; + +... --=20 2.33.1 From nobody Wed Jul 1 17:37:44 2026 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 70B06C433EF for ; Fri, 17 Dec 2021 17:58:30 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240098AbhLQR60 (ORCPT ); Fri, 17 Dec 2021 12:58:26 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36532 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240011AbhLQR6H (ORCPT ); Fri, 17 Dec 2021 12:58:07 -0500 Received: from mail-lf1-x131.google.com (mail-lf1-x131.google.com [IPv6:2a00:1450:4864:20::131]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1F647C06173E; Fri, 17 Dec 2021 09:58:07 -0800 (PST) Received: by mail-lf1-x131.google.com with SMTP id k37so6299811lfv.3; Fri, 17 Dec 2021 09:58:07 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=B10/DVlO3DNsnWTrb5zfh6CpHUm8NxkT51bMpGLaM+c=; b=Z9Pva736dbKy/rOtsePTw7Xth8b3Lg3wqHgEYOO2gg0DYuezuwlJtF51rIxsJ7Fbnw LGB3DV4NVssVDFZCiFxxKfB1tiE0JWGyLsXngQCqnqz/IPEG99n/bKTNbcOYtLfpyjIY LGp8l/ZOrW+gFktdcMPq3Rj6l1Dr56MR72X3atHoridzffcqFYMLUVjMFGdIkq3MBxuu g3js8GcgDvBnvr8QofIZKicUZBsjRCZU5mPqSh6NjIelJB+8Wx1rOQzibEMUxz/NeY2t Qrs20DzJk8DgSrt/jLK6UakPCgHl9gA7p6P7pPLZ+zMf8YUlQYUXC2h4hyiF1PbxTW5J q1vQ== 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=B10/DVlO3DNsnWTrb5zfh6CpHUm8NxkT51bMpGLaM+c=; b=fI7dGRlCdFteEjGBkZblQslfQ3pFzxOagZJNAp5clFazC/AyTKojPr0aTZrVUktXAb PvQvaJJ7quG1engoPlzw1uKiwbaCUCcW4QnRWhHauUE8gwaCb2ePX49zUFHJOda1isCK 1pnBymdfDOeGjSZboJGWrbEHBBobAI+2mBddrTjr8xJBOLQ5ojeJEQ9w2HLRGCEuyRjs jqrgj1I9YCPAyIvRL3K+GCb7vwqdiTi3EbsimYswlde7kdJ07CyCjXOCk0gZFblyTldv q1lX2xF/zVQyrdPFe+/1+9U9ra7feGodwca6B44jPsr2j/ikkb9PgV3PEMAnRTsdnF61 aWqQ== X-Gm-Message-State: AOAM532vZSi9IVu41gn/AJgkFZIGkDmyF421zlKy0K1pz85jj/BQML2I 7Ji8Ugi2X5BC0meVOg8UtXw= X-Google-Smtp-Source: ABdhPJzIDoIHo8AsB3EFB9eSksV0BQgYDEVpLjZQEglYFnulSrS5VzlTtEYKH8rFNpDfkaj/f+ZS8A== X-Received: by 2002:a05:6512:1047:: with SMTP id c7mr1147851lfb.2.1639763885445; Fri, 17 Dec 2021 09:58:05 -0800 (PST) Received: from localhost.localdomain (94-29-63-156.dynamic.spd-mgts.ru. [94.29.63.156]) by smtp.gmail.com with ESMTPSA id w23sm1479244lfa.191.2021.12.17.09.58.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 17 Dec 2021 09:58:05 -0800 (PST) From: Dmitry Osipenko To: Thierry Reding , Jonathan Hunter , Mark Brown , Takashi Iwai , Jaroslav Kysela , Liam Girdwood , Agneli Cc: linux-tegra@vger.kernel.org, alsa-devel@alsa-project.org, linux-kernel@vger.kernel.org, devicetree@vger.kernel.org Subject: [PATCH v5 02/11] ASoC: dt-bindings: tegra20-i2s: Convert to schema Date: Fri, 17 Dec 2021 20:55:57 +0300 Message-Id: <20211217175606.22645-3-digetx@gmail.com> X-Mailer: git-send-email 2.33.1 In-Reply-To: <20211217175606.22645-1-digetx@gmail.com> References: <20211217175606.22645-1-digetx@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" Convert NVIDIA Tegra20 I2S binding to schema. Reviewed-by: Rob Herring Acked-by: Thierry Reding Signed-off-by: Dmitry Osipenko --- .../bindings/sound/nvidia,tegra20-i2s.txt | 30 -------- .../bindings/sound/nvidia,tegra20-i2s.yaml | 70 +++++++++++++++++++ 2 files changed, 70 insertions(+), 30 deletions(-) delete mode 100644 Documentation/devicetree/bindings/sound/nvidia,tegra20-= i2s.txt create mode 100644 Documentation/devicetree/bindings/sound/nvidia,tegra20-= i2s.yaml diff --git a/Documentation/devicetree/bindings/sound/nvidia,tegra20-i2s.txt= b/Documentation/devicetree/bindings/sound/nvidia,tegra20-i2s.txt deleted file mode 100644 index dc30c6bfbe95..000000000000 --- a/Documentation/devicetree/bindings/sound/nvidia,tegra20-i2s.txt +++ /dev/null @@ -1,30 +0,0 @@ -NVIDIA Tegra 20 I2S controller - -Required properties: -- compatible : "nvidia,tegra20-i2s" -- reg : Should contain I2S registers location and length -- interrupts : Should contain I2S interrupt -- resets : Must contain an entry for each entry in reset-names. - See ../reset/reset.txt for details. -- reset-names : Must include the following entries: - - i2s -- dmas : Must contain an entry for each entry in clock-names. - See ../dma/dma.txt for details. -- dma-names : Must include the following entries: - - rx - - tx -- clocks : Must contain one entry, for the module clock. - See ../clocks/clock-bindings.txt for details. - -Example: - -i2s@70002800 { - compatible =3D "nvidia,tegra20-i2s"; - reg =3D <0x70002800 0x200>; - interrupts =3D < 45 >; - clocks =3D <&tegra_car 11>; - resets =3D <&tegra_car 11>; - reset-names =3D "i2s"; - dmas =3D <&apbdma 21>, <&apbdma 21>; - dma-names =3D "rx", "tx"; -}; diff --git a/Documentation/devicetree/bindings/sound/nvidia,tegra20-i2s.yam= l b/Documentation/devicetree/bindings/sound/nvidia,tegra20-i2s.yaml new file mode 100644 index 000000000000..4c00fd0943c3 --- /dev/null +++ b/Documentation/devicetree/bindings/sound/nvidia,tegra20-i2s.yaml @@ -0,0 +1,70 @@ +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/sound/nvidia,tegra20-i2s.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: NVIDIA Tegra20 I2S Controller + +description: | + The I2S Controller streams synchronous serial audio data between system + memory and an external audio device. The controller supports the I2S Left + Justified Mode, Right Justified Mode, and DSP mode formats. + +maintainers: + - Thierry Reding + - Jon Hunter + +properties: + compatible: + const: nvidia,tegra20-i2s + + reg: + maxItems: 1 + + interrupts: + maxItems: 1 + + clocks: + minItems: 1 + + resets: + maxItems: 1 + + reset-names: + const: i2s + + dmas: + minItems: 2 + + dma-names: + items: + - const: rx + - const: tx + +required: + - compatible + - reg + - interrupts + - clocks + - resets + - reset-names + - dmas + - dma-names + +additionalProperties: false + +examples: + - | + i2s@70002800 { + compatible =3D "nvidia,tegra20-i2s"; + reg =3D <0x70002800 0x200>; + interrupts =3D <45>; + clocks =3D <&tegra_car 11>; + resets =3D <&tegra_car 11>; + reset-names =3D "i2s"; + dmas =3D <&apbdma 21>, <&apbdma 21>; + dma-names =3D "rx", "tx"; + }; + +... --=20 2.33.1 From nobody Wed Jul 1 17:37:44 2026 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 CF35DC433EF for ; Fri, 17 Dec 2021 17:58:34 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240026AbhLQR6d (ORCPT ); Fri, 17 Dec 2021 12:58:33 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36534 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240017AbhLQR6I (ORCPT ); Fri, 17 Dec 2021 12:58:08 -0500 Received: from mail-lf1-x134.google.com (mail-lf1-x134.google.com [IPv6:2a00:1450:4864:20::134]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C3750C06173F; Fri, 17 Dec 2021 09:58:07 -0800 (PST) Received: by mail-lf1-x134.google.com with SMTP id l22so6240320lfg.7; Fri, 17 Dec 2021 09:58:07 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=s/Bk94jGQ1LLUV/eRDOVPSiVwi8PZOkXJ4VQl4ZqdBQ=; b=gd63/Dw9Nrlh//jLnmbfLktqpbCfnCD3MEQ9pshOVhQ2eQsgiaFVevrd/BHZ8mEqP/ 4Gw3BmuYCVBIjn5/H8W9nYnUXgTg2/O6WnKwRvGBtPtcsoV3P4BaaNNbRl+zAOMMf56t AvWvQO+fG8YS+Nku5Xh0aY7fRG5K7h2H+cObqJtjnNUM9CLiM+Zhqm0+imnsBcpwJUoH +znY2TxLKLVZKO5Z39+heBCOZ1JMBODO0DjWMA2rrqye26kYK/T6Jh+pmXMYxIrea17L gzJ1yec4Gb60E8nyQGKAXn/8rHwAbnz7meXhwMquCDQztKygRaRVy8zZurWIf3FG/D6j kpIQ== 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=s/Bk94jGQ1LLUV/eRDOVPSiVwi8PZOkXJ4VQl4ZqdBQ=; b=7RO5Pgte6qTWA2CWFvEb8cmWmQnOtZCj+Ngs2Rqc+h8P3/JyT4F6WKeBXV9UueoYh4 y2HwUWJPxtOrzwh3BxzQPhFLISVQXq67UmvxgbuXKgHOqVu0LW80A0lvhaZ3qM3w3VDE ayfOxVW5wNcyuUn0LKuwNnN7AQp5afYKS9ZGKRBw9x5RZ4InKyFZr9jt3nNJyLkozmBZ SDLFqRzG8niRcR/FZYzmf2TuN1LDxUzl2mAQU2WV2THn0oJF1572TrSwfxLlCxbsAhag kV1ulCmtMQYJ3W5EkP4fYPQbdMiihFOd6XzxMLHHAZa9JIBUrtvhpaUlIHyX3YZlB/l9 rnQg== X-Gm-Message-State: AOAM531TGxnGv/ivNIdVNQKxUuLnaetx3ZCIZuEXBgSCpfZbrYHAVxci 08YL5nvZcwUL2tBp4Fbg8r0= X-Google-Smtp-Source: ABdhPJzKaTTjJXre0dua8RwNlcxh74FOq2omKWYA7DY5cm1l0mFZGhkM+tnLSdB8x+VlxMCmD1u4NA== X-Received: by 2002:a05:6512:3f98:: with SMTP id x24mr3789088lfa.87.1639763886133; Fri, 17 Dec 2021 09:58:06 -0800 (PST) Received: from localhost.localdomain (94-29-63-156.dynamic.spd-mgts.ru. [94.29.63.156]) by smtp.gmail.com with ESMTPSA id w23sm1479244lfa.191.2021.12.17.09.58.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 17 Dec 2021 09:58:05 -0800 (PST) From: Dmitry Osipenko To: Thierry Reding , Jonathan Hunter , Mark Brown , Takashi Iwai , Jaroslav Kysela , Liam Girdwood , Agneli Cc: linux-tegra@vger.kernel.org, alsa-devel@alsa-project.org, linux-kernel@vger.kernel.org, devicetree@vger.kernel.org Subject: [PATCH v5 03/11] ASoC: dt-bindings: tegra20-i2s: Document new nvidia,fixed-parent-rate property Date: Fri, 17 Dec 2021 20:55:58 +0300 Message-Id: <20211217175606.22645-4-digetx@gmail.com> X-Mailer: git-send-email 2.33.1 In-Reply-To: <20211217175606.22645-1-digetx@gmail.com> References: <20211217175606.22645-1-digetx@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" Document new nvidia,fixed-parent-rate property which instructs that this board wants parent clock to stay at a fixed rate. It allows to prevent conflicts between audio components that share same parent PLL. For instance, this property allows to have HDMI audio, speaker and headphones in the system playing audio simultaneously, which is a common pattern for consumer devices. Reviewed-by: Rob Herring Acked-by: Thierry Reding Signed-off-by: Dmitry Osipenko --- .../devicetree/bindings/sound/nvidia,tegra20-i2s.yaml | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/Documentation/devicetree/bindings/sound/nvidia,tegra20-i2s.yam= l b/Documentation/devicetree/bindings/sound/nvidia,tegra20-i2s.yaml index 4c00fd0943c3..0572aceca8ab 100644 --- a/Documentation/devicetree/bindings/sound/nvidia,tegra20-i2s.yaml +++ b/Documentation/devicetree/bindings/sound/nvidia,tegra20-i2s.yaml @@ -42,6 +42,13 @@ properties: - const: rx - const: tx =20 + nvidia,fixed-parent-rate: + description: | + Specifies whether board prefers parent clock to stay at a fixed rate. + This allows multiple Tegra20 audio components work simultaneously by + limiting number of supportable audio rates. + type: boolean + required: - compatible - reg --=20 2.33.1 From nobody Wed Jul 1 17:37:44 2026 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 95546C43219 for ; Fri, 17 Dec 2021 17:58:36 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240146AbhLQR6f (ORCPT ); Fri, 17 Dec 2021 12:58:35 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36544 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236297AbhLQR6J (ORCPT ); Fri, 17 Dec 2021 12:58:09 -0500 Received: from mail-lf1-x130.google.com (mail-lf1-x130.google.com [IPv6:2a00:1450:4864:20::130]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 831C4C061401; Fri, 17 Dec 2021 09:58:08 -0800 (PST) Received: by mail-lf1-x130.google.com with SMTP id br40so3830063lfb.1; Fri, 17 Dec 2021 09:58:08 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=aXAi7CWSEqrGpygWLYaMuBzle5xA6rjl70U8+IK/iig=; b=gAf4vyWyDfBTmYvS814WS61PNOSjB6i0X1eYRP0Rt8E5afKVZXPICIFg+8N4+3NFrW d32TxT8TIG0FrREeY+jkAPX85b9rF08H1rcxj/bxPs+y4J3hCWVrCT6Ph9+K9nft4UJ6 YAwnamhOU5dP5HNR0K+ICe9oMHcRVrgHpCSQrPG7N4fUYV5jF8ZKreXCRExWKb67zs9p bl7v0Xlu6mSkaSDzl4TgqRQ9uZC4OP+XvfWq/GsQ9W5FU54DZbImeqcLUR3jEKKti1HH jQVpeEiNdK7x+lD+vR96JJZ0OekFRP2k0g33yiim+vq2ZMS1QVZ/EnXkMAOddv7NE9Xx k01g== 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=aXAi7CWSEqrGpygWLYaMuBzle5xA6rjl70U8+IK/iig=; b=1bzzGNuCKB/nRngeU7Q6KKfFuqH/XPejT2widwKlOVBTEKIkctNKuehRERgw43Jsx8 7eRU/YyLQF03obse8U4Nvc3uKcyHZ/bVd7N0jN8AHZpUPzmXeQHpC0faxlcZMl3qWtTm quIfQpokP2dzsh/Zv7uySSBHRFLwul1H/kvX7idS9oJGY3AbNomusmQwH6jZYrwjvW+u KQgydq0t+0QB+xgCxAeNsxkw6OBxU36U8jEAWUU7IPrZ3TDdmH5WwtTJxx0eXsuNY9mS l0IolzTkX70vSnejeM1WJuI9n4uz014ur3/v+D4nJ0UDFBrWta6+cqe97MvL3XAXBgrc UIIA== X-Gm-Message-State: AOAM530yh3se2fvv5ELXONupPE9swILxIEukYEEg+YlzanQy+QV9ZfEO fS2l2JphEgKq4p2JrQCEz0Q= X-Google-Smtp-Source: ABdhPJx35Ue2iDa1rMg6didg0FwagKJ9F9E5Stnc4n+YyJyNpV5/4ppZhzZlsSFN2XSSAWQK8ElASA== X-Received: by 2002:a05:6512:31d:: with SMTP id t29mr3745033lfp.331.1639763886836; Fri, 17 Dec 2021 09:58:06 -0800 (PST) Received: from localhost.localdomain (94-29-63-156.dynamic.spd-mgts.ru. [94.29.63.156]) by smtp.gmail.com with ESMTPSA id w23sm1479244lfa.191.2021.12.17.09.58.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 17 Dec 2021 09:58:06 -0800 (PST) From: Dmitry Osipenko To: Thierry Reding , Jonathan Hunter , Mark Brown , Takashi Iwai , Jaroslav Kysela , Liam Girdwood , Agneli Cc: linux-tegra@vger.kernel.org, alsa-devel@alsa-project.org, linux-kernel@vger.kernel.org, devicetree@vger.kernel.org Subject: [PATCH v5 04/11] ASoC: tegra20: spdif: Set FIFO trigger level Date: Fri, 17 Dec 2021 20:55:59 +0300 Message-Id: <20211217175606.22645-5-digetx@gmail.com> X-Mailer: git-send-email 2.33.1 In-Reply-To: <20211217175606.22645-1-digetx@gmail.com> References: <20211217175606.22645-1-digetx@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" FIFO trigger level must be bigger than or equal to the size of DMA burst, otherwise audio will be played x4 faster than it should be because part of the DMA data will be dropped on FIFO input buffer overflow. Acked-by: Thierry Reding Signed-off-by: Dmitry Osipenko --- sound/soc/tegra/tegra20_spdif.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/sound/soc/tegra/tegra20_spdif.c b/sound/soc/tegra/tegra20_spdi= f.c index 57a6c576b91f..e45e371edc42 100644 --- a/sound/soc/tegra/tegra20_spdif.c +++ b/sound/soc/tegra/tegra20_spdif.c @@ -69,6 +69,14 @@ static int tegra20_spdif_hw_params(struct snd_pcm_substr= eam *substream, =20 regmap_update_bits(spdif->regmap, TEGRA20_SPDIF_CTRL, mask, val); =20 + /* + * FIFO trigger level must be bigger than DMA burst or equal to it, + * otherwise data is discarded on overflow. + */ + regmap_update_bits(spdif->regmap, TEGRA20_SPDIF_DATA_FIFO_CSR, + TEGRA20_SPDIF_DATA_FIFO_CSR_TX_ATN_LVL_MASK, + TEGRA20_SPDIF_DATA_FIFO_CSR_TX_ATN_LVL_TU4_WORD_FULL); + switch (params_rate(params)) { case 32000: spdifclock =3D 4096000; --=20 2.33.1 From nobody Wed Jul 1 17:37:44 2026 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 C52F4C4321E for ; Fri, 17 Dec 2021 17:58:37 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240156AbhLQR6g (ORCPT ); Fri, 17 Dec 2021 12:58:36 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36548 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240025AbhLQR6J (ORCPT ); Fri, 17 Dec 2021 12:58:09 -0500 Received: from mail-lf1-x132.google.com (mail-lf1-x132.google.com [IPv6:2a00:1450:4864:20::132]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2C771C061746; Fri, 17 Dec 2021 09:58:09 -0800 (PST) Received: by mail-lf1-x132.google.com with SMTP id t3so6172253lfe.12; Fri, 17 Dec 2021 09:58:09 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=Aa9yOoBAsbVbHG/p5jLgnwkk1qHi5k7LSoJyKHkxWf8=; b=Hp038EhPsEX/h9Yl3bv4AclbmQNLVpsMCwmu+Kap3o46DhCTol4mS+RxfvPnIndB+W 337wZ6Qeji9i20vF3dYXIufPjaTC5zEeeAro27XaYktqAqdzx0f1sHUNaoz6723np3C8 tg9prHr8luMRr9nwPCzZ3pvGOeNQgXohRf+7ACcOEOuseMgIKL11x5na7fzW4cJ1JP6S /NwIqyso0eqSOfGhK0+AQJnpPQPVzcexsSRgHr8Q9QsrlgeiEcD5LUQAtD5m3BNWNRk8 MrAxR5p/h/W80Av/jEoAOarE7gcJCdBMjO1G/cCh72JJvu78aVRg1JJediQlhSHXHNiu Dp9g== 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=Aa9yOoBAsbVbHG/p5jLgnwkk1qHi5k7LSoJyKHkxWf8=; b=7zL+yjLQ+s+aSsqiXxK0sj8R9eUwVgFFR6cwzrp4kdJuT++Mx0VTOdHVOReCw3rRtk 3Ufd5r/6UGz/PTKr18sZwbvVfoCDSJ8BkVcjo7Y9I5AT9jkfQLV/2sSdUPS2n7ygHeZY GNQThUBcmFncRJwj8jEnmNgK0ghJZ+n0FxhE2w2kzseNRRjG+YfvVgs4GDJnPyNz7zP1 8aQsbs0HUkCejz51GIJvJy66EVdJDjaoa5XMkjYcfXaLZSfm0Vx0S5HUUnTa8n8xV7Fw cDBUN15QlYuEOgkhT/EK5x4E1yKxUWUzxwj1dqPaoTyiwH+L8n5D7nvpE9rdwpCtDCqd 05zA== X-Gm-Message-State: AOAM532MpoUSkSpvgzZItfllnUA9pm0t0baRE+v19r4xreMguFchee0w WodK0l3RyGr0DvtwhetzqNLd6BUZYtE= X-Google-Smtp-Source: ABdhPJxDbG9C/hfS2qMWQsIB4NCcsWLXQr40hT4oghlO4QZ/abjfdAKcGOjou7Lqh1mV0z92cH0Wuw== X-Received: by 2002:a05:6512:b14:: with SMTP id w20mr3659502lfu.164.1639763887504; Fri, 17 Dec 2021 09:58:07 -0800 (PST) Received: from localhost.localdomain (94-29-63-156.dynamic.spd-mgts.ru. [94.29.63.156]) by smtp.gmail.com with ESMTPSA id w23sm1479244lfa.191.2021.12.17.09.58.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 17 Dec 2021 09:58:07 -0800 (PST) From: Dmitry Osipenko To: Thierry Reding , Jonathan Hunter , Mark Brown , Takashi Iwai , Jaroslav Kysela , Liam Girdwood , Agneli Cc: linux-tegra@vger.kernel.org, alsa-devel@alsa-project.org, linux-kernel@vger.kernel.org, devicetree@vger.kernel.org Subject: [PATCH v5 05/11] ASoC: tegra20: spdif: Support device-tree Date: Fri, 17 Dec 2021 20:56:00 +0300 Message-Id: <20211217175606.22645-6-digetx@gmail.com> X-Mailer: git-send-email 2.33.1 In-Reply-To: <20211217175606.22645-1-digetx@gmail.com> References: <20211217175606.22645-1-digetx@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" Tegra20 S/PDIF driver was added in a pre-DT era and was never used since that time. Revive driver by adding device-tree support. Acked-by: Thierry Reding Signed-off-by: Dmitry Osipenko --- sound/soc/tegra/tegra20_spdif.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/sound/soc/tegra/tegra20_spdif.c b/sound/soc/tegra/tegra20_spdi= f.c index e45e371edc42..801784915004 100644 --- a/sound/soc/tegra/tegra20_spdif.c +++ b/sound/soc/tegra/tegra20_spdif.c @@ -10,6 +10,7 @@ #include #include #include +#include #include #include #include @@ -270,7 +271,7 @@ static int tegra20_spdif_platform_probe(struct platform= _device *pdev) =20 dev_set_drvdata(&pdev->dev, spdif); =20 - spdif->clk_spdif_out =3D devm_clk_get(&pdev->dev, "spdif_out"); + spdif->clk_spdif_out =3D devm_clk_get(&pdev->dev, "out"); if (IS_ERR(spdif->clk_spdif_out)) { pr_err("Can't retrieve spdif clock\n"); ret =3D PTR_ERR(spdif->clk_spdif_out); @@ -340,10 +341,17 @@ static const struct dev_pm_ops tegra20_spdif_pm_ops = =3D { tegra20_spdif_runtime_resume, NULL) }; =20 +static const struct of_device_id tegra20_spdif_of_match[] =3D { + { .compatible =3D "nvidia,tegra20-spdif", }, + {}, +}; +MODULE_DEVICE_TABLE(of, tegra20_spdif_of_match); + static struct platform_driver tegra20_spdif_driver =3D { .driver =3D { .name =3D DRV_NAME, .pm =3D &tegra20_spdif_pm_ops, + .of_match_table =3D tegra20_spdif_of_match, }, .probe =3D tegra20_spdif_platform_probe, .remove =3D tegra20_spdif_platform_remove, @@ -354,4 +362,3 @@ module_platform_driver(tegra20_spdif_driver); MODULE_AUTHOR("Stephen Warren "); MODULE_DESCRIPTION("Tegra20 SPDIF ASoC driver"); MODULE_LICENSE("GPL"); -MODULE_ALIAS("platform:" DRV_NAME); --=20 2.33.1 From nobody Wed Jul 1 17:37:44 2026 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 9433AC433FE for ; Fri, 17 Dec 2021 17:58:38 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240164AbhLQR6h (ORCPT ); Fri, 17 Dec 2021 12:58:37 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36550 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240008AbhLQR6K (ORCPT ); Fri, 17 Dec 2021 12:58:10 -0500 Received: from mail-lj1-x22a.google.com (mail-lj1-x22a.google.com [IPv6:2a00:1450:4864:20::22a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D5E90C061747; Fri, 17 Dec 2021 09:58:09 -0800 (PST) Received: by mail-lj1-x22a.google.com with SMTP id p8so4597904ljo.5; Fri, 17 Dec 2021 09:58:09 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=eqLuVXC4jwufxGK1dX3uLmtIMBuslaR2IYjyNFht/Gg=; b=eVsiYbxgI3SySynHVDPZjsz0AyNzwxQlGuvam0ExZRcWjLsqMPtnMrX938mJ3xZOtu Jqdh44zdQuqX+HpZQJiTNx1xGLtx/q2IDMBBwEnW3k1qsg0991IRHMmm5xzWyGwDoyGb ZJGFfaQFEYOe4iFSNmFDc+wgYH4RsGWTYzDiiMReUr7JqXUFiRYGUwoCLLX+aP/2ihLn 7nxqZ7ruNTZ1zk6h/73+0b+51k2Pcek0meD56cPUAbmKSRDwMRO5TQY46FT8CqyRA5i/ TmHP8eUFlgOGAzzN0FdzdsZZH/tbnZHvNipUbp2+1qA7aenRwYYn1fdhgegXmN1O6ufw ykZw== 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=eqLuVXC4jwufxGK1dX3uLmtIMBuslaR2IYjyNFht/Gg=; b=ge7EE2yoseOsHTPGLxcL22q6LSd2ArPbrJtzEPJTV0ORZ2aH6+L9UVJvTEGgeAkTHk NVvCb9xeFk+FgMbn+wocKCxYAUlwF+vFW/hwxTd175gQjMfEWbf4I0/n3nGUCjSBA0Qd jzI7Bbpf/zxWPXFZ8w8TYF/1dXBFJcUwq/0kXbEmCEhD5cKmHQbTENHbwKDWCoAGoSi9 +q+a9/GYW573fzNNL8kWbSzvQy/ycvircpsDw8BVuUM4zSeZqiVjsjh4Urcx1y9dxMrc cL014KG3fOma+TQXyyLENs0rIQ9ffgq22hfwujkjK5hAl0TRBfPR3v2+X3bwwrVOdGnh N1eQ== X-Gm-Message-State: AOAM531YybuXi6ohM4JYFhIieGpdI5bk6iZnqUP8jlc58FVGWHTcZIEo 1BGEH/VLaWtBkdx4kzuOStI= X-Google-Smtp-Source: ABdhPJyOv4C4jOeRdPJOG+B9sXUeBtRuepkZaN8QgUTqZOcmKtNHWB40FMVBmrpbEHpup8ZgQVAvlQ== X-Received: by 2002:a2e:5d7:: with SMTP id 206mr3790803ljf.133.1639763888185; Fri, 17 Dec 2021 09:58:08 -0800 (PST) Received: from localhost.localdomain (94-29-63-156.dynamic.spd-mgts.ru. [94.29.63.156]) by smtp.gmail.com with ESMTPSA id w23sm1479244lfa.191.2021.12.17.09.58.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 17 Dec 2021 09:58:07 -0800 (PST) From: Dmitry Osipenko To: Thierry Reding , Jonathan Hunter , Mark Brown , Takashi Iwai , Jaroslav Kysela , Liam Girdwood , Agneli Cc: linux-tegra@vger.kernel.org, alsa-devel@alsa-project.org, linux-kernel@vger.kernel.org, devicetree@vger.kernel.org Subject: [PATCH v5 06/11] ASoC: tegra20: spdif: Improve driver's code Date: Fri, 17 Dec 2021 20:56:01 +0300 Message-Id: <20211217175606.22645-7-digetx@gmail.com> X-Mailer: git-send-email 2.33.1 In-Reply-To: <20211217175606.22645-1-digetx@gmail.com> References: <20211217175606.22645-1-digetx@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" - Clean up whitespaces, defines and variables. - Remove obsolete code. - Adhere to upstream coding style. - Don't override returned error code. - Replace pr_err with dev_err. No functional changes are made by this patch. This is a minor code's refactoring that will ease further maintenance of the driver. Acked-by: Thierry Reding Signed-off-by: Dmitry Osipenko --- sound/soc/tegra/tegra20_spdif.c | 49 ++++++++++++--------------------- 1 file changed, 18 insertions(+), 31 deletions(-) diff --git a/sound/soc/tegra/tegra20_spdif.c b/sound/soc/tegra/tegra20_spdi= f.c index 801784915004..d5c618611dbb 100644 --- a/sound/soc/tegra/tegra20_spdif.c +++ b/sound/soc/tegra/tegra20_spdif.c @@ -23,8 +23,6 @@ =20 #include "tegra20_spdif.h" =20 -#define DRV_NAME "tegra20-spdif" - static __maybe_unused int tegra20_spdif_runtime_suspend(struct device *dev) { struct tegra20_spdif *spdif =3D dev_get_drvdata(dev); @@ -49,11 +47,10 @@ static __maybe_unused int tegra20_spdif_runtime_resume(= struct device *dev) } =20 static int tegra20_spdif_hw_params(struct snd_pcm_substream *substream, - struct snd_pcm_hw_params *params, - struct snd_soc_dai *dai) + struct snd_pcm_hw_params *params, + struct snd_soc_dai *dai) { - struct device *dev =3D dai->dev; - struct tegra20_spdif *spdif =3D snd_soc_dai_get_drvdata(dai); + struct tegra20_spdif *spdif =3D dev_get_drvdata(dai->dev); unsigned int mask =3D 0, val =3D 0; int ret, spdifclock; =20 @@ -106,7 +103,7 @@ static int tegra20_spdif_hw_params(struct snd_pcm_subst= ream *substream, =20 ret =3D clk_set_rate(spdif->clk_spdif_out, spdifclock); if (ret) { - dev_err(dev, "Can't set SPDIF clock rate: %d\n", ret); + dev_err(dai->dev, "Can't set SPDIF clock rate: %d\n", ret); return ret; } =20 @@ -127,9 +124,9 @@ static void tegra20_spdif_stop_playback(struct tegra20_= spdif *spdif) } =20 static int tegra20_spdif_trigger(struct snd_pcm_substream *substream, int = cmd, - struct snd_soc_dai *dai) + struct snd_soc_dai *dai) { - struct tegra20_spdif *spdif =3D snd_soc_dai_get_drvdata(dai); + struct tegra20_spdif *spdif =3D dev_get_drvdata(dai->dev); =20 switch (cmd) { case SNDRV_PCM_TRIGGER_START: @@ -151,7 +148,7 @@ static int tegra20_spdif_trigger(struct snd_pcm_substre= am *substream, int cmd, =20 static int tegra20_spdif_probe(struct snd_soc_dai *dai) { - struct tegra20_spdif *spdif =3D snd_soc_dai_get_drvdata(dai); + struct tegra20_spdif *spdif =3D dev_get_drvdata(dai->dev); =20 dai->capture_dma_data =3D NULL; dai->playback_dma_data =3D &spdif->playback_dma_data; @@ -160,26 +157,26 @@ static int tegra20_spdif_probe(struct snd_soc_dai *da= i) } =20 static const struct snd_soc_dai_ops tegra20_spdif_dai_ops =3D { - .hw_params =3D tegra20_spdif_hw_params, - .trigger =3D tegra20_spdif_trigger, + .hw_params =3D tegra20_spdif_hw_params, + .trigger =3D tegra20_spdif_trigger, }; =20 static struct snd_soc_dai_driver tegra20_spdif_dai =3D { - .name =3D DRV_NAME, + .name =3D "tegra20-spdif", .probe =3D tegra20_spdif_probe, .playback =3D { .stream_name =3D "Playback", .channels_min =3D 2, .channels_max =3D 2, .rates =3D SNDRV_PCM_RATE_32000 | SNDRV_PCM_RATE_44100 | - SNDRV_PCM_RATE_48000, + SNDRV_PCM_RATE_48000, .formats =3D SNDRV_PCM_FMTBIT_S16_LE, }, .ops =3D &tegra20_spdif_dai_ops, }; =20 static const struct snd_soc_component_driver tegra20_spdif_component =3D { - .name =3D DRV_NAME, + .name =3D "tegra20-spdif", }; =20 static bool tegra20_spdif_wr_rd_reg(struct device *dev, unsigned int reg) @@ -260,7 +257,7 @@ static const struct regmap_config tegra20_spdif_regmap_= config =3D { static int tegra20_spdif_platform_probe(struct platform_device *pdev) { struct tegra20_spdif *spdif; - struct resource *mem, *dmareq; + struct resource *mem; void __iomem *regs; int ret; =20 @@ -273,27 +270,19 @@ static int tegra20_spdif_platform_probe(struct platfo= rm_device *pdev) =20 spdif->clk_spdif_out =3D devm_clk_get(&pdev->dev, "out"); if (IS_ERR(spdif->clk_spdif_out)) { - pr_err("Can't retrieve spdif clock\n"); - ret =3D PTR_ERR(spdif->clk_spdif_out); - return ret; + dev_err(&pdev->dev, "Could not retrieve spdif clock\n"); + return PTR_ERR(spdif->clk_spdif_out); } =20 regs =3D devm_platform_get_and_ioremap_resource(pdev, 0, &mem); if (IS_ERR(regs)) return PTR_ERR(regs); =20 - dmareq =3D platform_get_resource(pdev, IORESOURCE_DMA, 0); - if (!dmareq) { - dev_err(&pdev->dev, "No DMA resource\n"); - return -ENODEV; - } - spdif->regmap =3D devm_regmap_init_mmio(&pdev->dev, regs, - &tegra20_spdif_regmap_config); + &tegra20_spdif_regmap_config); if (IS_ERR(spdif->regmap)) { dev_err(&pdev->dev, "regmap init failed\n"); - ret =3D PTR_ERR(spdif->regmap); - return ret; + return PTR_ERR(spdif->regmap); } =20 spdif->playback_dma_data.addr =3D mem->start + TEGRA20_SPDIF_DATA_OUT; @@ -306,7 +295,6 @@ static int tegra20_spdif_platform_probe(struct platform= _device *pdev) &tegra20_spdif_dai, 1); if (ret) { dev_err(&pdev->dev, "Could not register DAI: %d\n", ret); - ret =3D -ENOMEM; goto err_pm_disable; } =20 @@ -349,14 +337,13 @@ MODULE_DEVICE_TABLE(of, tegra20_spdif_of_match); =20 static struct platform_driver tegra20_spdif_driver =3D { .driver =3D { - .name =3D DRV_NAME, + .name =3D "tegra20-spdif", .pm =3D &tegra20_spdif_pm_ops, .of_match_table =3D tegra20_spdif_of_match, }, .probe =3D tegra20_spdif_platform_probe, .remove =3D tegra20_spdif_platform_remove, }; - module_platform_driver(tegra20_spdif_driver); =20 MODULE_AUTHOR("Stephen Warren "); --=20 2.33.1 From nobody Wed Jul 1 17:37:44 2026 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 9870DC433EF for ; Fri, 17 Dec 2021 17:58:44 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240069AbhLQR6m (ORCPT ); Fri, 17 Dec 2021 12:58:42 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36534 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240038AbhLQR6L (ORCPT ); Fri, 17 Dec 2021 12:58:11 -0500 Received: from mail-lf1-x134.google.com (mail-lf1-x134.google.com [IPv6:2a00:1450:4864:20::134]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7F809C061748; Fri, 17 Dec 2021 09:58:10 -0800 (PST) Received: by mail-lf1-x134.google.com with SMTP id g11so6302397lfu.2; Fri, 17 Dec 2021 09:58:10 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=Oq9KsYKOEQtYmLXJzVbR0p77Vqj89Yz0SNqCzPk9aww=; b=Be/hYpcFj7O+BPdmVmMrW4x/MfLWPoe6iIwwWKNvyfa5dQwvXFB2G/9uhWcEGiAXfz oQpv7a5SJq6ulmLSmVnEAc1KoTzBl0Wo4fMnIWiM8WM+ZAfEZNzw74TeIVWuiB97MHzO 6plY5TktsNKnQZQ9DO7dgZHldeOrSuMTjIDEaN6Yp4DZ9DWLzkSAD7zLhp+dkPbupKl+ cM7edbO8EXZSj6M5VAWfkaEVhHhCdGUNkm3X8cinU6KW7CBCSw1R0N/H2emmlWWvVy8u eIwHYsGoEM12gJ0U+4mPOn/2V8aWSdxGV3iytCGAQoEuSMjP+6vKG7yQAsla8DNqTDK1 LJxQ== 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=Oq9KsYKOEQtYmLXJzVbR0p77Vqj89Yz0SNqCzPk9aww=; b=OUytjpltWmQ/uKQWea5KfCzkRA1PHAUZXUTezpHY92oxHa3lWzWfw21Gv5gmqkp4QL H34YZfHFg3gTGbkmUhEk6MR9PmHWzm/al8gMKlVpUMLpl5kBocIZjPwsMJuXq5gOPbMx 2yEtVTrT+BnouP7cgq32Dqqrzs8CIOEMUvKcuyXm3b2tmV8+uUywG4j6YfaT6IRO9qOO obtxkbif/5LhErDAPypa2qS9OCy0PaPYQ9WOzYP/561G/MCHUT0V42CO1TwpVaJvDEgA 1cRcgYEXZrG5Ycruqaf/nxoUo16YVgeR2DzZ0bR7LVV2NovyrpBZmW/Pp3yRjQSodT6d fYxQ== X-Gm-Message-State: AOAM530oU6/aZYhaaDJhyTMSRYSG7AaQLKvZ8A62Sf3YLtiwybMtiBqw b4yHUcyQFx2S85z/gGgKDCk= X-Google-Smtp-Source: ABdhPJwURLrbEX96YqiOUtKnN+QvMqzk8Y4fn+is18eeyV6EuYmQSj830j+HQQ71wIzrKJhtD/lMzQ== X-Received: by 2002:a05:6512:23a4:: with SMTP id c36mr3822041lfv.125.1639763888877; Fri, 17 Dec 2021 09:58:08 -0800 (PST) Received: from localhost.localdomain (94-29-63-156.dynamic.spd-mgts.ru. [94.29.63.156]) by smtp.gmail.com with ESMTPSA id w23sm1479244lfa.191.2021.12.17.09.58.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 17 Dec 2021 09:58:08 -0800 (PST) From: Dmitry Osipenko To: Thierry Reding , Jonathan Hunter , Mark Brown , Takashi Iwai , Jaroslav Kysela , Liam Girdwood , Agneli Cc: linux-tegra@vger.kernel.org, alsa-devel@alsa-project.org, linux-kernel@vger.kernel.org, devicetree@vger.kernel.org Subject: [PATCH v5 07/11] ASoC: tegra20: spdif: Use more resource-managed helpers Date: Fri, 17 Dec 2021 20:56:02 +0300 Message-Id: <20211217175606.22645-8-digetx@gmail.com> X-Mailer: git-send-email 2.33.1 In-Reply-To: <20211217175606.22645-1-digetx@gmail.com> References: <20211217175606.22645-1-digetx@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" Use resource-managed helpers to make code cleaner. Driver's remove callback isn't needed anymore since driver is completely resource-managed now. Acked-by: Thierry Reding Signed-off-by: Dmitry Osipenko --- sound/soc/tegra/tegra20_spdif.c | 33 +++++++++------------------------ sound/soc/tegra/tegra_pcm.c | 6 ++++++ sound/soc/tegra/tegra_pcm.h | 1 + 3 files changed, 16 insertions(+), 24 deletions(-) diff --git a/sound/soc/tegra/tegra20_spdif.c b/sound/soc/tegra/tegra20_spdi= f.c index d5c618611dbb..7dd263721c2c 100644 --- a/sound/soc/tegra/tegra20_spdif.c +++ b/sound/soc/tegra/tegra20_spdif.c @@ -289,38 +289,24 @@ static int tegra20_spdif_platform_probe(struct platfo= rm_device *pdev) spdif->playback_dma_data.addr_width =3D DMA_SLAVE_BUSWIDTH_4_BYTES; spdif->playback_dma_data.maxburst =3D 4; =20 - pm_runtime_enable(&pdev->dev); + ret =3D devm_pm_runtime_enable(&pdev->dev); + if (ret) + return ret; =20 - ret =3D snd_soc_register_component(&pdev->dev, &tegra20_spdif_component, - &tegra20_spdif_dai, 1); + ret =3D devm_snd_soc_register_component(&pdev->dev, + &tegra20_spdif_component, + &tegra20_spdif_dai, 1); if (ret) { dev_err(&pdev->dev, "Could not register DAI: %d\n", ret); - goto err_pm_disable; + return ret; } =20 - ret =3D tegra_pcm_platform_register(&pdev->dev); + ret =3D devm_tegra_pcm_platform_register(&pdev->dev); if (ret) { dev_err(&pdev->dev, "Could not register PCM: %d\n", ret); - goto err_unregister_component; + return ret; } =20 - return 0; - -err_unregister_component: - snd_soc_unregister_component(&pdev->dev); -err_pm_disable: - pm_runtime_disable(&pdev->dev); - - return ret; -} - -static int tegra20_spdif_platform_remove(struct platform_device *pdev) -{ - tegra_pcm_platform_unregister(&pdev->dev); - snd_soc_unregister_component(&pdev->dev); - - pm_runtime_disable(&pdev->dev); - return 0; } =20 @@ -342,7 +328,6 @@ static struct platform_driver tegra20_spdif_driver =3D { .of_match_table =3D tegra20_spdif_of_match, }, .probe =3D tegra20_spdif_platform_probe, - .remove =3D tegra20_spdif_platform_remove, }; module_platform_driver(tegra20_spdif_driver); =20 diff --git a/sound/soc/tegra/tegra_pcm.c b/sound/soc/tegra/tegra_pcm.c index ef1e74d95236..468c8e77de21 100644 --- a/sound/soc/tegra/tegra_pcm.c +++ b/sound/soc/tegra/tegra_pcm.c @@ -48,6 +48,12 @@ int tegra_pcm_platform_register(struct device *dev) } EXPORT_SYMBOL_GPL(tegra_pcm_platform_register); =20 +int devm_tegra_pcm_platform_register(struct device *dev) +{ + return devm_snd_dmaengine_pcm_register(dev, &tegra_dmaengine_pcm_config, = 0); +} +EXPORT_SYMBOL_GPL(devm_tegra_pcm_platform_register); + int tegra_pcm_platform_register_with_chan_names(struct device *dev, struct snd_dmaengine_pcm_config *config, char *txdmachan, char *rxdmachan) diff --git a/sound/soc/tegra/tegra_pcm.h b/sound/soc/tegra/tegra_pcm.h index d602126c65b7..2a36eea1740d 100644 --- a/sound/soc/tegra/tegra_pcm.h +++ b/sound/soc/tegra/tegra_pcm.h @@ -32,6 +32,7 @@ int tegra_pcm_hw_params(struct snd_soc_component *compone= nt, snd_pcm_uframes_t tegra_pcm_pointer(struct snd_soc_component *component, struct snd_pcm_substream *substream); int tegra_pcm_platform_register(struct device *dev); +int devm_tegra_pcm_platform_register(struct device *dev); int tegra_pcm_platform_register_with_chan_names(struct device *dev, struct snd_dmaengine_pcm_config *config, char *txdmachan, char *rxdmachan); --=20 2.33.1 From nobody Wed Jul 1 17:37:44 2026 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 88F9DC4321E for ; Fri, 17 Dec 2021 17:58:46 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240054AbhLQR6p (ORCPT ); Fri, 17 Dec 2021 12:58:45 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36560 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240044AbhLQR6L (ORCPT ); Fri, 17 Dec 2021 12:58:11 -0500 Received: from mail-lf1-x12b.google.com (mail-lf1-x12b.google.com [IPv6:2a00:1450:4864:20::12b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6D46BC06173F; Fri, 17 Dec 2021 09:58:11 -0800 (PST) Received: by mail-lf1-x12b.google.com with SMTP id d38so6371506lfv.0; Fri, 17 Dec 2021 09:58:11 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=/XmIaZHgbch9Ndb9r5aHLF0Fx0YU8zrMQcOhUAQ7w2k=; b=VjmC0Y9w7NZLdn12GxvPfT3HjzRD7yE5rRR8+dZbQV/YUiLiq1hPZSE7/eXTx6YJbQ N5kxA5stjoRrV02Ho0bCFBc+uzBTAvDFIRpRAYDdAq1FJLKPTORqju61N8MnGp0oP7Ys ddVZzRfGLRCwQz5b3KrBSBkkTMQ5ITLq3XyBTi+HEatpG4H5rcBoTewdPpLaa1kySo32 3dhqSW4RutSB4xPUoAvRJfxXZ3d3D0qzY5VADsnVS86Qw6Qoq4qEFv0aFxXCBNVBfQJA O2iyhmXY1aliKLREMlsGvJ5/2zBp4AzIg2gaVt3+I/9jNyKx5023sDZ+33Apz2NAhXOn tAyg== 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=/XmIaZHgbch9Ndb9r5aHLF0Fx0YU8zrMQcOhUAQ7w2k=; b=DYVkeFp0cYrmytS4k+Ol/rwKZmnW9y7gWTk3iAL0E8tY+iRKQvLkglvL1XVP5bf1L6 N3V5DVNI1x3nmh7+XFLgxRkauGLD9zs21KFueNyNxiBW846EP/M7ru8TOkNeATqxOL7w HB2p44+oF5CHvfpfWufCOOOw5vKQTnJwS1wU7oPw8xAQDh7ofnwxE9mJV+TDFS+r6vvM xQV90Ncr1B4VJclnVv7jjnbYSQ0a16DgkHSkIkXnratEGTDIKXZGgCU7bWj3dKIW+agp EGanf9LHYbl/yw+BCKkf/S74TQHlNHcIIHa6Pebb6aMPhpLLCrb7EBan7foHtYRp4oJ8 qC+Q== X-Gm-Message-State: AOAM532t95/wFzuHgfF3XAuCVOkgxMwn5GsAv+ZkR+4NRGlvD2CHgTsO VzEMxV/OIgdZ5UEwq0QsDT0= X-Google-Smtp-Source: ABdhPJyB34TPLVV+Dx09e/VOaPT8n/32uTFbtegwmM16PU133AfDRdQYKVBq3XAz5cM+0dYvrhQ7ew== X-Received: by 2002:a05:6512:50c:: with SMTP id o12mr3751228lfb.41.1639763889556; Fri, 17 Dec 2021 09:58:09 -0800 (PST) Received: from localhost.localdomain (94-29-63-156.dynamic.spd-mgts.ru. [94.29.63.156]) by smtp.gmail.com with ESMTPSA id w23sm1479244lfa.191.2021.12.17.09.58.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 17 Dec 2021 09:58:09 -0800 (PST) From: Dmitry Osipenko To: Thierry Reding , Jonathan Hunter , Mark Brown , Takashi Iwai , Jaroslav Kysela , Liam Girdwood , Agneli Cc: linux-tegra@vger.kernel.org, alsa-devel@alsa-project.org, linux-kernel@vger.kernel.org, devicetree@vger.kernel.org Subject: [PATCH v5 08/11] ASoC: tegra20: spdif: Reset hardware Date: Fri, 17 Dec 2021 20:56:03 +0300 Message-Id: <20211217175606.22645-9-digetx@gmail.com> X-Mailer: git-send-email 2.33.1 In-Reply-To: <20211217175606.22645-1-digetx@gmail.com> References: <20211217175606.22645-1-digetx@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" Reset S/PDIF controller on runtime PM suspend/resume to ensure that we always have a consistent hardware state. Acked-by: Thierry Reding Signed-off-by: Dmitry Osipenko --- sound/soc/tegra/tegra20_spdif.c | 32 ++++++++++++++++++++++++++++++++ sound/soc/tegra/tegra20_spdif.h | 1 + 2 files changed, 33 insertions(+) diff --git a/sound/soc/tegra/tegra20_spdif.c b/sound/soc/tegra/tegra20_spdi= f.c index 7dd263721c2c..bc45a0a8afab 100644 --- a/sound/soc/tegra/tegra20_spdif.c +++ b/sound/soc/tegra/tegra20_spdif.c @@ -7,6 +7,7 @@ */ =20 #include +#include #include #include #include @@ -14,6 +15,7 @@ #include #include #include +#include #include #include #include @@ -27,6 +29,8 @@ static __maybe_unused int tegra20_spdif_runtime_suspend(s= truct device *dev) { struct tegra20_spdif *spdif =3D dev_get_drvdata(dev); =20 + regcache_cache_only(spdif->regmap, true); + clk_disable_unprepare(spdif->clk_spdif_out); =20 return 0; @@ -37,13 +41,35 @@ static __maybe_unused int tegra20_spdif_runtime_resume(= struct device *dev) struct tegra20_spdif *spdif =3D dev_get_drvdata(dev); int ret; =20 + ret =3D reset_control_assert(spdif->reset); + if (ret) + return ret; + ret =3D clk_prepare_enable(spdif->clk_spdif_out); if (ret) { dev_err(dev, "clk_enable failed: %d\n", ret); return ret; } =20 + usleep_range(10, 100); + + ret =3D reset_control_deassert(spdif->reset); + if (ret) + goto disable_clocks; + + regcache_cache_only(spdif->regmap, false); + regcache_mark_dirty(spdif->regmap); + + ret =3D regcache_sync(spdif->regmap); + if (ret) + goto disable_clocks; + return 0; + +disable_clocks: + clk_disable_unprepare(spdif->clk_spdif_out); + + return ret; } =20 static int tegra20_spdif_hw_params(struct snd_pcm_substream *substream, @@ -268,6 +294,12 @@ static int tegra20_spdif_platform_probe(struct platfor= m_device *pdev) =20 dev_set_drvdata(&pdev->dev, spdif); =20 + spdif->reset =3D devm_reset_control_get_exclusive(&pdev->dev, NULL); + if (IS_ERR(spdif->reset)) { + dev_err(&pdev->dev, "Can't retrieve spdif reset\n"); + return PTR_ERR(spdif->reset); + } + spdif->clk_spdif_out =3D devm_clk_get(&pdev->dev, "out"); if (IS_ERR(spdif->clk_spdif_out)) { dev_err(&pdev->dev, "Could not retrieve spdif clock\n"); diff --git a/sound/soc/tegra/tegra20_spdif.h b/sound/soc/tegra/tegra20_spdi= f.h index 1973ffc2d5c7..ff4b79e2052f 100644 --- a/sound/soc/tegra/tegra20_spdif.h +++ b/sound/soc/tegra/tegra20_spdif.h @@ -451,6 +451,7 @@ struct tegra20_spdif { struct snd_dmaengine_dai_dma_data capture_dma_data; struct snd_dmaengine_dai_dma_data playback_dma_data; struct regmap *regmap; + struct reset_control *reset; }; =20 #endif --=20 2.33.1 From nobody Wed Jul 1 17:37:44 2026 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 ED820C433FE for ; Fri, 17 Dec 2021 17:58:47 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240096AbhLQR6r (ORCPT ); Fri, 17 Dec 2021 12:58:47 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36568 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240013AbhLQR6M (ORCPT ); Fri, 17 Dec 2021 12:58:12 -0500 Received: from mail-lj1-x22c.google.com (mail-lj1-x22c.google.com [IPv6:2a00:1450:4864:20::22c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DC486C061751; Fri, 17 Dec 2021 09:58:11 -0800 (PST) Received: by mail-lj1-x22c.google.com with SMTP id a37so4537606ljq.13; Fri, 17 Dec 2021 09:58:11 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=btGZfuKkvHGlpDu1vpCSHhDujyvUpwrfJCWjKl++rLQ=; b=hTeyIA3ZMR1GhJuhwrMK33OO6tU4vclI8f1veWvFSxUY32rLFMAmHLt1tF9OU0+BXt V8V7ezaLiZ6dtUp/Tdhhz4QLhbJwRVqJmY1ECIqUgOJ4K1GZ84CLz1wO9EmEZIUrk7k0 UkKZhLQBBvDUbnuJv98SnQQRZsHAQJgc0wd4JlA5DL11S+xtIScRTIyK71r0mY7WxBH2 eTCkSZ9umnI5ZasO6qcp+6wPQ1cFpSgKQ/Xfz0YmFfLsRpp9L+KtauwBTV+crq642CLp GysCVKk6qi6IhRxGLdRTXCjbw8iN1bor/3Qa+ARhNPYp7ThEFNDmJUUNcpGGOf2F/o2L qxlw== 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=btGZfuKkvHGlpDu1vpCSHhDujyvUpwrfJCWjKl++rLQ=; b=bYl6UNMgUMBhFHfjjbkyt14gg++9jBjImTFzQUOrR7YaLPGSc7wh1olDhjbqrdb5dn +E3NRKZe/5w5tVsDNrbUkwVuM3i6RYoarwGj5q0kmbsPeFtmd3FWyrMISNeOcIATdsWV /QQyFdzWJubde/CL/S8odgkWDKP1YaSgcz9U89zBROJQeDpe13BoyMzohjGcGp4d8LSw jL57jKEkAwO3cwLahfLex8MTfRNf9QSBsmWYv8ZIkJ9dqdKKgTv6c/MKAWwfCwJfdbnL 3kuTfQ6Uz2lihyckXvFfOZz3P0zoLkBU7EBwy622LDydIbOKjGRyDBUpeGiglzhcL8NC NYcg== X-Gm-Message-State: AOAM531Fd+pvPT/hzHnJCSegBvIT7or8FsShyiWRl78E7ch8KtlHKGQy vntOziNKtFLIb3axGKa9E/M= X-Google-Smtp-Source: ABdhPJwc6k2Csr10tHFwoicg91w/boebavr0X5MJSYT45hxlb3vZvhXbsT4HBnNCjE7+UvzLbzTfbA== X-Received: by 2002:a2e:548:: with SMTP id 69mr3636945ljf.225.1639763890228; Fri, 17 Dec 2021 09:58:10 -0800 (PST) Received: from localhost.localdomain (94-29-63-156.dynamic.spd-mgts.ru. [94.29.63.156]) by smtp.gmail.com with ESMTPSA id w23sm1479244lfa.191.2021.12.17.09.58.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 17 Dec 2021 09:58:09 -0800 (PST) From: Dmitry Osipenko To: Thierry Reding , Jonathan Hunter , Mark Brown , Takashi Iwai , Jaroslav Kysela , Liam Girdwood , Agneli Cc: linux-tegra@vger.kernel.org, alsa-devel@alsa-project.org, linux-kernel@vger.kernel.org, devicetree@vger.kernel.org Subject: [PATCH v5 09/11] ASoC: tegra20: spdif: Support system suspend Date: Fri, 17 Dec 2021 20:56:04 +0300 Message-Id: <20211217175606.22645-10-digetx@gmail.com> X-Mailer: git-send-email 2.33.1 In-Reply-To: <20211217175606.22645-1-digetx@gmail.com> References: <20211217175606.22645-1-digetx@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" Support system suspend by enforcing runtime PM suspend/resume. Now there is no doubt that h/w is indeed stopped during suspend and that h/w state will be properly restored after resume. Acked-by: Thierry Reding Signed-off-by: Dmitry Osipenko --- sound/soc/tegra/tegra20_spdif.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/sound/soc/tegra/tegra20_spdif.c b/sound/soc/tegra/tegra20_spdi= f.c index bc45a0a8afab..a4aa5614aef4 100644 --- a/sound/soc/tegra/tegra20_spdif.c +++ b/sound/soc/tegra/tegra20_spdif.c @@ -345,6 +345,8 @@ static int tegra20_spdif_platform_probe(struct platform= _device *pdev) static const struct dev_pm_ops tegra20_spdif_pm_ops =3D { SET_RUNTIME_PM_OPS(tegra20_spdif_runtime_suspend, tegra20_spdif_runtime_resume, NULL) + SET_SYSTEM_SLEEP_PM_OPS(pm_runtime_force_suspend, + pm_runtime_force_resume) }; =20 static const struct of_device_id tegra20_spdif_of_match[] =3D { --=20 2.33.1 From nobody Wed Jul 1 17:37:44 2026 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 501D8C433EF for ; Fri, 17 Dec 2021 17:58:51 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240162AbhLQR6u (ORCPT ); Fri, 17 Dec 2021 12:58:50 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36544 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240014AbhLQR6R (ORCPT ); Fri, 17 Dec 2021 12:58:17 -0500 Received: from mail-lj1-x234.google.com (mail-lj1-x234.google.com [IPv6:2a00:1450:4864:20::234]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 953FAC061757; Fri, 17 Dec 2021 09:58:12 -0800 (PST) Received: by mail-lj1-x234.google.com with SMTP id 13so4530631ljj.11; Fri, 17 Dec 2021 09:58:12 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=Rf4HABf9hwf+vnoImyk/B+FAlr699NfkudJmwSj3syw=; b=F/+REdlsnNvoF3FARVHxq3vwNQi10r9TMMrUEmjFlGBpTFIacXreSj1Jo3lknWOES/ j1Gb+hs7XwfP/hAGGSy0hzxAHK86+XolIiNHom6J3dsaEzIVHeBhMOSoBjESN2pSVdEo bHH1ISvjx1SGlAFLEsvcSjI6n2R4sYNeQD7trBdwXqWK3kyQlo5vIW8ikBtPwm3uuKvB L/RTq4f+jZmYzcxUu64by+DbP6fBQBXgqaLIy5cJZvBi8quyxeH/LbEiiQeqlvi5Z8CM Y6AClpP8wLEzbvQ2jSC/mYDZITDM8DPVgkx7H0SSvgSP3IdzIJ7Q9l24Ed6B+6WQC0q0 OcSA== 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=Rf4HABf9hwf+vnoImyk/B+FAlr699NfkudJmwSj3syw=; b=hz/RKCcylqWEySDVXg4pXgYi0ysJSPVlBJ9NWePk6ItjENa6AbVnddKZKk+DJvVVKS hU4x2e+piekPnz7gaJvqitNIPr5+Pg0qpC7DqDAksCWgcGHCxe/fs82GWGxKSAsk8iPf o39OqELLi2LR8exxEDFo2zDcreWp+/aqPTpCXyXPstRIYMjIVDM8lzip8S1uXsUN4x/6 KAQPaQevwzHBUO8S3asywiccxscVHaoyh6XCunuNSSqZn05bwXH5aOX4drTvGMUBfsXh tKIZQSW1mwMVxHmsNR3+hxBgseyNZn8nHE5fajdrc1EQct0GmVeH6ieJmQprpNnS7tS2 33kQ== X-Gm-Message-State: AOAM532ngF1XHMJG+GePDDBOBME1rt/4AFa+JOCfQwvnndNsHJG+agVe QAHCS/JUheKW6WXWpAGVJCecFkn3NNo= X-Google-Smtp-Source: ABdhPJzSS0s1ORcsGwDzBVpKSNbAYe4H3eM6AY2Kg4eLWmj78Aq5e2x+wvrPeJ2D82Ph3/blgr+nKQ== X-Received: by 2002:a05:651c:4c6:: with SMTP id e6mr3630495lji.411.1639763890924; Fri, 17 Dec 2021 09:58:10 -0800 (PST) Received: from localhost.localdomain (94-29-63-156.dynamic.spd-mgts.ru. [94.29.63.156]) by smtp.gmail.com with ESMTPSA id w23sm1479244lfa.191.2021.12.17.09.58.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 17 Dec 2021 09:58:10 -0800 (PST) From: Dmitry Osipenko To: Thierry Reding , Jonathan Hunter , Mark Brown , Takashi Iwai , Jaroslav Kysela , Liam Girdwood , Agneli Cc: linux-tegra@vger.kernel.org, alsa-devel@alsa-project.org, linux-kernel@vger.kernel.org, devicetree@vger.kernel.org Subject: [PATCH v5 10/11] ASoC: tegra20: spdif: Filter out unsupported rates Date: Fri, 17 Dec 2021 20:56:05 +0300 Message-Id: <20211217175606.22645-11-digetx@gmail.com> X-Mailer: git-send-email 2.33.1 In-Reply-To: <20211217175606.22645-1-digetx@gmail.com> References: <20211217175606.22645-1-digetx@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" SPDIF and other SoC components share audio PLL on Tegra, thus only one component may set the desired base clock rate. This creates problem for HDMI audio because it uses SPDIF and audio may not work if SPDIF's clock doesn't exactly match standard audio rate since some receivers may reject audio in that case. Filter out audio rates which SPDIF output can't support, assuming that other components won't change rate at runtime. Acked-by: Thierry Reding Signed-off-by: Dmitry Osipenko --- sound/soc/tegra/tegra20_spdif.c | 63 ++++++++++++++++++++++++++++++++- 1 file changed, 62 insertions(+), 1 deletion(-) diff --git a/sound/soc/tegra/tegra20_spdif.c b/sound/soc/tegra/tegra20_spdi= f.c index a4aa5614aef4..8cc114c1862f 100644 --- a/sound/soc/tegra/tegra20_spdif.c +++ b/sound/soc/tegra/tegra20_spdif.c @@ -78,7 +78,8 @@ static int tegra20_spdif_hw_params(struct snd_pcm_substre= am *substream, { struct tegra20_spdif *spdif =3D dev_get_drvdata(dai->dev); unsigned int mask =3D 0, val =3D 0; - int ret, spdifclock; + long rate, spdifclock; + int ret; =20 mask |=3D TEGRA20_SPDIF_CTRL_PACK | TEGRA20_SPDIF_CTRL_BIT_MODE_MASK; @@ -133,6 +134,12 @@ static int tegra20_spdif_hw_params(struct snd_pcm_subs= tream *substream, return ret; } =20 + rate =3D clk_get_rate(spdif->clk_spdif_out); + if (rate !=3D spdifclock) + dev_warn_once(dai->dev, + "SPDIF clock rate %ld doesn't match requested rate %ld\n", + spdifclock, rate); + return 0; } =20 @@ -172,6 +179,59 @@ static int tegra20_spdif_trigger(struct snd_pcm_substr= eam *substream, int cmd, return 0; } =20 +static int tegra20_spdif_filter_rates(struct snd_pcm_hw_params *params, + struct snd_pcm_hw_rule *rule) +{ + struct snd_interval *r =3D hw_param_interval(params, rule->var); + struct snd_soc_dai *dai =3D rule->private; + struct tegra20_spdif *spdif =3D dev_get_drvdata(dai->dev); + struct clk *parent =3D clk_get_parent(spdif->clk_spdif_out); + const unsigned int rates[] =3D { 32000, 44100, 48000 }; + long i, parent_rate, valid_rates =3D 0; + + parent_rate =3D clk_get_rate(parent); + if (parent_rate <=3D 0) { + dev_err(dai->dev, "Can't get parent clock rate: %ld\n", + parent_rate); + return parent_rate ?: -EINVAL; + } + + for (i =3D 0; i < ARRAY_SIZE(rates); i++) { + if (parent_rate % (rates[i] * 128) =3D=3D 0) + valid_rates |=3D BIT(i); + } + + /* + * At least one rate must be valid, otherwise the parent clock isn't + * audio PLL. Nothing should be filtered in this case. + */ + if (!valid_rates) + valid_rates =3D BIT(ARRAY_SIZE(rates)) - 1; + + return snd_interval_list(r, ARRAY_SIZE(rates), rates, valid_rates); +} + +static int tegra20_spdif_startup(struct snd_pcm_substream *substream, + struct snd_soc_dai *dai) +{ + if (!device_property_read_bool(dai->dev, "nvidia,fixed-parent-rate")) + return 0; + + /* + * SPDIF and I2S share audio PLL. HDMI takes audio packets from SPDIF + * and audio may not work on some TVs if clock rate isn't precise. + * + * PLL rate is controlled by I2S side. Filter out audio rates that + * don't match PLL rate at the start of stream to allow both SPDIF + * and I2S work simultaneously, assuming that PLL rate won't be + * changed later on. + */ + return snd_pcm_hw_rule_add(substream->runtime, 0, + SNDRV_PCM_HW_PARAM_RATE, + tegra20_spdif_filter_rates, dai, + SNDRV_PCM_HW_PARAM_RATE, -1); +} + static int tegra20_spdif_probe(struct snd_soc_dai *dai) { struct tegra20_spdif *spdif =3D dev_get_drvdata(dai->dev); @@ -185,6 +245,7 @@ static int tegra20_spdif_probe(struct snd_soc_dai *dai) static const struct snd_soc_dai_ops tegra20_spdif_dai_ops =3D { .hw_params =3D tegra20_spdif_hw_params, .trigger =3D tegra20_spdif_trigger, + .startup =3D tegra20_spdif_startup, }; =20 static struct snd_soc_dai_driver tegra20_spdif_dai =3D { --=20 2.33.1 From nobody Wed Jul 1 17:37:44 2026 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 903F9C433F5 for ; Fri, 17 Dec 2021 17:58:49 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240122AbhLQR6s (ORCPT ); Fri, 17 Dec 2021 12:58:48 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36548 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240072AbhLQR6R (ORCPT ); Fri, 17 Dec 2021 12:58:17 -0500 Received: from mail-lf1-x135.google.com (mail-lf1-x135.google.com [IPv6:2a00:1450:4864:20::135]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4D3B4C06175C; Fri, 17 Dec 2021 09:58:13 -0800 (PST) Received: by mail-lf1-x135.google.com with SMTP id b22so6215122lfb.9; Fri, 17 Dec 2021 09:58:13 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=YIQlcF3gP50Ac2XyP/mWCT3TH1MR8AJE0l0k33C2rI4=; b=U31Jz7S+v6lmx5fTO+U88D6SrE37ODp+9q0365LAbGwqPixsRAWvweUHL1knkSgjxc dR9mrquyapfnZDQ8ZNd1f2W7h7y/ODKbkHmhIys72E0VX/dM1CUxUlU9QF26Rrk/UOqd 0WLY4RHukrOaZ02RrMyfR0BrjoLiqbJFsectgqGMP0lpf5VTdIa6zWGG/U7jMQXDE6PK 3YIKyAah8jH1PVDFwXVjtI+mWyciZ6Id16W7dqP3pkkkC5Wv3xSZ0WCWQcJPuzOXNzAy T8N1Q+IwsZK+1oNI0nnPfAEiboZsZT3ol230avvwaJzmPwmKJTWKxVvbHD2LtBxp7o6o BkiA== 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=YIQlcF3gP50Ac2XyP/mWCT3TH1MR8AJE0l0k33C2rI4=; b=GFzI/wM3q6l6ZI22o1qjAiSmt/TNnKweYaLkGvL3q1tOgdMdUarqdroNejxjerbTf6 FMH/t/uRS3saLrcQsIDlrUqIbWF7fthnJGKDvGt7/PY6HRjQMu9S7jsmeg63lyKxFCvy 2vr1BtpTDwz1HQ7qb9W/z3QeJIfkFiC2P4cCUgbYY5k8ItvnWAXpMkbnZxd6niVhzuMo CuwGo29jRzV0CRVO6mgxoN7EJqi0gDL32ky7g0+/4V5uG/DPBquOFpfT8M4zJcWaSbW2 hID/NMvuq38r0YTOiI1x4C+ff9xjbU1bvcb9E5pVPdRWkL99nCg/pfzEmsCMBNlyH00M K03w== X-Gm-Message-State: AOAM532c0Gub1KseVP9A7h9GAOqQLWjk2Vl5ljNoehhjM4VxCQL963id K+PHxYkt69iZcvybNsyUswk= X-Google-Smtp-Source: ABdhPJyEg+R6x5sc59XnGJjYnjPKD7SF9ULXc8Ov81sZnNr6zNhkgoNGoFiA05i3KxASVuxbn4LMvw== X-Received: by 2002:a05:6512:5c8:: with SMTP id o8mr2954480lfo.659.1639763891645; Fri, 17 Dec 2021 09:58:11 -0800 (PST) Received: from localhost.localdomain (94-29-63-156.dynamic.spd-mgts.ru. [94.29.63.156]) by smtp.gmail.com with ESMTPSA id w23sm1479244lfa.191.2021.12.17.09.58.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 17 Dec 2021 09:58:11 -0800 (PST) From: Dmitry Osipenko To: Thierry Reding , Jonathan Hunter , Mark Brown , Takashi Iwai , Jaroslav Kysela , Liam Girdwood , Agneli Cc: linux-tegra@vger.kernel.org, alsa-devel@alsa-project.org, linux-kernel@vger.kernel.org, devicetree@vger.kernel.org Subject: [PATCH v5 11/11] ASoC: tegra20: i2s: Filter out unsupported rates Date: Fri, 17 Dec 2021 20:56:06 +0300 Message-Id: <20211217175606.22645-12-digetx@gmail.com> X-Mailer: git-send-email 2.33.1 In-Reply-To: <20211217175606.22645-1-digetx@gmail.com> References: <20211217175606.22645-1-digetx@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" Support new nvidia,fixed-parent-rate device-tree property which instructs I2S that board wants parent clock rate to stay at a fixed rate. This allows to play audio over S/PDIF and I2S simultaneously. The root of the problem is that audio components on Tegra share the same audio PLL, and thus, only a subset of rates can be supported if we want to play audio simultaneously. Filter out audio rates that don't match parent clock rate if device-tree has the nvidia,fixed-parent-rate property. Acked-by: Thierry Reding Signed-off-by: Dmitry Osipenko --- sound/soc/tegra/tegra20_i2s.c | 49 +++++++++++++++++++++++++++++++++++ 1 file changed, 49 insertions(+) diff --git a/sound/soc/tegra/tegra20_i2s.c b/sound/soc/tegra/tegra20_i2s.c index 266d2cab9f49..27365a877e47 100644 --- a/sound/soc/tegra/tegra20_i2s.c +++ b/sound/soc/tegra/tegra20_i2s.c @@ -262,10 +262,59 @@ static int tegra20_i2s_probe(struct snd_soc_dai *dai) return 0; } =20 +static const unsigned int tegra20_i2s_rates[] =3D { + 8000, 11025, 16000, 22050, 32000, 44100, 48000, 64000, 88200, 96000 +}; + +static int tegra20_i2s_filter_rates(struct snd_pcm_hw_params *params, + struct snd_pcm_hw_rule *rule) +{ + struct snd_interval *r =3D hw_param_interval(params, rule->var); + struct snd_soc_dai *dai =3D rule->private; + struct tegra20_i2s *i2s =3D dev_get_drvdata(dai->dev); + struct clk *parent =3D clk_get_parent(i2s->clk_i2s); + long i, parent_rate, valid_rates =3D 0; + + parent_rate =3D clk_get_rate(parent); + if (parent_rate <=3D 0) { + dev_err(dai->dev, "Can't get parent clock rate: %ld\n", + parent_rate); + return parent_rate ?: -EINVAL; + } + + for (i =3D 0; i < ARRAY_SIZE(tegra20_i2s_rates); i++) { + if (parent_rate % (tegra20_i2s_rates[i] * 128) =3D=3D 0) + valid_rates |=3D BIT(i); + } + + /* + * At least one rate must be valid, otherwise the parent clock isn't + * audio PLL. Nothing should be filtered in this case. + */ + if (!valid_rates) + valid_rates =3D BIT(ARRAY_SIZE(tegra20_i2s_rates)) - 1; + + return snd_interval_list(r, ARRAY_SIZE(tegra20_i2s_rates), + tegra20_i2s_rates, valid_rates); +} + +static int tegra20_i2s_startup(struct snd_pcm_substream *substream, + struct snd_soc_dai *dai) +{ + if (!device_property_read_bool(dai->dev, "nvidia,fixed-parent-rate")) + return 0; + + return snd_pcm_hw_rule_add(substream->runtime, 0, + SNDRV_PCM_HW_PARAM_RATE, + tegra20_i2s_filter_rates, dai, + SNDRV_PCM_HW_PARAM_RATE, -1); +} + static const struct snd_soc_dai_ops tegra20_i2s_dai_ops =3D { .set_fmt =3D tegra20_i2s_set_fmt, .hw_params =3D tegra20_i2s_hw_params, .trigger =3D tegra20_i2s_trigger, + .startup =3D tegra20_i2s_startup, }; =20 static const struct snd_soc_dai_driver tegra20_i2s_dai_template =3D { --=20 2.33.1