From: Krzysztof Kozlowski <krzk@kernel.org>
To: "Darren.Ye" <darren.ye@mediatek.com>,
Liam Girdwood <lgirdwood@gmail.com>,
Mark Brown <broonie@kernel.org>, Rob Herring <robh@kernel.org>,
Krzysztof Kozlowski <krzk+dt@kernel.org>,
Conor Dooley <conor+dt@kernel.org>,
Matthias Brugger <matthias.bgg@gmail.com>,
AngeloGioacchino Del Regno
<angelogioacchino.delregno@collabora.com>,
Jaroslav Kysela <perex@perex.cz>, Takashi Iwai <tiwai@suse.com>,
Linus Walleij <linus.walleij@linaro.org>,
Bartosz Golaszewski <brgl@bgdev.pl>
Cc: linux-sound@vger.kernel.org, devicetree@vger.kernel.org,
linux-kernel@vger.kernel.org,
linux-arm-kernel@lists.infradead.org,
linux-mediatek@lists.infradead.org, linux-gpio@vger.kernel.org
Subject: Re: [PATCH 08/14] ASoC: mediatek: mt8196: support I2S in platform driver
Date: Fri, 7 Mar 2025 16:24:36 +0100 [thread overview]
Message-ID: <934d740a-f382-411a-b769-4f9f21a53257@kernel.org> (raw)
In-Reply-To: <20250307124841.23777-9-darren.ye@mediatek.com>
On 07/03/2025 13:47, Darren.Ye wrote:
> +
> +static int etdm_parse_dt(struct mtk_base_afe *afe)
> +{
> + int ret;
> + struct mt8196_afe_private *afe_priv = afe->platform_priv;
> + struct mtk_afe_i2s_priv *i2sin4_priv = afe_priv->dai_priv[MT8196_DAI_I2S_IN4];
> + struct mtk_afe_i2s_priv *i2sout4_priv = afe_priv->dai_priv[MT8196_DAI_I2S_OUT4];
> + unsigned int ch_num_in;
> + unsigned int ch_num_out;
> + unsigned int sync_in;
> + unsigned int sync_out;
> + unsigned int ip_mode;
> +
> + /* get etdm ch */
> + ret = of_property_read_u32(afe->dev->of_node, "mediatek,etdm-out-ch", &ch_num_out);
> + if (ret) {
> + dev_info(afe->dev, "%s() failed to read mediatek,etdm-out-ch\n", __func__);
> + return -EINVAL;
> + }
> + i2sout4_priv->ch_num = ch_num_out;
> + dev_dbg(afe->dev, "%s() mediatek,etdm-out-ch: %d\n", __func__, ch_num_out);
> +
> + ret = of_property_read_u32(afe->dev->of_node, "mediatek,etdm-in-ch", &ch_num_in);
> + if (ret) {
> + dev_info(afe->dev, "%s() failed to read mediatek,etdm-in-ch\n", __func__);
> + return -EINVAL;
> + }
> + i2sin4_priv->ch_num = ch_num_in;
> + dev_dbg(afe->dev, "%s() mediatek,etdm-in-ch: %d\n", __func__, ch_num_in);
> +
> + /* get etdm sync */
> + ret = of_property_read_u32(afe->dev->of_node, "mediatek,etdm-out-sync", &sync_out);
> + if (ret) {
> + dev_info(afe->dev, "%s() failed to read mediatek,etdm-out-sync\n", __func__);
> + return -EINVAL;
> + }
> + i2sout4_priv->sync = sync_out;
> + dev_dbg(afe->dev, "%s() mediatek,etdm-out-sync: %d\n", __func__, sync_out);
> +
> + ret = of_property_read_u32(afe->dev->of_node, "mediatek,etdm-in-sync", &sync_in);
> + if (ret) {
> + dev_info(afe->dev, "%s() failed to read mediatek,etdm-in-sync\n", __func__);
> + return -EINVAL;
> + }
> + i2sin4_priv->sync = sync_in;
> + dev_dbg(afe->dev, "%s() mediatek,etdm-in-sync: %d\n", __func__, sync_in);
> +
> + /* get etdm ip mode */
> + ret = of_property_read_u32(afe->dev->of_node, "mediatek,etdm-ip-mode", &ip_mode);
> + if (ret) {
> + dev_info(afe->dev, "%s() failed to read mediatek,etdm-ip-mode\n", __func__);
> + return -EINVAL;
> + }
> + i2sin4_priv->ip_mode = ip_mode;
> + dev_dbg(afe->dev, "%s() mediatek,etdm-ip-mode: %d\n", __func__, ip_mode);
> +
> + return 0;
> +}
> +
> +static int mt8196_dai_i2s_get_share(struct mtk_base_afe *afe)
> +{
> + struct mt8196_afe_private *afe_priv = afe->platform_priv;
> + const struct device_node *of_node = afe->dev->of_node;
> + const char *of_str;
> + const char *property_name;
> + struct mtk_afe_i2s_priv *i2s_priv;
> + int i;
> +
> + for (i = 0; i < DAI_I2S_NUM; i++) {
> + i2s_priv = afe_priv->dai_priv[mt8196_i2s_priv[i].id];
> + property_name = mt8196_i2s_priv[i].share_property_name;
> + if (of_property_read_string(of_node, property_name, &of_str))
> + continue;
> + i2s_priv->share_i2s_id = get_i2s_id_by_name(afe, of_str);
> + }
> + return 0;
> +}
> +
> +static int mt8196_dai_i2s_set_priv(struct mtk_base_afe *afe)
> +{
> + int i;
> + int ret;
> +
> + for (i = 0; i < DAI_I2S_NUM; i++) {
> + ret = mt8196_dai_set_priv(afe, mt8196_i2s_priv[i].id,
> + sizeof(struct mtk_afe_i2s_priv),
> + &mt8196_i2s_priv[i]);
> + if (ret)
> + return ret;
> + }
> + return 0;
> +}
> +
> +int mt8196_dai_i2s_register(struct mtk_base_afe *afe)
> +{
> + struct mtk_base_afe_dai *dai;
> + int ret;
> +
> + dev_dbg(afe->dev, "%s() successfully start\n", __func__);
Well, no. Tracing is for debugging entry/exit of functions. Say
something useful or just drop such entry/exist success messages.
> +
> + dai = devm_kzalloc(afe->dev, sizeof(*dai), GFP_KERNEL);
> + if (!dai)
> + return -ENOMEM;
> +
> + list_add(&dai->list, &afe->sub_dais);
> +
> + dai->dai_drivers = mtk_dai_i2s_driver;
> + dai->num_dai_drivers = ARRAY_SIZE(mtk_dai_i2s_driver);
> +
> + dai->controls = mtk_dai_i2s_controls;
> + dai->num_controls = ARRAY_SIZE(mtk_dai_i2s_controls);
> + dai->dapm_widgets = mtk_dai_i2s_widgets;
> + dai->num_dapm_widgets = ARRAY_SIZE(mtk_dai_i2s_widgets);
> + dai->dapm_routes = mtk_dai_i2s_routes;
> + dai->num_dapm_routes = ARRAY_SIZE(mtk_dai_i2s_routes);
> +
> + /* set all dai i2s private data */
> + ret = mt8196_dai_i2s_set_priv(afe);
> + if (ret)
> + return ret;
> +
> + /* parse share i2s */
> + ret = mt8196_dai_i2s_get_share(afe);
> + if (ret)
> + return ret;
> +
> + /* for customer to change ch_num & sync & ipmode from dts */
> + ret = etdm_parse_dt(afe);
> + if (ret) {
> + dev_info(afe->dev, "%s() fail to parse dts: %d\n", __func__, ret);
Why do you print errors twice?
> + return ret;
> + }
> +
> + return 0;
> +}
Best regards,
Krzysztof
next prev parent reply other threads:[~2025-03-07 15:24 UTC|newest]
Thread overview: 30+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-03-07 12:47 [PATCH 00/14] ASoC: mediatek: Add support for MT8196 SoC Darren.Ye
2025-03-07 12:47 ` [PATCH 01/14] ASoC: mediatek: common: modify mtk afe common driver for mt8196 Darren.Ye
2025-03-07 15:20 ` Krzysztof Kozlowski
2025-03-10 15:23 ` AngeloGioacchino Del Regno
2025-03-07 12:47 ` [PATCH 02/14] ASoC: mediatek: common: modify mtk afe platform " Darren.Ye
2025-03-07 15:21 ` Krzysztof Kozlowski
2025-03-07 12:47 ` [PATCH 03/14] ASoC: mediatek: mt8196: add common header Darren.Ye
2025-03-07 12:47 ` [PATCH 04/14] ASoC: mediatek: mt8196: add common interface for mt8196 DAI driver Darren.Ye
2025-03-07 15:22 ` Krzysztof Kozlowski
2025-03-10 15:23 ` AngeloGioacchino Del Regno
2025-03-07 12:47 ` [PATCH 05/14] ASoC: mediatek: mt8196: support audio clock control Darren.Ye
2025-03-07 15:32 ` Krzysztof Kozlowski
2025-03-10 15:23 ` AngeloGioacchino Del Regno
2025-03-07 12:47 ` [PATCH 06/14] ASoC: mediatek: mt8196: support audio GPIO control Darren.Ye
2025-03-14 10:21 ` Linus Walleij
2025-03-07 12:47 ` [PATCH 07/14] ASoC: mediatek: mt8196: support ADDA in platform driver Darren.Ye
2025-03-07 12:47 ` [PATCH 08/14] ASoC: mediatek: mt8196: support I2S " Darren.Ye
2025-03-07 15:24 ` Krzysztof Kozlowski [this message]
2025-03-07 12:47 ` [PATCH 09/14] ASoC: mediatek: mt8196: support TDM " Darren.Ye
2025-03-07 12:47 ` [PATCH 10/14] ASoC: mediatek: mt8196: support CM " Darren.Ye
2025-03-07 15:33 ` Krzysztof Kozlowski
2025-03-07 12:47 ` [PATCH 11/14] ASoC: mediatek: mt8196: add " Darren.Ye
2025-03-07 15:32 ` Krzysztof Kozlowski
2025-03-07 12:47 ` [PATCH 12/14] dt-bindings: mediatek: mt8196: add audio AFE document Darren.Ye
2025-03-07 14:35 ` Rob Herring (Arm)
2025-03-07 15:15 ` Krzysztof Kozlowski
2025-03-07 12:47 ` [PATCH 13/14] ASoC: mediatek: mt8196: add machine driver with mt6681 Darren.Ye
2025-03-07 12:47 ` [PATCH 14/14] dt-bindings: mediatek: mt8196: add mt8196-mt6681 document Darren.Ye
2025-03-07 14:35 ` Rob Herring (Arm)
2025-03-07 15:19 ` Krzysztof Kozlowski
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=934d740a-f382-411a-b769-4f9f21a53257@kernel.org \
--to=krzk@kernel.org \
--cc=angelogioacchino.delregno@collabora.com \
--cc=brgl@bgdev.pl \
--cc=broonie@kernel.org \
--cc=conor+dt@kernel.org \
--cc=darren.ye@mediatek.com \
--cc=devicetree@vger.kernel.org \
--cc=krzk+dt@kernel.org \
--cc=lgirdwood@gmail.com \
--cc=linus.walleij@linaro.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-gpio@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mediatek@lists.infradead.org \
--cc=linux-sound@vger.kernel.org \
--cc=matthias.bgg@gmail.com \
--cc=perex@perex.cz \
--cc=robh@kernel.org \
--cc=tiwai@suse.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).