Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-3.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2A215C433E0 for ; Thu, 14 Jan 2021 04:25:24 +0000 (UTC) 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 mail.kernel.org (Postfix) with ESMTPS id 9AADF238E5 for ; Thu, 14 Jan 2021 04:25:22 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 9AADF238E5 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=renesas.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=alsa-devel-bounces@alsa-project.org 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 3DC97851; Thu, 14 Jan 2021 05:24:25 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 3DC97851 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1610598315; bh=S5c1KKkfEKP7Eld8ppSc/m4omodF3HQ/4HP3gqOEenU=; h=Date:From:To:Subject:Cc:List-Id:List-Unsubscribe:List-Archive: List-Post:List-Help:List-Subscribe:From; b=iIPftQ2Dy8RN+Z4VAVxS1QLbTgU634tapodHubBfsl2+sQ551xowInBQD22AOiVPy CH/HGLihVflTnCDow2fUqHGLB45py2MGhfJsOx3S/3+lrG1lQGd5N0JGHPz1EDxnYw FnCsyvAf5EDJyW8Br0715LetiIepUOF1BVUAwqx8= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id 9F93CF80249; Thu, 14 Jan 2021 05:24:24 +0100 (CET) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 929EEF80249; Thu, 14 Jan 2021 05:24:22 +0100 (CET) Received: from relmlie6.idc.renesas.com (relmlor2.renesas.com [210.160.252.172]) by alsa1.perex.cz (Postfix) with ESMTP id A8FFAF80134 for ; Thu, 14 Jan 2021 05:24:09 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz A8FFAF80134 Date: 14 Jan 2021 13:24:04 +0900 X-IronPort-AV: E=Sophos;i="5.79,346,1602514800"; d="scan'208";a="68738169" Received: from unknown (HELO relmlir5.idc.renesas.com) ([10.200.68.151]) by relmlie6.idc.renesas.com with ESMTP; 14 Jan 2021 13:24:04 +0900 Received: from mercury.renesas.com (unknown [10.166.252.133]) by relmlir5.idc.renesas.com (Postfix) with ESMTP id 5995340078A6; Thu, 14 Jan 2021 13:24:04 +0900 (JST) Message-ID: <87bldsp2yt.wl-kuninori.morimoto.gx@renesas.com> From: Kuninori Morimoto To: Mark Brown , Jyri Sarha Subject: Question about daifmt of legacy DT on simple-card User-Agent: Wanderlust/2.15.9 Emacs/26.3 Mule/6.0 MIME-Version: 1.0 (generated by SEMI-EPG 1.14.7 - "Harue") Content-Type: text/plain; charset=US-ASCII Cc: Linux-ALSA 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" Hi ALSA SoC Cc Jyri For historical reason, simple-card supports legacy DT daifmt settings. Then, I noticed one strange code. -- simple-card-utils.c --- asoc_simple_parse_daifmt(xxx) { (A) daifmt = snd_soc_of_parse_daifmt(...); daifmt &= ~SND_SOC_DAIFMT_MASTER_MASK; if (!bitclkmaster && !framemaster) { /* * No dai-link level and master setting was not found from * sound node level, revert back to legacy DT parsing and * take the settings from codec node. */ (B) daifmt = snd_soc_of_parse_daifmt(codec, NULL, NULL, NULL) | (daifmt & ~SND_SOC_DAIFMT_CLOCK_MASK); } ... ... } It rollbacks to legacy DT parsing at (B) if (A) didn't have master settings. Here, (B) re-try to get daifmt, and use "or" with (daifmt & ~CLOCK mask). Why CLOCK mask ? and shouldn't it use mask when "or" ? Otherwise FORMAT and INV part will be duplicated, I think. for example daifmt = (snd_soc_of_parse_daifmt() & SND_SOC_DAIFMT_CLOCK_MASK) | (daifmt & ~SND_SOC_DAIFMT_CLOCK_MASK) I think using snd_soc_of_parse_daifmt() only is very enough at (B), but am I misunderstanding ?? The original code was from b3ca11ff59bc5842b01f13421a17e6d9a8936784 ("ASoC: simple-card: Move dai-link level properties away from dai subnodes") Thank you for your help !! Best regards --- Kuninori Morimoto