Skip to content

Commit c736d64

Browse files
committed
ASoC: mediatek: Update MT8195 machine driver
Merge series from Trevor Wu <trevor.wu@mediatek.com>: This series of patches adds support for RT5682s headset codec in mt8195 machine drivers, and SOF support on card mt8195-mt6359-rt1019-rt5682 is also included. Patches are based on broonie tree "for-next" branch. Changes since v1: - remove patch3 and patch4 in v1 - add SOF support on card mt8195-mt6359-rt1012-rt5682 - add new propertes to dt-bindings for mt8195-mt6359-rt1019-rt5682 Trevor Wu (4): ASoC: mediatek: mt8195: add headset codec rt5682s support dt-bindings: mediatek: mt8195: add model property ASoC: mediatek: mt8195: add sof support on mt8195-mt6359-rt1019-rt5682 dt-bindings: mediatek: mt8195: add adsp and dai-link property .../sound/mt8195-mt6359-rt1011-rt5682.yaml | 4 + .../sound/mt8195-mt6359-rt1019-rt5682.yaml | 14 + sound/soc/mediatek/Kconfig | 2 + .../mt8195/mt8195-mt6359-rt1011-rt5682.c | 29 +- .../mt8195/mt8195-mt6359-rt1019-rt5682.c | 347 +++++++++++++++++- 5 files changed, 370 insertions(+), 26 deletions(-) -- 2.18.0
2 parents 7bef001 + 6182ec4 commit c736d64

5 files changed

Lines changed: 370 additions & 26 deletions

File tree

Documentation/devicetree/bindings/sound/mt8195-mt6359-rt1011-rt5682.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,10 @@ properties:
1616
compatible:
1717
const: mediatek,mt8195_mt6359_rt1011_rt5682
1818

19+
model:
20+
$ref: /schemas/types.yaml#/definitions/string
21+
description: User specified audio sound card name
22+
1923
mediatek,platform:
2024
$ref: "/schemas/types.yaml#/definitions/phandle"
2125
description: The phandle of MT8195 ASoC platform.

Documentation/devicetree/bindings/sound/mt8195-mt6359-rt1019-rt5682.yaml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,10 @@ properties:
1616
compatible:
1717
const: mediatek,mt8195_mt6359_rt1019_rt5682
1818

19+
model:
20+
$ref: /schemas/types.yaml#/definitions/string
21+
description: User specified audio sound card name
22+
1923
mediatek,platform:
2024
$ref: "/schemas/types.yaml#/definitions/phandle"
2125
description: The phandle of MT8195 ASoC platform.
@@ -28,6 +32,16 @@ properties:
2832
$ref: "/schemas/types.yaml#/definitions/phandle"
2933
description: The phandle of MT8195 HDMI codec node.
3034

35+
mediatek,adsp:
36+
$ref: "/schemas/types.yaml#/definitions/phandle"
37+
description: The phandle of MT8195 ADSP platform.
38+
39+
mediatek,dai-link:
40+
$ref: /schemas/types.yaml#/definitions/string-array
41+
description:
42+
A list of the desired dai-links in the sound card. Each entry is a
43+
name defined in the machine driver.
44+
3145
additionalProperties: false
3246

3347
required:

sound/soc/mediatek/Kconfig

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -205,6 +205,7 @@ config SND_SOC_MT8195_MT6359_RT1019_RT5682
205205
select SND_SOC_MT6359
206206
select SND_SOC_RT1015P
207207
select SND_SOC_RT5682_I2C
208+
select SND_SOC_RT5682S
208209
select SND_SOC_DMIC
209210
select SND_SOC_HDMI_CODEC
210211
help
@@ -220,6 +221,7 @@ config SND_SOC_MT8195_MT6359_RT1011_RT5682
220221
select SND_SOC_MT6359
221222
select SND_SOC_RT1011
222223
select SND_SOC_RT5682_I2C
224+
select SND_SOC_RT5682S
223225
select SND_SOC_DMIC
224226
select SND_SOC_HDMI_CODEC
225227
help

sound/soc/mediatek/mt8195/mt8195-mt6359-rt1011-rt5682.c

