diff mbox series

[27/38] ASoC: mediatek: merge DAI call back functions into ops

Message ID 877cqetg6l.wl-kuninori.morimoto.gx@renesas.com (mailing list archive)
State Superseded
Headers show
Series ASoC: merge DAI call back functions into ops | expand

Commit Message

Kuninori Morimoto Aug. 2, 2023, 12:56 a.m. UTC
ALSA SoC merges DAI call backs into .ops.
This patch merge thesse into one.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
---
 sound/soc/mediatek/mt8195/mt8195-dai-etdm.c | 56 ++++++++++++---------
 1 file changed, 31 insertions(+), 25 deletions(-)

Comments

Trevor Wu (吳文良) Aug. 2, 2023, 12:25 p.m. UTC | #1
On Wed, 2023-08-02 at 00:56 +0000, Kuninori Morimoto wrote:
>  	 
> External email : Please do not click links or open attachments until
> you have verified the sender or the content.
>  ALSA SoC merges DAI call backs into .ops.
> This patch merge thesse into one.
> 
> Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
> ---
>  sound/soc/mediatek/mt8195/mt8195-dai-etdm.c | 56 ++++++++++++-------
> --
>  1 file changed, 31 insertions(+), 25 deletions(-)
> 
> diff --git a/sound/soc/mediatek/mt8195/mt8195-dai-etdm.c
> b/sound/soc/mediatek/mt8195/mt8195-dai-etdm.c
> index eedb9165f911..fd4f9f8f032d 100644
> --- a/sound/soc/mediatek/mt8195/mt8195-dai-etdm.c
> +++ b/sound/soc/mediatek/mt8195/mt8195-dai-etdm.c
> @@ -2456,25 +2456,6 @@ static int
> mtk_dai_hdmitx_dptx_set_sysclk(struct snd_soc_dai *dai,
>  return mtk_dai_etdm_cal_mclk(afe, freq, dai->id);
>  }
>  
> -static const struct snd_soc_dai_ops mtk_dai_etdm_ops = {
> -.startup = mtk_dai_etdm_startup,
> -.shutdown = mtk_dai_etdm_shutdown,
> -.hw_params = mtk_dai_etdm_hw_params,
> -.trigger = mtk_dai_etdm_trigger,
> -.set_sysclk = mtk_dai_etdm_set_sysclk,
> -.set_fmt = mtk_dai_etdm_set_fmt,
> -.set_tdm_slot = mtk_dai_etdm_set_tdm_slot,
> -};
> -
> -static const struct snd_soc_dai_ops mtk_dai_hdmitx_dptx_ops = {
> -.startup= mtk_dai_hdmitx_dptx_startup,
> -.shutdown= mtk_dai_hdmitx_dptx_shutdown,
> -.hw_params= mtk_dai_hdmitx_dptx_hw_params,
> -.trigger= mtk_dai_hdmitx_dptx_trigger,
> -.set_sysclk= mtk_dai_hdmitx_dptx_set_sysclk,
> -.set_fmt= mtk_dai_etdm_set_fmt,
> -};
> -
>  /* dai driver */
>  #define MTK_ETDM_RATES (SNDRV_PCM_RATE_8000_384000)
>  
> @@ -2505,6 +2486,36 @@ static int mtk_dai_etdm_probe(struct
> snd_soc_dai *dai)
>  return 0;
>  }
>  
> +static const struct snd_soc_dai_ops mtk_dai_hdmitx_dptx_ops = {
> +.startup= mtk_dai_hdmitx_dptx_startup,
> +.shutdown= mtk_dai_hdmitx_dptx_shutdown,
> +.hw_params= mtk_dai_hdmitx_dptx_hw_params,
> +.trigger= mtk_dai_hdmitx_dptx_trigger,
> +.set_sysclk= mtk_dai_hdmitx_dptx_set_sysclk,
> +.set_fmt= mtk_dai_etdm_set_fmt,
> +};
> +
> +static const struct snd_soc_dai_ops mtk_dai_hdmitx_dptx_ops2 = {
> +.probe= mtk_dai_etdm_probe,
> +.startup= mtk_dai_hdmitx_dptx_startup,
> +.shutdown= mtk_dai_hdmitx_dptx_shutdown,
> +.hw_params= mtk_dai_hdmitx_dptx_hw_params,
> +.trigger= mtk_dai_hdmitx_dptx_trigger,
> +.set_sysclk= mtk_dai_hdmitx_dptx_set_sysclk,
> +.set_fmt= mtk_dai_etdm_set_fmt,
> +};
> +

Why are you including mtk_dai_hdmitx_dptx_ops2 and keeping
mtk_dai_hdmitx_dptx_ops even though you are not using it?

Thanks,
Trevor

