mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Krzysztof Kozlowski <krzk@kernel.org>
To: Cyril <Cyril.Chao@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>
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,
	Project_Global_Chrome_Upstream_Group@mediatek.com
Subject: Re: [PATCH 09/10] ASoC: mediatek: mt8189: add machine driver with nau8825
Date: Sat, 28 Jun 2025 14:39:04 +0200	[thread overview]
Message-ID: <a62e0111-e3b7-4772-9467-3a2927972f6f@kernel.org> (raw)
In-Reply-To: <20250628071442.31155-10-Cyril.Chao@mediatek.com>

On 28/06/2025 09:14, Cyril wrote:
> +
> +static int mt8189_nau8825_soc_card_probe(struct mtk_soc_card_data *soc_card_data, bool legacy)
> +{
> +	struct snd_soc_card *card = soc_card_data->card_data->card;
> +	struct snd_soc_dai_link *dai_link;
> +	bool init_nau8825 = false;
> +	bool init_rt5682s = false;
> +	bool init_rt5650 = false;
> +	bool init_rt5682i = false;
> +	bool init_dumb = false;
> +	int i;
> +
> +	dev_dbg(card->dev, "%s(), legacy: %d\n", __func__, legacy);

Drop probe success/start/finish messages. Pretty useless.

> +
> +	for_each_card_prelinks(card, i, dai_link) {
> +		if (strcmp(dai_link->name, "TDM_DPTX_BE") == 0) {
> +			if (dai_link->num_codecs &&
> +			    strcmp(dai_link->codecs->dai_name, "snd-soc-dummy-dai"))
> +				dai_link->init = mt8189_dptx_codec_init;
> +		} else if (strcmp(dai_link->name, "PCM_0_BE") == 0) {
> +			if (dai_link->num_codecs &&
> +			    strcmp(dai_link->codecs->dai_name, "snd-soc-dummy-dai"))
> +				dai_link->init = mt8189_hdmi_codec_init;
> +		} else if (strcmp(dai_link->name, "I2SOUT0_BE") == 0 ||
> +			   strcmp(dai_link->name, "I2SIN0_BE") == 0) {
> +			if (!strcmp(dai_link->codecs->dai_name, NAU8825_CODEC_DAI)) {
> +				dai_link->ops = &mt8189_nau8825_ops;
> +				if (!init_nau8825) {
> +					dai_link->init = mt8189_headset_codec_init;
> +					dai_link->exit = mt8189_headset_codec_exit;
> +					init_nau8825 = true;
> +				}
> +			} else if (!strcmp(dai_link->codecs->dai_name, RT5682S_CODEC_DAI)) {
> +				dai_link->ops = &mt8189_headset_i2s_ops;
> +				if (!init_rt5682s) {
> +					dai_link->init = mt8189_headset_codec_init;
> +					dai_link->exit = mt8189_headset_codec_exit;
> +					init_rt5682s = true;
> +				}
> +			} else if (!strcmp(dai_link->codecs->dai_name, RT5650_CODEC_DAI)) {
> +				dai_link->ops = &mt8189_headset_i2s_ops;
> +				if (!init_rt5650) {
> +					dai_link->init = mt8189_headset_codec_init;
> +					dai_link->exit = mt8189_headset_codec_exit;
> +					init_rt5650 = true;
> +				}
> +			} else if (!strcmp(dai_link->codecs->dai_name, RT5682I_CODEC_DAI)) {
> +				dai_link->ops = &mt8189_headset_i2s_ops;
> +				if (!init_rt5682i) {
> +					dai_link->init = mt8189_headset_codec_init;
> +					dai_link->exit = mt8189_headset_codec_exit;
> +					init_rt5682i = true;
> +				}
> +			} else {
> +				if (strcmp(dai_link->codecs->dai_name, "snd-soc-dummy-dai")) {
> +					if (!init_dumb) {
> +						dai_link->init = mt8189_dumb_amp_init;
> +						init_dumb = true;
> +					}
> +				}
> +			}
> +		}
> +	}
> +
> +	return 0;
> +}
> +
> +static struct snd_soc_card mt8189_nau8825_soc_card = {
> +	.owner = THIS_MODULE,
> +	.dai_link = mt8189_nau8825_dai_links,
> +	.num_links = ARRAY_SIZE(mt8189_nau8825_dai_links),
> +	.dapm_widgets = mt8189_nau8825_card_widgets,
> +	.num_dapm_widgets = ARRAY_SIZE(mt8189_nau8825_card_widgets),
> +	.dapm_routes = mt8189_nau8825_card_routes,
> +	.num_dapm_routes = ARRAY_SIZE(mt8189_nau8825_card_routes),
> +	.controls = mt8189_nau8825_card_controls,
> +	.num_controls = ARRAY_SIZE(mt8189_nau8825_card_controls),
> +};
> +
> +static const struct mtk_soundcard_pdata mt8189_nau8825_card = {
> +	.card_name = "mt8189_nau8825",
> +	.card_data = &(struct mtk_platform_card_data) {
> +		.card = &mt8189_nau8825_soc_card,
> +		.num_jacks = MT8189_JACK_MAX,
> +		.flags = NAU8825_HS_PRESENT
> +	},
> +	.sof_priv = NULL,
> +	.soc_probe = mt8189_nau8825_soc_card_probe,
> +};
> +
> +static const struct mtk_soundcard_pdata mt8189_rt5650_card = {
> +	.card_name = "mt8189_rt5650",
> +	.card_data = &(struct mtk_platform_card_data) {
> +		.card = &mt8189_nau8825_soc_card,
> +		.num_jacks = MT8189_JACK_MAX,
> +		.flags = RT5650_HS_PRESENT
> +	},
> +	.sof_priv = NULL,
> +	.soc_probe = mt8189_nau8825_soc_card_probe,
> +};
> +
> +static const struct mtk_soundcard_pdata mt8189_rt5682s_card = {
> +	.card_name = "mt8189_rt5682s",
> +	.card_data = &(struct mtk_platform_card_data) {
> +		.card = &mt8189_nau8825_soc_card,
> +		.num_jacks = MT8189_JACK_MAX,
> +		.flags = RT5682S_HS_PRESENT
> +	},
> +	.sof_priv = NULL,
> +	.soc_probe = mt8189_nau8825_soc_card_probe,
> +};
> +
> +static const struct mtk_soundcard_pdata mt8189_rt5682i_card = {
> +	.card_name = "mt8189_rt5682i",
> +	.card_data = &(struct mtk_platform_card_data) {
> +		.card = &mt8189_nau8825_soc_card,
> +		.num_jacks = MT8189_JACK_MAX,
> +		.flags = RT5682I_HS_PRESENT
> +	},
> +	.sof_priv = NULL,
> +	.soc_probe = mt8189_nau8825_soc_card_probe,
> +};
> +
> +#if IS_ENABLED(CONFIG_OF)

