linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: Tzung-Bi Shih <tzungbi@kernel.org>
To: Trevor Wu <trevor.wu@mediatek.com>
Cc: broonie@kernel.org, tiwai@suse.com, robh+dt@kernel.org,
	matthias.bgg@gmail.com, devicetree@vger.kernel.org,
	alsa-devel@alsa-project.org, linux-kernel@vger.kernel.org,
	linux-mediatek@lists.infradead.org, yc.hung@mediatek.com,
	aaronyu@google.com, linux-arm-kernel@lists.infradead.org,
	angelogioacchino.delregno@collabora.com
Subject: Re: [PATCH v2 1/5] ASoC: mediatek: mt8195: merge machine driver
Date: Thu, 17 Mar 2022 10:24:11 +0800	[thread overview]
Message-ID: <YjKby/RYpMtcxeUm@google.com> (raw)
In-Reply-To: <20220316060139.6211-2-trevor.wu@mediatek.com>

Hi,
I didn't review too many details because I found the patch is not easy to
review.  Please consider to not reorder symbols if it can.  If it is still
hard to generate reasonable chunks or the reorders are necessary, it could
put some refactor patches prior to the "merge".

On Wed, Mar 16, 2022 at 02:01:35PM +0800, Trevor Wu wrote:
> diff --git a/sound/soc/mediatek/mt8195/mt8195-mt6359-rt1019-rt5682.c b/sound/soc/mediatek/mt8195/mt8195-mt6359.c
[...]
>  #include <linux/input.h>
>  #include <linux/module.h>
> +#include <linux/of_device.h>
>  #include <linux/pm_runtime.h>
>  #include <sound/jack.h>
>  #include <sound/pcm_params.h>
>  #include <sound/rt5682.h>
> -#include <sound/sof.h>

Why does it remove the header?

> +struct mt8195_mt6359_priv {
> +	struct snd_soc_jack headset_jack;
> +	struct snd_soc_jack dp_jack;
> +	struct snd_soc_jack hdmi_jack;
> +	struct clk *i2so1_mclk;
> +};
> +
> +struct mt8195_card_data {
> +	const char *name;
> +	unsigned long quirk;
> +};
> +
> +struct sof_conn_stream {
> +	const char *normal_link;
> +	const char *sof_link;
> +	const char *sof_dma;
> +	int stream_dir;
> +};
[...]
> -struct sof_conn_stream {
> -	const char *normal_link;
> -	const char *sof_link;
> -	const char *sof_dma;
> -	int stream_dir;
> -};
> -
> -struct mt8195_mt6359_rt1019_rt5682_priv {
> -	struct snd_soc_jack headset_jack;
> -	struct snd_soc_jack dp_jack;
> -	struct snd_soc_jack hdmi_jack;
> -	struct clk *i2so1_mclk;
> -};

The effective operation here: rename from mt8195_mt6359_rt1019_rt5682_priv
to mt8195_mt6359_priv.  However, it somehow reorders the code.  As a result,
the change looks like more complicated than just a "merge" operation.

