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: 102399 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:994d:0:b0:3d9:f83d:47d9 with SMTP id k13csp891831vqr; Fri, 2 Jun 2023 02:12:07 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ5dGDg7fPfVbHSxBds2dWnL/PFRhoaaIPmqXhX6d7eeSHsQlNcQLMqvaSX2Y0/AVQTNW/TC X-Received: by 2002:a92:4b08:0:b0:335:fc8:9b4 with SMTP id m8-20020a924b08000000b003350fc809b4mr8084850ilg.19.1685697127045; Fri, 02 Jun 2023 02:12:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1685697127; cv=none; d=google.com; s=arc-20160816; b=R+cY/puhbc+rFxAkyjo9iUzlKrqWc5Wg/CHm1/i6RSbgcTRtnf+2thOI83veAippZM F+8s2Gj6vgZtj48i7x+F79ljG/2+8hv4uV8GJ0SYY5MYPVeDv2qu34gG7I5bGf8cW7RE e98KXyRaBvvrXy9/9E7/ySQZNI2XR6FstyY/ORMUgkCUehNyiUuHxDudKfnc7VfdTixQ SLrSbGaJ5yRREfc+SwpRdMN6vlyoaf2tqZS5MWN7N8Mvm4JaOeTIS3ETi0cCBOXQs0uS isDOU3E6lAOOJNR9DgH49Z7sBn0j8RFk/pRbcdoZnfx3unQJ1cfJmaU5qGVzI3c8uhwg +CHQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=lmqqRgiUwINg0zM6iswD1JyF/sKo+vBLZEf0BZFnUDQ=; b=chXhO7O+3MuOEN6eMhsT4VsvMakDFcwS/Q7tlFpxS9B+a2vkgnEHtMj7hjOb5oZhnj Pl1d7NBbrnKztEvDVlDgzDZ8v+kxeXyySUmKEANaIu73GzF6oUyZ1jaCFErJJGLh1JUo iu+eKbeDCjtuvwFOwDNKBbVl417PlosY7XPO+tVA5u+Ca/8n6A4QKsa92m7fp3nu2RH4 ELnQ4Mns+Nk8Wc6XPaKTiCjPwqiRo6RnXMA2AOvo/+gNLpMjCxFfNtdXIQXV6HPrsPn2 Lzv6GP6fpwzadjFlgTBoN8AQzftjGUs8U0c4YGilsGg1bhL4+UIkBElwKaHTakDOuS7A 6wug== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@pqrs.dk header.s=google header.b=PsUDUxex; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id u9-20020a637909000000b0053f0cdab823si675212pgc.469.2023.06.02.02.11.54; Fri, 02 Jun 2023 02:12:07 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@pqrs.dk header.s=google header.b=PsUDUxex; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234532AbjFBJFE (ORCPT + 99 others); Fri, 2 Jun 2023 05:05:04 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59484 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234994AbjFBJEG (ORCPT ); Fri, 2 Jun 2023 05:04:06 -0400 Received: from mail-ej1-x62a.google.com (mail-ej1-x62a.google.com [IPv6:2a00:1450:4864:20::62a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 44F4110C0 for ; Fri, 2 Jun 2023 02:03:46 -0700 (PDT) Received: by mail-ej1-x62a.google.com with SMTP id a640c23a62f3a-973f78329e3so269473566b.3 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=YR6cqwPHZOj5RnFNV26npycDThf4THGtG1e4wfTWpLV+uwGmHytTWgqGKSTqzsoPeB 4R6d9palTuu0IrADSIOL/k0ch596zwEBt3XNLXyFGVzld0nZYCCTVMNE536Oq+MACz5M Jj48hsSE9JmogJhl6VV2wIedqfPoClAoT4lrOiAG665+0mk9mbmIrY4vo2RbJuJ7FgqR 9kr196ugUO18hYGBhFvC2t/uZU53AwSuD7TxSD4tLjgFIQMyqyOJxfDEsBa/c1KpNB+P RLtixs19mZnTSBjnB8AnLcbnt+4JpzMbVVmB4xQO5OqFVyVw6DQpCekKSVMb6Dr8ZWbV c8Nw== X-Gm-Message-State: AC+VfDwkacSTXzsPvVeWJNpE+MLhSSKpVaFv8Btqa5sjMoFGC3FoLk7s hYO0XOnyM8EyrMIV8gd2xbVWCg== 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-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1767581550953183599?= X-GMAIL-MSGID: =?utf-8?q?1767581550953183599?= 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: 102405 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:994d:0:b0:3d9:f83d:47d9 with SMTP id k13csp896350vqr; Fri, 2 Jun 2023 02:23:11 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ74XL0spuqkJws17kS1/HQ85tnq2N+YNuYS5Yqzs1h1W6IRkX5Xff/z0IV/VUHAXP/Zihib X-Received: by 2002:a05:6a20:3d85:b0:10e:457f:254c with SMTP id s5-20020a056a203d8500b0010e457f254cmr9986518pzi.2.1685697791149; Fri, 02 Jun 2023 02:23:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1685697791; cv=none; d=google.com; s=arc-20160816; b=ZLwRX+zsjEhl1flkv3tVg6c2H2Eie+qGA4pU1NCqslefDaGGGW38Ns2Rm7bx8lWaGa KsBWJMXIhOBlaKIj9mp6BG4xiE2XXjLRjyoQtuvqrDO61/aruCTiKQ5xrSC8EF0IkkBy 6YpqQG8P7or40Ed5VtQ/x356Nl3UgtjkshhbyQLxZyLjNAli165C57Xhr/kYhFAQd9W2 mWbOcA79QpHN4SMNTRXTlYONkywXO1zSsTppyxIssMTmeXkftz0lnyy8obtem6UzMlCZ Vt0D81CK0Lhv/wpzSlWiPTORA6ZQSbOWs6UWsi5XTBqwdR0yW+wlnzNAP+fFMcU7CPzJ c7sQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=8/iuC9pgq+loj7BUT0q2UIND8pBHqchhclkWSDPXeDM=; b=XKJaFJhqJk9Cf1ZZIqOBPP2M4RhFEvxZfBFuXoajURjqnl+5zHVcATMtifGbYIH+RM kY1noQROIiLB1gh7y4p5o5kczGu2RysqfyJL2LZE6cGhCLTX9c0rFEvziAAfdD87zPEP ZpyE6Q5R16NQE57/KAwIb/u8wnR/dQmTCQU93rF9gfm6YiASnGvv8r5HbfojCJWTVsJc frvRFFgEh7EoLvo9ZoOZrleH5COVhYfmJI8K9tSUBUW2vzl9IbrhdPGSVwQV/f6NwIha GUDaOgb2XiaGwf+Ip9hncCUE96cUmZMV158X/ik9lSUXeEd7F97YQfGb5/xUCGJpZric TZ8g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@pqrs.dk header.s=google header.b=K1yBeMpB; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id c4-20020a170902d48400b001b04a379cd2si618728plg.348.2023.06.02.02.22.56; Fri, 02 Jun 2023 02:23:11 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@pqrs.dk header.s=google header.b=K1yBeMpB; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234584AbjFBJFJ (ORCPT + 99 others); Fri, 2 Jun 2023 05:05:09 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60108 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234281AbjFBJEI (ORCPT ); Fri, 2 Jun 2023 05:04:08 -0400 Received: from mail-ej1-x631.google.com (mail-ej1-x631.google.com [IPv6:2a00:1450:4864:20::631]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DE39510C6 for ; Fri, 2 Jun 2023 02:03:47 -0700 (PDT) Received: by mail-ej1-x631.google.com with SMTP id a640c23a62f3a-97467e06511so41065666b.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=NQfP9AG7euYd+cRmo9uXBbRJHeXNYbB3NOTtJh3C9BO3+a6DVjLn0Tlhqh43Ftkx2W sz1wA/y6LC6BIrorCdqNQyenRjfK0hjWt1rRmSw2LKwmMOG84ZGg6Vg6/jYybAKqY5ng fVTpixvDJjePZ+kSCbNOdf1rppdqkwtXQPFQhG3b6nMNg9NvkusahZa1kmLHM3aq1Egc c5gVFb4et3AkibRoVcDtgVzVOuvWAxqlNb2FwImeNehZDHD2CygDVOTJxwZ4ZkatT+Pb 3v5bCDYO3umwUf4E2f5VFkwbjPCgZFfRRimHN/vjc1e+kYKE7Kuzz6/1YWNAhFAeCBzP hOEg== X-Gm-Message-State: AC+VfDwiALr4escjwK/C/x+LE+tiP3b94yxImKIlB40M4oBq7hNZ0eDK MsGR7I1i2jZ6qOrhoNRrBo+D1w== 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-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1767582247110787420?= X-GMAIL-MSGID: =?utf-8?q?1767582247110787420?= 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: 102397 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:994d:0:b0:3d9:f83d:47d9 with SMTP id k13csp891610vqr; Fri, 2 Jun 2023 02:11:31 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ65mCmQSIGKbaXd5Ii0Fb/MzFedRibemmseHoIrFlmb8uL3NPeWJoHoxpIqNE/u3Xa+iuyM X-Received: by 2002:a9d:66c4:0:b0:6af:67d4:b37 with SMTP id t4-20020a9d66c4000000b006af67d40b37mr2313367otm.6.1685697091503; Fri, 02 Jun 2023 02:11:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1685697091; cv=none; d=google.com; s=arc-20160816; b=nHma5wqKqFUVSbvYpniEkrFkFUmJYshvWXJFFrzcvinq/FxdxyH8oO+1Hh/MeEUzsc QrHSs0nZbgsfJHoLRDxkrpZqe+tWYka2Iy+bkEsL/Lu8opmkCXVdUVnC/qUoINLxtLLL YnoB3jz3aC/Sm15L40ifNNKb9/juDH0ANdrJPuf4TwX8yx2WokP+PC9yKNffmMnnsi87 rFrrqWeFcf9J1bQvZyodSwBJiOYM0QH9mv8dRmz+R46IutmIzFBFVhkEy26cMTxElO7b YCQ0KxDzgQmC8LP8aX4e5SwbGAdAYhwM/l3durYDZJM0oGci2q8jMn6ucQZ4mq+7ta2H t9zg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=ppOouDsw2ZJBp9Pb63smrW3GHRr3r6Vq+ntYkWdxiUU=; b=y6Olj8agkECgstSAPuQWd821x5e5VRvTehqLWGcDO2G8hYMtvkwZ9HeML3E4RIcXKU MOKND7p1O9MuTgHgbbmmBKhABT0cxIOATpSf8iDt2GiB+cucRkBRxMumdVHEG6KaedIa 0mRbSbt+0kDk4RGTOb7mRuJHevjwvdaRIdFJ8pCYqOAwjgZkrtp1ZY5sE76+pnfda/Il 6zpoNTMFSHwvif5hq6n798wFoFY72Fxal2h7g00PQ8uOgIc+WNts9PXRr26WbEjU1gRE eMvK6a0hVYBkSneoF9VOmk6gxfuogU1ZqW4YGLkUKC98LQLH1Y/ac9CNNsXl7lonh3Op 0dkw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@pqrs.dk header.s=google header.b=W7A072+4; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id z4-20020aa79904000000b0064e1b65f01dsi405118pff.237.2023.06.02.02.11.19; Fri, 02 Jun 2023 02:11:31 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@pqrs.dk header.s=google header.b=W7A072+4; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234905AbjFBJFO (ORCPT + 99 others); Fri, 2 Jun 2023 05:05:14 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59878 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234812AbjFBJEM (ORCPT ); Fri, 2 Jun 2023 05:04:12 -0400 Received: from mail-ed1-x529.google.com (mail-ed1-x529.google.com [IPv6:2a00:1450:4864:20::529]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A888510CE for ; Fri, 2 Jun 2023 02:03:49 -0700 (PDT) Received: by mail-ed1-x529.google.com with SMTP id 4fb4d7f45d1cf-5147e40bbbbso2630652a12.3 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=F1G7rFHoau7zziPMyxc+A1NsvQCESqS4QdOoiTTuv7Xd/KfIUnbmKt0WdI0QCDJzko R2ACyvBIO7YxD70f/0efIHXx1+gCrObpxiHmMchSYuyra+/sFPzyw0W3z8fA8E25ksUA hXkQwc2lrRkEx81+ujsVmlh53bvUeqFVAIt3h2wS+KrPSh4hlJ9Q5drHpI+D/OK0el0w FzkvCe68ctsWQnuU2sfEXk/htC+Imk2PeZOhwkxasr4srtVgc1Ekx0+dyZ1h6PzTiNS8 7O8F3/3W4ohz5BRlZ0s1FUQoCICdyiSQ15f9qWiXkiv9qM46zgDRkyTO7mhhRRb3nU5F l6Aw== X-Gm-Message-State: AC+VfDy5lSEcglMz7ddy4swHKbqWWf4UBLKXty6TJTlIpl5imu2MtL6F d73wfbgd9MFqLejVOgDlIjQD2g== 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-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1767581513320180172?= X-GMAIL-MSGID: =?utf-8?q?1767581513320180172?= 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: 102411 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:994d:0:b0:3d9:f83d:47d9 with SMTP id k13csp897820vqr; Fri, 2 Jun 2023 02:26:49 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ4lyOWGsRUCMxnJ2TEZ30CBSuzxkr6GgLdcEVSNoowewJIlvTmqBuc5hllz9zz4k6HDNTlE X-Received: by 2002:a17:902:ec8d:b0:1b1:1168:bdd9 with SMTP id x13-20020a170902ec8d00b001b11168bdd9mr1806632plg.23.1685698009013; Fri, 02 Jun 2023 02:26:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1685698008; cv=none; d=google.com; s=arc-20160816; b=v6SjrAiGLtV3g/Vj9d5QdBcTnDI9gaI980Q/JJk7W6z5so1eZMY8s4xlVEvOlIVkLy Hjdkj3A3guAtxel9jun+5PtZvITKKRuoHskM3MZO/D4Gvhd7bzrceik6h0BRuVO55YTp rorMvctZyZa8pifftw6tfVRHCvWEJ7nYgnueOgpBNrcyKTP0eay7l6wXDDcZVKcJ9wyp GpEam1bF5ziDpb1FAbxcNxbpuAd8JGMwFh5l4Q4Ue98jsFb737sJl6MJrnoJBnbIzvOK hPj+EpawgpXFV9DDSIZ3zUSVa8rXowlryv+DPD7/rK3EFeznr05Yc2DyX2nTtUnKurpk 307g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=FMKaght3EZRcwtR4hLhGpGozkma4rbwmuu+0lxvlO3A=; b=T2/ToXgbur6hI2G0iDaL6jPmGleV5cqy354/4AaiEJaPNP7Lix607kazDEg14rbTCd 9lDnKKTl0oYmpalJPFr1cSWvgG4U/7J0sQdAq1ErYhr1FHME7vy/swmRfEM2yS+kzq/u wn9hnznbzJsoK1QG2aKEJlZP2+M7qvISm1FiYgXRXIgA28nkco2QvNj6wPQUYBqJQBRZ lwaIMl82YFfZRv3+bNB60jrODFvdtBqC6bFIQqeMx8p/4Vj2si3sF2vsOm8VK9NHHRvd bxO5ci2OC2VvCqLySFsJN7/sBqTJ75Rpq0bQzkpgODsHFSmNtm3kdFTzvhlta2l+wWcq XmUQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@pqrs.dk header.s=google header.b=aG3Fb8X3; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id w1-20020a170902c78100b001a8096ef2bfsi629052pla.34.2023.06.02.02.26.34; Fri, 02 Jun 2023 02:26:48 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@pqrs.dk header.s=google header.b=aG3Fb8X3; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234595AbjFBJFQ (ORCPT + 99 others); Fri, 2 Jun 2023 05:05:16 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59888 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229471AbjFBJEN (ORCPT ); Fri, 2 Jun 2023 05:04:13 -0400 Received: from mail-ej1-x62b.google.com (mail-ej1-x62b.google.com [IPv6:2a00:1450:4864:20::62b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0A2DD10D2 for ; Fri, 2 Jun 2023 02:03:51 -0700 (PDT) Received: by mail-ej1-x62b.google.com with SMTP id a640c23a62f3a-97460240863so75007166b.0 for ; Fri, 02 Jun 2023 02:03:50 -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=h1XSIrra4ZWJHgx8Rgr9Je71Zd0czzyZnDiIh93ul/COcxn3vp3SiQiM54hj9pJUja dZ3ImXErdO3iC+IN2aB9a+HU8J1SEcT6sUomE7vE+t0Im9xFUOH22CkYRNI0i6r5hp4O FhV7k2udz6wExnSjpHU8dQiO//WWdvVGkuzy/3qHYpE0xwt1Q3FJdzItLdYsH3hnB8Rc HxoBW71NtvF9wmFDEI8W96eNOH47UFEUUBQR5vsHZl3iFq5t5kdlQLRPqW1PffXd7Qdo 3YPxTh5Dv0C9BYzaAyuiXy/6wD4O3l1zDO9uVH35b9yT0+v01EM8c1xOJMp6Q0PlrDti gBMQ== X-Gm-Message-State: AC+VfDx+MZxTv8uqLqHCMDtC+9BWohvcthnCcOc77XAgAux8qvQDvrpj ivaoVMVlt/1CpemA1KSdDVyb3Q== 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-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1767582475245016442?= X-GMAIL-MSGID: =?utf-8?q?1767582475245016442?= 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;