From patchwork Thu Sep 7 15:17:15 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Jakob Unterwurzacher X-Patchwork-Id: 13376496 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id C5CA0EC8738 for ; Thu, 7 Sep 2023 15:18:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:Message-Id:Date:Subject:Cc :To:From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References: List-Owner; bh=NjsXCs9QamMsWG/pVMVOZbwN59Yafz8v979qfwsWcss=; b=V6jPP4w388kgNL XWcj4qYBrHsoBiFJyC/QRycxRVSKJY3bLiB5aCDoL44UKSyldPpI14tOCqyxFsT0ouzzPQlKHME+U 97B3JUf6t6w3VUwDaMWyyaq78mVhYcw/ACecEEdjQMX9Bc7K9moFSyGMboJ3iguBxnsotmp1SyVsG UQaMm6TkQN9m1N7KQR1O2f+eprI7PMv28HRWqN1x8H0xalDfBC1UBXgon113wevjAHfij6qJ0Pbqs FqdMdLL/3RLrexQNkBLv91RlzT2dRVYOcdF9+7vVK1O5a4nhIhKSmaGpRF9YpFpl1yPJ1Lw+xoTVj Lcu1N8ayGIX2WHCVbaZw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qeGlp-00CFRJ-02; Thu, 07 Sep 2023 15:18:13 +0000 Received: from mail-wm1-x32f.google.com ([2a00:1450:4864:20::32f]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1qeGll-00CFQH-25; Thu, 07 Sep 2023 15:18:11 +0000 Received: by mail-wm1-x32f.google.com with SMTP id 5b1f17b1804b1-40078c4855fso12004905e9.3; Thu, 07 Sep 2023 08:18:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1694099885; x=1694704685; darn=lists.infradead.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=HfJRvGG1+8tzxY0msM4PeR5IqsDQRVgMRK4cu1iRcR4=; b=fIhzH1TKTx8zhOSsS02s5u9navLk16rPitCi8GhqnEYphgTWSwzT/uknqNp/OHYF9z MWePa3IP9LxQOSkxXRs3oJT7BrN4oRrLAWiHqiv1fDGYvgNFvPRJBSFX0J1gR2G4h8hv lcM1lON71qwosst0R/ku6m4WzqnxBUHBSZ4ZlAu9yWEAYH+hGGr9EWmwTWEnL1MsxYC6 leTEEtOWLtNEY2yx0FKVjGFjkjUxZ9RoXRmfKb8AMYDowTkFgmMzXSMbm5izxg9MuYSK MCr8Hr2YcUdhMvBsoSEoocc1l4nguzNkNrXWpTFl+IuzzQ9NpRvK5qtMAezgCqzjw2Rq i1lw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1694099885; x=1694704685; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=HfJRvGG1+8tzxY0msM4PeR5IqsDQRVgMRK4cu1iRcR4=; b=lCJxgZIrainvXKnW9yn46js7D31mZX5IqaM4q+IAOs1kNy9uafpiMs0bR0SDLbsx9s fBsPnws6ua1ceRJ9cA8uNuBX8m2dKkwhnEARon8nlQ1X/GelOpSumBwyIbiA+RjrDkjM IG174DbWop1CJiFHAyqgtDV62MbBEIr3aX3ILwNg8y8V/OoJCc3yepa2uUoq0JgP9vmM aHli0Q/atcezWNikXBWsEQ2UOtORNA+C/FBNOwA+sUjZHQhNOtAg/DC0t53QZi9NCmmT 8LlycYC9dmdv0MyUX00lJaBq5/tME+VSDfZifyUYB23sx1qXrBHrXw0FzBqXzxxAayhm KDFg== X-Gm-Message-State: AOJu0Yx/qV9wvLFLlPnvlkWrVnQwAap4Brqoz2k6WyVxMRg6SzIzOIOw czi6iScQAQ8wkwmeweOZ7ok= X-Google-Smtp-Source: AGHT+IEWg4FplZCvEqhV5FF+ef0iLgRk5TOFXN3+CPcXJLIjMTAIazbHqeW6H02I5cYNKK/M1AKx3Q== X-Received: by 2002:a5d:6846:0:b0:319:8a21:6f9a with SMTP id o6-20020a5d6846000000b003198a216f9amr4825426wrw.63.1694099884935; Thu, 07 Sep 2023 08:18:04 -0700 (PDT) Received: from opti3050-1.lan (ip092042140082.rev.nessus.at. [92.42.140.82]) by smtp.gmail.com with ESMTPSA id l16-20020adfe9d0000000b00317e77106dbsm23511973wrn.48.2023.09.07.08.18.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 07 Sep 2023 08:18:04 -0700 (PDT) From: Jakob Unterwurzacher X-Google-Original-From: Jakob Unterwurzacher To: Rob Herring , Krzysztof Kozlowski , Conor Dooley , Heiko Stuebner , Jakob Unterwurzacher , Ermin Sunj , Quentin Schulz Cc: stable@vger.kernel.org, devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-rockchip@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH v3 1/2] arm64: dts: rockchip: use codec as clock master on px30-ringneck-haikou Date: Thu, 7 Sep 2023 17:17:15 +0200 Message-Id: <20230907151725.198347-1-jakob.unterwurzacher@theobroma-systems.com> X-Mailer: git-send-email 2.39.2 MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230907_081809_686151_5D5DC716 X-CRM114-Status: GOOD ( 13.67 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org From: Ermin Sunj If the codec is not the clock master, the MCLK needs to be synchronous to both I2S_SCL ans I2S_LRCLK. We do not have that on Haikou, causing distorted audio. Before: Running an audio test script on Ringneck, 1kHz output sine wave is not stable and shows distortion. After: 10h audio test script loop failed only one time. That is 0.00014% failure rate. Cc: stable@vger.kernel.org Fixes: c484cf93f61b ("arm64: dts: rockchip: add PX30-µQ7 (Ringneck) SoM with Haikou baseboard") Signed-off-by: Ermin Sunj Signed-off-by: Jakob Unterwurzacher --- Notes: v1: https://lore.kernel.org/lkml/20230823122000.585787-1-jakob.unterwurzacher@theobroma-systems.com/ v2: https://lore.kernel.org/lkml/20230823131651.586934-1-jakob.unterwurzacher@theobroma-systems.com/ arch/arm64/boot/dts/rockchip/px30-ringneck-haikou.dts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/arch/arm64/boot/dts/rockchip/px30-ringneck-haikou.dts b/arch/arm64/boot/dts/rockchip/px30-ringneck-haikou.dts index 08a3ad3e7ae9..8792fae50257 100644 --- a/arch/arm64/boot/dts/rockchip/px30-ringneck-haikou.dts +++ b/arch/arm64/boot/dts/rockchip/px30-ringneck-haikou.dts @@ -68,15 +68,15 @@ i2s0-sound { simple-audio-card,format = "i2s"; simple-audio-card,name = "Haikou,I2S-codec"; simple-audio-card,mclk-fs = <512>; + simple-audio-card,frame-master = <&sgtl5000_codec>; + simple-audio-card,bitclock-master = <&sgtl5000_codec>; - simple-audio-card,codec { + sgtl5000_codec: simple-audio-card,codec { clocks = <&sgtl5000_clk>; sound-dai = <&sgtl5000>; }; simple-audio-card,cpu { - bitclock-master; - frame-master; sound-dai = <&i2s0_8ch>; }; }; From patchwork Thu Sep 7 15:17:16 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Jakob Unterwurzacher X-Patchwork-Id: 13376497 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id B9553EC8738 for ; Thu, 7 Sep 2023 15:18:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=2FB7weYFfcP/R5c9PwXXkZV2D3ow2Ti1+KJG7VHMDJ8=; b=R2pS+fTcT5qr7X 677A7acvoZQ5YjGLYTw8zhqvNWA/IRtr7bmNiLtqdUfysXoYnNzUf9V7J10t2vA34B/d2WFbKsQ0E T90/d/XKV732D6SNzMRgQBpFvX0JXre5r2yzuUmhFQcL5ETa4h2oWQu+7NZaQm4y1IasB9B5o/3I/ UfSiCKZ+m7Rdy/jSLUMG7cfWWJBz6pVOCG8d9e0snMkt3a/JwYtAgbapl8A/UfZXPUgsLBbfIc3E4 wMD2WpVMODYVRQocxmAq8QhFHqZMxLq21ZbOVQqi31igR0RM4FSocvdIuUurFcNuSnhypCsdmmrla cCA1sgXkPA6jZHmfWeCg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qeGlz-00CFTv-2a; Thu, 07 Sep 2023 15:18:23 +0000 Received: from mail-wr1-x432.google.com ([2a00:1450:4864:20::432]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1qeGlx-00CFSP-18; Thu, 07 Sep 2023 15:18:22 +0000 Received: by mail-wr1-x432.google.com with SMTP id ffacd0b85a97d-31c7912416bso1178221f8f.1; Thu, 07 Sep 2023 08:18:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1694099897; x=1694704697; darn=lists.infradead.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=Nn8Z/jGqRZ9itG0RlqprNFY2blvA+oxqrFjdAqCBlzs=; b=DK/9kiM6YW3TgcJoPkzkC2jDn6NtyaD473GWIe6J2KgHP4y2eEna5JL1IKQJQVMs6s MOv6rjrkNyTNT80TsUabjuy6BXyvksTCiJRs0RR/xYSVHtQV9xjG39+RUvxau3rgDkn5 tFBBMJPZzIassRc1eOwGOtSICBGvIsXM92gBn3l/W2RUppJvmFlI5//PqXhJTKwOL9fY JyPBM6YrIuDcYiBYYUNSFkRWkjWHUi/dhLmqHuEuT38a/3RVFNzWUmWpaOOONsCMFQhj cPoOSNUbUomU3HZIDCZwxM+Tz/NjjQUaCBMcROQ0kAF2tsoFOk4VYNPZ+CjElYqzUodl cjNA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1694099897; x=1694704697; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=Nn8Z/jGqRZ9itG0RlqprNFY2blvA+oxqrFjdAqCBlzs=; b=LcZmSkNn93zgpezKiuJ/vhZPDn2vrmYdHgoNvRzb7OQi/13afU7wkf/2g7iACbP0IQ D77jOw0rFvfFF0sV4ymh93xgbsh1Ba6UCetDsysrpk08skuza/g7dAp06ouHU02GrUTN hM9YdGdNyGwUqXDqXMpafO1sjSR7iHO13EHOS/yuKwKCqW0hwJyybKCYcYxH6sXfxg5Y H6Nz+0dal9O3i7sTbjHoI1w+DwBTHzhH30nL7tFOTLQoYteqBqsFHEEnMrO+NmgsMgB5 ZjvCZuTSd4RjHCbo2VLRyXj2teu9IW8IxeNlWrWbz7XPcjCJA5IRef5vPsR2AGU7aSZB +xLg== X-Gm-Message-State: AOJu0YwrdZvIrDm/cIF0I7WvQ4Z8lLnt8bD6r7NBD1Obv/qTaEiyOiKG AZODsG8N2xC8s+YMCidjO5o= X-Google-Smtp-Source: AGHT+IGwqB/QeKYr78Cb/wkxyZKiPbzH4gGpc1Z9STFRTx1jV4gSJPT2SnI8z4IiTAFD941kik9PbQ== X-Received: by 2002:a5d:4105:0:b0:314:3740:7f69 with SMTP id l5-20020a5d4105000000b0031437407f69mr4401146wrp.37.1694099897397; Thu, 07 Sep 2023 08:18:17 -0700 (PDT) Received: from opti3050-1.lan (ip092042140082.rev.nessus.at. [92.42.140.82]) by smtp.gmail.com with ESMTPSA id l16-20020adfe9d0000000b00317e77106dbsm23511973wrn.48.2023.09.07.08.18.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 07 Sep 2023 08:18:17 -0700 (PDT) From: Jakob Unterwurzacher X-Google-Original-From: Jakob Unterwurzacher To: Rob Herring , Krzysztof Kozlowski , Conor Dooley , Heiko Stuebner , Jakob Unterwurzacher , Ermin Sunj , Quentin Schulz Cc: stable@vger.kernel.org, devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-rockchip@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH v3 2/2] arm64: dts: rockchip: set codec system-clock-fixed on px30-ringneck-haikou Date: Thu, 7 Sep 2023 17:17:16 +0200 Message-Id: <20230907151725.198347-2-jakob.unterwurzacher@theobroma-systems.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230907151725.198347-1-jakob.unterwurzacher@theobroma-systems.com> References: <20230907151725.198347-1-jakob.unterwurzacher@theobroma-systems.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230907_081821_388976_9BDEFA95 X-CRM114-Status: GOOD ( 13.38 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Having sgtl5000_clk defines as "fixed-clock" is not enough to prevent the dai subsystem from overwriting the frequency via sgtl5000_set_dai_sysclk. Setting system-clock-fixed does the job, and now a 1kHz sine wave comes out as actually 1kHz, no matter the sample rate of the source. Testcase: These should sound the same: speaker-test -r 48000 -t sine -f 1000 speaker-test -r 24000 -t sine -f 1000 Also remove the clock link here as having it in sgtl5000 and sgtl5000_codec causes duplicate clock unprepares with associated backtrace. Cc: stable@vger.kernel.org Fixes: c484cf93f61b ("arm64: dts: rockchip: add PX30-µQ7 (Ringneck) SoM with Haikou baseboard") Signed-off-by: Jakob Unterwurzacher --- arch/arm64/boot/dts/rockchip/px30-ringneck-haikou.dts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/arch/arm64/boot/dts/rockchip/px30-ringneck-haikou.dts b/arch/arm64/boot/dts/rockchip/px30-ringneck-haikou.dts index 8792fae50257..de0a1f2af983 100644 --- a/arch/arm64/boot/dts/rockchip/px30-ringneck-haikou.dts +++ b/arch/arm64/boot/dts/rockchip/px30-ringneck-haikou.dts @@ -72,8 +72,10 @@ i2s0-sound { simple-audio-card,bitclock-master = <&sgtl5000_codec>; sgtl5000_codec: simple-audio-card,codec { - clocks = <&sgtl5000_clk>; sound-dai = <&sgtl5000>; + // Prevent the dai subsystem from overwriting the clock + // frequency. We are using a fixed-frequency oscillator. + system-clock-fixed; }; simple-audio-card,cpu {