From patchwork Fri Jun 2 09:03:18 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Alvin_=C5=A0ipraga?= X-Patchwork-Id: 689293 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 3F439C7EE24 for ; Mon, 5 Jun 2023 13:54:27 +0000 (UTC) Received: from alsa1.perex.cz (alsa1.perex.cz [207.180.221.201]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by alsa0.perex.cz (Postfix) with ESMTPS id AB680828; Mon, 5 Jun 2023 15:53:34 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz AB680828 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1685973264; bh=W1jCt0g71EO+++ay8+gq6YLMZDQgnf3+KltF5E9KjHM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-Id: List-Archive:List-Help:List-Owner:List-Post:List-Subscribe: List-Unsubscribe:From; b=uKy1l+ppi6erVk97u+aaIFT7YkTQDRmbOW7j75oudPjqIEskKVv2ixMb5fFpRRbhU 4lt6RUCFThXZCnkNa3Xm8PBNBvTVioj14KWSC96d+6R8oCiBxo6/cKVKnZt76qcVoP iCRakqxlVc8mcs+ZACI9x0sDEeODsrwmZM7KWfOw= Received: by alsa1.perex.cz (Postfix, from userid 50401) id B02F0F80551; Mon, 5 Jun 2023 15:52:46 +0200 (CEST) Received: from mailman-core.alsa-project.org (mailman-core.alsa-project.org [10.254.200.10]) by alsa1.perex.cz (Postfix) with ESMTP id 56006F80549; Mon, 5 Jun 2023 15:52:46 +0200 (CEST) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 96022F80132; Fri, 2 Jun 2023 11:03:52 +0200 (CEST) Received: from mail-ej1-x62b.google.com (mail-ej1-x62b.google.com [IPv6:2a00:1450:4864:20::62b]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id 97F2DF80132 for ; Fri, 2 Jun 2023 11:03:46 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 97F2DF80132 Authentication-Results: alsa1.perex.cz; dkim=pass (2048-bit key, unprotected) header.d=pqrs.dk header.i=@pqrs.dk header.a=rsa-sha256 header.s=google header.b=PsUDUxex Received: by mail-ej1-x62b.google.com with SMTP id a640c23a62f3a-97000a039b2so270244766b.2 for ; Fri, 02 Jun 2023 02:03:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=pqrs.dk; s=google; t=1685696624; x=1688288624; 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=lmqqRgiUwINg0zM6iswD1JyF/sKo+vBLZEf0BZFnUDQ=; b=PsUDUxexLrW3qJIJMMeH0z/bQvrHVeGXXEVIg6jC84q5cZT/2pA22ihuOt5kr8K32z Ce58wDcU3/NbbC6NfAn2EtyPPHo5Zn7rxiAZX5lGNOfrP4b5fjYvUvWXikGAVAM3G/Dm GNMbfO1VysCFDsZ4p7szujfKrewggNF76QAes8VQrtNFYr6KnXSoSBepumy6jmSiMVaY a/R3IGl5ZLeyrxQ1HmZXYhyxaWsgMa5S33yJBUxJ8gfb8HVSISXiTYJvDkBIZlaMA2OL 3vzdxjXtcJCM66l8HcBeqsGP4fLMSsjDFKJqgXQwwfUVMzPNMcq18/KSFndgrgThlS89 pMQw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1685696624; x=1688288624; 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=lmqqRgiUwINg0zM6iswD1JyF/sKo+vBLZEf0BZFnUDQ=; b=Y/6P5GsrH8iD5HS8tuhoMDgSEEsalNVpgRL41O0u/TkbV+5fKzSQ1MdlY07W15IoVG hX1gHfPIylTwyIJXUEQrmWcRJntYkYsf1/3S6az7BkhQDVfKQYni43Rz5nsDXy8r9GSw 5S/b4U1UVnZZ6hkVZbKJFu7gSmYrMuHlSvmdMeY1NZl+3ErlGuksTYjGaTsL1QCDLiYW LnHYaJ6tQaPb5nr14947LHgOvmpViHRF8w/oIAdyk65Ev9gqZjMu9AvMJSPwNHWWIZ1p J6DdL1YLmx7YiaIQOKn9KPcdAxhchYlzrSu8GOAsVPkBRRoJvt8foGldVwSLRbgaCcci NG4w== X-Gm-Message-State: AC+VfDwkBhmT8EKSeqw7ZDgCYZ78HgPFCXGUirvV1lBZhbBX1fYKJnTu 0Tl6+lLLg4c172GPC7OQhCENiQ== X-Google-Smtp-Source: ACHHUZ6FkgH9Pi4zxcCao3h6bU7K54MDeWgSQbT7iAsMjpkVsc6amBOT7zaP+p1lvup38fs0YdmhYw== X-Received: by 2002:a17:907:9618:b0:953:8249:1834 with SMTP id gb24-20020a170907961800b0095382491834mr12522628ejc.16.1685696624649; Fri, 02 Jun 2023 02:03:44 -0700 (PDT) Received: from localhost.localdomain (80.71.142.18.ipv4.parknet.dk. [80.71.142.18]) by smtp.gmail.com with ESMTPSA id w23-20020a170906385700b009707fa1c316sm488031ejc.213.2023.06.02.02.03.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 02 Jun 2023 02:03:44 -0700 (PDT) From: =?utf-8?q?Alvin_=C5=A0ipraga?= To: Liam Girdwood , Mark Brown , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Jaroslav Kysela , Takashi Iwai , Kuninori Morimoto Cc: =?utf-8?q?Alvin_=C5=A0ipraga?= , alsa-devel@alsa-project.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 1/4] ASoC: dt-bindings: document new symmetric-clock-role flag Date: Fri, 2 Jun 2023 11:03:18 +0200 Message-Id: <20230602090322.1876359-2-alvin@pqrs.dk> X-Mailer: git-send-email 2.40.0 In-Reply-To: <20230602090322.1876359-1-alvin@pqrs.dk> References: <20230602090322.1876359-1-alvin@pqrs.dk> MIME-Version: 1.0 X-MailFrom: alvin@pqrs.dk X-Mailman-Rule-Hits: nonmember-moderation X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; header-match-alsa-devel.alsa-project.org-0; header-match-alsa-devel.alsa-project.org-1 Message-ID-Hash: WHKGHD7TDXFGCNRMQAJSTODTVDQUJSE2 X-Message-ID-Hash: WHKGHD7TDXFGCNRMQAJSTODTVDQUJSE2 X-Mailman-Approved-At: Mon, 05 Jun 2023 13:52:43 +0000 X-Mailman-Version: 3.3.8 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" Archived-At: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: From: Alvin Šipraga The new flag specifies that both ends of the dai-link have the same clock consumer/provider role. This should be used to describe hardware where e.g. the CPU and codec both receive their bit- and frame-clocks from an external source. Signed-off-by: Alvin Šipraga --- .../devicetree/bindings/sound/simple-card.yaml | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/Documentation/devicetree/bindings/sound/simple-card.yaml b/Documentation/devicetree/bindings/sound/simple-card.yaml index b05e05c81cc4..ce738d1a394d 100644 --- a/Documentation/devicetree/bindings/sound/simple-card.yaml +++ b/Documentation/devicetree/bindings/sound/simple-card.yaml @@ -27,6 +27,11 @@ definitions: description: dai-link uses bit clock inversion $ref: /schemas/types.yaml#/definitions/flag + symmetric-clock-roles: + description: | + dai-link uses same clock consumer/provider role for both CPU and Codec + $ref: /schemas/types.yaml#/definitions/flag + dai-tdm-slot-num: description: see tdm-slot.txt. $ref: /schemas/types.yaml#/definitions/uint32 @@ -128,6 +133,8 @@ definitions: $ref: "#/definitions/frame-inversion" bitclock-inversion: $ref: "#/definitions/bitclock-inversion" + symmetric-clock-roles: + $ref: "#/definitions/symmetric-clock-roles" frame-master: $ref: /schemas/types.yaml#/definitions/flag bitclock-master: @@ -181,6 +188,8 @@ properties: $ref: "#/definitions/frame-inversion" simple-audio-card,bitclock-inversion: $ref: "#/definitions/bitclock-inversion" + simple-audio-card,symmetric-clock-roles: + $ref: "#/definitions/symmetric-clock-roles" simple-audio-card,format: $ref: "#/definitions/format" simple-audio-card,mclk-fs: @@ -230,6 +239,8 @@ patternProperties: $ref: "#/definitions/frame-inversion" bitclock-inversion: $ref: "#/definitions/bitclock-inversion" + symmetric-clock-roles: + $ref: "#/definitions/symmetric-clock-roles" format: $ref: "#/definitions/format" mclk-fs: From patchwork Fri Jun 2 09:03:19 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Alvin_=C5=A0ipraga?= X-Patchwork-Id: 689292 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 002D6C77B73 for ; Mon, 5 Jun 2023 13:54:52 +0000 (UTC) Received: from alsa1.perex.cz (alsa1.perex.cz [207.180.221.201]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by alsa0.perex.cz (Postfix) with ESMTPS id 9023284B; Mon, 5 Jun 2023 15:54:00 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 9023284B DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1685973290; bh=XqJYExxQFEBS1earnpLrL3D6RMEK1qeUhABHq/1MA6g=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-Id: List-Archive:List-Help:List-Owner:List-Post:List-Subscribe: List-Unsubscribe:From; b=naSDT86wuK7xOS1PErHWMyis7M781y4FknZK/KNQbQywU4c70d9cYP7rhBoQH7wy2 1hgExdyaCh/4UsgbABRSXijIgK6zfYZPne0IvLIvy0Z3abrrXucLmuYg/myQxC/ImS KpSjzDqqTXWbq44y/8rd6XC6+CkfLxM+WZri9D3M= Received: by alsa1.perex.cz (Postfix, from userid 50401) id 36087F8057F; Mon, 5 Jun 2023 15:52:52 +0200 (CEST) Received: from mailman-core.alsa-project.org (mailman-core.alsa-project.org [10.254.200.10]) by alsa1.perex.cz (Postfix) with ESMTP id C2E84F8057F; Mon, 5 Jun 2023 15:52:51 +0200 (CEST) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 5C2B8F800ED; Fri, 2 Jun 2023 11:04:00 +0200 (CEST) Received: from mail-ed1-x52e.google.com (mail-ed1-x52e.google.com [IPv6:2a00:1450:4864:20::52e]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id 40DF4F80149 for ; Fri, 2 Jun 2023 11:03:47 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 40DF4F80149 Authentication-Results: alsa1.perex.cz; dkim=pass (2048-bit key, unprotected) header.d=pqrs.dk header.i=@pqrs.dk header.a=rsa-sha256 header.s=google header.b=K1yBeMpB Received: by mail-ed1-x52e.google.com with SMTP id 4fb4d7f45d1cf-51640b9ed95so241258a12.2 for ; Fri, 02 Jun 2023 02:03:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=pqrs.dk; s=google; t=1685696626; x=1688288626; 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=8/iuC9pgq+loj7BUT0q2UIND8pBHqchhclkWSDPXeDM=; b=K1yBeMpBVIyXpZOk4aIP0ge7LNiFJvDqYOSNIVpD86eYCYyy8DH0RfBt7XJAG4NSRk 5RKTKtJKP/1Oa0yeujEtwik60eVCbWz6w175oko0mwaI+fY0LUHU39kh/wpADcdnjOwa NqDT95GmEvI13yF+WnHDrTE8xsAFdkWt40HxiB4+Wrue8DmFxzQVSAyPbWghNCMdspfk NlNHWIdVoWhLNGrnrxxrPvE7w/CXasgvunm/4116b9qSZ173Cjp7zZHfUfsdbp297AcE FGMwB5xdCy7hUFh7R0RsYEtEsEfHpOl5YNbJKDaWOfWsnIkZs+k6n19ff7HNoKfTrw3F /xrw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1685696626; x=1688288626; 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=8/iuC9pgq+loj7BUT0q2UIND8pBHqchhclkWSDPXeDM=; b=NsD7ZY+QZ3tKxrgpRjEFVzd27lIBWYUzrZ2dm7Bv1raGf68DC1v64r5pegqrC5KfXr 4XV73Mq9Ob9PRgaO9y4ra7bhLmToU4BI6h0niyyO0U46NhfyJeTNDAFRlAaM6os+4itR JSI4QAxMZATZnRlcGN9oePYIr3eJzQZLiWJ4lpm/1lOTUkQDGfoW37JhSMZEyLzeHIzo ARFc5AEtZHK/HcljyRlULwoXyK0Tj1XQTMUHYs1i/qVuUTPDP10/J/ZRq7a8+L6OkfmQ lCXuMFWmYvKzwW/8LJ4NwvBS+OU8aZ1mz6K22iWazJMFlFc+d9u9TvrgWC3OfG8Jfpiw z4XQ== X-Gm-Message-State: AC+VfDzsYsl84yiXanhKgUiQxehsOsMv4SQKvtDYENXmfYzAwZXALG21 Ab02m3Qtozo8CADY3cmagzFfmw== X-Google-Smtp-Source: ACHHUZ57MiVriTCuxX+gZLPjT5VoffIDc1r1ZvgGusNN8s74xGZXqvkznPNQ/GUhKpf/VK5I52mxjQ== X-Received: by 2002:a17:907:3e14:b0:974:545d:cfa3 with SMTP id hp20-20020a1709073e1400b00974545dcfa3mr2630054ejc.64.1685696626324; Fri, 02 Jun 2023 02:03:46 -0700 (PDT) Received: from localhost.localdomain (80.71.142.18.ipv4.parknet.dk. [80.71.142.18]) by smtp.gmail.com with ESMTPSA id w23-20020a170906385700b009707fa1c316sm488031ejc.213.2023.06.02.02.03.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 02 Jun 2023 02:03:46 -0700 (PDT) From: =?utf-8?q?Alvin_=C5=A0ipraga?= To: Liam Girdwood , Mark Brown , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Jaroslav Kysela , Takashi Iwai , Kuninori Morimoto Cc: =?utf-8?q?Alvin_=C5=A0ipraga?= , alsa-devel@alsa-project.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 2/4] ASoC: core: add support for dai-links with symmetric clock roles Date: Fri, 2 Jun 2023 11:03:19 +0200 Message-Id: <20230602090322.1876359-3-alvin@pqrs.dk> X-Mailer: git-send-email 2.40.0 In-Reply-To: <20230602090322.1876359-1-alvin@pqrs.dk> References: <20230602090322.1876359-1-alvin@pqrs.dk> MIME-Version: 1.0 X-MailFrom: alvin@pqrs.dk X-Mailman-Rule-Hits: nonmember-moderation X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; header-match-alsa-devel.alsa-project.org-0; header-match-alsa-devel.alsa-project.org-1 Message-ID-Hash: LXRNK2RMXGEIDDKDT3FD6MXQWK6NJMM4 X-Message-ID-Hash: LXRNK2RMXGEIDDKDT3FD6MXQWK6NJMM4 X-Mailman-Approved-At: Mon, 05 Jun 2023 13:52:46 +0000 X-Mailman-Version: 3.3.8 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" Archived-At: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: From: Alvin Šipraga The snd_soc_dai_link::dai_fmt field contains the nominal bit- and frame-clock consumer/provider role from the point of view of the codec. The ASoC core then assumes that it should flip the roles when initializing the format on the CPU. But in cases where both the CPU and codec are clock consumers, e.g. because of an external clock source, this assumption breaks down. To allow for proper configuration of the backing CPU/codec drivers for consumer roles, introduce support for a symmetric_clock_roles flag. The role flipping will be skipped when this flag is set. Signed-off-by: Alvin Šipraga --- include/sound/soc.h | 3 +++ sound/soc/soc-core.c | 4 +++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/include/sound/soc.h b/include/sound/soc.h index 533e553a343f..87f4fb3d4b20 100644 --- a/include/sound/soc.h +++ b/include/sound/soc.h @@ -718,6 +718,9 @@ struct snd_soc_dai_link { /* Keep DAI active over suspend */ unsigned int ignore_suspend:1; + /* Assume CPU/Codec have the same clock consumer/provider role */ + unsigned int symmetric_clock_roles:1; + /* Symmetry requirements */ unsigned int symmetric_rate:1; unsigned int symmetric_channels:1; diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c index b48efc3a08d2..7817b86dd93d 100644 --- a/sound/soc/soc-core.c +++ b/sound/soc/soc-core.c @@ -1216,6 +1216,7 @@ static void snd_soc_runtime_get_dai_fmt(struct snd_soc_pcm_runtime *rtd) int snd_soc_runtime_set_dai_fmt(struct snd_soc_pcm_runtime *rtd, unsigned int dai_fmt) { + struct snd_soc_dai_link *dai_link = rtd->dai_link; struct snd_soc_dai *cpu_dai; struct snd_soc_dai *codec_dai; unsigned int i; @@ -1231,7 +1232,8 @@ int snd_soc_runtime_set_dai_fmt(struct snd_soc_pcm_runtime *rtd, } /* Flip the polarity for the "CPU" end of link */ - dai_fmt = snd_soc_daifmt_clock_provider_flipped(dai_fmt); + if (!dai_link->symmetric_clock_roles) + dai_fmt = snd_soc_daifmt_clock_provider_flipped(dai_fmt); for_each_rtd_cpu_dais(rtd, i, cpu_dai) { ret = snd_soc_dai_set_fmt(cpu_dai, dai_fmt); From patchwork Fri Jun 2 09:03:20 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Alvin_=C5=A0ipraga?= X-Patchwork-Id: 689788 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 4C915C7EE24 for ; Mon, 5 Jun 2023 13:54:35 +0000 (UTC) Received: from alsa1.perex.cz (alsa1.perex.cz [207.180.221.201]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by alsa0.perex.cz (Postfix) with ESMTPS id 08139847; Mon, 5 Jun 2023 15:53:43 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 08139847 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1685973273; bh=PjXX2zE4e2Lq8yVi0PfGCjj2tGLEeRhhAMqZOho1kN0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-Id: List-Archive:List-Help:List-Owner:List-Post:List-Subscribe: List-Unsubscribe:From; b=s7yLtP6SeWNPRDGR7XXN9X9DEwJn+Hy1uf6gZFgdFb4an6dwZAEcQNaWF9g+rjcd2 qih4w4B3FOgOx35UWNucSugEOhOdxcUN/ATG1TMRpGVmU5m5hKz25OV6kWEKxbJbmW yiFSZBPFAzVYxHU8RXu7hYsZo8mV+r4IslhrJYSg= Received: by alsa1.perex.cz (Postfix, from userid 50401) id 96693F80578; Mon, 5 Jun 2023 15:52:50 +0200 (CEST) Received: from mailman-core.alsa-project.org (mailman-core.alsa-project.org [10.254.200.10]) by alsa1.perex.cz (Postfix) with ESMTP id 0659AF80549; Mon, 5 Jun 2023 15:52:50 +0200 (CEST) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 3C157F804DA; Fri, 2 Jun 2023 11:03:58 +0200 (CEST) Received: from mail-ed1-x532.google.com (mail-ed1-x532.google.com [IPv6:2a00:1450:4864:20::532]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id 27434F800ED for ; Fri, 2 Jun 2023 11:03:49 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 27434F800ED Authentication-Results: alsa1.perex.cz; dkim=pass (2048-bit key, unprotected) header.d=pqrs.dk header.i=@pqrs.dk header.a=rsa-sha256 header.s=google header.b=W7A072+4 Received: by mail-ed1-x532.google.com with SMTP id 4fb4d7f45d1cf-514859f3ffbso2644329a12.1 for ; Fri, 02 Jun 2023 02:03:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=pqrs.dk; s=google; t=1685696628; x=1688288628; 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=ppOouDsw2ZJBp9Pb63smrW3GHRr3r6Vq+ntYkWdxiUU=; b=W7A072+4L5LVDFH8xeLtIvjZhQinq7JukGEfUyDMsfu3Ltgt+G1BtIcw7ak1xEEHGl hAUqRouAfhJg//9Q+p9+8CJGUpYPUOHUrUGQLFmt/FgEgERYhiqusJZ/e0ZQu9O6eSc4 DmqOcdWC7yH1yDWj3Mg1nCVroO1VyUTPGMiUYTYRge94t/W+DcZlKQs6ItelryoyQ93m AEse3zS9XK/8Xz0VxP5mXPBfOf9dJj5ZVZ6CBqR4kiMc1Y4YCpeB0HjfKGSca7+rNxCz j7/GQhJUvGMovqQPDjqKV+Ah7gqBFlQFoVekcAxbhOM1gWsPj9HXrKGxgdKQrIOH6NjA ZO6g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1685696628; x=1688288628; 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=ppOouDsw2ZJBp9Pb63smrW3GHRr3r6Vq+ntYkWdxiUU=; b=kvQoHbNUULsDT+SFAE6H3LgD+NWdUNG9kUgpHVqTaUujzZlMxOYt+ZxR7YW3eDwbRH m5uOjogRdP0Gv3kmRTlojiegKZ1L2t4cpiS1CgsVsfgl9Ka5CH2ac3PtP8N+EjqHXg4+ 6rySdLWql3NRFTMXdshtMnPz6u9+oZTGyVwqvyIcuqpZwClPctIfWzk04yLO5x+p5YQL VFpaGLB0qmDRhcNZaituuG+fVxwdKcR08ZWhwteEU41Fr2gc5j/E/xUJaJSMoT5SUf9c UIEmsaL/9uirm3AV9oc5Z8K1N10sSK6Nt59ch6NxeGiIJikrkpxJIn6gHimeYI4LA2Ux 6EbQ== X-Gm-Message-State: AC+VfDzvT8QVh5KXyGs9qb1+p/jMXpBuaKGI5rS/7t7cxLz04D6lwRHh Bt+Xer3H1BbO8d/hjwgP64EF1g== X-Google-Smtp-Source: ACHHUZ4S9FTeGd8RGDT+UXj2VgaTZT2QVwDEvvsYF+21upP5MdbUrrtn+d9nL+oT4j4acVNL6wfeEg== X-Received: by 2002:a17:907:d17:b0:966:eb8:2f12 with SMTP id gn23-20020a1709070d1700b009660eb82f12mr10334273ejc.11.1685696628034; Fri, 02 Jun 2023 02:03:48 -0700 (PDT) Received: from localhost.localdomain (80.71.142.18.ipv4.parknet.dk. [80.71.142.18]) by smtp.gmail.com with ESMTPSA id w23-20020a170906385700b009707fa1c316sm488031ejc.213.2023.06.02.02.03.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 02 Jun 2023 02:03:47 -0700 (PDT) From: =?utf-8?q?Alvin_=C5=A0ipraga?= To: Liam Girdwood , Mark Brown , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Jaroslav Kysela , Takashi Iwai , Kuninori Morimoto Cc: =?utf-8?q?Alvin_=C5=A0ipraga?= , alsa-devel@alsa-project.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 3/4] ASoC: audio-graph-card2: parse symmetric-clock-roles property Date: Fri, 2 Jun 2023 11:03:20 +0200 Message-Id: <20230602090322.1876359-4-alvin@pqrs.dk> X-Mailer: git-send-email 2.40.0 In-Reply-To: <20230602090322.1876359-1-alvin@pqrs.dk> References: <20230602090322.1876359-1-alvin@pqrs.dk> MIME-Version: 1.0 X-MailFrom: alvin@pqrs.dk X-Mailman-Rule-Hits: nonmember-moderation X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; header-match-alsa-devel.alsa-project.org-0; header-match-alsa-devel.alsa-project.org-1 Message-ID-Hash: WT7X56H34JRDGZNKKUM75PVRQ7PFS4GA X-Message-ID-Hash: WT7X56H34JRDGZNKKUM75PVRQ7PFS4GA X-Mailman-Approved-At: Mon, 05 Jun 2023 13:52:46 +0000 X-Mailman-Version: 3.3.8 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" Archived-At: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: From: Alvin Šipraga The property, when set, specifies that both ends of the dai-link should have the same clock consumer/provider roles. Like with parsing of DAI format, the property can be specified in multiple places: ports { (A) port { (B) endpoint { (C) }; }; }; So each place has to be checked. In case the clock roles are symmetric, there is then no need to flip the role when parsing the DAI format on the CPU side, as it should then be the same on the Codec side. Signed-off-by: Alvin Šipraga --- sound/soc/generic/audio-graph-card2.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/sound/soc/generic/audio-graph-card2.c b/sound/soc/generic/audio-graph-card2.c index 25aa79dd55b3..9b4ebfd0c0b6 100644 --- a/sound/soc/generic/audio-graph-card2.c +++ b/sound/soc/generic/audio-graph-card2.c @@ -721,13 +721,18 @@ static void graph_link_init(struct asoc_simple_priv *priv, if (of_node_name_eq(ports, "ports")) graph_parse_daifmt(ports, &daifmt, &bit_frame); /* (A) */ + if (of_property_read_bool(ep, "symmetric-clock-roles") || + of_property_read_bool(port, "symmetric-clock-roles") || + of_property_read_bool(ports, "symmetric-clock-roles")) + dai_link->symmetric_clock_roles = 1; + /* * convert bit_frame * We need to flip clock_provider if it was CPU node, * because it is Codec base. */ daiclk = snd_soc_daifmt_clock_provider_from_bitmap(bit_frame); - if (is_cpu_node) + if (is_cpu_node && !dai_link->symmetric_clock_roles) daiclk = snd_soc_daifmt_clock_provider_flipped(daiclk); dai_link->dai_fmt = daifmt | daiclk; From patchwork Fri Jun 2 09:03:21 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Alvin_=C5=A0ipraga?= X-Patchwork-Id: 689787 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 DA7B7C7EE24 for ; Mon, 5 Jun 2023 13:55:22 +0000 (UTC) Received: from alsa1.perex.cz (alsa1.perex.cz [207.180.221.201]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by alsa0.perex.cz (Postfix) with ESMTPS id 8451C6C1; Mon, 5 Jun 2023 15:54:30 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 8451C6C1 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1685973320; bh=bjCG6Z1H4Y9mgflhUJNA4NwiuQy7EB2yOZM2exbxbcc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-Id: List-Archive:List-Help:List-Owner:List-Post:List-Subscribe: List-Unsubscribe:From; b=gKOqX+xtsKuv9OcNwtJWcgToqZLcNmCZcmZQgEZKAENKjipUQz3PcK/SeZmfP8Up2 nlonNnJEcQIDUL0RSTA8ZGFIzvMzIFX6pfnSKxP6NejGfTfq3f6Y3EaahavXxSxznC gTa4rmdUmnUXt1syfsfzK1Ww2fO17yRg7Rc5rjV8= Received: by alsa1.perex.cz (Postfix, from userid 50401) id 4A4AFF8059F; Mon, 5 Jun 2023 15:52:55 +0200 (CEST) Received: from mailman-core.alsa-project.org (mailman-core.alsa-project.org [10.254.200.10]) by alsa1.perex.cz (Postfix) with ESMTP id AF90EF805A8; Mon, 5 Jun 2023 15:52:54 +0200 (CEST) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 25559F80132; Fri, 2 Jun 2023 11:04:01 +0200 (CEST) Received: from mail-ed1-x535.google.com (mail-ed1-x535.google.com [IPv6:2a00:1450:4864:20::535]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id 06430F80199 for ; Fri, 2 Jun 2023 11:03:51 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 06430F80199 Authentication-Results: alsa1.perex.cz; dkim=pass (2048-bit key, unprotected) header.d=pqrs.dk header.i=@pqrs.dk header.a=rsa-sha256 header.s=google header.b=aG3Fb8X3 Received: by mail-ed1-x535.google.com with SMTP id 4fb4d7f45d1cf-51640b9ed95so241326a12.2 for ; Fri, 02 Jun 2023 02:03:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=pqrs.dk; s=google; t=1685696629; x=1688288629; 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=FMKaght3EZRcwtR4hLhGpGozkma4rbwmuu+0lxvlO3A=; b=aG3Fb8X3K9WKKxNliXyqCzqEZZLOAoC6+28JL4RDvnce9WPai1yKdx0ChsOA6lzB7y sgOHuV1st30My66XqPWbpZNBLehHxsHl9kFZRb4hR8CuRGTZfAUA8pTLXzixnF/cixb5 jPt1Pdg3POHJ5A2WTe56XJ2P0GNmJmOCmrvIIQUviHJgSY5tVV5CvfpKte6P6z/3oh4l PSHUkwTIQqidY85LpUOWYubwIctytCIgg7cbqb6ySfLJr/0Jw9w1RQU2wNtJGYmfrmaS RZyfs8UuR7zTmy/p6b+RZIJkHQg+dM/aGHLTvzNl2PD0I6gI2Ldpn2M+nbY4iTKv7H4X d5Lw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1685696629; x=1688288629; 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=FMKaght3EZRcwtR4hLhGpGozkma4rbwmuu+0lxvlO3A=; b=EChcYmdgDRuJAcwp1pLgSqmEZ/tDH7sgg3OV3W5W7wUkvD72cvDPtX+vRZSGo3mJya 4GdgBod8whVzRNlo7YRJ5SF8y5jQGQdara0yHvAGu9+Lvbhz90/lhkC0J6pogdhSw/0L Ik3pDH/ScdVL4yTPkhlOkqCh/VnXFSp4k5WRd0aQd/MW1qGLBu6d37AX2vMLyLejA3BT HTfm4sXD3KKiQSbB0ENu6EDxcH3Q5d4kUetYAmEPgFcyKuoIQbWvUCc7Eby3XdlQoplg /EDg76dE4BKT2NzSk0FyAnYI7Uvcdak+AuQwJE4SbuP+4eOCTsRuvb2Fdn1lbf8Ja02P LRSA== X-Gm-Message-State: AC+VfDzxZcxrr5SGvEOpl+vNLV1Db6CnEyYgJxxQTZApQNK0H9qb53xu y17Ppab8at6gH/2D709D5Srbxg== X-Google-Smtp-Source: ACHHUZ4jmlviWCEZ9d2sqlZKV0HRtlTNsu09RrXOh72/ySDy+4DwbEEj8oyV65wODyolmmip16qHpg== X-Received: by 2002:a17:906:d550:b0:974:6334:f6b2 with SMTP id cr16-20020a170906d55000b009746334f6b2mr806371ejc.22.1685696629567; Fri, 02 Jun 2023 02:03:49 -0700 (PDT) Received: from localhost.localdomain (80.71.142.18.ipv4.parknet.dk. [80.71.142.18]) by smtp.gmail.com with ESMTPSA id w23-20020a170906385700b009707fa1c316sm488031ejc.213.2023.06.02.02.03.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 02 Jun 2023 02:03:49 -0700 (PDT) From: =?utf-8?q?Alvin_=C5=A0ipraga?= To: Liam Girdwood , Mark Brown , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Jaroslav Kysela , Takashi Iwai , Kuninori Morimoto Cc: =?utf-8?q?Alvin_=C5=A0ipraga?= , alsa-devel@alsa-project.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 4/4] ASoC: simple-card: parse symmetric-clock-roles property Date: Fri, 2 Jun 2023 11:03:21 +0200 Message-Id: <20230602090322.1876359-5-alvin@pqrs.dk> X-Mailer: git-send-email 2.40.0 In-Reply-To: <20230602090322.1876359-1-alvin@pqrs.dk> References: <20230602090322.1876359-1-alvin@pqrs.dk> MIME-Version: 1.0 X-MailFrom: alvin@pqrs.dk X-Mailman-Rule-Hits: nonmember-moderation X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; header-match-alsa-devel.alsa-project.org-0; header-match-alsa-devel.alsa-project.org-1 Message-ID-Hash: 7EP5RR44L5P67K54ABLBIV6MMIDG52SQ X-Message-ID-Hash: 7EP5RR44L5P67K54ABLBIV6MMIDG52SQ X-Mailman-Approved-At: Mon, 05 Jun 2023 13:52:46 +0000 X-Mailman-Version: 3.3.8 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" Archived-At: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: From: Alvin Šipraga The property, when set, specifies that both ends of the dai-link should have the same clock consumer/provider roles. As with other simple-card properties, a prefix can be specified. Signed-off-by: Alvin Šipraga --- sound/soc/generic/simple-card.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/sound/soc/generic/simple-card.c b/sound/soc/generic/simple-card.c index 5a5e4ecd0f61..4513e30948b7 100644 --- a/sound/soc/generic/simple-card.c +++ b/sound/soc/generic/simple-card.c @@ -181,6 +181,7 @@ static int simple_link_init(struct asoc_simple_priv *priv, { struct device *dev = simple_priv_to_dev(priv); struct snd_soc_dai_link *dai_link = simple_priv_to_link(priv, li->link); + char prop[128]; int ret; ret = asoc_simple_parse_daifmt(dev, node, codec, @@ -188,6 +189,9 @@ static int simple_link_init(struct asoc_simple_priv *priv, if (ret < 0) return 0; + snprintf(prop, sizeof(prop), "%ssymmetric-clock-roles", prefix); + dai_link->symmetric_clock_roles = of_property_read_bool(node, prop); + dai_link->init = asoc_simple_dai_init; dai_link->ops = &simple_ops;