From: Tzung-Bi Shih <tzungbi@kernel.org>
To: Jiaxin Yu <jiaxin.yu@mediatek.com>
Cc: broonie@kernel.org, robh+dt@kernel.org, aaronyu@google.com,
matthias.bgg@gmail.com, trevor.wu@mediatek.com,
linmq006@gmail.com, alsa-devel@alsa-project.org,
devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org,
linux-mediatek@lists.infradead.org, linux-kernel@vger.kernel.org,
Project_Global_Chrome_Upstream_Group@mediatek.com,
kernel test robot <lkp@intel.com>
Subject: Re: [v4 2/2] ASoC: mediatek: mt8192: support rt1015p_rt5682s
Date: Mon, 14 Mar 2022 11:16:36 +0800 [thread overview]
Message-ID: <Yi6zlIvA6t+yEbza@google.com> (raw)
In-Reply-To: <20220311162213.6942-3-jiaxin.yu@mediatek.com>
On Sat, Mar 12, 2022 at 12:22:13AM +0800, Jiaxin Yu wrote:
> Supports machines with rt1015p and rt5682s. Uses new proposed compatible
> string "mt8192_mt6359_rt1015p_rt5682s". Using define to simplifies card
> name and compatible name, and uses the snd_soc_of_get_dai_link_codecs()
> to complete the configuration of dai_link's codecs.
Rephrase the paragraph and consider to use imperative mood as [1] suggests.
[1]: https://www.kernel.org/doc/html/latest/process/submitting-patches.html#describe-your-changes
The patch includes multiple changes. Could you further separate it into:
1. Refactor for I2S3 DAI links for original amps.
2. Refactor for I2S8 and I2S9 DAI links for original headset codec RT5682.
3. Support mt8192_mt6359_rt1015p_rt5682s for RT5682S.
> Reported-by: kernel test robot <lkp@intel.com>
The tag can be dropped as "Supports machines with rt1015p and rt5682s" is not
an idea from the bot. Put it in change logs if you would like it to be a
record.
> +static int mt8192_mt6359_card_set_be_link(struct snd_soc_card *card,
> + struct snd_soc_dai_link *link,
> + struct device_node *node,
> + char *link_name)
> +{
> + int ret;
> +
> + if (node && strcmp(link->name, link_name) == 0) {
> + ret = snd_soc_of_get_dai_link_codecs(card->dev, node, link);
> + if (ret < 0) {
> + dev_err(card->dev, "get dai link codecs fail\n");
How about using dev_err_probe()? As the callers also report errors if
mt8192_mt6359_card_set_be_link() fails, the log can be dropped.
> static int mt8192_mt6359_dev_probe(struct platform_device *pdev)
> {
> struct snd_soc_card *card;
> - struct device_node *platform_node, *hdmi_codec;
> + struct device_node *platform_node, *hdmi_codec, *headset_codec, *speaker_codec;
> int ret, i;
> struct snd_soc_dai_link *dai_link;
> struct mt8192_mt6359_priv *priv;
> + struct device *dev;
[...]
> + dev = &pdev->dev;
I don't think it could help too much unless it was struggling for code
columns. Please consider to drop the variable or you should s/&pdev->dev/dev/g
for the function.
> + speaker_codec = of_get_child_by_name(dev->of_node, "mediatek,speaker-codec");
> + if (!speaker_codec) {
> + ret = -EINVAL;
> + dev_err_probe(dev, ret, "Property 'speaker_codec' missing or invalid\n");
> + goto err_speaker_codec;
> + }
> +
> + headset_codec = of_get_child_by_name(dev->of_node, "mediatek,headset-codec");
> + if (!headset_codec) {
> + ret = -EINVAL;
> + dev_err_probe(dev, ret, "Property 'headset_codec' missing or invalid\n");
> + goto err_headset_codec;
> + }
Are these new DT bindings? They are not in
Documentation/devicetree/bindings/sound/mt8192-mt6359-rt1015-rt5682.yaml.
> + ret = mt8192_mt6359_card_set_be_link(card, dai_link, speaker_codec, "I2S3");
> + if (ret) {
> + dev_err_probe(&pdev->dev, ret, "%s set speaker_codec fail\n",
As mentioned above, I don't think `dev` could help too much. However, to be
consistent, either drop the `dev` variable or use `dev` here.
> + ret = mt8192_mt6359_card_set_be_link(card, dai_link, headset_codec, "I2S8");
> + if (ret) {
> + dev_err_probe(&pdev->dev, ret, "%s set headset_codec fail\n",
> + dai_link->name);
Ditto.
> + ret = mt8192_mt6359_card_set_be_link(card, dai_link, headset_codec, "I2S9");
> + if (ret) {
> + dev_err_probe(&pdev->dev, ret, "%s set headset_codec fail\n",
> + dai_link->name);
Ditto.
> ret = mt8192_afe_gpio_init(&pdev->dev);
> if (ret) {
> - dev_err(&pdev->dev, "init gpio error %d\n", ret);
> - goto put_hdmi_codec;
> + dev_err_probe(&pdev->dev, ret, "%s init gpio error\n", __func__);
Ditto.
> ret = devm_snd_soc_register_card(&pdev->dev, card);
> -
> -put_hdmi_codec:
> + if (ret)
> + dev_err_probe(&pdev->dev, ret,
Ditto.
> +err_probe:
> + of_node_put(headset_codec);
> +err_headset_codec:
> + of_node_put(speaker_codec);
> +err_speaker_codec:
> of_node_put(hdmi_codec);
> -put_platform_node:
> +err_hdmi_codec:
> of_node_put(platform_node);
> +err_platform_node:
> +
The new line can be dropped.
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
prev parent reply other threads:[~2022-03-14 3:18 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-03-11 16:22 [v4 0/2] ASoC: mediatek: mt8192: support rt1015p_rt5682s Jiaxin Yu
2022-03-11 16:22 ` [v4 1/2] ASoC: dt-bindings: mt8192-mt6359: add new compatible for using rt1015p and rt5682 Jiaxin Yu
2022-03-11 16:22 ` [v4 2/2] ASoC: mediatek: mt8192: support rt1015p_rt5682s Jiaxin Yu
2022-03-14 3:16 ` Tzung-Bi Shih [this message]
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=Yi6zlIvA6t+yEbza@google.com \
--to=tzungbi@kernel.org \
--cc=Project_Global_Chrome_Upstream_Group@mediatek.com \
--cc=aaronyu@google.com \
--cc=alsa-devel@alsa-project.org \
--cc=broonie@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=jiaxin.yu@mediatek.com \
--cc=linmq006@gmail.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mediatek@lists.infradead.org \
--cc=lkp@intel.com \
--cc=matthias.bgg@gmail.com \
--cc=robh+dt@kernel.org \
--cc=trevor.wu@mediatek.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).