2023-10-24 03:51:34

by Maso Huang (黃加竹)

[permalink] [raw]
Subject: [PATCH v2 0/3] ASoC: mediatek: Remove redundant code and add sample rate checker of MT7986 SoC

Changes in v2:
- devide v1 patch [1/2] into v2 [1/3] [2/3] with appropriate title and description
- refine error log based on reviewer's suggestions [3/3]

1. Drop the remove callback of mt7986_wm8960.
2. Remove the mt7986_wm8960_priv structure
3. Add sample rate checker.
Patches are based on broonie tree "for-next" branch.

Maso Huang (3):
ASoC: mediatek: mt7986: drop the remove callback of mt7986_wm8960
ASoC: mediatek: mt7986: remove the mt7986_wm8960_priv structure
ASoC: mediatek: mt7986: add sample rate checker

sound/soc/mediatek/mt7986/mt7986-dai-etdm.c | 23 +++++++++--
sound/soc/mediatek/mt7986/mt7986-wm8960.c | 43 ++++++---------------
2 files changed, 31 insertions(+), 35 deletions(-)

--
2.18.0


2023-10-24 03:51:36

by Maso Huang (黃加竹)

[permalink] [raw]
Subject: [PATCH v2 3/3] ASoC: mediatek: mt7986: add sample rate checker

mt7986 only supports 8/12/16/24/32/48/96/192 kHz

Signed-off-by: Maso Huang <[email protected]>
Reviewed-by: AngeloGioacchino Del Regno <[email protected]>
---
sound/soc/mediatek/mt7986/mt7986-dai-etdm.c | 23 +++++++++++++++++----
1 file changed, 19 insertions(+), 4 deletions(-)

diff --git a/sound/soc/mediatek/mt7986/mt7986-dai-etdm.c b/sound/soc/mediatek/mt7986/mt7986-dai-etdm.c
index e523d33846fe..d57971413a04 100644
--- a/sound/soc/mediatek/mt7986/mt7986-dai-etdm.c
+++ b/sound/soc/mediatek/mt7986/mt7986-dai-etdm.c
@@ -237,12 +237,27 @@ static int mtk_dai_etdm_hw_params(struct snd_pcm_substream *substream,
struct snd_pcm_hw_params *params,
struct snd_soc_dai *dai)
{
+ unsigned int rate = params_rate(params);
struct mtk_base_afe *afe = snd_soc_dai_get_drvdata(dai);

- mtk_dai_etdm_config(afe, params, dai, SNDRV_PCM_STREAM_PLAYBACK);
- mtk_dai_etdm_config(afe, params, dai, SNDRV_PCM_STREAM_CAPTURE);
-
- return 0;
+ switch (rate) {
+ case 8000:
+ case 12000:
+ case 16000:
+ case 24000:
+ case 32000:
+ case 48000:
+ case 96000:
+ case 192000:
+ mtk_dai_etdm_config(afe, params, dai, SNDRV_PCM_STREAM_PLAYBACK);
+ mtk_dai_etdm_config(afe, params, dai, SNDRV_PCM_STREAM_CAPTURE);
+ return 0;
+ default:
+ dev_err(afe->dev,
+ "Sample rate %d invalid. Supported rates: 8/12/16/24/32/48/96/192 kHz\n",
+ rate);
+ return -EINVAL;
+ }
}

static int mtk_dai_etdm_trigger(struct snd_pcm_substream *substream, int cmd,
--
2.18.0

2023-10-24 18:53:49

by Mark Brown

[permalink] [raw]
Subject: Re: [PATCH v2 0/3] ASoC: mediatek: Remove redundant code and add sample rate checker of MT7986 SoC

On Tue, 24 Oct 2023 11:50:16 +0800, Maso Huang wrote:
> Changes in v2:
> - devide v1 patch [1/2] into v2 [1/3] [2/3] with appropriate title and description
> - refine error log based on reviewer's suggestions [3/3]
>
> 1. Drop the remove callback of mt7986_wm8960.
> 2. Remove the mt7986_wm8960_priv structure
> 3. Add sample rate checker.
> Patches are based on broonie tree "for-next" branch.
>
> [...]

Applied to

https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git for-next

Thanks!

[1/3] ASoC: mediatek: mt7986: drop the remove callback of mt7986_wm8960
commit: 3e92ea2a460bc410789b24f328de9985ddc3eea6
[2/3] ASoC: mediatek: mt7986: remove the mt7986_wm8960_priv structure
commit: 0f10adb0ed0c0d74f8bc5facf2c70bc515210295
[3/3] ASoC: mediatek: mt7986: add sample rate checker
commit: 0e20929434080aa87614fa0135c97bb9337ece27

All being well this means that it will be integrated into the linux-next
tree (usually sometime in the next 24 hours) and sent to Linus during
the next merge window (or sooner if it is a bug fix), however if
problems are discovered then the patch may be dropped or reverted.

You may get further e-mails resulting from automated or manual testing
and review of the tree, please engage with people reporting problems and
send followup patches addressing any issues that are reported if needed.

If any updates are required or you are submitting further changes they
should be sent as incremental updates against current git, existing
patches will not be replaced.

Please add any relevant lists and maintainers to the CCs when replying
to this mail.

Thanks,
Mark