> +static const struct snd_soc_dai_ops mtk_dai_etdm_ops = {
> +.probe= mtk_dai_etdm_probe,
> +.startup= mtk_dai_etdm_startup,
> +.shutdown= mtk_dai_etdm_shutdown,
> +.hw_params= mtk_dai_etdm_hw_params,
> +.trigger= mtk_dai_etdm_trigger,
> +.set_sysclk= mtk_dai_etdm_set_sysclk,
> +.set_fmt= mtk_dai_etdm_set_fmt,
> +.set_tdm_slot= mtk_dai_etdm_set_tdm_slot,
> +};
> +
>  static struct snd_soc_dai_driver mtk_dai_etdm_driver[] = {
>  {
>  .name = "DPTX",
> @@ -2529,7 +2540,6 @@ static struct snd_soc_dai_driver
> mtk_dai_etdm_driver[] = {
>  .formats = MTK_ETDM_FORMATS,
>  },
>  .ops = &mtk_dai_etdm_ops,
> -.probe = mtk_dai_etdm_probe,
>  },
>  {
>  .name = "ETDM2_IN",
> @@ -2542,7 +2552,6 @@ static struct snd_soc_dai_driver
> mtk_dai_etdm_driver[] = {
>  .formats = MTK_ETDM_FORMATS,
>  },
>  .ops = &mtk_dai_etdm_ops,
> -.probe = mtk_dai_etdm_probe,
>  },
>  {
>  .name = "ETDM1_OUT",
> @@ -2555,7 +2564,6 @@ static struct snd_soc_dai_driver
> mtk_dai_etdm_driver[] = {
>  .formats = MTK_ETDM_FORMATS,
>  },
>  .ops = &mtk_dai_etdm_ops,
> -.probe = mtk_dai_etdm_probe,
>  },
>  {
>  .name = "ETDM2_OUT",
> @@ -2568,7 +2576,6 @@ static struct snd_soc_dai_driver
> mtk_dai_etdm_driver[] = {
>  .formats = MTK_ETDM_FORMATS,
>  },
>  .ops = &mtk_dai_etdm_ops,
> -.probe = mtk_dai_etdm_probe,
>  },
>  {
>  .name = "ETDM3_OUT",
> @@ -2580,8 +2587,7 @@ static struct snd_soc_dai_driver
> mtk_dai_etdm_driver[] = {
>  .rates = MTK_ETDM_RATES,
>  .formats = MTK_ETDM_FORMATS,
>  },
> -.ops = &mtk_dai_hdmitx_dptx_ops,
> -.probe = mtk_dai_etdm_probe,
> +.ops = &mtk_dai_hdmitx_dptx_ops2,
>  },
>  };
>  
> -- 
> 2.25.1
>
Kuninori Morimoto Aug. 2, 2023, 11:12 p.m. UTC | #2
Hi Trevor

Thank you for your review.

> > External email : Please do not click links or open attachments until
> > you have verified the sender or the content.
> >  ALSA SoC merges DAI call backs into .ops.
> > This patch merge thesse into one.
> > 
> > Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
> > ---
(snip)
> Why are you including mtk_dai_hdmitx_dptx_ops2 and keeping
> mtk_dai_hdmitx_dptx_ops even though you are not using it?

Because there are 2 users of mtk_dai_hdmitx_dptx_ops (A),
one needs .probe (B)

	static struct snd_soc_dai_driver mtk_dai_etdm_driver[] = {
		{
			.name = "DPTX",
			.id = MT8195_AFE_IO_DPTX,
			...
(A)			.ops = &mtk_dai_hdmitx_dptx_ops,
		},
		...
		{
			.name = "ETDM3_OUT",
			.id = MT8195_AFE_IO_ETDM3_OUT,
			...
(A)			.ops = &mtk_dai_hdmitx_dptx_ops,
(B)			.probe = mtk_dai_etdm_probe,
		},
	};


mtk_dai_hdmitx_dptx_ops   = (A)
mtk_dai_hdmitx_dptx_ops2  = (A) + (B)

Thank you for your help !!

Best regards
---
Kuninori Morimoto
Trevor Wu (吳文良) Aug. 3, 2023, 5:13 a.m. UTC | #3
On Wed, 2023-08-02 at 00:56 +0000, Kuninori Morimoto wrote:
> 
>  ALSA SoC merges DAI call backs into .ops.
> This patch merge thesse into one.
> 
> Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
> 

Acked-by: Trevor Wu <trevor.wu@mediatek.com>
diff mbox series

Patch

diff --git a/sound/soc/mediatek/mt8195/mt8195-dai-etdm.c b/sound/soc/mediatek/mt8195/mt8195-dai-etdm.c
index eedb9165f911..fd4f9f8f032d 100644
--- a/sound/soc/mediatek/mt8195/mt8195-dai-etdm.c
+++ b/sound/soc/mediatek/mt8195/mt8195-dai-etdm.c
@@ -2456,25 +2456,6 @@  static int mtk_dai_hdmitx_dptx_set_sysclk(struct snd_soc_dai *dai,
 	return mtk_dai_etdm_cal_mclk(afe, freq, dai->id);
 }
 