Lines changed: 22 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,9 @@
2727
#define RT5682_CODEC_DAI "rt5682-aif1"
2828
#define RT5682_DEV0_NAME "rt5682.2-001a"
2929

30+
#define RT5682S_CODEC_DAI "rt5682s-aif1"
31+
#define RT5682S_DEV0_NAME "rt5682s.2-001a"
32+
3033
struct mt8195_mt6359_rt1011_rt5682_priv {
3134
struct device_node *platform_node;
3235
struct device_node *hdmi_node;
@@ -691,14 +694,12 @@ SND_SOC_DAILINK_DEFS(ETDM1_IN_BE,
691694

692695
SND_SOC_DAILINK_DEFS(ETDM2_IN_BE,
693696
DAILINK_COMP_ARRAY(COMP_CPU("ETDM2_IN")),
694-
DAILINK_COMP_ARRAY(COMP_CODEC(RT5682_DEV0_NAME,
695-
RT5682_CODEC_DAI)),
697+
DAILINK_COMP_ARRAY(COMP_DUMMY()),
696698
DAILINK_COMP_ARRAY(COMP_EMPTY()));
697699

698700
SND_SOC_DAILINK_DEFS(ETDM1_OUT_BE,
699701
DAILINK_COMP_ARRAY(COMP_CPU("ETDM1_OUT")),
700-
DAILINK_COMP_ARRAY(COMP_CODEC(RT5682_DEV0_NAME,
701-
RT5682_CODEC_DAI)),
702+
DAILINK_COMP_ARRAY(COMP_DUMMY()),
702703
DAILINK_COMP_ARRAY(COMP_EMPTY()));
703704

704705
SND_SOC_DAILINK_DEFS(ETDM2_OUT_BE,
@@ -1046,9 +1047,19 @@ static int mt8195_mt6359_rt1011_rt5682_dev_probe(struct platform_device *pdev)
10461047
struct snd_soc_card *card = &mt8195_mt6359_rt1011_rt5682_soc_card;
10471048
struct snd_soc_dai_link *dai_link;
10481049
struct mt8195_mt6359_rt1011_rt5682_priv *priv;
1050+
int is5682s = 0;
10491051
int ret, i;
10501052

10511053
card->dev = &pdev->dev;
1054+
ret = snd_soc_of_parse_card_name(card, "model");
1055+
if (ret) {
1056+
dev_err(&pdev->dev, "%s new card name parsing error %d\n",
1057+
__func__, ret);
1058+
return ret;
1059+
}
1060+
1061+
if (strstr(card->name, "_5682s"))
1062+
is5682s = 1;
10521063

10531064
priv = devm_kzalloc(&pdev->dev, sizeof(*priv), GFP_KERNEL);
10541065
if (!priv)
@@ -1078,9 +1089,7 @@ static int mt8195_mt6359_rt1011_rt5682_dev_probe(struct platform_device *pdev)
10781089
dai_link->codecs->dai_name = "i2s-hifi";
10791090
dai_link->init = mt8195_dptx_codec_init;
10801091
}
1081-
}
1082-
1083-
if (strcmp(dai_link->name, "ETDM3_OUT_BE") == 0) {
1092+
} else if (strcmp(dai_link->name, "ETDM3_OUT_BE") == 0) {
10841093
priv->hdmi_node =
10851094
of_parse_phandle(pdev->dev.of_node,
10861095
"mediatek,hdmi-codec", 0);
@@ -1092,6 +1101,12 @@ static int mt8195_mt6359_rt1011_rt5682_dev_probe(struct platform_device *pdev)
10921101
dai_link->codecs->dai_name = "i2s-hifi";
10931102
dai_link->init = mt8195_hdmi_codec_init;
10941103
}
1104+
} else if (strcmp(dai_link->name, "ETDM1_OUT_BE") == 0 ||
1105+
strcmp(dai_link->name, "ETDM2_IN_BE") == 0) {
1106+
dai_link->codecs->name =
1107+
is5682s ? RT5682S_DEV0_NAME : RT5682_DEV0_NAME;
1108+
dai_link->codecs->dai_name =
1109+
is5682s ? RT5682S_CODEC_DAI : RT5682_CODEC_DAI;
10951110
}
10961111
}
10971112

0 commit comments

Comments
 (0)