Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp8189439rwb; Tue, 13 Dec 2022 03:27:28 -0800 (PST) X-Google-Smtp-Source: AA0mqf7YagfscfddtQQd0RLIuTYXPEGhdGcyhx/VkPjGL8h9kTtE12YAI+Dkwj/v0wfCp4w+7oZA X-Received: by 2002:a05:6402:1641:b0:46c:aa8b:da5c with SMTP id s1-20020a056402164100b0046caa8bda5cmr19833720edx.33.1670930848656; Tue, 13 Dec 2022 03:27:28 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1670930848; cv=none; d=google.com; s=arc-20160816; b=upH46CATq+9843E3n8Kls8uOU17daI4yCFzq8Pfihjj5263FjnyOGopBmltyuXfPlq Irv11qMigDRZDzSyn4QhOoFi0cKrYdiJ2m2jj6cqgzEVqgYvxWoyWMU5LT2f+v6XWkJv cfsp/U58wlNNz2TIyOKVRHvHoIw3cGq9NRKy3wgCDb7RCe8An8UZ8Lh6VP1MGFlHyB7y 64fkUBLPq8QEOIeyJNi4k+glYxgadxyvLzaJHBoA8LxvOn2IZ1GmJ7es1/BfLjOApYE4 uKB3F4OsM9LDl/MdLxYjAUwJdQ/NfaJS0MB78JCjuL2jQKKhO40+qripeagva9wdPCWQ pj1g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:content-language:subject:user-agent:mime-version :date:message-id:dkim-signature; bh=vc5uXKVAE2YUv86H9GjMKa7o5oMNjSMTC+mbRY3KC8Q=; b=jte99gZ1UWErz5cNtYaq0VEhmSFLMRuzJNkIQAqyt6AqsAij2Ionyz8JmY1b9IKOWn f1GHU0QQEe7PvFuHIzKZ0SEFG+GnyVU4YpzQCJ4222hjjy94qncbgiNKr8rpJtplkbPA w41zQIvZFLTaBDGOElW2jM5LLTOmTl6jVKtZYiKLiZpaJEClVdERbEyBU74NN478AzWf oFArSap1vLQflS7uKi7OdSShL8QWfHLxZ7Z6c8UhsIRSLXMuSumH7ZGSKfUPR2IRGc5T EQ4z3qerRvRMiybq+SNkjsSTKAM9toNDdXKM/ETpfMBnIUO0qFgxRp3KlgcCHmDuwUl3 4ugg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@collabora.com header.s=mail header.b=BBnxouu9; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=collabora.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id n14-20020a05640205ce00b0046b1ffb7211si10656703edx.423.2022.12.13.03.27.10; Tue, 13 Dec 2022 03:27:28 -0800 (PST) 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=@collabora.com header.s=mail header.b=BBnxouu9; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=collabora.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235195AbiLMKp7 (ORCPT + 73 others); Tue, 13 Dec 2022 05:45:59 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37258 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235054AbiLMKph (ORCPT ); Tue, 13 Dec 2022 05:45:37 -0500 Received: from madras.collabora.co.uk (madras.collabora.co.uk [IPv6:2a00:1098:0:82:1000:25:2eeb:e5ab]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 421155F99; Tue, 13 Dec 2022 02:45:36 -0800 (PST) Received: from [192.168.1.100] (2-237-20-237.ip236.fastwebnet.it [2.237.20.237]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) (Authenticated sender: kholk11) by madras.collabora.co.uk (Postfix) with ESMTPSA id 6BCFC6602AB2; Tue, 13 Dec 2022 10:45:34 +0000 (GMT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=collabora.com; s=mail; t=1670928335; bh=w1yA+xs8yCYHN5qeaHYkgBaLhwgeFIfgr7wKK0PyC9g=; h=Date:Subject:To:Cc:References:From:In-Reply-To:From; b=BBnxouu90Jw41QL+9sQ3fE7jPlrtNm0wtOLRX1u1SHrbK8ptogo5MnN6bK2ZDvokw //dOdy3sb79D2TwptTYBpkcm403QVTXMxTAlz9+nMbqhV5ipBf5R7JPM2gyfFAVch1 Pkan9wOs3Pv/c8ssp38ZO1/iH8Lse9++MnyzVqtuT34i0tcDQeEs+Yw6vGbls3VpRj BGfQHWMbZ8ahJ8e5Kf22dFJFCdgPw55eG+aLP3FBIU/UUgOgDZ43YPeCzDSBQa+bBi GyhteaSB5XtFQCUCkmr5yokeDPJsaU778tetZXPKzdYG9gJUxsLM/DDyuLmh3zOJM+ ay4McLmBmQPRg== Message-ID: <869cfa5a-2cfa-e5b7-b8f5-a79b9b364b25@collabora.com> Date: Tue, 13 Dec 2022 11:45:32 +0100 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.5.1 Subject: Re: [PATCH v3 05/12] ASoC: mediatek: mt8188: support etdm in platform driver Content-Language: en-US To: Trevor Wu , broonie@kernel.org, lgirdwood@gmail.com, tiwai@suse.com, perex@perex.cz, robh+dt@kernel.org, krzysztof.kozlowski+dt@linaro.org, matthias.bgg@gmail.com, p.zabel@pengutronix.de Cc: Project_Global_Chrome_Upstream_Group@mediatek.com, alsa-devel@alsa-project.org, linux-mediatek@lists.infradead.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, devicetree@vger.kernel.org References: <20221208033148.21866-1-trevor.wu@mediatek.com> <20221208033148.21866-6-trevor.wu@mediatek.com> From: AngeloGioacchino Del Regno In-Reply-To: <20221208033148.21866-6-trevor.wu@mediatek.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,NICE_REPLY_A,SPF_HELO_NONE, SPF_PASS 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 Il 08/12/22 04:31, Trevor Wu ha scritto: > Add mt8188 etdm dai driver support. > > Signed-off-by: Trevor Wu > --- > I don't add Reviewed-by tag because one new header file is included > in the patch to resolve compiling issue found by kernel test robot. > Additionally, I re-layout the code for better understanding of the > follow-up patch. > --- > sound/soc/mediatek/mt8188/mt8188-dai-etdm.c | 2591 +++++++++++++++++++ > 1 file changed, 2591 insertions(+) > create mode 100644 sound/soc/mediatek/mt8188/mt8188-dai-etdm.c > > diff --git a/sound/soc/mediatek/mt8188/mt8188-dai-etdm.c b/sound/soc/mediatek/mt8188/mt8188-dai-etdm.c > new file mode 100644 > index 000000000000..c653fa5e3f85 > --- /dev/null > +++ b/sound/soc/mediatek/mt8188/mt8188-dai-etdm.c ..snip.. > + > +static void mt8188_dai_etdm_parse_of(struct mtk_base_afe *afe) > +{ > + const struct device_node *of_node = afe->dev->of_node; > + struct mt8188_afe_private *afe_priv = afe->platform_priv; > + struct mtk_dai_etdm_priv *etdm_data; > + int i, j; > + char prop[48]; > + u8 disable_chn[MT8188_ETDM_MAX_CHANNELS]; > + int max_chn = MT8188_ETDM_MAX_CHANNELS; > + u32 sel; > + int ret; > + int dai_id; > + unsigned int sync_id; > + struct { > + const char *name; > + const unsigned int sync_id; > + } of_afe_etdms[MT8188_AFE_IO_ETDM_NUM] = { > + {"etdm-in1", ETDM_SYNC_FROM_IN1}, > + {"etdm-in2", ETDM_SYNC_FROM_IN2}, > + {"etdm-out1", ETDM_SYNC_FROM_OUT1}, > + {"etdm-out2", ETDM_SYNC_FROM_OUT2}, > + {"etdm-out3", ETDM_SYNC_FROM_OUT3}, > + }; > + > + for (i = 0; i < MT8188_AFE_IO_ETDM_NUM; i++) { > + dai_id = ETDM_TO_DAI_ID(i); > + etdm_data = afe_priv->dai_priv[dai_id]; > + > + ret = snprintf(prop, sizeof(prop), > + "mediatek,%s-mclk-always-on-rate", > + of_afe_etdms[i].name); > + if (ret < 0) { > + dev_info(afe->dev, "%s snprintf err=%d\n", Is this property optional? If yes, this dev_info() must be a dev_dbg(), otherwise, this must be a dev_err(). Please fix all prints to use the right message level. > + __func__, ret); > + return; Also, is it possible to specify this property only on selected eTDMs? As it is right now, if anyone wants to specify this only on, for example, etdm-out1 and out2, that won't work. In that case, you should replace that return with a `continue`. P.S.: I'm raising this question because you're not forcing "all or nothing" in commit [10/12] where you introduce the bindings for this driver, so I suppose that returning (hence stopping to parse) is a mistake. > + } > + ret = of_property_read_u32(of_node, prop, &sel); > + if (ret == 0) { > + etdm_data->mclk_dir = SND_SOC_CLOCK_OUT; > + if (mtk_dai_etdm_cal_mclk(afe, sel, dai_id)) > + dev_info(afe->dev, "%s unsupported mclk %uHz\n", > + __func__, sel); > + } > + Regards, Angelo