From patchwork Fri Dec 17 17:55:56 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Osipenko X-Patchwork-Id: 12685391 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 alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) (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 C2BE4C433F5 for ; Fri, 17 Dec 2021 18:00:33 +0000 (UTC) Received: from alsa1.perex.cz (alsa1.perex.cz [207.180.221.201]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by alsa0.perex.cz (Postfix) with ESMTPS id 0D29B285F; Fri, 17 Dec 2021 18:59:42 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 0D29B285F DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1639764032; bh=mOQ2eHw2UAJ//F0AMmxVBH++DECSj33r4EBlB3u0ixY=; h=From:To:Subject:Date:In-Reply-To:References:Cc:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=S6OvIbbaoa+lI4Up2pogm/dF3u6LentXR96kUVi1bY6VgdW8f7Lius5vPxL7LXBUN IP4+zvAFyAPPzskp20J0mdluDIuzHBp5PCq+r9FflwH6pObFb02FJAJh+NgiDvya9H dSdQKQpRYWLQc/WpU6z8BbvUlco2Uv8pvFZ6D1hY= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id CDB28F80511; Fri, 17 Dec 2021 18:58:22 +0100 (CET) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 47975F804EB; Fri, 17 Dec 2021 18:58:18 +0100 (CET) Received: from mail-lj1-x22a.google.com (mail-lj1-x22a.google.com [IPv6:2a00:1450:4864:20::22a]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id 19B28F8016D for ; Fri, 17 Dec 2021 18:58:10 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 19B28F8016D Authentication-Results: alsa1.perex.cz; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="DTTzqDWs" Received: by mail-lj1-x22a.google.com with SMTP id z8so4566552ljz.9 for ; 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=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=MLYwsH2gYlq0WUzM49q8bi6lKkfV7yV9sXH67Yhxg0DFJvz6uIzBLyqhtaLkdaTa5V Cp27HRMkJ8PzzQMK6X69mBlsZhFvsWCmnjp/4qQ+FGTBkDKaKfz0PbV2swmbWXWx79ip O8YwbTsIDMJNrseuMXS5nmwfiANRfuaKNas6imF740we3zLUT83dZoMFh+hA57ztL44p u3Tfz8FDigyjp5mYFWRxbUQfXE11klMukUQzNgnUENN4Jx6prBTI5AbVD4bjckP1s+/T 3pRcQmZo1cm4pfp42gKOhWVCGZlNKnvRjZkD0N01/mN47pr9ni4WdF+CQQuFPhTO9taj RkWA== X-Gm-Message-State: AOAM530hEjROUfrfpbqqZnuhVwNG10N0lGIFX7elWfDU5xxhJEW/YZzt kgo3HehN7GiguOV0zNwOSp0= 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 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 Cc: linux-tegra@vger.kernel.org, devicetree@vger.kernel.org, alsa-devel@alsa-project.org, linux-kernel@vger.kernel.org X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: alsa-devel-bounces@alsa-project.org Sender: "Alsa-devel" 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.yaml 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 = "nvidia,tegra20-spdif"; + reg = <0x70002400 0x200>; + interrupts = <77>; + clocks = <&clk 99>, <&clk 98>; + clock-names = "out", "in"; + resets = <&rst 10>; + dmas = <&apbdma 3>, <&apbdma 3>; + dma-names = "rx", "tx"; + #sound-dai-cells = <0>; + }; + +... From patchwork Fri Dec 17 17:55:57 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Osipenko X-Patchwork-Id: 12685395 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 alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) (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 35D09C433F5 for ; Fri, 17 Dec 2021 18:01:13 +0000 (UTC) Received: from alsa1.perex.cz (alsa1.perex.cz [207.180.221.201]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by alsa0.perex.cz (Postfix) with ESMTPS id 606432848; Fri, 17 Dec 2021 19:00:21 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 606432848 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1639764071; bh=YTRxQaHPC7lTAydNxR6j66vYJ/1owmYsMiJO62pXc38=; h=From:To:Subject:Date:In-Reply-To:References:Cc:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=nnNXduHgbCuLdmoVtPiZ+z0mzeZlb8yMrk/BEvIHg8kouUAx7WardBvwjdAzUDRwR f9Q2zzBuGAnK1Pdh8MYQXlVjhWnD1XUwJSordwvKN0RZ+F5giXJ/zlPY6qQK3GzHk6 9ZaEwTG2bjxu016ab33pM7zTTuXCajgmWIf70KS0= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id 6DC9DF80524; Fri, 17 Dec 2021 18:58:24 +0100 (CET) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 18B9CF80163; Fri, 17 Dec 2021 18:58:21 +0100 (CET) Received: from mail-lf1-x132.google.com (mail-lf1-x132.google.com [IPv6:2a00:1450:4864:20::132]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id 57B64F8027C for ; Fri, 17 Dec 2021 18:58:07 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 57B64F8027C Authentication-Results: alsa1.perex.cz; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="Z9Pva736" Received: by mail-lf1-x132.google.com with SMTP id cf39so6239490lfb.8 for ; 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=WFXObndMm8nWO4L9N4Fp3bLKOmSiPmnBekM74C0oL2IIh1kkImYeEF4HOMdPdYzYMZ hd4/+YSoSFcZjxDFcCSBTN/aFZvV7+DK/QlEIn+c7BzhUrWu4LCKV4L4qhRcndq5j1nN QQtH8MqF19eb9prFzjt4VCKmBTepWIVcpXlNUa1DSrE0mHGiXP3wJmyQClyXRZL2nqeL JtWY5FeUwnYN0AFWHSICHtt5YBukNE/aewlwSJJnZAkaGiPXe6YW5+V7yM+a4mSjybbe sIIJ4ShOwkMUWRS2BepsqrZIWYB4le7n+Im1k1GNd7SjexIReyUSOuwoTf0K0+3MGhRx csEg== X-Gm-Message-State: AOAM533UYR5QhnKH1tJ8BWEgmXFaaVWJ/nZvsplWrnl6BwRToAIGXNvF VRFG3gUiaiXzrwzjJ0QcnEw= 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 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 Cc: linux-tegra@vger.kernel.org, devicetree@vger.kernel.org, alsa-devel@alsa-project.org, linux-kernel@vger.kernel.org X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: alsa-devel-bounces@alsa-project.org Sender: "Alsa-devel" 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 = "nvidia,tegra20-i2s"; - reg = <0x70002800 0x200>; - interrupts = < 45 >; - clocks = <&tegra_car 11>; - resets = <&tegra_car 11>; - reset-names = "i2s"; - dmas = <&apbdma 21>, <&apbdma 21>; - dma-names = "rx", "tx"; -}; diff --git a/Documentation/devicetree/bindings/sound/nvidia,tegra20-i2s.yaml 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 = "nvidia,tegra20-i2s"; + reg = <0x70002800 0x200>; + interrupts = <45>; + clocks = <&tegra_car 11>; + resets = <&tegra_car 11>; + reset-names = "i2s"; + dmas = <&apbdma 21>, <&apbdma 21>; + dma-names = "rx", "tx"; + }; + +... From patchwork Fri Dec 17 17:55:58 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Osipenko X-Patchwork-Id: 12685381 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 alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) (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 ABF59C433F5 for ; Fri, 17 Dec 2021 17:59:44 +0000 (UTC) Received: from alsa1.perex.cz (alsa1.perex.cz [207.180.221.201]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by alsa0.perex.cz (Postfix) with ESMTPS id 7997C2022; Fri, 17 Dec 2021 18:58:52 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 7997C2022 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1639763982; bh=2Ol8abKGc+zskkMapnQKJNkYYl2bq1CyrDrpn/+MGgA=; h=From:To:Subject:Date:In-Reply-To:References:Cc:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=QESRXebxN41EbF7oRBtGhZ5H6ynuSseR9HukogZ1jad6jF6qt4CCvBB9tVNictvlB ASp+o9Vy1seRM9sZ+G8swwBheFcJMmj09YUe3a6tZmluzuQb0NvyFJSD/UZXU+Y7fq BanMejxE3h4lnw+y0D/l1WP9VILsyckP3vcNySHQ= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id 97B81F804CA; Fri, 17 Dec 2021 18:58:17 +0100 (CET) Received: by alsa1.perex.cz (Postfix, from userid 50401) id E7952F804CA; Fri, 17 Dec 2021 18:58:15 +0100 (CET) Received: from mail-lf1-x12f.google.com (mail-lf1-x12f.google.com [IPv6:2a00:1450:4864:20::12f]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id 2F42CF80161 for ; Fri, 17 Dec 2021 18:58:08 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 2F42CF80161 Authentication-Results: alsa1.perex.cz; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="gd63/Dw9" Received: by mail-lf1-x12f.google.com with SMTP id t3so6172165lfe.12 for ; 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=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=eBq1U9NtApwglXEropCmx6KnkVF2nkp44SfSdcz30bFodaGrHSsCz8qyDAHN+vOarl 4MywB0T7tUXG1npo8WglG+kDwbqP0w8PXYvgXNYETb0BMaIVX05bY9NM8rQhSYxybvgZ yQTlUsANXvvBO2xvMheJf1I9JvDw7Oxa/dPh2BDWFvJN8O7woQN5clv1l2xRU2k3Vn0j Rn+5IPsA2MMpXKSbVLVfT0jq/UsYFcHEE3Rash07tkVopruS+fizEnsSc7Xe+jx7T22h 10cjp7IkUJjxkRKQLqnR6PFrzUW+eG1On/TfgCnqOn0B6bdCks6gh6XqfIdjROgRJFkc iqHg== X-Gm-Message-State: AOAM533V0jHcVOfQDMrVb75qaLxeaoMvQeIvMWaTftny9M8xqX2YdZB+ kA9MJTf5Qhx2EJEMR1Z0FYY= 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 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 Cc: linux-tegra@vger.kernel.org, devicetree@vger.kernel.org, alsa-devel@alsa-project.org, linux-kernel@vger.kernel.org X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: alsa-devel-bounces@alsa-project.org Sender: "Alsa-devel" 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.yaml 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 + 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 From patchwork Fri Dec 17 17:55:59 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Osipenko X-Patchwork-Id: 12685393 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 alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) (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 CE6FBC433F5 for ; Fri, 17 Dec 2021 18:00:49 +0000 (UTC) Received: from alsa1.perex.cz (alsa1.perex.cz [207.180.221.201]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by alsa0.perex.cz (Postfix) with ESMTPS id E9402287E; Fri, 17 Dec 2021 18:59:57 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz E9402287E DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1639764048; bh=TCdlS3i1JG0E4HVY892U2Nz4csN4u0Hso1LmaN+CGmE=; h=From:To:Subject:Date:In-Reply-To:References:Cc:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=ZK1kdcyxYguISvtL+tb1DmI85Tg06vOsNZUSTBKpqzGDj1Ed8YhzCfCZGPWLduKcw 9x75G6ID2UkO57bla6PzO3yX+WxjoeddkG2wnDWPdKsHe8mGrQtRRssbyLQ1eyFfcj zarKHFbth1S+0MSSbfD006HGwSM8tuLT205BcINw= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id 4CCC1F80518; Fri, 17 Dec 2021 18:58:23 +0100 (CET) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 8BE63F8016D; Fri, 17 Dec 2021 18:58:20 +0100 (CET) Received: from mail-lf1-x12d.google.com (mail-lf1-x12d.google.com [IPv6:2a00:1450:4864:20::12d]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id 5BD7CF800B0 for ; Fri, 17 Dec 2021 18:58:12 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 5BD7CF800B0 Authentication-Results: alsa1.perex.cz; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="gAf4vyWy" Received: by mail-lf1-x12d.google.com with SMTP id d38so6371319lfv.0 for ; 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=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=wbITlWX4oMih2WBkhUtz1Dpo0y4fb4gKc+UYpRzS/DbOij5CS+xL5ymCeNfnI6WGcF Zkom3uVBg7RMJ6/4KydIspMLogBYogiAZ2OXHusmnIEJyYOFNV3MB2Czo36LMLeyr3A7 RvwiD6t4Pqv03XLGOSfFUDmemZ09z9d59+/ZnLOrDXtp7YdBVDSmi+Y4b7p+ViIpuxB8 ZtFTivNIzK+HjP8F0SuOPGeiHE98URA/0N7ufMp37B0+RbpabfeE9CtAxbaK+Pyn4oJR KE00Bx8w2bVbVS+GhFs9v5d604GaWOsgfbR5nl1qGgJMoeZbfXVCq/wbb8rtXqua4m/k 0sCQ== X-Gm-Message-State: AOAM531O9tC5RYePHfoU37KmvTrF682zJ5rycgszDtufjdb/bYK/mZnx fJQ19n6ATT86l8rckC6uzx0= 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 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 Cc: linux-tegra@vger.kernel.org, devicetree@vger.kernel.org, alsa-devel@alsa-project.org, linux-kernel@vger.kernel.org X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: alsa-devel-bounces@alsa-project.org Sender: "Alsa-devel" 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_spdif.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_substream *substream, regmap_update_bits(spdif->regmap, TEGRA20_SPDIF_CTRL, mask, val); + /* + * 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 = 4096000; From patchwork Fri Dec 17 17:56:00 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Osipenko X-Patchwork-Id: 12685385 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 alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) (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 D7303C433EF for ; Fri, 17 Dec 2021 18:00:15 +0000 (UTC) Received: from alsa1.perex.cz (alsa1.perex.cz [207.180.221.201]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by alsa0.perex.cz (Postfix) with ESMTPS id 94C021FDA; Fri, 17 Dec 2021 18:59:23 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 94C021FDA DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1639764013; bh=Vl/41kvfdFpyRHJ6pNDcrzc48X1FAH4DBnCBilQ1CLE=; h=From:To:Subject:Date:In-Reply-To:References:Cc:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=LCs3Lu4AXMlZwBDo1CQwsMiX2OpO01BamZEf1cSoMPI8kROG9e1VsZ88kFF6FbiNO vO3IheDLNw8+yiaQcwV4Cw5kjBYlR5J1Tqi8o/NYBoaz5kg0qZ3k8gnd8hYNfGRWh3 sHwz6YQcxRik2LxrngNpyOVvwwnD/Dne71bUX0rY= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id 3DF29F804EB; Fri, 17 Dec 2021 18:58:22 +0100 (CET) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 15BB0F804FA; Fri, 17 Dec 2021 18:58:18 +0100 (CET) Received: from mail-lf1-x136.google.com (mail-lf1-x136.google.com [IPv6:2a00:1450:4864:20::136]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id 6DB07F800AB for ; Fri, 17 Dec 2021 18:58:09 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 6DB07F800AB Authentication-Results: alsa1.perex.cz; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="Hp038EhP" Received: by mail-lf1-x136.google.com with SMTP id cf39so6239654lfb.8 for ; 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=7TXyF6UV69eBJmYDenl15PjBete1Zum7/1bocTb8o9BiNT5eHLH+kYtS6+Jqq4g8oU 32/4yNbchsDgSjA21h9NSDXDecLWse57pIbKTTqIkAAhbbExkVbmleEKwUgAtdnC9kzQ dEkCLXKyK0Lc1709GF7mSuXojuNt1gsFuT232tIINvh5lBBM+AIGYtQphS/lNH3WL5GW huidbuDDxh2cAKXg/HUI0zSEXO9u9fOVR4pTx7ZQRuzxmjGOUo/FunM47xoJp/gaauxH XwMeSEn+Q6aCytJ+NdXO8y/lo5FBkHHkHyl6Kulyvnq9CTjvlQ4aBXwavDgwWSQHbzi3 xykA== X-Gm-Message-State: AOAM53373B1gQRfK0znuORi9iPvdqRYpBmm8iEfC8AVs2FBMPdmY7u17 xJAcu+1DrTA2QNjXcMzRygI= 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 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 Cc: linux-tegra@vger.kernel.org, devicetree@vger.kernel.org, alsa-devel@alsa-project.org, linux-kernel@vger.kernel.org X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: alsa-devel-bounces@alsa-project.org Sender: "Alsa-devel" 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_spdif.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) dev_set_drvdata(&pdev->dev, spdif); - spdif->clk_spdif_out = devm_clk_get(&pdev->dev, "spdif_out"); + spdif->clk_spdif_out = devm_clk_get(&pdev->dev, "out"); if (IS_ERR(spdif->clk_spdif_out)) { pr_err("Can't retrieve spdif clock\n"); ret = PTR_ERR(spdif->clk_spdif_out); @@ -340,10 +341,17 @@ static const struct dev_pm_ops tegra20_spdif_pm_ops = { tegra20_spdif_runtime_resume, NULL) }; +static const struct of_device_id tegra20_spdif_of_match[] = { + { .compatible = "nvidia,tegra20-spdif", }, + {}, +}; +MODULE_DEVICE_TABLE(of, tegra20_spdif_of_match); + static struct platform_driver tegra20_spdif_driver = { .driver = { .name = DRV_NAME, .pm = &tegra20_spdif_pm_ops, + .of_match_table = tegra20_spdif_of_match, }, .probe = tegra20_spdif_platform_probe, .remove = 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); From patchwork Fri Dec 17 17:56:01 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Osipenko X-Patchwork-Id: 12685397 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 alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) (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 36AD8C433EF for ; Fri, 17 Dec 2021 18:01:28 +0000 (UTC) Received: from alsa1.perex.cz (alsa1.perex.cz [207.180.221.201]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by alsa0.perex.cz (Postfix) with ESMTPS id 62BD2289F; Fri, 17 Dec 2021 19:00:36 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 62BD2289F DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1639764086; bh=oStwOQFSzZFNTEX57YYfd7fgakSTr9Y9N0zm1cpE7HU=; h=From:To:Subject:Date:In-Reply-To:References:Cc:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=MbKMmdSRhK06fDi2qgqzYTbw50o1YamiK0Hmbso5V5zEXNjjtC9dQkfVOXzLwGvyK OeTYYp8Ug57u3IW7Yir5ZrzCSzM4OGwucT07+Xyr6EFD3tot89/SCsDgsZZBbJVFdT kMvgpOLQF5LMl2GR0M5cJqEJGbIqNlegftHY3BCw= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id EF30FF804F2; Fri, 17 Dec 2021 18:58:27 +0100 (CET) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 9F9FAF804E2; Fri, 17 Dec 2021 18:58:18 +0100 (CET) Received: from mail-lj1-x22b.google.com (mail-lj1-x22b.google.com [IPv6:2a00:1450:4864:20::22b]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id 87D29F80163 for ; Fri, 17 Dec 2021 18:58:09 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 87D29F80163 Authentication-Results: alsa1.perex.cz; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="eVsiYbxg" Received: by mail-lj1-x22b.google.com with SMTP id 207so4557689ljf.10 for ; 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=tc9BXF7QvAirMvlC7Nw4xJu2ksKxLUWZI7ZyEGv05TTkDx2xHd2aTrIVOkAwE8GKjO o6qaTKHiSVJ2XcWoJO92cDj9cZwN1imFFwVq6zNBeF/BHV0FASjNpBT3s3ispRiVic7l +7GkUIQqxdJ5s2G9DarTBmQjDWb1tVHGE2+VeBrnx5cB1aHOlq/8z4Cq6PhRX5CitQHj 9K/AKifBQK+YDKI4c10SLnt7HnseClBL7pDDLsOL+J9noICz5v2W8XcNbguRDKsg8kUr FY176JmXOkV+6SiAmMx/l9GvVKIIC89RJ3jm1XkjjM3IuYyhO7PR2JV0ZmTWm+vggWMA z1Sg== X-Gm-Message-State: AOAM530ngaFTYleJ4SIXf3lkV2skSiK8BLGcGwQQHt9/pzeqgIhpDGoX d1pZ5MyzmAFjeeVRgxtsAvXCBzeBVcE= 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 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 Cc: linux-tegra@vger.kernel.org, devicetree@vger.kernel.org, alsa-devel@alsa-project.org, linux-kernel@vger.kernel.org X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: alsa-devel-bounces@alsa-project.org Sender: "Alsa-devel" - 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_spdif.c index 801784915004..d5c618611dbb 100644 --- a/sound/soc/tegra/tegra20_spdif.c +++ b/sound/soc/tegra/tegra20_spdif.c @@ -23,8 +23,6 @@ #include "tegra20_spdif.h" -#define DRV_NAME "tegra20-spdif" - static __maybe_unused int tegra20_spdif_runtime_suspend(struct device *dev) { struct tegra20_spdif *spdif = dev_get_drvdata(dev); @@ -49,11 +47,10 @@ static __maybe_unused int tegra20_spdif_runtime_resume(struct device *dev) } 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 = dai->dev; - struct tegra20_spdif *spdif = snd_soc_dai_get_drvdata(dai); + struct tegra20_spdif *spdif = dev_get_drvdata(dai->dev); unsigned int mask = 0, val = 0; int ret, spdifclock; @@ -106,7 +103,7 @@ static int tegra20_spdif_hw_params(struct snd_pcm_substream *substream, ret = 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; } @@ -127,9 +124,9 @@ static void tegra20_spdif_stop_playback(struct tegra20_spdif *spdif) } 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 = snd_soc_dai_get_drvdata(dai); + struct tegra20_spdif *spdif = dev_get_drvdata(dai->dev); switch (cmd) { case SNDRV_PCM_TRIGGER_START: @@ -151,7 +148,7 @@ static int tegra20_spdif_trigger(struct snd_pcm_substream *substream, int cmd, static int tegra20_spdif_probe(struct snd_soc_dai *dai) { - struct tegra20_spdif *spdif = snd_soc_dai_get_drvdata(dai); + struct tegra20_spdif *spdif = dev_get_drvdata(dai->dev); dai->capture_dma_data = NULL; dai->playback_dma_data = &spdif->playback_dma_data; @@ -160,26 +157,26 @@ static int tegra20_spdif_probe(struct snd_soc_dai *dai) } static const struct snd_soc_dai_ops tegra20_spdif_dai_ops = { - .hw_params = tegra20_spdif_hw_params, - .trigger = tegra20_spdif_trigger, + .hw_params = tegra20_spdif_hw_params, + .trigger = tegra20_spdif_trigger, }; static struct snd_soc_dai_driver tegra20_spdif_dai = { - .name = DRV_NAME, + .name = "tegra20-spdif", .probe = tegra20_spdif_probe, .playback = { .stream_name = "Playback", .channels_min = 2, .channels_max = 2, .rates = SNDRV_PCM_RATE_32000 | SNDRV_PCM_RATE_44100 | - SNDRV_PCM_RATE_48000, + SNDRV_PCM_RATE_48000, .formats = SNDRV_PCM_FMTBIT_S16_LE, }, .ops = &tegra20_spdif_dai_ops, }; static const struct snd_soc_component_driver tegra20_spdif_component = { - .name = DRV_NAME, + .name = "tegra20-spdif", }; 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 = { 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; @@ -273,27 +270,19 @@ static int tegra20_spdif_platform_probe(struct platform_device *pdev) spdif->clk_spdif_out = devm_clk_get(&pdev->dev, "out"); if (IS_ERR(spdif->clk_spdif_out)) { - pr_err("Can't retrieve spdif clock\n"); - ret = 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); } regs = devm_platform_get_and_ioremap_resource(pdev, 0, &mem); if (IS_ERR(regs)) return PTR_ERR(regs); - dmareq = platform_get_resource(pdev, IORESOURCE_DMA, 0); - if (!dmareq) { - dev_err(&pdev->dev, "No DMA resource\n"); - return -ENODEV; - } - spdif->regmap = 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 = PTR_ERR(spdif->regmap); - return ret; + return PTR_ERR(spdif->regmap); } spdif->playback_dma_data.addr = 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 = -ENOMEM; goto err_pm_disable; } @@ -349,14 +337,13 @@ MODULE_DEVICE_TABLE(of, tegra20_spdif_of_match); static struct platform_driver tegra20_spdif_driver = { .driver = { - .name = DRV_NAME, + .name = "tegra20-spdif", .pm = &tegra20_spdif_pm_ops, .of_match_table = tegra20_spdif_of_match, }, .probe = tegra20_spdif_platform_probe, .remove = tegra20_spdif_platform_remove, }; - module_platform_driver(tegra20_spdif_driver); MODULE_AUTHOR("Stephen Warren "); From patchwork Fri Dec 17 17:56:02 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Osipenko X-Patchwork-Id: 12685383 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 alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) (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 EA9D0C433EF for ; Fri, 17 Dec 2021 17:59:57 +0000 (UTC) Received: from alsa1.perex.cz (alsa1.perex.cz [207.180.221.201]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by alsa0.perex.cz (Postfix) with ESMTPS id 01F892009; Fri, 17 Dec 2021 18:59:06 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 01F892009 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1639763996; bh=EgWZ18uv3EHwHaKAUQzezyaowXFjNpN6C+GuAdTarC0=; h=From:To:Subject:Date:In-Reply-To:References:Cc:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=DtEvbLMG/HWpVYzRWWUYKM7Q05pcvgrNbrkZdtPNGg0nRysMuq74fKTM5HWIp5/r9 dge3nJqqxTf1lBliyMK5CyYtGwr1/AhS/E4QcSa7CrQ4K7OEH36+fxnFU8AKct25yt 2UjoLeaHGutIWe46Xaj55fqD/GODa1tEMhVe/e/k= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id 59BA4F800AB; Fri, 17 Dec 2021 18:58:21 +0100 (CET) Received: by alsa1.perex.cz (Postfix, from userid 50401) id E0DF4F804F2; Fri, 17 Dec 2021 18:58:17 +0100 (CET) Received: from mail-lf1-x12a.google.com (mail-lf1-x12a.google.com [IPv6:2a00:1450:4864:20::12a]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id D07ADF802A0 for ; Fri, 17 Dec 2021 18:58:10 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz D07ADF802A0 Authentication-Results: alsa1.perex.cz; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="Be/hYpcF" Received: by mail-lf1-x12a.google.com with SMTP id cf39so6239767lfb.8 for ; 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=fFSVRVhcFDecXsx6BqmrZ/+ZlZys3O4VgCCv5xlMNOJ+B+huccBhBsbpYyESalRZA9 TEO18CuVitGqHq8gZFDkuooOqby9F+tg2ijSQPD6LEA5lpOmxlmGtqUat/3xCH3U2nD1 3ZDD5BTkMKJiMHz5OwJ5jxyUajz2cMK2VQI1dLd/+gMy28YLgrpNuuASDorrTk2txOfD lzQWRgCc2lBCgJ0Rj97Ln7X5ijdQnC3ZLOLz6Cv6f9W6M7yxJEasLAPqCqokmxAHgKFW xz2kbUVaG8qJ6JTAR7f1YlHCCnNxflMi117osEeUkQnfds2p/RXxpfNkftbv0LEegfTC evjw== X-Gm-Message-State: AOAM530ZHPfTGZMHfXNham72YFCCWUExOCgxR5g1OELd1+6cFbxkH3yQ QZGhAlIZJYZAc3A95NhaLiU= 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 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 Cc: linux-tegra@vger.kernel.org, devicetree@vger.kernel.org, alsa-devel@alsa-project.org, linux-kernel@vger.kernel.org X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: alsa-devel-bounces@alsa-project.org Sender: "Alsa-devel" 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_spdif.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 platform_device *pdev) spdif->playback_dma_data.addr_width = DMA_SLAVE_BUSWIDTH_4_BYTES; spdif->playback_dma_data.maxburst = 4; - pm_runtime_enable(&pdev->dev); + ret = devm_pm_runtime_enable(&pdev->dev); + if (ret) + return ret; - ret = snd_soc_register_component(&pdev->dev, &tegra20_spdif_component, - &tegra20_spdif_dai, 1); + ret = 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; } - ret = tegra_pcm_platform_register(&pdev->dev); + ret = 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; } - 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; } @@ -342,7 +328,6 @@ static struct platform_driver tegra20_spdif_driver = { .of_match_table = tegra20_spdif_of_match, }, .probe = tegra20_spdif_platform_probe, - .remove = tegra20_spdif_platform_remove, }; module_platform_driver(tegra20_spdif_driver); 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); +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 *component, 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); From patchwork Fri Dec 17 17:56:03 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Osipenko X-Patchwork-Id: 12685403 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 alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) (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 3BEFFC433F5 for ; Fri, 17 Dec 2021 18:02:20 +0000 (UTC) Received: from alsa1.perex.cz (alsa1.perex.cz [207.180.221.201]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by alsa0.perex.cz (Postfix) with ESMTPS id 680F328B7; Fri, 17 Dec 2021 19:01:28 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 680F328B7 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1639764138; bh=dZ83lhOhpmsL/GPo9a85Mzo2Xz+FY36iwunFvVyF7SA=; h=From:To:Subject:Date:In-Reply-To:References:Cc:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=T6jiG826g0UIf6mpVa3i5rZVqdgzIm9qzPouaTYjtKgAnIA8avvqIJiP8o8cFlUyd twY2Rh7UsFSjenQNdCaYvViy2OdNDhqTPoD14Xn6oUAQLg5nXzX9hN4DxDQhKhTn2+ Xmpe9oE6qoG5KsiJrGTaegbQTY/WqPI4loVp1Qfk= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id 76149F80536; Fri, 17 Dec 2021 18:58:29 +0100 (CET) Received: by alsa1.perex.cz (Postfix, from userid 50401) id AE369F80525; Fri, 17 Dec 2021 18:58:26 +0100 (CET) Received: from mail-lf1-x130.google.com (mail-lf1-x130.google.com [IPv6:2a00:1450:4864:20::130]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id 9357EF8030F for ; Fri, 17 Dec 2021 18:58:15 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 9357EF8030F Authentication-Results: alsa1.perex.cz; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="VjmC0Y9w" Received: by mail-lf1-x130.google.com with SMTP id cf39so6239830lfb.8 for ; Fri, 17 Dec 2021 09:58:15 -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=aIgmRlrgn9NPD/kpkXQz0rcDNGtexq3+LiBKVWB7roiM1SspQZQ08IkwVaoG3W6/WT 7jUBLiFdi08NvUC7oCCe8Eph/yTf53t/ZNiJZcHrnBsMwPu/0yATAoT/wukhkKM1PzGs RyEcF+fOWPyP9jjSw6+9BOb6uzYlvarZ4nzQuoB0x1BMbKET/ZXeiofSdo22LEmdU3VB Xu4gSHs370CBmriR4zwQ5qwwyylBbQaRMXRDe2H103gQV4pxJGHpyrlGXuTKBPzEOMwb AeVJUsTMv3BY4BTg1v4M0xEeQL12DQcge34G8EP5s68MqJ4HzxQJpCX368e0mJoit1i6 4rFQ== X-Gm-Message-State: AOAM533iaP7AR74SFBJPlD5TJNKL3SryTworK4JjijlmN+shmAUwMHr/ /ZQcfm/ePNiXbHkHD4AFQR27DfULPVE= 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 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 Cc: linux-tegra@vger.kernel.org, devicetree@vger.kernel.org, alsa-devel@alsa-project.org, linux-kernel@vger.kernel.org X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: alsa-devel-bounces@alsa-project.org Sender: "Alsa-devel" 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_spdif.c index 7dd263721c2c..bc45a0a8afab 100644 --- a/sound/soc/tegra/tegra20_spdif.c +++ b/sound/soc/tegra/tegra20_spdif.c @@ -7,6 +7,7 @@ */ #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(struct device *dev) { struct tegra20_spdif *spdif = dev_get_drvdata(dev); + regcache_cache_only(spdif->regmap, true); + clk_disable_unprepare(spdif->clk_spdif_out); return 0; @@ -37,13 +41,35 @@ static __maybe_unused int tegra20_spdif_runtime_resume(struct device *dev) struct tegra20_spdif *spdif = dev_get_drvdata(dev); int ret; + ret = reset_control_assert(spdif->reset); + if (ret) + return ret; + ret = clk_prepare_enable(spdif->clk_spdif_out); if (ret) { dev_err(dev, "clk_enable failed: %d\n", ret); return ret; } + usleep_range(10, 100); + + ret = reset_control_deassert(spdif->reset); + if (ret) + goto disable_clocks; + + regcache_cache_only(spdif->regmap, false); + regcache_mark_dirty(spdif->regmap); + + ret = regcache_sync(spdif->regmap); + if (ret) + goto disable_clocks; + return 0; + +disable_clocks: + clk_disable_unprepare(spdif->clk_spdif_out); + + return ret; } static int tegra20_spdif_hw_params(struct snd_pcm_substream *substream, @@ -268,6 +294,12 @@ static int tegra20_spdif_platform_probe(struct platform_device *pdev) dev_set_drvdata(&pdev->dev, spdif); + spdif->reset = 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 = 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_spdif.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; }; #endif From patchwork Fri Dec 17 17:56:04 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Osipenko X-Patchwork-Id: 12685401 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 alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) (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 82E86C433EF for ; Fri, 17 Dec 2021 18:02:01 +0000 (UTC) Received: from alsa1.perex.cz (alsa1.perex.cz [207.180.221.201]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by alsa0.perex.cz (Postfix) with ESMTPS id A2E57289E; Fri, 17 Dec 2021 19:01:09 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz A2E57289E DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1639764119; bh=OUfYfB9FwkQbrFW8I835LS+lqG+miLAVKQXKnH48vps=; h=From:To:Subject:Date:In-Reply-To:References:Cc:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=Et/jZW0Fm9LQ2NBpEb+M4w+E3deS7a5KXuZ4UvloLrVfQbh/6rW2dKC/jknTI0t+N QCF+okE+BUQnqHJkeju4rburtb3UIPeQX6qY4kttqFRWpibO0C8fnNUoCcxX4jicR5 +n9WH7v/TsKVERMrbDILQWYIuBLC8HCdQ8d85v/s= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id EA7C4F8052F; Fri, 17 Dec 2021 18:58:28 +0100 (CET) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 03A35F80528; Fri, 17 Dec 2021 18:58:24 +0100 (CET) Received: from mail-lj1-x22e.google.com (mail-lj1-x22e.google.com [IPv6:2a00:1450:4864:20::22e]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id 9415CF8047B for ; Fri, 17 Dec 2021 18:58:12 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 9415CF8047B Authentication-Results: alsa1.perex.cz; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="hTeyIA3Z" Received: by mail-lj1-x22e.google.com with SMTP id bn20so4567626ljb.8 for ; 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=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=PuiR3TOFrwR8fH9Rvs02dhjr7iRfeceFnccOVcz5RIS0Ha8aDvXNQI/a/gv8tgKDw+ VPMZ3N3PyoUaUrbSTf0bCXrhKlcGrYCvh2JEXDkx7UOFi6XjdaO8EID04PAnTBjvfUt1 SDsa6EGIKHCqORPXS/go+ccnDR+nj5FkFYrvGmMnfY34gzidF6U4gQxiMAro1dFzVgAD j+i7QD/HPGAkJZdZ/taQ/iv68dtAD2eyhK/MtXk92PhDPKj6zrvv/p5/yaSo/E/hgUZs 4gcv616uMXPfZryA3EXPxztNW/RGJ616LEsqqOAwYm3cUsbpU713O+H+AcR9nyVnUACM 8ozg== X-Gm-Message-State: AOAM53095ZgF6xPFHyIlZsQnm3isUFsJeMPU07sgLlwbKsxMJKeA5rAa a7ELXWSOkOqjXBpHc9KaceA= 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 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 Cc: linux-tegra@vger.kernel.org, devicetree@vger.kernel.org, alsa-devel@alsa-project.org, linux-kernel@vger.kernel.org X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: alsa-devel-bounces@alsa-project.org Sender: "Alsa-devel" 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_spdif.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 = { 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) }; static const struct of_device_id tegra20_spdif_of_match[] = { From patchwork Fri Dec 17 17:56:05 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Osipenko X-Patchwork-Id: 12685399 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 alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) (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 1E155C433F5 for ; Fri, 17 Dec 2021 18:01:42 +0000 (UTC) Received: from alsa1.perex.cz (alsa1.perex.cz [207.180.221.201]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by alsa0.perex.cz (Postfix) with ESMTPS id DEBD91AC9; Fri, 17 Dec 2021 19:00:49 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz DEBD91AC9 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1639764100; bh=RSRSyNB2bIRIGR9AmgpslVLPosGed3rGZvncjaY2fKw=; h=From:To:Subject:Date:In-Reply-To:References:Cc:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=QHRaqNccdrG8CMyvdJSxIHqJYy61Hkeh3Z6i9A+CEc5o7es71QD/u2i7aXELDX14u 8Vpzz8+Wellw4Y1GsFTgle+rYbNfMCF72kNX7B8eGYtiyDSE6aARWPrsJ/0LGeCM8A taB5SnkI0zy67dvk0WIskUj1jxHwYXgFXBxQRPbE= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id 64E0DF80528; Fri, 17 Dec 2021 18:58:28 +0100 (CET) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 5FCA8F80510; Fri, 17 Dec 2021 18:58:22 +0100 (CET) Received: from mail-lj1-x231.google.com (mail-lj1-x231.google.com [IPv6:2a00:1450:4864:20::231]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id 4A07FF80161 for ; Fri, 17 Dec 2021 18:58:13 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 4A07FF80161 Authentication-Results: alsa1.perex.cz; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="F/+REdls" Received: by mail-lj1-x231.google.com with SMTP id l7so4628157lja.2 for ; 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=LMIGTPHKpf3IoERroDnzwlA1J39GEqp4DemJta2tpCpiin/XpFpC3zOBecXrDTGP8B +nfk8V2YQg6ywzuzN6+oh0NbUMXb1Qw55TJ31MHNkQ1GXhphNFs+xdlIo6c5dX0f0hxf B2h4y9HSHr0PR5qhhfWPnbp7l28cOUff2P0EtpBwvGqtGe1srVWBWjeFD9/CT7TwkI4/ 3AbaK0eRtPrLyucCfq8KBClvdq+K99Iab8vOnnB1NBoBsOv+J9AaaiRUlX9SmYFiQ5/T q/fVeU3OELUTJ75Rh67zZgpQYoLdd9/3kDQ2Ivwfx9UrgD6tXrPKgwCmsrfdWUZpOAoy UlSQ== X-Gm-Message-State: AOAM531YAOfK9Fhj8jWEPV8o1S99BVV01ru1kjKmNXbBS1RkTYYWd/n3 7OJ/Cjczwv6LITFg5lOeFxY= 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 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 Cc: linux-tegra@vger.kernel.org, devicetree@vger.kernel.org, alsa-devel@alsa-project.org, linux-kernel@vger.kernel.org X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: alsa-devel-bounces@alsa-project.org Sender: "Alsa-devel" 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_spdif.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_substream *substream, { struct tegra20_spdif *spdif = dev_get_drvdata(dai->dev); unsigned int mask = 0, val = 0; - int ret, spdifclock; + long rate, spdifclock; + int ret; mask |= TEGRA20_SPDIF_CTRL_PACK | TEGRA20_SPDIF_CTRL_BIT_MODE_MASK; @@ -133,6 +134,12 @@ static int tegra20_spdif_hw_params(struct snd_pcm_substream *substream, return ret; } + rate = clk_get_rate(spdif->clk_spdif_out); + if (rate != spdifclock) + dev_warn_once(dai->dev, + "SPDIF clock rate %ld doesn't match requested rate %ld\n", + spdifclock, rate); + return 0; } @@ -172,6 +179,59 @@ static int tegra20_spdif_trigger(struct snd_pcm_substream *substream, int cmd, return 0; } +static int tegra20_spdif_filter_rates(struct snd_pcm_hw_params *params, + struct snd_pcm_hw_rule *rule) +{ + struct snd_interval *r = hw_param_interval(params, rule->var); + struct snd_soc_dai *dai = rule->private; + struct tegra20_spdif *spdif = dev_get_drvdata(dai->dev); + struct clk *parent = clk_get_parent(spdif->clk_spdif_out); + const unsigned int rates[] = { 32000, 44100, 48000 }; + long i, parent_rate, valid_rates = 0; + + parent_rate = clk_get_rate(parent); + if (parent_rate <= 0) { + dev_err(dai->dev, "Can't get parent clock rate: %ld\n", + parent_rate); + return parent_rate ?: -EINVAL; + } + + for (i = 0; i < ARRAY_SIZE(rates); i++) { + if (parent_rate % (rates[i] * 128) == 0) + valid_rates |= 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 = 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 = 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 = { .hw_params = tegra20_spdif_hw_params, .trigger = tegra20_spdif_trigger, + .startup = tegra20_spdif_startup, }; static struct snd_soc_dai_driver tegra20_spdif_dai = { From patchwork Fri Dec 17 17:56:06 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Osipenko X-Patchwork-Id: 12685405 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 alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) (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 F2D8FC433EF for ; Fri, 17 Dec 2021 18:02:34 +0000 (UTC) Received: from alsa1.perex.cz (alsa1.perex.cz [207.180.221.201]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by alsa0.perex.cz (Postfix) with ESMTPS id 43CC228A1; Fri, 17 Dec 2021 19:01:43 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 43CC228A1 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1639764153; bh=iN0xVrOclKYtVrDjpwW4A3Omk5XZhrSNb6LNBJK/658=; h=From:To:Subject:Date:In-Reply-To:References:Cc:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=Gm4Va5J/Z/JOSIsZT+pmS3FRJL/6l7zD3iT2LsgEHpfuUwAwmyPbjYfEqlBji1mH4 dsi4o9nemmUcnILzpaLPVA7kEOp+P/y8+awtPp6Sj/C8gCnwN6lj0lgv045UdnB7LC qxchDpxmIPlDkPjYwjnHmCJesuSeO9/wlv6XRvxM= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id 0FA3FF8053A; Fri, 17 Dec 2021 18:58:30 +0100 (CET) Received: by alsa1.perex.cz (Postfix, from userid 50401) id D47EBF804F2; Fri, 17 Dec 2021 18:58:21 +0100 (CET) Received: from mail-lf1-x135.google.com (mail-lf1-x135.google.com [IPv6:2a00:1450:4864:20::135]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id DF238F8047C for ; Fri, 17 Dec 2021 18:58:14 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz DF238F8047C Authentication-Results: alsa1.perex.cz; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="U31Jz7S+" Received: by mail-lf1-x135.google.com with SMTP id k37so6300362lfv.3 for ; Fri, 17 Dec 2021 09:58:14 -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=HSzgB5+85c9hW/u45y1iyDJTwAQ5HZUNx3XUDoSo9vyMr36E0JvwkkTRYH/sk/DuKn mvApTtKZ+952ChjpsVPJq1Z0mqSAbvep56Paf1Hqm9MPFw/PfsQ9y7kwG63nZPs9fdJU j+fh0dJsMzI4TsEvgE0cpALrSajzjWsjKoWpl+W0BIBGu2f2orDdMFMlfPdOYdd/w9ih zRixwdTyPz8cSGzFxfAiRvWIc8cJ7of/UiYr8OiNfHN0ubZUJUpny7yjn0otmCcNZBrs Hi/Ut0Gqzx/gRgqXQeWN0kOAJAUjVUoEHci81FI0KVCorv5iojrwfoZj4Qf+kjb1k0NF tbiA== X-Gm-Message-State: AOAM532/KCwHHJjCZIT7UegZT5qhXcHnQHd2op541mEImnurWik+Cy20 SrVCNZ6y1u8kbeI0Ze6PVq4= 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 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 Cc: linux-tegra@vger.kernel.org, devicetree@vger.kernel.org, alsa-devel@alsa-project.org, linux-kernel@vger.kernel.org X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: alsa-devel-bounces@alsa-project.org Sender: "Alsa-devel" 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; } +static const unsigned int tegra20_i2s_rates[] = { + 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 = hw_param_interval(params, rule->var); + struct snd_soc_dai *dai = rule->private; + struct tegra20_i2s *i2s = dev_get_drvdata(dai->dev); + struct clk *parent = clk_get_parent(i2s->clk_i2s); + long i, parent_rate, valid_rates = 0; + + parent_rate = clk_get_rate(parent); + if (parent_rate <= 0) { + dev_err(dai->dev, "Can't get parent clock rate: %ld\n", + parent_rate); + return parent_rate ?: -EINVAL; + } + + for (i = 0; i < ARRAY_SIZE(tegra20_i2s_rates); i++) { + if (parent_rate % (tegra20_i2s_rates[i] * 128) == 0) + valid_rates |= 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 = 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 = { .set_fmt = tegra20_i2s_set_fmt, .hw_params = tegra20_i2s_hw_params, .trigger = tegra20_i2s_trigger, + .startup = tegra20_i2s_startup, }; static const struct snd_soc_dai_driver tegra20_i2s_dai_template = {