> -static const struct snd_soc_dapm_route mt8195_mt6359_rt1019_rt5682_routes[] = {
> -	/* speaker */
> -	{ "Speakers", NULL, "Speaker" },
> +static const struct snd_kcontrol_new mt8195_mt6359_controls[] = {
> +	SOC_DAPM_PIN_SWITCH("Headphone Jack"),
> +	SOC_DAPM_PIN_SWITCH("Headset Mic"),
> +};
> +
> +static const struct snd_soc_dapm_route mt8195_mt6359_routes[] = {
>  	/* headset */
>  	{ "Headphone Jack", NULL, "HPOL" },
>  	{ "Headphone Jack", NULL, "HPOR" },
> @@ -80,55 +94,31 @@ static const struct snd_soc_dapm_route mt8195_mt6359_rt1019_rt5682_routes[] = {
>  	{"I021", NULL, SOF_DMA_DL3},
>  };
>  
> -static const struct snd_kcontrol_new mt8195_mt6359_rt1019_rt5682_controls[] = {
> -	SOC_DAPM_PIN_SWITCH("Speakers"),
> -	SOC_DAPM_PIN_SWITCH("Headphone Jack"),
> -	SOC_DAPM_PIN_SWITCH("Headset Mic"),
> +static const struct snd_soc_dapm_widget mt8195_dual_speaker_widgets[] = {
> +	SND_SOC_DAPM_SPK("Left Speaker", NULL),
> +	SND_SOC_DAPM_SPK("Right Speaker", NULL),
>  };
>  
> -static int mt8195_rt5682_etdm_hw_params(struct snd_pcm_substream *substream,
> -					struct snd_pcm_hw_params *params)
> -{
[...]
> +static const struct snd_kcontrol_new mt8195_dual_speaker_controls[] = {
> +	SOC_DAPM_PIN_SWITCH("Left Speaker"),
> +	SOC_DAPM_PIN_SWITCH("Right Speaker"),
> +};

Ditto.  I would expect it only renames and adds something.  However, if you
look at the block and the following, it looks like changed a lot.

> @@ -143,20 +133,20 @@ static int mt8195_mt6359_mtkaif_calibration(struct snd_soc_pcm_runtime *rtd)
>  	struct mtk_base_afe *afe = snd_soc_component_get_drvdata(cmpnt_afe);
>  	struct mt8195_afe_private *afe_priv = afe->platform_priv;
>  	struct mtkaif_param *param = &afe_priv->mtkaif_params;
> -	int phase;
> -	unsigned int monitor;
> -	int mtkaif_calibration_num_phase;
> +	int chosen_phase_1, chosen_phase_2, chosen_phase_3;
> +	int prev_cycle_1, prev_cycle_2, prev_cycle_3;
>  	int test_done_1, test_done_2, test_done_3;
>  	int cycle_1, cycle_2, cycle_3;
> -	int prev_cycle_1, prev_cycle_2, prev_cycle_3;
> -	int chosen_phase_1, chosen_phase_2, chosen_phase_3;
> -	int counter;
> -	bool mtkaif_calibration_ok;
>  	int mtkaif_chosen_phase[MT8195_MTKAIF_MISO_NUM];
>  	int mtkaif_phase_cycle[MT8195_MTKAIF_MISO_NUM];
> +	int mtkaif_calibration_num_phase;
> +	bool mtkaif_calibration_ok;
> +	unsigned int monitor;
> +	int counter;
> +	int phase;
>  	int i;

The reorder of variable declaration is irrelevant to the patch.  Drop them.
If it has good reason to do so, send another patch for the purpose.

> @@ -513,7 +446,7 @@ static int mt8195_playback_startup(struct snd_pcm_substream *substream)
>  	return 0;
>  }
>  
> -static const struct snd_soc_ops mt8195_playback_ops = {
> +const struct snd_soc_ops mt8195_playback_ops = {
>  	.startup = mt8195_playback_startup,

Why does it remove the `static`?

> +static int mt8195_mt6359_dev_probe(struct platform_device *pdev)
>  {
[...]
> +	match = of_match_device(pdev->dev.driver->of_match_table, &pdev->dev);
> +	if (!match || !match->data)
> +		return -EINVAL;
> +
> +	card_data = (struct mt8195_card_data *)match->data;

Use of_device_get_match_data().

> -static const struct dev_pm_ops mt8195_mt6359_rt1019_rt5682_pm_ops = {
> +const struct dev_pm_ops mt8195_mt6359_pm_ops = {
>  	.poweroff = snd_soc_poweroff,
>  	.restore = snd_soc_resume,
>  };

Why does it remove the `static`?

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

  reply	other threads:[~2022-03-17  2:25 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-03-16  6:01 [PATCH v2 0/5] ASoC: mediatek: Add support for MT8195 sound card with max98390 and rt5682 Trevor Wu
2022-03-16  6:01 ` [PATCH v2 1/5] ASoC: mediatek: mt8195: merge machine driver Trevor Wu
2022-03-17  2:24   ` Tzung-Bi Shih [this message]
2022-03-17  4:17     ` Trevor Wu
2022-03-16  6:01 ` [PATCH v2 2/5] ASoC: dt-bindings: mediatek: mt8195: merge mt8195 machine yaml Trevor Wu
2022-03-16  6:01 ` [PATCH v2 3/5] ASoC: mediatek: mt8195: rename card controls Trevor Wu
2022-03-16  6:01 ` [PATCH v2 4/5] ASoC: mediatek: mt8195: add machine support for max98390 and rt5682 Trevor Wu
2022-03-16  6:01 ` [PATCH v2 5/5] ASoC: dt-bindings: mediatek: mt8195: support mt8195-mt6359-max98390-rt5682 Trevor Wu

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=YjKby/RYpMtcxeUm@google.com \
    --to=tzungbi@kernel.org \
    --cc=aaronyu@google.com \
    --cc=alsa-devel@alsa-project.org \
    --cc=angelogioacchino.delregno@collabora.com \
    --cc=broonie@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mediatek@lists.infradead.org \
    --cc=matthias.bgg@gmail.com \
    --cc=robh+dt@kernel.org \
    --cc=tiwai@suse.com \
    --cc=trevor.wu@mediatek.com \
    --cc=yc.hung@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).