Message ID | 20240226-audio-i350-v5-0-54827318b453@baylibre.com |
---|---|
Headers | show |
Series | Add audio support for the MediaTek Genio 350-evk board | expand |
On Fri, Jun 14, 2024 at 09:27:43AM +0200, Alexandre Mergnat wrote: > This serie aim to add the following audio support for the Genio 350-evk: > - Playback > - 2ch Headset Jack (Earphone) > - 1ch Line-out Jack (Speaker) > - 8ch HDMI Tx I seem to remember you had review comments that needed addressing from AngeloGioacchino, why resend without addressing those?
On 14/06/2024 11:31, Mark Brown wrote: > On Fri, Jun 14, 2024 at 09:27:43AM +0200, Alexandre Mergnat wrote: >> This serie aim to add the following audio support for the Genio 350-evk: >> - Playback >> - 2ch Headset Jack (Earphone) >> - 1ch Line-out Jack (Speaker) >> - 8ch HDMI Tx > > I seem to remember you had review comments that needed addressing from > AngeloGioacchino, why resend without addressing those? I don't see any comment: https://lore.kernel.org/lkml/20240226-audio-i350-v5-0-e7e2569df481@baylibre.com/
On Mon, Jun 17, 2024 at 10:05:37AM +0200, Alexandre Mergnat wrote: > On 14/06/2024 11:31, Mark Brown wrote: > > I seem to remember you had review comments that needed addressing from > > AngeloGioacchino, why resend without addressing those? > I don't see any comment: > https://lore.kernel.org/lkml/20240226-audio-i350-v5-0-e7e2569df481@baylibre.com/ Possibly it was racing with comments on the previous version? In any case I see it's still waiting for some review from AngeloGioacchino.
Il 17/06/24 10:05, Alexandre Mergnat ha scritto: > > > On 14/06/2024 11:31, Mark Brown wrote: >> On Fri, Jun 14, 2024 at 09:27:43AM +0200, Alexandre Mergnat wrote: >>> This serie aim to add the following audio support for the Genio 350-evk: >>> - Playback >>> - 2ch Headset Jack (Earphone) >>> - 1ch Line-out Jack (Speaker) >>> - 8ch HDMI Tx >> >> I seem to remember you had review comments that needed addressing from >> AngeloGioacchino, why resend without addressing those? > > I don't see any comment: > https://lore.kernel.org/lkml/20240226-audio-i350-v5-0-e7e2569df481@baylibre.com/ > Mark, the review comments were on the v4 of this series :-) I'll review this version probably tomorrow, or anyway this week. Cheers, Angelo
Il 14/06/24 09:27, Alexandre Mergnat ha scritto: > Add Digital Micro Device Audio Interface support for MT8365 SoC. > > Signed-off-by: Alexandre Mergnat <amergnat@baylibre.com> Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
Il 14/06/24 09:27, Alexandre Mergnat ha scritto: > Add ADDA Device Audio Interface support for MT8365 SoC. > > Signed-off-by: Alexandre Mergnat <amergnat@baylibre.com> Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
Il 14/06/24 09:27, Alexandre Mergnat ha scritto: > Add I2S Device Audio Interface support for MT8365 SoC. > > Signed-off-by: Alexandre Mergnat <amergnat@baylibre.com> Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
Il 14/06/24 09:27, Alexandre Mergnat ha scritto: > Add audio clock wrapper and audio tuner control. > > Signed-off-by: Alexandre Mergnat <amergnat@baylibre.com> Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
Il 14/06/24 09:27, Alexandre Mergnat ha scritto: > - Add specific config to enable: > - MT8365 sound support > - MT6357 audio codec support > - Add the mt8365 directory and all drivers under it. > > Signed-off-by: Alexandre Mergnat <amergnat@baylibre.com> > --- > sound/soc/mediatek/Kconfig | 20 ++++++++++++++++++++ > sound/soc/mediatek/Makefile | 1 + > sound/soc/mediatek/mt8365/Makefile | 15 +++++++++++++++ > 3 files changed, 36 insertions(+) > > diff --git a/sound/soc/mediatek/Kconfig b/sound/soc/mediatek/Kconfig > index 5a8476e1ecca..c1c86ecc0601 100644 > --- a/sound/soc/mediatek/Kconfig > +++ b/sound/soc/mediatek/Kconfig > @@ -298,3 +298,23 @@ config SND_SOC_MT8195_MT6359 > boards with the MT6359 and other I2S audio codecs. > Select Y if you have such device. > If unsure select "N". > + > +config SND_SOC_MT8365 > + tristate "ASoC support for Mediatek MT8365 chip" > + depends on ARCH_MEDIATEK > + select SND_SOC_MEDIATEK > + help > + This adds ASoC platform driver support for Mediatek MT8365 chip > + that can be used with other codecs. > + Select Y if you have such device. > + If unsure select "N". > + > +config SND_SOC_MT8365_MT6357 > + tristate "ASoC Audio driver for MT8365 with MT6357 codec" > + depends on SND_SOC_MT8365 && MTK_PMIC_WRAP > + select SND_SOC_MT6357 > + help > + This adds support for ASoC machine driver for Mediatek MT8365 s/Mediatek/MediaTek/g (here and everywhere else in other commits as well) > + boards with the MT6357 codec. MT6357 PMIC codec after which Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
Il 14/06/24 09:27, Alexandre Mergnat ha scritto: > Add header files for register definition and structure. > > Signed-off-by: Alexandre Mergnat <amergnat@baylibre.com> > --- > sound/soc/mediatek/mt8365/mt8365-afe-common.h | 491 +++++++++++++ > sound/soc/mediatek/mt8365/mt8365-reg.h | 991 ++++++++++++++++++++++++++ > 2 files changed, 1482 insertions(+) > > diff --git a/sound/soc/mediatek/mt8365/mt8365-afe-common.h b/sound/soc/mediatek/mt8365/mt8365-afe-common.h > new file mode 100644 > index 000000000000..4d8f8c4b19e3 > --- /dev/null > +++ b/sound/soc/mediatek/mt8365/mt8365-afe-common.h > @@ -0,0 +1,491 @@ > +/* SPDX-License-Identifier: GPL-2.0 > + * > + * Mediatek 8365 audio driver common definitions > + * > + * Copyright (c) 2024 MediaTek Inc. > + * Authors: Jia Zeng <jia.zeng@mediatek.com> > + * Alexandre Mergnat <amergnat@baylibre.com> > + */ > + > +#ifndef _MT8365_AFE_COMMON_H_ > +#define _MT8365_AFE_COMMON_H_ > + > +#define COMMON_CLOCK_FRAMEWORK_API > +#define IDLE_TASK_DRIVER_API > +#define ENABLE_AFE_APLL_TUNER Those three definitions do not exist upstream. Please remove. > + > +#include <linux/clk.h> > +#include <linux/list.h> > +#include <linux/regmap.h> > +#include <sound/soc.h> > +#include <sound/asound.h> > +#include "../common/mtk-base-afe.h" > +#include "mt8365-reg.h" > + > +#define ENUM_TO_STR(enum) #enum Unused definition > + > +#define snd_soc_dai_stream_active_playback(dai) \ > + snd_soc_dai_stream_active(dai, SNDRV_PCM_STREAM_PLAYBACK) > +#define snd_soc_dai_stream_active_capture(dai) \ > + snd_soc_dai_stream_active(dai, SNDRV_PCM_STREAM_CAPTURE) > + Those are used only once and only in mt8365-dai-pcm.c, and I just noticed that. Can you please just remove those two and directly call snd_soc_dai_stream_active() with the right params in function mt8365_dai_pcm1_prepare()? > +enum { > + MT8365_AFE_MEMIF_DL1, > + MT8365_AFE_MEMIF_DL2, > + MT8365_AFE_MEMIF_TDM_OUT, ..snip.. > + > +#ifdef CONFIG_MTK_HIFIXDSP_SUPPORT This configuration option doesn't exist. Please remove the ifdef and the enclosed code entirely, as it's unused. > +struct mt8365_adsp_data { > + /* information adsp supply */ > + bool adsp_on; > + int (*hostless_active)(void); > + /* information afe supply */ > + int (*set_afe_memif)(struct mtk_base_afe *afe, > + int memif_id, > + unsigned int rate, > + unsigned int channels, > + snd_pcm_format_t format); > + int (*set_afe_memif_enable)(struct mtk_base_afe *afe, > + int memif_id, > + unsigned int rate, > + unsigned int period_size, > + int enable); > + void (*get_afe_memif_sram)(struct mtk_base_afe *afe, > + int memif_id, > + unsigned int *paddr, > + unsigned int *size); > + void (*set_afe_init)(struct mtk_base_afe *afe); > + void (*set_afe_uninit)(struct mtk_base_afe *afe); > +}; > +#endif > + > +struct mt8365_afe_private { > + struct clk *clocks[MT8365_CLK_NUM]; > + struct regmap *topckgen; > + struct mt8365_fe_dai_data fe_data[MT8365_AFE_MEMIF_NUM]; > + struct mt8365_be_dai_data be_data[MT8365_AFE_BACKEND_NUM]; > + struct mt8365_control_data ctrl_data; > + struct mt8365_gasrc_data gasrc_data[MT8365_TDM_ASRC_NUM]; > +#ifdef CONFIG_MTK_HIFIXDSP_SUPPORT > + struct mt8365_adsp_data adsp_data; ditto > +#endif > + int afe_on_ref_cnt; > + int top_cg_ref_cnt[MT8365_TOP_CG_NUM]; > + void __iomem *afe_sram_vir_addr; > + unsigned int afe_sram_phy_addr; > + unsigned int afe_sram_size; > + /* locks */ > + spinlock_t afe_ctrl_lock; > + struct mutex afe_clk_mutex; /* Protect & sync APLL TUNER registers access*/ > +#ifdef CONFIG_DEBUG_FS > + struct dentry *debugfs_dentry[MT8365_AFE_DEBUGFS_NUM]; > +#endif > + int apll_tuner_ref_cnt[MT8365_AFE_APLL_NUM]; > + unsigned int tdm_out_mode; > + unsigned int cm2_mux_input; > + > + /* dai */ > + bool dai_on[MT8365_AFE_BACKEND_END]; > + void *dai_priv[MT8365_AFE_BACKEND_END]; > +}; > + .... > +#ifdef CONFIG_MTK_HIFIXDSP_SUPPORT same > +struct mtk_base_afe *mt8365_afe_pcm_get_info(void); > +#endif > + > +int mt8365_dai_i2s_register(struct mtk_base_afe *afe); > +int mt8365_dai_set_priv(struct mtk_base_afe *afe, > + int id, > + int priv_size, > + const void *priv_data); > + Everything else looks good. After applying the proposed cleanups, Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com> Cheers, Angelo
Il 14/06/24 09:27, Alexandre Mergnat ha scritto: > Add audio front end support of MT8365 SoC. > Update the file header. > > Signed-off-by: Alexandre Mergnat <amergnat@baylibre.com> Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
Il 14/06/24 09:27, Alexandre Mergnat ha scritto: > Add the sound node which is linked to the MT8365 SoC AFE and > the MT6357 audio codec. > > Update the file header. > > Signed-off-by: Alexandre Mergnat <amergnat@baylibre.com> > --- > arch/arm64/boot/dts/mediatek/mt8365-evk.dts | 89 +++++++++++++++++++++++++++++ > 1 file changed, 89 insertions(+) > > diff --git a/arch/arm64/boot/dts/mediatek/mt8365-evk.dts b/arch/arm64/boot/dts/mediatek/mt8365-evk.dts > index 50cbaefa1a99..1d5457f9a4c2 100644 > --- a/arch/arm64/boot/dts/mediatek/mt8365-evk.dts > +++ b/arch/arm64/boot/dts/mediatek/mt8365-evk.dts > @@ -4,6 +4,7 @@ > * Authors: > * Fabien Parent <fparent@baylibre.com> > * Bernhard Rosenkränzer <bero@baylibre.com> > + * Alexandre Mergnat <amergnat@baylibre.com> > */ > > /dts-v1/; > @@ -86,6 +87,28 @@ optee_reserved: optee@43200000 { > reg = <0 0x43200000 0 0x00c00000>; > }; > }; > + > + sound: sound { > + compatible = "mediatek,mt8365-mt6357"; > + pinctrl-names = "default", > + "dmic", > + "miso_off", > + "miso_on", > + "mosi_off", > + "mosi_on"; > + pinctrl-0 = <&aud_default_pins>; > + pinctrl-1 = <&aud_dmic_pins>; > + pinctrl-2 = <&aud_miso_off_pins>; > + pinctrl-3 = <&aud_miso_on_pins>; > + pinctrl-4 = <&aud_mosi_off_pins>; > + pinctrl-5 = <&aud_mosi_on_pins>; > + mediatek,platform = <&afe>; > + }; > +}; > + > +&afe { > + mediatek,dmic-mode = <1>; > + status = "okay"; > }; > > &cpu0 { > @@ -178,9 +201,75 @@ &mt6357_pmic { > interrupts-extended = <&pio 145 IRQ_TYPE_LEVEL_HIGH>; > interrupt-controller; > #interrupt-cells = <2>; > + vaud28-supply = <&mt6357_vaud28_reg>; > + audio-codec { > + mediatek,micbias0-microvolt = <1900000>; > + mediatek,micbias1-microvolt = <1700000>; > + }; > }; > > &pio { > + aud_default_pins: audiodefault-pins { > + pins { clk-dat-pins > + pinmux = <MT8365_PIN_72_CMDAT4__FUNC_I2S3_BCK>, > + <MT8365_PIN_73_CMDAT5__FUNC_I2S3_LRCK>, > + <MT8365_PIN_74_CMDAT6__FUNC_I2S3_MCK>, > + <MT8365_PIN_75_CMDAT7__FUNC_I2S3_DO>; > + }; > + }; > + > + aud_dmic_pins: audiodmic-pins { > + pins { clk-dat-pins > + pinmux = <MT8365_PIN_117_DMIC0_CLK__FUNC_DMIC0_CLK>, > + <MT8365_PIN_118_DMIC0_DAT0__FUNC_DMIC0_DAT0>, > + <MT8365_PIN_119_DMIC0_DAT1__FUNC_DMIC0_DAT1>; > + }; > + }; > + > + aud_miso_off_pins: misooff-pins { > + pins { clk-dat-pins and same for all the others. > + pinmux = <MT8365_PIN_53_AUD_CLK_MISO__FUNC_GPIO53>, > + <MT8365_PIN_54_AUD_SYNC_MISO__FUNC_GPIO54>, > + <MT8365_PIN_55_AUD_DAT_MISO0__FUNC_GPIO55>, > + <MT8365_PIN_56_AUD_DAT_MISO1__FUNC_GPIO56>; > + input-enable; > + bias-pull-down; > + drive-strength = <MTK_DRIVE_2mA>; drive-strength = <2>; > + }; > + }; > + > + aud_miso_on_pins: misoon-pins { > + pins { > + pinmux = <MT8365_PIN_53_AUD_CLK_MISO__FUNC_AUD_CLK_MISO>, > + <MT8365_PIN_54_AUD_SYNC_MISO__FUNC_AUD_SYNC_MISO>, > + <MT8365_PIN_55_AUD_DAT_MISO0__FUNC_AUD_DAT_MISO0>, > + <MT8365_PIN_56_AUD_DAT_MISO1__FUNC_AUD_DAT_MISO1>; > + drive-strength = <MTK_DRIVE_6mA>; = <6>; > + }; > + }; > + > + aud_mosi_off_pins: mosioff-pins { > + pins { > + pinmux = <MT8365_PIN_49_AUD_CLK_MOSI__FUNC_GPIO49>, > + <MT8365_PIN_50_AUD_SYNC_MOSI__FUNC_GPIO50>, > + <MT8365_PIN_51_AUD_DAT_MOSI0__FUNC_GPIO51>, > + <MT8365_PIN_52_AUD_DAT_MOSI1__FUNC_GPIO52>; > + input-enable; > + bias-pull-down; > + drive-strength = <MTK_DRIVE_2mA>; = <2>; > + }; > + }; > + > + aud_mosi_on_pins: mosion-pins { > + pins { > + pinmux = <MT8365_PIN_49_AUD_CLK_MOSI__FUNC_AUD_CLK_MOSI>, > + <MT8365_PIN_50_AUD_SYNC_MOSI__FUNC_AUD_SYNC_MOSI>, > + <MT8365_PIN_51_AUD_DAT_MOSI0__FUNC_AUD_DAT_MOSI0>, > + <MT8365_PIN_52_AUD_DAT_MOSI1__FUNC_AUD_DAT_MOSI1>; > + drive-strength = <MTK_DRIVE_6mA>; = <6>; Cheers, Angelo
This serie aim to add the following audio support for the Genio 350-evk: - Playback - 2ch Headset Jack (Earphone) - 1ch Line-out Jack (Speaker) - 8ch HDMI Tx - Capture - 1ch DMIC (On-board Digital Microphone) - 1ch AMIC (On-board Analogic Microphone) - 1ch Headset Jack (External Analogic Microphone) Of course, HDMI playback need the MT8365 display patches [1] and a DTS change documented in "mediatek,mt8365-mt6357.yaml". Applied patch: - mfd: mt6397-core: register mt6357 sound codec Test passed: - mixer-test log: [3] - pcm-test log: [4] [1]: https://lore.kernel.org/all/20231023-display-support-v1-0-5c860ed5c33b@baylibre.com/ [2]: https://lore.kernel.org/all/20240313110147.1267793-1-angelogioacchino.delregno@collabora.com/ [3]: https://pastebin.com/pc43AVrT [4]: https://pastebin.com/cCtGhDpg [5]: https://gitlab.baylibre.com/baylibre/mediatek/bsp/linux/-/commits/sound/for-next/add-i350-audio-support Signed-off-by: Alexandre Mergnat <amergnat@baylibre.com> --- Changes in v5: - Rebase to "next-20240523" branch. - bindings: power supply property moved to the parent node - Replace "SoC" by "ASoC" in the patch title (5/16) - Move and rename DAI I2S's defines - Improve code readability and cleanup - Link to v4: https://lore.kernel.org/r/20240226-audio-i350-v4-0-082b22186d4c@baylibre.com Changes in v4: - Rebase to "next-20240422" branch. - Re-pass dt_binding_check, functionnal tests, mixer test and pcm test. - Remove copyright changes. - Move mt6357 audio codec documention from mt6357.yaml to mediatek,mt6357.yaml - Fix broken indentation in mt8365-evk.dts - Remove empty node. - Add more dai link name according to the HW capability. - Remove spurious property (mediatek,topckgen) from mediatek,mt8365-afe.yaml - Rename "afe" to "audio-controller" in the documentation. - Link to v3: https://lore.kernel.org/r/20240226-audio-i350-v3-0-16bb2c974c55@baylibre.com Changes in v3: - Re-order documentation commit to fix dt_binding_check error. - Remove $ref and add "mediatek," prefix to vaud28-supply property. - Link to v2: https://lore.kernel.org/r/20240226-audio-i350-v2-0-3043d483de0d@baylibre.com Changes in v2: - Documentation fixed: - Remove spurious description. - Change property order to fit with dts coding style rules. - micbias property: use microvolt value instead of index. - mediatek,i2s-shared-clock property removed. - mediatek,dmic-iir-on property removed. - mediatek,dmic-irr-mode property removed. - Change dmic-two-wire-mode => dmic-mode to be aligned with another SoC - Remove the spurious 2nd reg of the afe. - Manage IIR filter feature using audio controls. - Fix audio controls to pass mixer-test and pcm-test. - Refactor some const name according to feedbacks. - Rework the codec to remove spurious driver data. - Use the new common MTK probe functions for AFE PCM and sound card. - Rework pinctrl probe in the soundcard driver. - Remove spurious "const" variables in all files. - Link to v1: https://lore.kernel.org/r/20240226-audio-i350-v1-0-4fa1cea1667f@baylibre.com --- Alexandre Mergnat (14): ASoC: dt-bindings: mediatek,mt8365-afe: Add audio afe document ASoC: dt-bindings: mediatek,mt8365-mt6357: Add audio sound card document dt-bindings: mfd: mediatek: Add codec property for MT6357 PMIC ASoC: mediatek: mt8365: Add common header ASoC: mediatek: mt8365: Add audio clock control support ASoC: mediatek: mt8365: Add I2S DAI support ASoC: mediatek: mt8365: Add ADDA DAI support ASoC: mediatek: mt8365: Add DMIC DAI support ASoC: mediatek: mt8365: Add PCM DAI support ASoC: mediatek: mt8365: Add the AFE driver support ASoC: mediatek: Add MT8365 support arm64: defconfig: enable mt8365 sound arm64: dts: mediatek: add afe support for mt8365 SoC arm64: dts: mediatek: add audio support for mt8365-evk Nicolas Belin (2): ASoc: mediatek: mt8365: Add a specific soundcard for EVK ASoC: codecs: add MT6357 support .../devicetree/bindings/mfd/mediatek,mt6357.yaml | 33 + .../bindings/sound/mediatek,mt8365-afe.yaml | 130 ++ .../bindings/sound/mediatek,mt8365-mt6357.yaml | 107 + arch/arm64/boot/dts/mediatek/mt8365-evk.dts | 89 + arch/arm64/boot/dts/mediatek/mt8365.dtsi | 43 +- arch/arm64/configs/defconfig | 2 + sound/soc/codecs/Kconfig | 7 + sound/soc/codecs/Makefile | 2 + sound/soc/codecs/mt6357.c | 1898 ++++++++++++++++ sound/soc/codecs/mt6357.h | 662 ++++++ sound/soc/mediatek/Kconfig | 20 + sound/soc/mediatek/Makefile | 1 + sound/soc/mediatek/mt8365/Makefile | 15 + sound/soc/mediatek/mt8365/mt8365-afe-clk.c | 429 ++++ sound/soc/mediatek/mt8365/mt8365-afe-clk.h | 32 + sound/soc/mediatek/mt8365/mt8365-afe-common.h | 491 +++++ sound/soc/mediatek/mt8365/mt8365-afe-pcm.c | 2275 ++++++++++++++++++++ sound/soc/mediatek/mt8365/mt8365-dai-adda.c | 311 +++ sound/soc/mediatek/mt8365/mt8365-dai-dmic.c | 340 +++ sound/soc/mediatek/mt8365/mt8365-dai-i2s.c | 850 ++++++++ sound/soc/mediatek/mt8365/mt8365-dai-pcm.c | 293 +++ sound/soc/mediatek/mt8365/mt8365-mt6357.c | 345 +++ sound/soc/mediatek/mt8365/mt8365-reg.h | 991 +++++++++ 23 files changed, 9364 insertions(+), 2 deletions(-) --- base-commit: 3689b0ef08b70e4e03b82ebd37730a03a672853a change-id: 20240226-audio-i350-4e11da088e55 Best regards,