Drop, you have warnings now :/

> +static const struct of_device_id mt8189_nau8825_dt_match[] = {
> +	{.compatible = "mediatek,mt8189-nau8825-sound", .data = &mt8189_nau8825_card,},
> +	{.compatible = "mediatek,mt8189-rt5650-sound", .data = &mt8189_rt5650_card,},
> +	{.compatible = "mediatek,mt8189-rt5682s-sound", .data = &mt8189_rt5682s_card,},
> +	{.compatible = "mediatek,mt8189-rt5682i-sound", .data = &mt8189_rt5682i_card,},
> +	{}
> +};
> +
> +MODULE_DEVICE_TABLE(of, mt8189_nau8825_dt_match);
> +#endif
> +
> +static struct platform_driver mt8189_nau8825_driver = {
> +	.driver = {
> +		.name = "mt8189-nau8825",
> +#if IS_ENABLED(CONFIG_OF)

Drop all this ifdefry, not helpful.

> +		.of_match_table = mt8189_nau8825_dt_match,
> +#endif
> +		.pm = &snd_soc_pm_ops,
> +	},
> +	.probe = mtk_soundcard_common_probe,
> +};
> +
> +module_platform_driver(mt8189_nau8825_driver);
> +
> +/* Module information */
> +MODULE_DESCRIPTION("MT8189 NAU8825 ALSA SoC machine driver");
> +MODULE_AUTHOR("Darren Ye <darren.ye@mediatek.com>");
> +MODULE_LICENSE("GPL");
> +MODULE_ALIAS("mt8189 nau8825 soc card");

That's neither needed nor correct. Look how aliases are created first.


Best regards,
Krzysztof

  reply	other threads:[~2025-06-28 12:39 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-06-28  7:14 [PATCH 00/10] ASoC: mediatek: Add support for MT8189 SoC Cyril
2025-06-28  7:14 ` [PATCH 01/10] ASoC: mediatek: mt8189: add common header Cyril
2025-06-28  7:14 ` [PATCH 02/10] ASoC: mediatek: mt8189: support audio clock control Cyril
2025-06-28  7:14 ` [PATCH 03/10] ASoC: mediatek: mt8189: support ADDA in platform driver Cyril
2025-06-28  7:14 ` [PATCH 04/10] ASoC: mediatek: mt8189: support I2S " Cyril
2025-06-28  7:14 ` [PATCH 05/10] ASoC: mediatek: mt8189: support TDM " Cyril
2025-06-28  7:14 ` [PATCH 06/10] ASoC: mediatek: mt8189: support PCM " Cyril
2025-06-28  7:14 ` [PATCH 07/10] ASoC: mediatek: mt8189: add " Cyril
2025-06-28  7:14 ` [PATCH 08/10] ASoC: dt-bindings: mediatek,mt8189-afe-pcm: add audio afe document Cyril
2025-06-28 12:46   ` Krzysztof Kozlowski
2025-06-28  7:14 ` [PATCH 09/10] ASoC: mediatek: mt8189: add machine driver with nau8825 Cyril
2025-06-28 12:39   ` Krzysztof Kozlowski [this message]
2025-07-18  8:44     ` Cyril Chao (钞悦)
2025-07-18  9:18       ` Krzysztof Kozlowski
2025-06-28  7:14 ` [PATCH 10/10] ASoC: dt-bindings: mediatek,mt8189-nau8825: add mt8189-nau8825 document Cyril
2025-06-28 12:42   ` Krzysztof Kozlowski
2025-07-18  8:48     ` Cyril Chao (钞悦)
2025-07-18  9: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=a62e0111-e3b7-4772-9467-3a2927972f6f@kernel.org \
    --to=krzk@kernel.org \
    --cc=Cyril.Chao@mediatek.com \
    --cc=Project_Global_Chrome_Upstream_Group@mediatek.com \
    --cc=angelogioacchino.delregno@collabora.com \
    --cc=broonie@kernel.org \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=krzk+dt@kernel.org \
    --cc=lgirdwood@gmail.com \
    --cc=linux-arm-kernel@lists.infradead.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

all inboxes | Powered by JetHome®