* Re: [PATCH v5 2/3] ASoC: mediatek: mt8188-mt6359: add es8326 support
[not found] ` <20231115090903.578438-3-zhourui@huaqin.corp-partner.google.com>
@ 2023-11-15 9:15 ` AngeloGioacchino Del Regno
0 siblings, 0 replies; 2+ messages in thread
From: AngeloGioacchino Del Regno @ 2023-11-15 9:15 UTC (permalink / raw)
To: Rui Zhou, lgirdwood, broonie, robh+dt, krzysztof.kozlowski+dt,
conor+dt, perex, allen-kh.cheng, kuninori.morimoto.gx
Cc: linux-sound, devicetree, linux-mediatek
Il 15/11/23 10:09, Rui Zhou ha scritto:
> To use ES8326 as the codec, add a new sound card
> named mt8186_es8326.
>
> Signed-off-by: Rui Zhou <zhourui@huaqin.corp-partner.google.com>
> ---
> sound/soc/mediatek/Kconfig | 1 +
> sound/soc/mediatek/mt8188/mt8188-mt6359.c | 100 +++++++++++++++++++++-
> 2 files changed, 100 insertions(+), 1 deletion(-)
>
> 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 33d477cc2e54..0421debe3ce4 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"
> @@ -261,6 +268,17 @@ static struct snd_soc_jack_pin nau8825_jack_pins[] = {
> },
> };
>
> +static struct snd_soc_jack_pin es8326_jack_pins[] = {
This is practically the same as nau8825_jack_pins, can we please avoid duplication?
> + {
> + .pin = "Headphone",
> + .mask = SND_JACK_HEADPHONE,
> + },
> + {
> + .pin = "Headset Mic",
> + .mask = SND_JACK_MICROPHONE,
> + },
> +};
> +
> struct mt8188_card_data {
> const char *name;
> unsigned long quirk;
> @@ -943,6 +961,71 @@ static const struct snd_soc_ops mt8188_sof_be_ops = {
> .hw_params = mt8188_sof_be_hw_params,
> };
>
> +static int mt8188_es8326_codec_init(struct snd_soc_pcm_runtime *rtd)
> +{
> + struct mtk_soc_card_data *soc_card_data = snd_soc_card_get_drvdata(rtd->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_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,
> + es8326_jack_pins,
> + ARRAY_SIZE(es8326_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;
> + }
> +
This exact code pattern is repeated already twice: once for RT5682s and once for
NAU8825. Can we please commonize it?
> + return ret;
> +};
> +
> +static void mt8188_es8326_codec_exit(struct snd_soc_pcm_runtime *rtd)
> +{
Same for this one.
> + struct snd_soc_component *component = snd_soc_rtd_to_codec(rtd, 0)->component;
> +
> + snd_soc_component_set_jack(component, NULL, NULL);
> +}
> +
Regards,
Angelo
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH v5 1/3] ASoC: dt-bindings: mt8188-mt6359: add es8326 support
[not found] ` <20231115090903.578438-2-zhourui@huaqin.corp-partner.google.com>
@ 2023-11-15 14:42 ` Conor Dooley
0 siblings, 0 replies; 2+ messages in thread
From: Conor Dooley @ 2023-11-15 14:42 UTC (permalink / raw)
To: Rui Zhou
Cc: lgirdwood, broonie, robh+dt, krzysztof.kozlowski+dt, conor+dt,
angelogioacchino.delregno, perex, allen-kh.cheng,
kuninori.morimoto.gx, linux-sound, devicetree, linux-mediatek
[-- Attachment #1: Type: text/plain, Size: 1224 bytes --]
On Wed, Nov 15, 2023 at 05:09:01PM +0800, Rui Zhou wrote:
> Add compatible string "mediatek,mt8188-es8326" to support new board
> with es8326 codec.
>
> Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
> Signed-off-by: Rui Zhou <zhourui@huaqin.corp-partner.google.com>
Acked-by: Conor Dooley <conor.dooley@microchip.com>
Please pick up ぱcks from previous submissions:
https://lore.kernel.org/all/20231108-handmade-cadmium-97ff07964b02@spud/
Cheers,
Conor.
> ---
> .../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
>
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 228 bytes --]
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2023-11-15 14:42 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <20231115090903.578438-1-zhourui@huaqin.corp-partner.google.com>
[not found] ` <20231115090903.578438-3-zhourui@huaqin.corp-partner.google.com>
2023-11-15 9:15 ` [PATCH v5 2/3] ASoC: mediatek: mt8188-mt6359: add es8326 support AngeloGioacchino Del Regno
[not found] ` <20231115090903.578438-2-zhourui@huaqin.corp-partner.google.com>
2023-11-15 14:42 ` [PATCH v5 1/3] ASoC: dt-bindings: " Conor Dooley
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).