Re: [PATCH 4/5] ASoC: mediatek: mt8188-mt6359: support new board with nau88255

From: AngeloGioacchino Del Regno
Date: Wed May 17 2023 - 07:54:33 EST


Il 17/05/23 13:15, Trevor Wu ha scritto:
This patch adds multiple i2s codecs support including NAU88L25,
MAX98390, and the dumb amp like NAU8318 usage. In addition, dmic-codec
is also added to skip the beginning pop noise.

Signed-off-by: Trevor Wu <trevor.wu@xxxxxxxxxxxx>
---
sound/soc/mediatek/Kconfig | 4 +
sound/soc/mediatek/mt8188/mt8188-mt6359.c | 267 +++++++++++++++++++++-
2 files changed, 270 insertions(+), 1 deletion(-)

diff --git a/sound/soc/mediatek/Kconfig b/sound/soc/mediatek/Kconfig
index 4baac72677d9..4ea012342b52 100644
--- a/sound/soc/mediatek/Kconfig
+++ b/sound/soc/mediatek/Kconfig
@@ -225,6 +225,10 @@ config SND_SOC_MT8188_MT6359
depends on SND_SOC_MT8188 && MTK_PMIC_WRAP
select SND_SOC_MT6359
select SND_SOC_HDMI_CODEC
+ select SND_SOC_DMIC
+ select SND_SOC_MAX98390
+ select SND_SOC_NAU8315
+ select SND_SOC_NAU8825
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 6c3f36e2fffd..15fce2741f01 100644
--- a/sound/soc/mediatek/mt8188/mt8188-mt6359.c
+++ b/sound/soc/mediatek/mt8188/mt8188-mt6359.c
@@ -6,6 +6,7 @@
* Author: Trevor Wu <trevor.wu@xxxxxxxxxxxx>
*/
+#include <linux/input.h>
#include <linux/module.h>
#include <linux/of_device.h>
#include <linux/pm_runtime.h>
@@ -13,10 +14,25 @@
#include <sound/pcm_params.h>
#include <sound/soc.h>
#include "mt8188-afe-common.h"
+#include "../../codecs/nau8825.h"
#include "../../codecs/mt6359.h"
#include "../common/mtk-afe-platform-driver.h"
#include "../common/mtk-soundcard-driver.h"
+/*
+ * Maxim MAX98390
+ */
+#define MAX98390_CODEC_DAI "max98390-aif1"
+#define MAX98390_DEV0_NAME "max98390.0-0038" /* rear right */
+#define MAX98390_DEV1_NAME "max98390.0-0039" /* rear left */
+#define MAX98390_DEV2_NAME "max98390.0-003a" /* front right */
+#define MAX98390_DEV3_NAME "max98390.0-003b" /* front left */
+
+/*
+ * Nau88l25
+ */
+#define NAU8825_CODEC_DAI "nau8825-hifi"
+
/* FE */
SND_SOC_DAILINK_DEFS(playback2,
DAILINK_COMP_ARRAY(COMP_CPU("DL2")),
@@ -143,12 +159,15 @@ SND_SOC_DAILINK_DEFS(pcm1,
SND_SOC_DAILINK_DEFS(ul_src,
DAILINK_COMP_ARRAY(COMP_CPU("UL_SRC")),
DAILINK_COMP_ARRAY(COMP_CODEC("mt6359-sound",
- "mt6359-snd-codec-aif1")),
+ "mt6359-snd-codec-aif1"),
+ COMP_CODEC("dmic-codec",
+ "dmic-hifi")),
DAILINK_COMP_ARRAY(COMP_EMPTY()));
struct mt8188_mt6359_priv {
struct snd_soc_jack dp_jack;
struct snd_soc_jack hdmi_jack;
+ struct snd_soc_jack headset_jack;
};
static struct snd_soc_jack_pin mt8188_hdmi_jack_pins[] = {
@@ -165,11 +184,50 @@ static struct snd_soc_jack_pin mt8188_dp_jack_pins[] = {
},
};
+static struct snd_soc_jack_pin nau8825_jack_pins[] = {
+ {
+ .pin = "Headphone",

One Intel driver using NAU8825 declares this as

.pin = "Headphone Jack",

can we please use the same name, so that we're able to eventually share the
same configuration in the userspace?

For reference, please check intel/avs/boards/nau8825.c

Thanks,
Angelo