-static const struct snd_soc_dai_ops mtk_dai_etdm_ops = {
-	.startup = mtk_dai_etdm_startup,
-	.shutdown = mtk_dai_etdm_shutdown,
-	.hw_params = mtk_dai_etdm_hw_params,
-	.trigger = mtk_dai_etdm_trigger,
-	.set_sysclk = mtk_dai_etdm_set_sysclk,
-	.set_fmt = mtk_dai_etdm_set_fmt,
-	.set_tdm_slot = mtk_dai_etdm_set_tdm_slot,
-};
-
-static const struct snd_soc_dai_ops mtk_dai_hdmitx_dptx_ops = {
-	.startup	= mtk_dai_hdmitx_dptx_startup,
-	.shutdown	= mtk_dai_hdmitx_dptx_shutdown,
-	.hw_params	= mtk_dai_hdmitx_dptx_hw_params,
-	.trigger	= mtk_dai_hdmitx_dptx_trigger,
-	.set_sysclk	= mtk_dai_hdmitx_dptx_set_sysclk,
-	.set_fmt	= mtk_dai_etdm_set_fmt,
-};
-
 /* dai driver */
 #define MTK_ETDM_RATES (SNDRV_PCM_RATE_8000_384000)
 
@@ -2505,6 +2486,36 @@  static int mtk_dai_etdm_probe(struct snd_soc_dai *dai)
 	return 0;
 }
 
+static const struct snd_soc_dai_ops mtk_dai_hdmitx_dptx_ops = {
+	.startup	= mtk_dai_hdmitx_dptx_startup,
+	.shutdown	= mtk_dai_hdmitx_dptx_shutdown,
+	.hw_params	= mtk_dai_hdmitx_dptx_hw_params,
+	.trigger	= mtk_dai_hdmitx_dptx_trigger,
+	.set_sysclk	= mtk_dai_hdmitx_dptx_set_sysclk,
+	.set_fmt	= mtk_dai_etdm_set_fmt,
+};
+
+static const struct snd_soc_dai_ops mtk_dai_hdmitx_dptx_ops2 = {
+	.probe		= mtk_dai_etdm_probe,
+	.startup	= mtk_dai_hdmitx_dptx_startup,
+	.shutdown	= mtk_dai_hdmitx_dptx_shutdown,
+	.hw_params	= mtk_dai_hdmitx_dptx_hw_params,
+	.trigger	= mtk_dai_hdmitx_dptx_trigger,
+	.set_sysclk	= mtk_dai_hdmitx_dptx_set_sysclk,
+	.set_fmt	= mtk_dai_etdm_set_fmt,
+};
+
+static const struct snd_soc_dai_ops mtk_dai_etdm_ops = {
+	.probe		= mtk_dai_etdm_probe,
+	.startup	= mtk_dai_etdm_startup,
+	.shutdown	= mtk_dai_etdm_shutdown,
+	.hw_params	= mtk_dai_etdm_hw_params,
+	.trigger	= mtk_dai_etdm_trigger,
+	.set_sysclk	= mtk_dai_etdm_set_sysclk,
+	.set_fmt	= mtk_dai_etdm_set_fmt,
+	.set_tdm_slot	= mtk_dai_etdm_set_tdm_slot,
+};
+
 static struct snd_soc_dai_driver mtk_dai_etdm_driver[] = {
 	{
 		.name = "DPTX",
@@ -2529,7 +2540,6 @@  static struct snd_soc_dai_driver mtk_dai_etdm_driver[] = {
 			.formats = MTK_ETDM_FORMATS,
 		},
 		.ops = &mtk_dai_etdm_ops,
-		.probe = mtk_dai_etdm_probe,
 	},
 	{
 		.name = "ETDM2_IN",
@@ -2542,7 +2552,6 @@  static struct snd_soc_dai_driver mtk_dai_etdm_driver[] = {
 			.formats = MTK_ETDM_FORMATS,
 		},
 		.ops = &mtk_dai_etdm_ops,
-		.probe = mtk_dai_etdm_probe,
 	},
 	{
 		.name = "ETDM1_OUT",
@@ -2555,7 +2564,6 @@  static struct snd_soc_dai_driver mtk_dai_etdm_driver[] = {
 			.formats = MTK_ETDM_FORMATS,
 		},
 		.ops = &mtk_dai_etdm_ops,
-		.probe = mtk_dai_etdm_probe,
 	},
 	{
 		.name = "ETDM2_OUT",
@@ -2568,7 +2576,6 @@  static struct snd_soc_dai_driver mtk_dai_etdm_driver[] = {
 			.formats = MTK_ETDM_FORMATS,
 		},
 		.ops = &mtk_dai_etdm_ops,
-		.probe = mtk_dai_etdm_probe,
 	},
 	{
 		.name = "ETDM3_OUT",
@@ -2580,8 +2587,7 @@  static struct snd_soc_dai_driver mtk_dai_etdm_driver[] = {
 			.rates = MTK_ETDM_RATES,
 			.formats = MTK_ETDM_FORMATS,
 		},
-		.ops = &mtk_dai_hdmitx_dptx_ops,
-		.probe = mtk_dai_etdm_probe,
+		.ops = &mtk_dai_hdmitx_dptx_ops2,
 	},
 };