ASoC: mediatek: Add support for MT7986 SoC
Subsystems (4)
v4 cover ASoC: mediatek: Add support for MT7986 SoC
Changes in v4:
- fix typo of authors and copyright
- refine with bitfield helper for readability [2/6]
- refine with human readable error message [3/6]
- use "mt7986-wm8960-sound" as compatible string [4/6] [5/6]
- refine properties based on reviewer's suggestions [5/6]
- remove assigned-clocks and assigned-clocks-parents [6/6]
- constrain clocks per variants [6/6]
Changes in v3:
- merge clk api to mt7986-afe-pcm.c, remove [2/7] in v2
- refine based on reviewer's suggestions [1/6] [2/6]
- fix the comment format, move in clk api, and simplify based on reviewer's suggestions [3/6]
- remove redundant prefix in dt-binding [6/6]
Changes in v2:
- v1 title: [PATCH 0/7] ASoC: mediatek: Add support for MT79xx SoC
- add missing maintainers
- rename mt79xx to mt7986 in all files
- use clk bulk api in mt7986-afe-clk.c [2/7]
- refine mt79xx-afe-pcm.c based on reviewer's suggestions [4/7]
- refine dt-binding files based on reviewer's suggestions [6/7] [7/7]
- transpose [3/7] and [4/7] in v1 to fix test build errors
Maso Huang (6):
ASoC: mediatek: mt7986: add common header
ASoC: mediatek: mt7986: support etdm in platform driver
ASoC: mediatek: mt7986: add platform driver
ASoC: mediatek: mt7986: add machine driver with wm8960
ASoC: dt-bindings: mediatek,mt7986-wm8960: add mt7986-wm8960 document
ASoC: dt-bindings: mediatek,mt7986-afe: add audio afe document
.../bindings/sound/mediatek,mt7986-afe.yaml | 160 +++++ .../sound/mediatek,mt7986-wm8960.yaml | 67 ++ sound/soc/mediatek/Kconfig | 20 + sound/soc/mediatek/Makefile | 1 + sound/soc/mediatek/mt7986/Makefile | 9 + sound/soc/mediatek/mt7986/mt7986-afe-common.h | 49 ++ sound/soc/mediatek/mt7986/mt7986-afe-pcm.c | 622 ++++++++++++++++++ sound/soc/mediatek/mt7986/mt7986-dai-etdm.c | 411 ++++++++++++ sound/soc/mediatek/mt7986/mt7986-reg.h | 196 ++++++ sound/soc/mediatek/mt7986/mt7986-wm8960.c | 196 ++++++ 10 files changed, 1731 insertions(+) create mode 100644 Documentation/devicetree/bindings/sound/mediatek,mt7986-afe.yaml create mode 100644 Documentation/devicetree/bindings/sound/mediatek,mt7986-wm8960.yaml create mode 100644 sound/soc/mediatek/mt7986/Makefile create mode 100644 sound/soc/mediatek/mt7986/mt7986-afe-common.h create mode 100644 sound/soc/mediatek/mt7986/mt7986-afe-pcm.c create mode 100644 sound/soc/mediatek/mt7986/mt7986-dai-etdm.c create mode 100644 sound/soc/mediatek/mt7986/mt7986-reg.h create mode 100644 sound/soc/mediatek/mt7986/mt7986-wm8960.c
Signature · 1 line
2.18.0
PATCH v4 1/6 ASoC: mediatek: mt7986: add common header
Add header files for register definition and structure.
--- sound/soc/mediatek/mt7986/mt7986-afe-common.h | 49 +++++ sound/soc/mediatek/mt7986/mt7986-reg.h | 196 ++++++++++++++++++ 2 files changed, 245 insertions(+) create mode 100644 sound/soc/mediatek/mt7986/mt7986-afe-common.h create mode 100644 sound/soc/mediatek/mt7986/mt7986-reg.h
sound/soc/mediatek/mt7986/mt7986-afe-common.h new file +49 -0
@@ -0,0 +1,49 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +/* +* mt7986-afe-common.h -- MediaTek 7986 audio driver definitions +* +* Copyright (c) 2023 MediaTek Inc. +* Authors: Vic Wu <[email protected]> +* Maso Huang <[email protected]> +*/ + +#ifndef _MT_7986_AFE_COMMON_H_ +#define _MT_7986_AFE_COMMON_H_ + +#include <sound/soc.h> +#include <linux/clk.h> +#include <linux/list.h> +#include <linux/regmap.h> +#include "../common/mtk-base-afe.h" + +enum { +MT7986_MEMIF_DL1 , +MT7986_MEMIF_VUL12 , +MT7986_MEMIF_NUM , +MT7986_DAI_ETDM =MT7986_MEMIF_NUM , +MT7986_DAI_NUM , +}; + +enum { +MT7986_IRQ_0 , +MT7986_IRQ_1 , +MT7986_IRQ_2 , +MT7986_IRQ_NUM , +}; + +struct mt7986_afe_private { +struct clk_bulk_data *clks; +int num_clks; + +int pm_runtime_bypass_reg_ctl; + +/* dai */ +void *dai_priv[MT7986_DAI_NUM ]; +}; + +unsigned int mt7986_afe_rate_transform (struct device *dev, +unsigned int rate); + +/* dai register */ +int mt7986_dai_etdm_register (struct mtk_base_afe *afe); +#endif
sound/soc/mediatek/mt7986/mt7986-reg.h new file +196 -0
196 lines not on this page · raw message
Signature · 1 line
2.18.0
PATCH v4 2/6 ASoC: mediatek: mt7986: support etdm in platform driver
In reply to Maso HuangAdd mt7986 etdm dai driver support.
--- sound/soc/mediatek/mt7986/mt7986-dai-etdm.c | 411 ++++++++++++++++++++ 1 file changed, 411 insertions(+) create mode 100644 sound/soc/mediatek/mt7986/mt7986-dai-etdm.c
sound/soc/mediatek/mt7986/mt7986-dai-etdm.c new file +411 -0
@@ -0,0 +1,411 @@ +// SPDX-License-Identifier: GPL-2.0 +/* +* MediaTek ALSA SoC Audio DAI eTDM Control +* +* Copyright (c) 2023 MediaTek Inc. +* Authors: Vic Wu <[email protected]> +* Maso Huang <[email protected]> +*/ + +#include <linux/bitfield.h> +#include <linux/bitops.h> +#include <linux/regmap.h> +#include <sound/pcm_params.h> +#include "mt7986-afe-common.h" +#include "mt7986-reg.h" + +#define HOPPING_CLK 0 +#define APLL_CLK 1 +#define MTK_DAI_ETDM_FORMAT_I2S 0 +#define MTK_DAI_ETDM_FORMAT_DSPA 4 +#define MTK_DAI_ETDM_FORMAT_DSPB 5 + +enum { +MTK_ETDM_RATE_8K =0 , +MTK_ETDM_RATE_12K =1 , +MTK_ETDM_RATE_16K =2 , +MTK_ETDM_RATE_24K =3 , +MTK_ETDM_RATE_32K =4 , +MTK_ETDM_RATE_48K =5 , +MTK_ETDM_RATE_96K =7 , +MTK_ETDM_RATE_192K =9 , +MTK_ETDM_RATE_11K =16 , +MTK_ETDM_RATE_22K =17 , +MTK_ETDM_RATE_44K =18 , +MTK_ETDM_RATE_88K =19 , +MTK_ETDM_RATE_176K =20 , +}; + +struct mtk_dai_etdm_priv { +bool bck_inv; +bool lrck_inv; +bool slave_mode; +unsigned int format; +}; + +static unsigned int mt7986_etdm_rate_transform (struct device *dev,unsigned int rate) +{ +switch (rate) { +case 8000 : +return MTK_ETDM_RATE_8K ; +case 11025 : +return MTK_ETDM_RATE_11K ; +case 12000 : +return MTK_ETDM_RATE_12K ; +case 16000 : +return MTK_ETDM_RATE_16K ; +case 22050 : +return MTK_ETDM_RATE_22K ; +case 24000 : +return MTK_ETDM_RATE_24K ; +case 32000 : +return MTK_ETDM_RATE_32K ; +case 44100 : +return MTK_ETDM_RATE_44K ; +case 48000 : +return MTK_ETDM_RATE_48K ; +case 88200 : +return MTK_ETDM_RATE_88K ; +case 96000 : +return MTK_ETDM_RATE_96K ; +case 176400 : +return MTK_ETDM_RATE_176K ; +case 192000 : +return MTK_ETDM_RATE_192K ; +default : +dev_warn (dev,"%s(), rate %u invalid, using %d!!!\n" , + __func__, rate,MTK_ETDM_RATE_48K ); +return MTK_ETDM_RATE_48K ; + } +} + +static int get_etdm_wlen (unsigned int bitwidth) +{ +return bitwidth <=16 ?16 :32 ; +} + +/* dai component */ +/* interconnection */ + +static const struct snd_kcontrol_new o124_mix[] = { +SOC_DAPM_SINGLE_AUTODISABLE ("I032_Switch" ,AFE_CONN124_1 ,0 ,1 ,0 ), +}; + +static const struct snd_kcontrol_new o125_mix[] = { +SOC_DAPM_SINGLE_AUTODISABLE ("I033_Switch" ,AFE_CONN125_1 ,1 ,1 ,0 ), +}; + +static const struct snd_soc_dapm_widget mtk_dai_etdm_widgets[] = { + +/* DL */ +SND_SOC_DAPM_MIXER ("I150" ,SND_SOC_NOPM ,0 ,0 ,NULL ,0 ), +SND_SOC_DAPM_MIXER ("I151" ,SND_SOC_NOPM ,0 ,0 ,NULL ,0 ), +/* UL */ +SND_SOC_DAPM_MIXER ("O124" ,SND_SOC_NOPM ,0 ,0 , o124_mix,ARRAY_SIZE (o124_mix)), +SND_SOC_DAPM_MIXER ("O125" ,SND_SOC_NOPM ,0 ,0 , o125_mix,ARRAY_SIZE (o125_mix)), +}; + +static const struct snd_soc_dapm_route mtk_dai_etdm_routes[] = { + {"I150" ,NULL ,"ETDM Capture" }, + {"I151" ,NULL ,"ETDM Capture" }, + {"ETDM Playback" ,NULL ,"O124" }, + {"ETDM Playback" ,NULL ,"O125" }, + {"O124" ,"I032_Switch" ,"I032" }, + {"O125" ,"I033_Switch" ,"I033" }, +}; + +/* dai ops */ +static int mtk_dai_etdm_startup (struct snd_pcm_substream *substream, +struct snd_soc_dai *dai) +{ +struct mtk_base_afe *afe =snd_soc_dai_get_drvdata (dai); +struct mt7986_afe_private *afe_priv = afe->platform_priv; +int ret; + + ret =clk_bulk_prepare_enable (afe_priv->num_clks, afe_priv->clks); +if (ret) +return dev_err_probe (afe->dev, ret,"Failed to enable clocks\n" ); + +regmap_update_bits (afe->regmap,AUDIO_TOP_CON2 ,CLK_OUT5_PDN_MASK ,0 ); +regmap_update_bits (afe->regmap,AUDIO_TOP_CON2 ,CLK_IN5_PDN_MASK ,0 ); + +return 0 ; +} + +static void mtk_dai_etdm_shutdown (struct snd_pcm_substream *substream, +struct snd_soc_dai *dai) +{ +struct mtk_base_afe *afe =snd_soc_dai_get_drvdata (dai); +struct mt7986_afe_private *afe_priv = afe->platform_priv; + +regmap_update_bits (afe->regmap,AUDIO_TOP_CON2 ,CLK_OUT5_PDN_MASK , +CLK_OUT5_PDN ); +regmap_update_bits (afe->regmap,AUDIO_TOP_CON2 ,CLK_IN5_PDN_MASK , +CLK_IN5_PDN ); + +clk_bulk_disable_unprepare (afe_priv->num_clks, afe_priv->clks); +} + +static unsigned int get_etdm_ch_fixup (unsigned int channels) +{ +if (channels >16 ) +return 24 ; +else if (channels >8 ) +return 16 ; +else if (channels >4 ) +return 8 ; +else if (channels >2 ) +return 4 ; +else +return 2 ; +} + +static int mtk_dai_etdm_config (struct mtk_base_afe *afe, +struct snd_pcm_hw_params *params, +struct snd_soc_dai *dai, +int stream) +{ +struct mt7986_afe_private *afe_priv = afe->platform_priv; +struct mtk_dai_etdm_priv *etdm_data = afe_priv->dai_priv[dai->id]; +unsigned int rate =params_rate (params); +unsigned int etdm_rate =mt7986_etdm_rate_transform (afe->dev, rate); +unsigned int afe_rate =mt7986_afe_rate_transform (afe->dev, rate); +unsigned int channels =params_channels (params); +unsigned int bit_width =params_width (params); +unsigned int wlen =get_etdm_wlen (bit_width); +unsigned int val =0 ; +unsigned int mask =0 ; + +dev_dbg (afe->dev,"%s(), stream %d, rate %u, bitwidth %u\n" , + __func__, stream, rate, bit_width); + +/* CON0 */ + mask |=ETDM_BIT_LEN_MASK ; + val |=FIELD_PREP (ETDM_BIT_LEN_MASK , bit_width -1 ); + mask |=ETDM_WRD_LEN_MASK ; + val |=FIELD_PREP (ETDM_WRD_LEN_MASK , wlen -1 ); + mask |=ETDM_FMT_MASK ; + val |=FIELD_PREP (ETDM_FMT_MASK , etdm_data->format); + mask |=ETDM_CH_NUM_MASK ; + val |=FIELD_PREP (ETDM_CH_NUM_MASK ,get_etdm_ch_fixup (channels) -1 ); + mask |=RELATCH_SRC_MASK ; + val |=FIELD_PREP (RELATCH_SRC_MASK ,APLL_CLK ); + +switch (stream) { +case SNDRV_PCM_STREAM_PLAYBACK : +/* set ETDM_OUT5_CON0 */ +regmap_update_bits (afe->regmap,ETDM_OUT5_CON0 , mask, val); + +/* set ETDM_OUT5_CON4 */ +regmap_update_bits (afe->regmap,ETDM_OUT5_CON4 , +OUT_RELATCH_MASK ,OUT_RELATCH (afe_rate)); +regmap_update_bits (afe->regmap,ETDM_OUT5_CON4 , +OUT_CLK_SRC_MASK ,OUT_CLK_SRC (APLL_CLK )); +regmap_update_bits (afe->regmap,ETDM_OUT5_CON4 , +OUT_SEL_FS_MASK ,OUT_SEL_FS (etdm_rate)); + +/* set ETDM_OUT5_CON5 */ +regmap_update_bits (afe->regmap,ETDM_OUT5_CON5 , +ETDM_CLK_DIV_MASK ,ETDM_CLK_DIV ); +break ; +case SNDRV_PCM_STREAM_CAPTURE : +/* set ETDM_IN5_CON0 */ +regmap_update_bits (afe->regmap,ETDM_IN5_CON0 , mask, val); +regmap_update_bits (afe->regmap,ETDM_IN5_CON0 , +ETDM_SYNC_MASK ,ETDM_SYNC ); + +/* set ETDM_IN5_CON2 */ +regmap_update_bits (afe->regmap,ETDM_IN5_CON2 , +IN_CLK_SRC_MASK ,IN_CLK_SRC (APLL_CLK )); + +/* set ETDM_IN5_CON3 */ +regmap_update_bits (afe->regmap,ETDM_IN5_CON3 , +IN_SEL_FS_MASK ,IN_SEL_FS (etdm_rate)); + +/* set ETDM_IN5_CON4 */ +regmap_update_bits (afe->regmap,ETDM_IN5_CON4 , +IN_RELATCH_MASK ,IN_RELATCH (afe_rate)); +break ; +default : +break ; + } + +return 0 ; +} + +static int mtk_dai_etdm_hw_params (struct snd_pcm_substream *substream, +struct snd_pcm_hw_params *params, +struct snd_soc_dai *dai) +{ +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 ; +} + +static int mtk_dai_etdm_trigger (struct snd_pcm_substream *substream,int cmd, +struct snd_soc_dai *dai) +{ +struct mtk_base_afe *afe =snd_soc_dai_get_drvdata (dai); + +dev_dbg (afe->dev,"%s(), cmd %d, dai id %d\n" , __func__, cmd, dai->id); +switch (cmd) { +case SNDRV_PCM_TRIGGER_START : +case SNDRV_PCM_TRIGGER_RESUME : +regmap_update_bits (afe->regmap,ETDM_IN5_CON0 ,ETDM_EN_MASK , +ETDM_EN ); +regmap_update_bits (afe->regmap,ETDM_OUT5_CON0 ,ETDM_EN_MASK , +ETDM_EN ); +break ; +case SNDRV_PCM_TRIGGER_STOP : +case SNDRV_PCM_TRIGGER_SUSPEND : +regmap_update_bits (afe->regmap,ETDM_IN5_CON0 ,ETDM_EN_MASK , +0 ); +regmap_update_bits (afe->regmap,ETDM_OUT5_CON0 ,ETDM_EN_MASK , +0 ); +break ; +default : +break ; + } + +return 0 ; +} + +static int mtk_dai_etdm_set_fmt (struct snd_soc_dai *dai,unsigned int fmt) +{ +struct mtk_base_afe *afe =snd_soc_dai_get_drvdata (dai); +struct mt7986_afe_private *afe_priv = afe->platform_priv; +struct mtk_dai_etdm_priv *etdm_data; +void *priv_data; + +switch (dai->id) { +case MT7986_DAI_ETDM : +break ; +default : +dev_warn (afe->dev,"%s(), id %d not support\n" , + __func__, dai->id); +return -EINVAL ; + } + + priv_data =devm_kzalloc (afe->dev,sizeof (struct mtk_dai_etdm_priv ), +GFP_KERNEL ); +if (!priv_data) +return -ENOMEM ; + + afe_priv->dai_priv[dai->id] = priv_data; + etdm_data = afe_priv->dai_priv[dai->id]; + +switch (fmt &SND_SOC_DAIFMT_FORMAT_MASK ) { +case SND_SOC_DAIFMT_I2S : + etdm_data->format =MTK_DAI_ETDM_FORMAT_I2S ; +break ; +case SND_SOC_DAIFMT_DSP_A : + etdm_data->format =MTK_DAI_ETDM_FORMAT_DSPA ; +break ; +case SND_SOC_DAIFMT_DSP_B : + etdm_data->format =MTK_DAI_ETDM_FORMAT_DSPB ; +break ; +default : +return -EINVAL ; + } + +switch (fmt &SND_SOC_DAIFMT_INV_MASK ) { +case SND_SOC_DAIFMT_NB_NF : + etdm_data->bck_inv = false; + etdm_data->lrck_inv = false; +break ; +case SND_SOC_DAIFMT_NB_IF : + etdm_data->bck_inv = false; + etdm_data->lrck_inv = true; +break ; +case SND_SOC_DAIFMT_IB_NF : + etdm_data->bck_inv = true; + etdm_data->lrck_inv = false; +break ; +case SND_SOC_DAIFMT_IB_IF : + etdm_data->bck_inv = true; + etdm_data->lrck_inv = true; +break ; +default : +return -EINVAL ; + } + +switch (fmt &SND_SOC_DAIFMT_MASTER_MASK ) { +case SND_SOC_DAIFMT_CBM_CFM : + etdm_data->slave_mode = true; +break ; +case SND_SOC_DAIFMT_CBS_CFS : + etdm_data->slave_mode = false; +break ; +default : +return -EINVAL ; + } + +return 0 ; +} + +static const struct snd_soc_dai_ops mtk_dai_etdm_ops = { + .startup = mtk_dai_etdm_startup, + .shutdown = mtk_dai_etdm_shutdown, + .hw_params = mtk_dai_etdm_hw_params, + .trigger = mtk_dai_etdm_trigger, + .set_fmt = mtk_dai_etdm_set_fmt, +}; + +/* dai driver */ +#define MTK_ETDM_RATES (SNDRV_PCM_RATE_8000_48000 |\ + SNDRV_PCM_RATE_88200 |\ + SNDRV_PCM_RATE_96000 |\ + SNDRV_PCM_RATE_176400 |\ + SNDRV_PCM_RATE_192000) + +#define MTK_ETDM_FORMATS (SNDRV_PCM_FMTBIT_S16_LE |\ + SNDRV_PCM_FMTBIT_S24_LE |\ + SNDRV_PCM_FMTBIT_S32_LE) + +static struct snd_soc_dai_driver mtk_dai_etdm_driver[] = { + { + .name ="ETDM" , + .id =MT7986_DAI_ETDM , + .capture = { + .stream_name ="ETDM Capture" , + .channels_min =1 , + .channels_max =2 , + .rates =MTK_ETDM_RATES , + .formats =MTK_ETDM_FORMATS , + }, + .playback = { + .stream_name ="ETDM Playback" , + .channels_min =1 , + .channels_max =2 , + .rates =MTK_ETDM_RATES , + .formats =MTK_ETDM_FORMATS , + }, + .ops = &mtk_dai_etdm_ops, + .symmetric_rate =1 , + .symmetric_sample_bits =1 , + }, +}; + +int mt7986_dai_etdm_register (struct mtk_base_afe *afe) +{ +struct mtk_base_afe_dai *dai; + + dai =devm_kzalloc (afe->dev,sizeof (*dai),GFP_KERNEL ); +if (!dai) +return -ENOMEM ; + +list_add (&dai->list, &afe->sub_dais); + + dai->dai_drivers = mtk_dai_etdm_driver; + dai->num_dai_drivers =ARRAY_SIZE (mtk_dai_etdm_driver); + + dai->dapm_widgets = mtk_dai_etdm_widgets; + dai->num_dapm_widgets =ARRAY_SIZE (mtk_dai_etdm_widgets); + dai->dapm_routes = mtk_dai_etdm_routes; + dai->num_dapm_routes =ARRAY_SIZE (mtk_dai_etdm_routes); + +return 0 ; +}
Signature · 1 line
2.18.0
PATCH v4 3/6 ASoC: mediatek: mt7986: add platform driver
In reply to Maso HuangAdd mt7986 platform driver.
--- sound/soc/mediatek/Kconfig | 10 + sound/soc/mediatek/Makefile | 1 + sound/soc/mediatek/mt7986/Makefile | 8 + sound/soc/mediatek/mt7986/mt7986-afe-pcm.c | 622 +++++++++++++++++++++ 4 files changed, 641 insertions(+) create mode 100644 sound/soc/mediatek/mt7986/Makefile create mode 100644 sound/soc/mediatek/mt7986/mt7986-afe-pcm.c
sound/soc/mediatek/Kconfig +10 -0
@@ -54,6 +54,16 @@ config SND_SOC_MT6797_MT6351 Select Y if you have such device. If unsure select "N". +config SND_SOC_MT7986 + tristate "ASoC support for Mediatek MT7986 chip" + depends on ARCH_MEDIATEK + select SND_SOC_MEDIATEK + help + This adds ASoC platform driver support for MediaTek MT7986 chip + that can be used with other codecs. + Select Y if you have such device. + If unsure select "N". + config SND_SOC_MT8173 tristate "ASoC support for Mediatek MT8173 chip" depends on ARCH_MEDIATEK
sound/soc/mediatek/Makefile +1 -0
@@ -2,6 +2,7 @@ obj-$(CONFIG_SND_SOC_MEDIATEK) += common/ obj-$(CONFIG_SND_SOC_MT2701) += mt2701/ obj-$(CONFIG_SND_SOC_MT6797) += mt6797/ +obj-$(CONFIG_SND_SOC_MT7986) += mt7986/ obj-$(CONFIG_SND_SOC_MT8173) += mt8173/ obj-$(CONFIG_SND_SOC_MT8183) += mt8183/ obj-$(CONFIG_SND_SOC_MT8186) += mt8186/
sound/soc/mediatek/mt7986/Makefile new file +8 -0
@@ -0,0 +1,8 @@ +# SPDX-License-Identifier: GPL-2.0 + +# platform driver +snd-soc-mt7986-afe-objs := \ + mt7986-afe-pcm.o \ + mt7986-dai-etdm.o + +obj-$(CONFIG_SND_SOC_MT7986) += snd-soc-mt7986-afe.o
sound/soc/mediatek/mt7986/mt7986-afe-pcm.c new file +622 -0
622 lines not on this page · raw message
Signature · 1 line
2.18.0
PATCH v4 4/6 ASoC: mediatek: mt7986: add machine driver with wm8960
In reply to Maso HuangAdd support for mt7986 board with wm8960.
--- sound/soc/mediatek/Kconfig | 10 ++ sound/soc/mediatek/mt7986/Makefile | 1 + sound/soc/mediatek/mt7986/mt7986-wm8960.c | 196 ++++++++++++++++++++++ 3 files changed, 207 insertions(+) create mode 100644 sound/soc/mediatek/mt7986/mt7986-wm8960.c
sound/soc/mediatek/Kconfig +10 -0
@@ -64,6 +64,16 @@ config SND_SOC_MT7986 Select Y if you have such device. If unsure select "N". +config SND_SOC_MT7986_WM8960 + tristate "ASoc Audio driver for MT7986 with WM8960 codec" + depends on SND_SOC_MT7986 && I2C + select SND_SOC_WM8960 + help + This adds support for ASoC machine driver for MediaTek MT7986 + boards with the WM8960 codecs. + Select Y if you have such device. + If unsure select "N". + config SND_SOC_MT8173 tristate "ASoC support for Mediatek MT8173 chip" depends on ARCH_MEDIATEK
sound/soc/mediatek/mt7986/Makefile +1 -0
@@ -6,3 +6,4 @@ snd-soc-mt7986-afe-objs := \ mt7986-dai-etdm.o obj-$(CONFIG_SND_SOC_MT7986) += snd-soc-mt7986-afe.o +obj-$(CONFIG_SND_SOC_MT7986_WM8960) += mt7986-wm8960.o
sound/soc/mediatek/mt7986/mt7986-wm8960.c new file +196 -0
196 lines not on this page · raw message
Signature · 1 line
2.18.0
Re: [PATCH v4 4/6] ASoC: mediatek: mt7986: add machine driver with wm8960
sound/soc/mediatek/Kconfig config SND_SOC_MT7986 · line 68
Quoted 10 lines · Maso Huang
sound/soc/mediatek/Kconfig +2
-0@@ -64,6 +64,16 @@ config SND_SOC_MT7986 Select Y if you have such device. If unsure select "N". +config SND_SOC_MT7986_WM8960 + tristate "ASoc Audio driver for MT7986 with WM8960 codec"
s/ASoc/ASoC/
Quoted 7 lines
sound/soc/mediatek/Kconfig +7
-0+ depends on SND_SOC_MT7986 && I2C + select SND_SOC_WM8960 + help + This adds support for ASoC machine driver for MediaTek MT7986 + boards with the WM8960 codecs. + Select Y if you have such device. + If unsure select "N".
Signature · 1 line
~Randy
PATCH v4 5/6 ASoC: dt-bindings: mediatek,mt7986-wm8960: add mt7986-wm8960 document
In reply to Maso HuangAdd document for mt7986 board with wm8960.
--- .../sound/mediatek,mt7986-wm8960.yaml | 67 +++++++++++++++++++ 1 file changed, 67 insertions(+) create mode 100644 Documentation/devicetree/bindings/sound/mediatek,mt7986-wm8960.yaml
Documentation/devicetree/bindings/sound/mediatek,mt7986-wm8960.yaml new file +67 -0
@@ -0,0 +1,67 @@ +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/sound/mediatek,mt7986-wm8960.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: MediaTek MT7986 sound card with WM8960 codec + +maintainers: + - Maso Huang <[email protected]> + +allOf: + - $ref: sound-card-common.yaml# + +properties: + compatible: + const: mediatek,mt7986-wm8960-sound + + platform: + type: object + additionalProperties: false + properties: + sound-dai: + description: The phandle of MT7986 platform. + maxItems: 1 + required: + - sound-dai + + codec: + type: object + additionalProperties: false + properties: + sound-dai: + description: The phandle of wm8960 codec. + maxItems: 1 + required: + - sound-dai + +unevaluatedProperties: false + +required: + - compatible + - audio-routing + - platform + - codec + +examples: + - | + sound { + compatible = "mediatek,mt7986-wm8960-sound"; + model = "mt7986-wm8960"; + audio-routing = + "Headphone", "HP_L", + "Headphone", "HP_R", + "LINPUT1", "AMIC", + "RINPUT1", "AMIC"; + + platform { + sound-dai = <&afe>; + }; + + codec { + sound-dai = <&wm8960>; + }; + }; + +...
Signature · 1 line
2.18.0
Rob Herring
maintainerRe: [PATCH v4 5/6] ASoC: dt-bindings: mediatek,mt7986-wm8960: add mt7986-wm8960 document
Quoted 9 lines · Maso Huang
Add document for mt7986 board with wm8960.
Signed-off-by Maso Huang <[email protected]>Reviewed-by AngeloGioacchino Del Regno <[email protected]>--- .../sound/mediatek,mt7986-wm8960.yaml | 67 +++++++++++++++++++ 1 file changed, 67 insertions(+) create mode 100644 Documentation/devicetree/bindings/sound/mediatek,mt7986-wm8960.yaml
My bot found errors running 'make DT_CHECKER_FLAGS=-m dt_binding_check' on your patch (DT_CHECKER_FLAGS is new in v5.13):
yamllint warnings/errors:
dtschema/dtc warnings/errors:
/builds/robherring/dt-review-ci/linux/Documentation/devicetree/bindings/sound/mediatek,mt7986-wm8960.yaml:
Error in referenced schema matching $id: http://devicetree.org/schemas/sound/sound-card-common.yaml
/builds/robherring/dt-review-ci/linux/Documentation/devicetree/bindings/sound/mediatek,mt7986-wm8960.example.dtb: sound: False schema does not allow {'compatible': ['mediatek,mt7986-wm8960-sound'], 'model': ['mt7986-wm8960'], 'audio-routing': ['Headphone', 'HP_L', 'Headphone', 'HP_R', 'LINPUT1', 'AMIC', 'RINPUT1', 'AMIC'], 'platform': {'sound-dai': [[4294967295]]}, 'codec': {'sound-dai': [[4294967295]]}, '$nodename': ['sound']}
from schema $id: http://devicetree.org/schemas/sound/mediatek,mt7986-wm8960.yaml# /builds/robherring/dt-review-ci/linux/Documentation/devicetree/bindings/sound/mediatek,mt7986-wm8960.example.dtb: sound: Unevaluated properties are not allowed ('audio-routing', 'model' were unexpected) from schema $id: http://devicetree.org/schemas/sound/mediatek,mt7986-wm8960.yaml#
doc reference errors (make refcheckdocs):
See https://patchwork.ozlabs.org/project/devicetree-bindings/patch/[email protected]
The base for the series is generally the latest rc1. A different dependency should be noted in *this* patch.
If you already ran 'make dt_binding_check' and didn't see the above error(s), then make sure 'yamllint' is installed and dt-schema is up to date:
pip3 install dtschema --upgrade
Please check and re-submit after running the above command yourself. Note that DT_SCHEMA_FILES can be set to your schema file to speed up checking your schema. However, it must be unset to test all examples with your schema.
PATCH v4 6/6 ASoC: dt-bindings: mediatek,mt7986-afe: add audio afe document
In reply to Maso HuangAdd mt7986 audio afe document.
--- .../bindings/sound/mediatek,mt7986-afe.yaml | 160 ++++++++++++++++++ 1 file changed, 160 insertions(+) create mode 100644 Documentation/devicetree/bindings/sound/mediatek,mt7986-afe.yaml
Documentation/devicetree/bindings/sound/mediatek,mt7986-afe.yaml new file +160 -0
@@ -0,0 +1,160 @@ +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/sound/mediatek,mt7986-afe.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: MediaTek AFE PCM controller for MT7986 + +maintainers: + - Maso Huang <[email protected]> + +properties: + compatible: + oneOf: + - const: mediatek,mt7986-afe + - items: + - enum: + - mediatek,mt7981-afe + - mediatek,mt7988-afe + - const: mediatek,mt7986-afe + + reg: + maxItems: 1 + + interrupts: + maxItems: 1 + + clocks: + minItems: 5 + items: + - description: audio bus clock + - description: audio 26M clock + - description: audio intbus clock + - description: audio hopping clock + - description: audio pll clock + - description: mux for pcm_mck + - description: audio i2s/pcm mck + + clock-names: + minItems: 5 + items: + - const: bus_ck + - const: 26m_ck + - const: l_ck + - const: aud_ck + - const: eg2_ck + - const: sel + - const: i2s_m + +required: + - compatible + - reg + - interrupts + - clocks + - clock-names + +allOf: + - if: + properties: + compatible: + contains: + const: mediatek,mt7986-afe + then: + properties: + clocks: + items: + - description: audio bus clock + - description: audio 26M clock + - description: audio intbus clock + - description: audio hopping clock + - description: audio pll clock + clock-names: + items: + - const: bus_ck + - const: 26m_ck + - const: l_ck + - const: aud_ck + - const: eg2_ck + + - if: + properties: + compatible: + contains: + const: mediatek,mt7981-afe + then: + properties: + clocks: + items: + - description: audio bus clock + - description: audio 26M clock + - description: audio intbus clock + - description: audio hopping clock + - description: audio pll clock + - description: mux for pcm_mck + clock-names: + items: + - const: bus_ck + - const: 26m_ck + - const: l_ck + - const: aud_ck + - const: eg2_ck + - const: sel + + - if: + properties: + compatible: + contains: + const: mediatek,mt7988-afe + then: + properties: + clocks: + items: + - description: audio bus clock + - description: audio 26M clock + - description: audio intbus clock + - description: audio hopping clock + - description: audio pll clock + - description: mux for pcm_mck + - description: audio i2s/pcm mck + clock-names: + items: + - const: bus_ck + - const: 26m_ck + - const: l_ck + - const: aud_ck + - const: eg2_ck + - const: sel + - const: i2s_m + +additionalProperties: false + +examples: + - | + #include <dt-bindings/interrupt-controller/arm-gic.h> + #include <dt-bindings/interrupt-controller/irq.h> + #include <dt-bindings/clock/mt7986-clk.h> + + afe@11210000 { + compatible = "mediatek,mt7986-afe"; + reg = <0x11210000 0x9000>; + interrupts = <GIC_SPI 106 IRQ_TYPE_LEVEL_HIGH>; + clocks = <&infracfg_ao CLK_INFRA_AUD_BUS_CK>, + <&infracfg_ao CLK_INFRA_AUD_26M_CK>, + <&infracfg_ao CLK_INFRA_AUD_L_CK>, + <&infracfg_ao CLK_INFRA_AUD_AUD_CK>, + <&infracfg_ao CLK_INFRA_AUD_EG2_CK>; + clock-names = "bus_ck", + "26m_ck", + "l_ck", + "aud_ck", + "eg2_ck"; + assigned-clocks = <&topckgen CLK_TOP_A1SYS_SEL>, + <&topckgen CLK_TOP_AUD_L_SEL>, + <&topckgen CLK_TOP_A_TUNER_SEL>; + assigned-clock-parents = <&topckgen CLK_TOP_APLL2_D4>, + <&apmixedsys CLK_APMIXED_APLL2>, + <&topckgen CLK_TOP_APLL2_D4>; + }; + +...
Signature · 1 line
2.18.0
Mark Brown
maintainerQuoted 10 lines · Maso Huang
Changes in v4:
- fix typo of authors and copyright
- refine with bitfield helper for readability [2/6]
- refine with human readable error message [3/6]
- use "mt7986-wm8960-sound" as compatible string [4/6] [5/6]
- refine properties based on reviewer's suggestions [5/6]
- remove assigned-clocks and assigned-clocks-parents [6/6]
- constrain clocks per variants [6/6][...]
Applied to
https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git for-next
Thanks!
[1/6] ASoC: mediatek: mt7986: add common header
commit: c4c3c32d088d5a432d3c40efef80d1b64743b6bc
[2/6] ASoC: mediatek: mt7986: support etdm in platform driver
commit: 9f8df795ae8daa0051fe15b27c7a3b3842d3d91f
[3/6] ASoC: mediatek: mt7986: add platform driver
commit: 8d0d4884ba2cdabc823dc263c987bb22aae5fa5e
[4/6] ASoC: mediatek: mt7986: add machine driver with wm8960
commit: 9873277fc2ea6e517602c29cb336bb1e43ff528c
[5/6] ASoC: dt-bindings: mediatek,mt7986-wm8960: add mt7986-wm8960 document
commit: af835f0b49777476528be5a913e5c00fc3789f41
[6/6] ASoC: dt-bindings: mediatek,mt7986-afe: add audio afe document
commit: b41efc224a5c859ce982ab73e8a05ecac73d4752All 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