From patchwork Wed Aug 23 13:16:50 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jakob Unterwurzacher X-Patchwork-Id: 13362392 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 40639EE49A0 for ; Wed, 23 Aug 2023 13:18:49 +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=XbDxT8laDZEq3ensTPkhblD5qdVgYLA1e+jcNvTGvxg=; b=bXwWvGWQhVf5On v8XVDmGqTBJvIjJdyrEtuEtRceQbRiiQm+M2tNAHdgSgT8CHz7UGEkAgTkkfk9KAzhhqW5T35fIQc ahVNrF8ql6JDcT4I67YRU93ekIE5+zGZXKJTyCSYtWY0aXoBgz4rQxOBKRLGh5NIq7V5xvgZvIu67 /6zx+vggo1XzvBpNELb1O2CrOXJeHnZxMXLZk13030CA80egFbT0PWgQ5yQhiq8RmgNc4cEIogQEf DfA79WUh+eMWa+wonDbf9S6yLLfvACX/q/hfrwK2J2zvSaAbBgR39BW8ijxYBwrMDceLe5G+/gjF2 kv4116PXeUTqYuAHs21A==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qYnkf-000el4-1t; Wed, 23 Aug 2023 13:18:25 +0000 Received: from mail-lf1-x129.google.com ([2a00:1450:4864:20::129]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1qYnjV-000dvY-2a; Wed, 23 Aug 2023 13:17:25 +0000 Received: by mail-lf1-x129.google.com with SMTP id 2adb3069b0e04-500913779f5so2365366e87.2; Wed, 23 Aug 2023 06:17:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1692796629; x=1693401429; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=zBFiSqxtgE2qy8qbvWPPqSrYIOJ343wUW66KNQ39qd4=; b=IVzyWNbaRAJqaA3TurIA2O1yCof/v1W5K2F3Ent7kxd6jRrE8BNwkgYcaiVOgJF1Ve kEWfMkthjdKlhVQxDPXlLEE4BInpyokyJ+iWhOiFgqDxJqQY33v+uke3+tjJ7mItFgJv Tx9NTgmrT+A5JTZwQuT7mjO6do+LuVoHI3chiD4IiXyn3Q2kRP4L+P6kQK0cQR1j2Vsr 1kt5f0a196emSX7/snmyUt1UzEn/ucDesbuKzeH8dhje+e/0suj+3R8bdhL4M/zM06GO vYT27r+KvlypY5dzOEyLOOs0HRTScPQ+iHrSGVjU6F6mVVtLVaZCFrFpwB60wn4TUig2 bZEg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1692796629; x=1693401429; 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=zBFiSqxtgE2qy8qbvWPPqSrYIOJ343wUW66KNQ39qd4=; b=YA5JDh7LaxSjC1bMdngYmR8Ocym1YBQPV7K4imwKDa/KXwYX92FQbWh/lcAr7eeLwL erkkgbWipKipPWGDlJpM5ZUnseaZO0vkU4CfhCgYe7OQgt8+XTDj6vyAB+B0Zah17I5f GWVmYuXQdxooyrHulMiOghGD2pCwfBZ8xvasLuLrmg597ZlwPsU5ndM3WAK69lMHjqMr 9gtZY1CNnJ2+5se+pXapQa9vHmmjcXXdyxa9F5cake3GYCerN4NFqfvBUZYRDCE2dNwj nUQJg/g3TSmvkfqkf7RL4htNiggzaK60uKeznNvQ9bKZjFYoDwJ8Tsm0vsfy0vrc+vXM joeg== X-Gm-Message-State: AOJu0Yx12VgN3sXIIkAt0j+qyF86DRwVtAYf1LFg6YadvNvoMylglbbL DmayQYp5Esat9+/ZVA00Ccc= X-Google-Smtp-Source: AGHT+IHT0ZG43kF2bkH6Jx4v+vfepZPgwnJjLHSz7HzuHLiPqFJ/3p+IYo8/1XCMjlZjCIfyvrMDqA== X-Received: by 2002:a05:6512:457:b0:500:920d:2add with SMTP id y23-20020a056512045700b00500920d2addmr2367594lfk.34.1692796628748; Wed, 23 Aug 2023 06:17:08 -0700 (PDT) Received: from opti3050-1.lan (ip092042140082.rev.nessus.at. [92.42.140.82]) by smtp.gmail.com with ESMTPSA id e1-20020a05600c218100b003fc080acf68sm22463192wme.34.2023.08.23.06.17.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 23 Aug 2023 06:17:08 -0700 (PDT) From: Jakob Unterwurzacher X-Google-Original-From: Jakob Unterwurzacher To: Rob Herring , Krzysztof Kozlowski , Heiko Stuebner Cc: jakob.unterwurzacher@theobroma-systems.com, Ermin Sunj , devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-rockchip@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH v2 1/2] arm64: dts: rockchip: use codec as clock master on px30-ringneck-haikou Date: Wed, 23 Aug 2023 15:16:50 +0200 Message-Id: <20230823131651.586934-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-20230823_061713_835880_1CE58600 X-CRM114-Status: GOOD ( 13.29 ) 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. Signed-off-by: Ermin Sunj 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 3a447d03e2a8..dafeef0c2dab 100644 --- a/arch/arm64/boot/dts/rockchip/px30-ringneck-haikou.dts +++ b/arch/arm64/boot/dts/rockchip/px30-ringneck-haikou.dts @@ -68,8 +68,10 @@ 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>; }; From patchwork Wed Aug 23 13:16:51 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jakob Unterwurzacher X-Patchwork-Id: 13362394 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 1AF37EE49B9 for ; Wed, 23 Aug 2023 13:18:57 +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=zoHuAUfjR/Rvqvv2V/FixA8qk/Fi04AfM+swXiMRkGw=; b=ag57KqEd0UYlQg RK1LmsAlnmqDY0ZMy3/Y61IV7U+zjap7RfEBI2v0Q0Rk7xT3D2TXdd2eS0Cph6dubQGrEFlLPZbwq MEDnqDYQOpKV1Gqa2TgMd8bPRrm8lMcTuzjXYZM5KtXSriJiJ+L9NF45QoeDyWb1j2FsXqtsc5zxW f4M4h+WLcoSksRXj9A8h+2EGU0ndN1Um/R6wBgQthT5OjRlPiZ2xu9qZU8zSuAOPMJNkffYnl2RYa E9gCfFOlJQiWaVPReERidBfN5Cpe0IIHiAvDaZQVVM/s5NYwa4IV6bIj9gB/wMw+PFsAUEbxR5W36 CDXJGbnDqbTe7eQCQxGQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qYnkg-000elv-2D; Wed, 23 Aug 2023 13:18:26 +0000 Received: from mail-lj1-x231.google.com ([2a00:1450:4864:20::231]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1qYnje-000e3r-2P; Wed, 23 Aug 2023 13:17:33 +0000 Received: by mail-lj1-x231.google.com with SMTP id 38308e7fff4ca-2b9bb097c1bso86063421fa.0; Wed, 23 Aug 2023 06:17:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1692796638; x=1693401438; 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=gCkeO3JMTWnAck68Ec8pL9VBr1IQgmzcgGRPd/I418Q=; b=HHtL5kjzz9CC75rSGGBlEATePuGnbCNdaaRHirXhA8oryVb0k/uQZAXAVgigFYDGvD 4rLRJDPfVM5oJOfqgaaZWd9SRVV7ZJ9v20yzMkiAKpcu1upmMIuM/1jv7OeYQEPCwwnc KxIv5GTjHAZdcZLqfn9kZBy9etsiWdHmAsx6tovC1VP8g5qlrRIxjSlwbbChMPVX4LIJ 3iU3WoT1HSc7J7UW3RIdnS2C6rzRf653gYmWtsWVkO6XwafAq8wauIZaos2ZT5M/TpGM Kv2CzDxiBNuU8OrV/fzvLtAvY4kIDFP07SFewBZeWjpnpk+376iOYfW1NmXj1udyfqZu 4QGw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1692796638; x=1693401438; 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=gCkeO3JMTWnAck68Ec8pL9VBr1IQgmzcgGRPd/I418Q=; b=KcjirutLqkf7Nbe0YCwITWSrNY5Yole2jTiPdncVhLQ63GB6o6GNYTJc7YqJSoIkQr iEWXoRqFa7O7XqMVgL6+yiVm+jw/GIW20VQhwOQysl153FjzO0xA/76r8L2e8DnwLVj0 bp6hCi0YzTg68l5uCcDz+0pwdzYBrTd6mUtG0FahXL7+Lnf66IHSjKfyz/6ep9Rma4KZ 8zRotcp8MdY9EoMVCrDm3uifpVWH/HeQPQl24EkmQqoZUaKVbOjmok8wytkpR+hDq4yQ JJ5ZZEgQqU6igxWnOMjPEUHRRJ+WOjeoBq+7EC3HI4TgdHkm1K5e51BmlZj7ivoxaDgE v8MA== X-Gm-Message-State: AOJu0Yx8FE8yqrqPxVlCSy9tAUpDW4jOxZEQdBBV1QDQkCfZOJQwWScR GFwBn1gkCvd4oVW06+bWoG0= X-Google-Smtp-Source: AGHT+IHsC8O1Dq5TVhEX9ZRsOegPJCDRHJD3up522LXRl9bLZX1msmlAVl5aMPUj2r2JwDGJl5PCmA== X-Received: by 2002:a2e:7d04:0:b0:2b8:3ac9:e201 with SMTP id y4-20020a2e7d04000000b002b83ac9e201mr9171906ljc.40.1692796638300; Wed, 23 Aug 2023 06:17:18 -0700 (PDT) Received: from opti3050-1.lan (ip092042140082.rev.nessus.at. [92.42.140.82]) by smtp.gmail.com with ESMTPSA id e1-20020a05600c218100b003fc080acf68sm22463192wme.34.2023.08.23.06.17.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 23 Aug 2023 06:17:18 -0700 (PDT) From: Jakob Unterwurzacher X-Google-Original-From: Jakob Unterwurzacher To: Rob Herring , Krzysztof Kozlowski , Heiko Stuebner Cc: jakob.unterwurzacher@theobroma-systems.com, devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-rockchip@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH v2 2/2] arm64: dts: rockchip: set codec system-clock-fixed on px30-ringneck-haikou Date: Wed, 23 Aug 2023 15:16:51 +0200 Message-Id: <20230823131651.586934-2-jakob.unterwurzacher@theobroma-systems.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230823131651.586934-1-jakob.unterwurzacher@theobroma-systems.com> References: <20230823131651.586934-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-20230823_061722_784238_7B56E449 X-CRM114-Status: GOOD ( 12.70 ) 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. 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 dafeef0c2dab..2cad02096271 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 {