* [v9 1/4] ASoC: dt-bindings: mt8188-mt6359: add es8326 support
2023-12-12 12:30 [v9 0/4] add es8326 dt-bindings, commonize headset codec API, es8326 support and Enable dual amp for rt5682s Rui Zhou
@ 2023-12-12 12:30 ` Rui Zhou
2023-12-12 12:30 ` [v9 2/4] ASoC: mediatek: mt8188-mt6359: commonize headset codec init/exit api Rui Zhou
` (3 subsequent siblings)
4 siblings, 0 replies; 8+ messages in thread
From: Rui Zhou @ 2023-12-12 12:30 UTC (permalink / raw)
To: lgirdwood, broonie, robh+dt, krzysztof.kozlowski+dt, conor+dt,
matthias.bgg, angelogioacchino.delregno, perex, tiwai, trevor.wu,
allen-kh.cheng, kuninori.morimoto.gx
Cc: devicetree, linux-arm-kernel, linux-kernel, linux-mediatek,
Rui Zhou, Conor Dooley
Add compatible string "mediatek,mt8188-es8326" to support new board
with es8326 codec.
Acked-by: Conor Dooley <conor.dooley@microchip.com>
Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
Signed-off-by: Rui Zhou <zhourui@huaqin.corp-partner.google.com>
---
.../devicetree/bindings/sound/mediatek,mt8188-mt6359.yaml | 1 +
1 file changed, 1 insertion(+)
diff --git a/Documentation/devicetree/bindings/sound/mediatek,mt8188-mt6359.yaml b/Documentation/devicetree/bindings/sound/mediatek,mt8188-mt6359.yaml
index 4c8c95057ef7..f94ad0715e32 100644
--- a/Documentation/devicetree/bindings/sound/mediatek,mt8188-mt6359.yaml
+++ b/Documentation/devicetree/bindings/sound/mediatek,mt8188-mt6359.yaml
@@ -15,6 +15,7 @@ allOf:
properties:
compatible:
enum:
+ - mediatek,mt8188-es8326
- mediatek,mt8188-mt6359-evb
- mediatek,mt8188-nau8825
- mediatek,mt8188-rt5682s
--
2.25.1
^ permalink raw reply related [flat|nested] 8+ messages in thread* [v9 2/4] ASoC: mediatek: mt8188-mt6359: commonize headset codec init/exit api
2023-12-12 12:30 [v9 0/4] add es8326 dt-bindings, commonize headset codec API, es8326 support and Enable dual amp for rt5682s Rui Zhou
2023-12-12 12:30 ` [v9 1/4] ASoC: dt-bindings: mt8188-mt6359: add es8326 support Rui Zhou
@ 2023-12-12 12:30 ` Rui Zhou
2023-12-12 12:30 ` [v9 3/4] ASoC: mediatek: mt8188-mt6359: add es8326 support Rui Zhou
` (2 subsequent siblings)
4 siblings, 0 replies; 8+ messages in thread
From: Rui Zhou @ 2023-12-12 12:30 UTC (permalink / raw)
To: lgirdwood, broonie, robh+dt, krzysztof.kozlowski+dt, conor+dt,
matthias.bgg, angelogioacchino.delregno, perex, tiwai, trevor.wu,
allen-kh.cheng, kuninori.morimoto.gx
Cc: devicetree, linux-arm-kernel, linux-kernel, linux-mediatek,
Rui Zhou
Reduce code duplication, unify the headset codec init/exit api.
Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
Signed-off-by: Rui Zhou <zhourui@huaqin.corp-partner.google.com>
---
sound/soc/mediatek/mt8188/mt8188-mt6359.c | 67 ++---------------------
1 file changed, 6 insertions(+), 61 deletions(-)
diff --git a/sound/soc/mediatek/mt8188/mt8188-mt6359.c b/sound/soc/mediatek/mt8188/mt8188-mt6359.c
index 33d477cc2e54..b4606a28794c 100644
--- a/sound/soc/mediatek/mt8188/mt8188-mt6359.c
+++ b/sound/soc/mediatek/mt8188/mt8188-mt6359.c
@@ -726,7 +726,7 @@ static int mt8188_max98390_codec_init(struct snd_soc_pcm_runtime *rtd)
return 0;
}
-static int mt8188_nau8825_codec_init(struct snd_soc_pcm_runtime *rtd)
+static int mt8188_headset_codec_init(struct snd_soc_pcm_runtime *rtd)
{
struct snd_soc_card *card = rtd->card;
struct mtk_soc_card_data *soc_card_data = snd_soc_card_get_drvdata(card);
@@ -775,68 +775,13 @@ static int mt8188_nau8825_codec_init(struct snd_soc_pcm_runtime *rtd)
return 0;
};
-static int mt8188_rt5682s_codec_init(struct snd_soc_pcm_runtime *rtd)
-{
- struct snd_soc_card *card = rtd->card;
- struct mtk_soc_card_data *soc_card_data = snd_soc_card_get_drvdata(card);
- struct mt8188_mt6359_priv *priv = soc_card_data->mach_priv;
- struct snd_soc_component *component = snd_soc_rtd_to_codec(rtd, 0)->component;
- struct snd_soc_jack *jack = &priv->headset_jack;
- int ret;
-
- ret = snd_soc_dapm_new_controls(&card->dapm, mt8188_nau8825_widgets,
- ARRAY_SIZE(mt8188_nau8825_widgets));
- if (ret) {
- dev_err(rtd->dev, "unable to add rt5682s card widget, ret %d\n", ret);
- return ret;
- }
-
- ret = snd_soc_add_card_controls(card, mt8188_nau8825_controls,
- ARRAY_SIZE(mt8188_nau8825_controls));
- if (ret) {
- dev_err(rtd->dev, "unable to add rt5682s card controls, ret %d\n", ret);
- return ret;
- }
-
- ret = snd_soc_card_jack_new_pins(rtd->card, "Headset Jack",
- SND_JACK_HEADSET | SND_JACK_BTN_0 |
- SND_JACK_BTN_1 | SND_JACK_BTN_2 |
- SND_JACK_BTN_3,
- jack,
- nau8825_jack_pins,
- ARRAY_SIZE(nau8825_jack_pins));
- if (ret) {
- dev_err(rtd->dev, "Headset Jack creation failed: %d\n", ret);
- return ret;
- }
-
- snd_jack_set_key(jack->jack, SND_JACK_BTN_0, KEY_PLAYPAUSE);
- snd_jack_set_key(jack->jack, SND_JACK_BTN_1, KEY_VOICECOMMAND);
- snd_jack_set_key(jack->jack, SND_JACK_BTN_2, KEY_VOLUMEUP);
- snd_jack_set_key(jack->jack, SND_JACK_BTN_3, KEY_VOLUMEDOWN);
- ret = snd_soc_component_set_jack(component, jack, NULL);
-
- if (ret) {
- dev_err(rtd->dev, "Headset Jack call-back failed: %d\n", ret);
- return ret;
- }
-
- return 0;
-};
-
-static void mt8188_nau8825_codec_exit(struct snd_soc_pcm_runtime *rtd)
+static void mt8188_headset_codec_exit(struct snd_soc_pcm_runtime *rtd)
{
struct snd_soc_component *component = snd_soc_rtd_to_codec(rtd, 0)->component;
snd_soc_component_set_jack(component, NULL, NULL);
}
-static void mt8188_rt5682s_codec_exit(struct snd_soc_pcm_runtime *rtd)
-{
- struct snd_soc_component *component = snd_soc_rtd_to_codec(rtd, 0)->component;
-
- snd_soc_component_set_jack(component, NULL, NULL);
-}
static int mt8188_nau8825_hw_params(struct snd_pcm_substream *substream,
struct snd_pcm_hw_params *params)
@@ -1407,15 +1352,15 @@ static int mt8188_mt6359_dev_probe(struct platform_device *pdev)
} else if (!strcmp(dai_link->codecs->dai_name, NAU8825_CODEC_DAI)) {
dai_link->ops = &mt8188_nau8825_ops;
if (!init_nau8825) {
- dai_link->init = mt8188_nau8825_codec_init;
- dai_link->exit = mt8188_nau8825_codec_exit;
+ dai_link->init = mt8188_headset_codec_init;
+ dai_link->exit = mt8188_headset_codec_exit;
init_nau8825 = true;
}
} else if (!strcmp(dai_link->codecs->dai_name, RT5682S_CODEC_DAI)) {
dai_link->ops = &mt8188_rt5682s_i2s_ops;
if (!init_rt5682s) {
- dai_link->init = mt8188_rt5682s_codec_init;
- dai_link->exit = mt8188_rt5682s_codec_exit;
+ dai_link->init = mt8188_headset_codec_init;
+ dai_link->exit = mt8188_headset_codec_exit;
init_rt5682s = true;
}
} else {
--
2.25.1
^ permalink raw reply related [flat|nested] 8+ messages in thread* [v9 3/4] ASoC: mediatek: mt8188-mt6359: add es8326 support
2023-12-12 12:30 [v9 0/4] add es8326 dt-bindings, commonize headset codec API, es8326 support and Enable dual amp for rt5682s Rui Zhou
2023-12-12 12:30 ` [v9 1/4] ASoC: dt-bindings: mt8188-mt6359: add es8326 support Rui Zhou
2023-12-12 12:30 ` [v9 2/4] ASoC: mediatek: mt8188-mt6359: commonize headset codec init/exit api Rui Zhou
@ 2023-12-12 12:30 ` Rui Zhou
2023-12-12 12:44 ` AngeloGioacchino Del Regno
2023-12-12 12:30 ` [v9 4/4] ASoC: mediatek: mt8188-mt6359: Enable dual amp for mt8188-rt5682s Rui Zhou
2023-12-19 18:06 ` [v9 0/4] add es8326 dt-bindings, commonize headset codec API, es8326 support and Enable dual amp for rt5682s Mark Brown
4 siblings, 1 reply; 8+ messages in thread
From: Rui Zhou @ 2023-12-12 12:30 UTC (permalink / raw)
To: lgirdwood, broonie, robh+dt, krzysztof.kozlowski+dt, conor+dt,
matthias.bgg, angelogioacchino.delregno, perex, tiwai, trevor.wu,
allen-kh.cheng, kuninori.morimoto.gx
Cc: devicetree, linux-arm-kernel, linux-kernel, linux-mediatek,
Rui Zhou
To use ES8326 as the codec, add a new sound card
named mt8186_es8326.
Reviewed-by: Trevor Wu <trevor.wu@mediatek.com>
Signed-off-by: Rui Zhou <zhourui@huaqin.corp-partner.google.com>
---
sound/soc/mediatek/Kconfig | 1 +
sound/soc/mediatek/mt8188/mt8188-mt6359.c | 56 ++++++++++++++++++++++-
2 files changed, 55 insertions(+), 2 deletions(-)
diff --git a/sound/soc/mediatek/Kconfig b/sound/soc/mediatek/Kconfig
index b93d455744ab..296b434caf81 100644
--- a/sound/soc/mediatek/Kconfig
+++ b/sound/soc/mediatek/Kconfig
@@ -252,6 +252,7 @@ config SND_SOC_MT8188_MT6359
select SND_SOC_NAU8315
select SND_SOC_NAU8825
select SND_SOC_RT5682S
+ select SND_SOC_ES8326
help
This adds support for ASoC machine driver for MediaTek MT8188
boards with the MT6359 and other I2S audio codecs.
diff --git a/sound/soc/mediatek/mt8188/mt8188-mt6359.c b/sound/soc/mediatek/mt8188/mt8188-mt6359.c
index b4606a28794c..d1884f23a1a7 100644
--- a/sound/soc/mediatek/mt8188/mt8188-mt6359.c
+++ b/sound/soc/mediatek/mt8188/mt8188-mt6359.c
@@ -34,6 +34,8 @@
#define NAU8825_HS_PRESENT BIT(0)
#define RT5682S_HS_PRESENT BIT(1)
+#define ES8326_HS_PRESENT BIT(2)
+#define MAX98390_TWO_AMP BIT(3)
/*
* Maxim MAX98390
*/
@@ -48,6 +50,11 @@
*/
#define NAU8825_CODEC_DAI "nau8825-hifi"
+/*
+ * ES8326
+ */
+#define ES8326_CODEC_DAI "ES8326 HiFi"
+
#define SOF_DMA_DL2 "SOF_DMA_DL2"
#define SOF_DMA_DL3 "SOF_DMA_DL3"
#define SOF_DMA_UL4 "SOF_DMA_UL4"
@@ -888,6 +895,30 @@ static const struct snd_soc_ops mt8188_sof_be_ops = {
.hw_params = mt8188_sof_be_hw_params,
};
+static int mt8188_es8326_hw_params(struct snd_pcm_substream *substream,
+ struct snd_pcm_hw_params *params)
+{
+ struct snd_soc_pcm_runtime *rtd = snd_soc_substream_to_rtd(substream);
+ struct snd_soc_dai *cpu_dai = snd_soc_rtd_to_cpu(rtd, 0);
+ struct snd_soc_dai *codec_dai = snd_soc_rtd_to_codec(rtd, 0);
+ unsigned int rate = params_rate(params);
+ int ret;
+
+ /* Configure MCLK for codec */
+ ret = snd_soc_dai_set_sysclk(codec_dai, 0, rate * 256, SND_SOC_CLOCK_IN);
+ if (ret < 0) {
+ dev_err(codec_dai->dev, "can't set MCLK %d\n", ret);
+ return ret;
+ }
+
+ /* Configure MCLK for cpu */
+ return snd_soc_dai_set_sysclk(cpu_dai, 0, rate * 256, SND_SOC_CLOCK_OUT);
+}
+
+static const struct snd_soc_ops mt8188_es8326_ops = {
+ .hw_params = mt8188_es8326_hw_params,
+};
+
static struct snd_soc_dai_link mt8188_mt6359_dai_links[] = {
/* FE */
[DAI_LINK_DL2_FE] = {
@@ -1197,7 +1228,7 @@ static void mt8188_fixup_controls(struct snd_soc_card *card)
struct mt8188_card_data *card_data = (struct mt8188_card_data *)priv->private_data;
struct snd_kcontrol *kctl;
- if (card_data->quirk & (NAU8825_HS_PRESENT | RT5682S_HS_PRESENT)) {
+ if (card_data->quirk & (NAU8825_HS_PRESENT | RT5682S_HS_PRESENT | ES8326_HS_PRESENT)) {
struct snd_soc_dapm_widget *w, *next_w;
for_each_card_widgets_safe(card, w, next_w) {
@@ -1238,6 +1269,7 @@ static int mt8188_mt6359_dev_probe(struct platform_device *pdev)
struct mt8188_card_data *card_data;
struct snd_soc_dai_link *dai_link;
bool init_mt6359 = false;
+ bool init_es8326 = false;
bool init_nau8825 = false;
bool init_rt5682s = false;
bool init_max98390 = false;
@@ -1344,7 +1376,14 @@ static int mt8188_mt6359_dev_probe(struct platform_device *pdev)
strcmp(dai_link->name, "ETDM1_IN_BE") == 0 ||
strcmp(dai_link->name, "ETDM2_IN_BE") == 0) {
if (!strcmp(dai_link->codecs->dai_name, MAX98390_CODEC_DAI)) {
- dai_link->ops = &mt8188_max98390_ops;
+ /*
+ * The TDM protocol settings with fixed 4 slots are defined in
+ * mt8188_max98390_ops. Two amps is I2S mode,
+ * SOC and codec don't require TDM settings.
+ */
+ if (!(card_data->quirk & MAX98390_TWO_AMP)) {
+ dai_link->ops = &mt8188_max98390_ops;
+ }
if (!init_max98390) {
dai_link->init = mt8188_max98390_codec_init;
init_max98390 = true;
@@ -1363,6 +1402,13 @@ static int mt8188_mt6359_dev_probe(struct platform_device *pdev)
dai_link->exit = mt8188_headset_codec_exit;
init_rt5682s = true;
}
+ } else if (!strcmp(dai_link->codecs->dai_name, ES8326_CODEC_DAI)) {
+ dai_link->ops = &mt8188_es8326_ops;
+ if (!init_es8326) {
+ dai_link->init = mt8188_headset_codec_init;
+ dai_link->exit = mt8188_headset_codec_exit;
+ init_es8326 = true;
+ }
} else {
if (strcmp(dai_link->codecs->dai_name, "snd-soc-dummy-dai")) {
if (!init_dumb) {
@@ -1405,10 +1451,16 @@ static struct mt8188_card_data mt8188_rt5682s_card = {
.quirk = RT5682S_HS_PRESENT,
};
+static struct mt8188_card_data mt8188_es8326_card = {
+ .name = "mt8188_es8326",
+ .quirk = ES8326_HS_PRESENT | MAX98390_TWO_AMP,
+};
+
static const struct of_device_id mt8188_mt6359_dt_match[] = {
{ .compatible = "mediatek,mt8188-mt6359-evb", .data = &mt8188_evb_card, },
{ .compatible = "mediatek,mt8188-nau8825", .data = &mt8188_nau8825_card, },
{ .compatible = "mediatek,mt8188-rt5682s", .data = &mt8188_rt5682s_card, },
+ { .compatible = "mediatek,mt8188-es8326", .data = &mt8188_es8326_card, },
{ /* sentinel */ },
};
MODULE_DEVICE_TABLE(of, mt8188_mt6359_dt_match);
--
2.25.1
^ permalink raw reply related [flat|nested] 8+ messages in thread* Re: [v9 3/4] ASoC: mediatek: mt8188-mt6359: add es8326 support
2023-12-12 12:30 ` [v9 3/4] ASoC: mediatek: mt8188-mt6359: add es8326 support Rui Zhou
@ 2023-12-12 12:44 ` AngeloGioacchino Del Regno
[not found] ` <CABRjgztKkpE8KOBfj47Bdt_EXFiXA8+6eh6+=WMyPHW2UOF-oA@mail.gmail.com>
0 siblings, 1 reply; 8+ messages in thread
From: AngeloGioacchino Del Regno @ 2023-12-12 12:44 UTC (permalink / raw)
To: Rui Zhou, lgirdwood, broonie, robh+dt, krzysztof.kozlowski+dt,
conor+dt, matthias.bgg, perex, tiwai, trevor.wu, allen-kh.cheng,
kuninori.morimoto.gx
Cc: devicetree, linux-arm-kernel, linux-kernel, linux-mediatek
Il 12/12/23 13:30, Rui Zhou ha scritto:
> To use ES8326 as the codec, add a new sound card
> named mt8186_es8326.
>
> Reviewed-by: Trevor Wu <trevor.wu@mediatek.com>
> Signed-off-by: Rui Zhou <zhourui@huaqin.corp-partner.google.com>
Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
....but this series is going to be ignored like that, because you didn't add the
right mailing lists to the To/Cc.
Please use scripts/get_maintainer.pl
Thanks,
Angelo
^ permalink raw reply [flat|nested] 8+ messages in thread
* [v9 4/4] ASoC: mediatek: mt8188-mt6359: Enable dual amp for mt8188-rt5682s
2023-12-12 12:30 [v9 0/4] add es8326 dt-bindings, commonize headset codec API, es8326 support and Enable dual amp for rt5682s Rui Zhou
` (2 preceding siblings ...)
2023-12-12 12:30 ` [v9 3/4] ASoC: mediatek: mt8188-mt6359: add es8326 support Rui Zhou
@ 2023-12-12 12:30 ` Rui Zhou
2023-12-19 18:06 ` [v9 0/4] add es8326 dt-bindings, commonize headset codec API, es8326 support and Enable dual amp for rt5682s Mark Brown
4 siblings, 0 replies; 8+ messages in thread
From: Rui Zhou @ 2023-12-12 12:30 UTC (permalink / raw)
To: lgirdwood, broonie, robh+dt, krzysztof.kozlowski+dt, conor+dt,
matthias.bgg, angelogioacchino.delregno, perex, tiwai, trevor.wu,
allen-kh.cheng, kuninori.morimoto.gx
Cc: devicetree, linux-arm-kernel, linux-kernel, linux-mediatek,
Rui Zhou
Enable support for dual MAX98390 amplifiers on the mt8188-rt5682s board.
Reviewed-by: Trevor Wu <trevor.wu@mediatek.com>
Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
Signed-off-by: Rui Zhou <zhourui@huaqin.corp-partner.google.com>
---
sound/soc/mediatek/mt8188/mt8188-mt6359.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/sound/soc/mediatek/mt8188/mt8188-mt6359.c b/sound/soc/mediatek/mt8188/mt8188-mt6359.c
index d1884f23a1a7..a391066ab204 100644
--- a/sound/soc/mediatek/mt8188/mt8188-mt6359.c
+++ b/sound/soc/mediatek/mt8188/mt8188-mt6359.c
@@ -1448,7 +1448,7 @@ static struct mt8188_card_data mt8188_nau8825_card = {
static struct mt8188_card_data mt8188_rt5682s_card = {
.name = "mt8188_rt5682s",
- .quirk = RT5682S_HS_PRESENT,
+ .quirk = RT5682S_HS_PRESENT | MAX98390_TWO_AMP,
};
static struct mt8188_card_data mt8188_es8326_card = {
--
2.25.1
^ permalink raw reply related [flat|nested] 8+ messages in thread* Re: [v9 0/4] add es8326 dt-bindings, commonize headset codec API, es8326 support and Enable dual amp for rt5682s
2023-12-12 12:30 [v9 0/4] add es8326 dt-bindings, commonize headset codec API, es8326 support and Enable dual amp for rt5682s Rui Zhou
` (3 preceding siblings ...)
2023-12-12 12:30 ` [v9 4/4] ASoC: mediatek: mt8188-mt6359: Enable dual amp for mt8188-rt5682s Rui Zhou
@ 2023-12-19 18:06 ` Mark Brown
4 siblings, 0 replies; 8+ messages in thread
From: Mark Brown @ 2023-12-19 18:06 UTC (permalink / raw)
To: lgirdwood, robh+dt, krzysztof.kozlowski+dt, conor+dt,
matthias.bgg, angelogioacchino.delregno, perex, tiwai, trevor.wu,
allen-kh.cheng, kuninori.morimoto.gx, Rui Zhou
Cc: devicetree, linux-arm-kernel, linux-kernel, linux-mediatek
On Tue, 12 Dec 2023 20:30:46 +0800, Rui Zhou wrote:
> Add dt-bindings for es8326 and codec es8326 support.
> Remove duplicate code, commonize headset codec init/exit API.
> At the same time, Enable dual amp max98390 for rt5682s.
>
> Changes in v9:
> - PATCH 3/4: Add comment for MAX98390_TWO_AMP.
> - Link to v8: https://lore.kernel.org/all/20231208070933.720324-1-zhourui@huaqin.corp-partner.google.com/
>
> [...]
Applied to
https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git for-next
Thanks!
[1/4] ASoC: dt-bindings: mt8188-mt6359: add es8326 support
commit: ea244b35a4da60a92d0e3be528f82ebcbcf10753
[2/4] ASoC: mediatek: mt8188-mt6359: commonize headset codec init/exit api
commit: 1a268000b03a162bd5feb7fce1c130f1b31602b5
[3/4] ASoC: mediatek: mt8188-mt6359: add es8326 support
commit: e794a894427b1d64f2ebff24f003c60373d68c2c
[4/4] ASoC: mediatek: mt8188-mt6359: Enable dual amp for mt8188-rt5682s
commit: 3423c3db22e9213acd279ff3800bb1e91aa2ac89
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
^ permalink raw reply [flat|nested] 8+ messages in thread