* [PATCH 0/2] ASoC: mediatek: mt8192-mt6359: support machine
@ 2022-03-01 7:29 Jiaxin Yu
2022-03-01 7:29 ` [PATCH 1/2] ASoC: dt-bindings: mt8192-mt6359: add new compatible for using rt1015p and rt5682 Jiaxin Yu
2022-03-01 7:29 ` [PATCH 2/2] ASoC: mediatek: mt8192: support rt1015p_rt5682s Jiaxin Yu
0 siblings, 2 replies; 6+ messages in thread
From: Jiaxin Yu @ 2022-03-01 7:29 UTC (permalink / raw)
To: broonie
Cc: robh+dt, matthias.bgg, trevor.wu, tzungbi, alsa-devel, devicetree,
linux-arm-kernel, linux-mediatek, linux-kernel,
Project_Global_Chrome_Upstream_Group, Jiaxin Yu
The series reuses mt8192-mt6359-rt1015-rt5682.c for supporting machine
driver with rt1015p speaker amplifier and rt5682s headset codec.
Jiaxin Yu (2):
ASoC: dt-bindings: mt8192-mt6359: add new compatible for using rt1015p
and rt5682
ASoC: mediatek: mt8192: support rt1015p_rt5682s
.../sound/mt8192-mt6359-rt1015-rt5682.yaml | 1 +
sound/soc/mediatek/Kconfig | 1 +
.../mt8192/mt8192-mt6359-rt1015-rt5682.c | 87 +++++++++++++++++--
3 files changed, 84 insertions(+), 5 deletions(-)
--
2.18.0
^ permalink raw reply [flat|nested] 6+ messages in thread* [PATCH 1/2] ASoC: dt-bindings: mt8192-mt6359: add new compatible for using rt1015p and rt5682 2022-03-01 7:29 [PATCH 0/2] ASoC: mediatek: mt8192-mt6359: support machine Jiaxin Yu @ 2022-03-01 7:29 ` Jiaxin Yu 2022-03-01 7:29 ` [PATCH 2/2] ASoC: mediatek: mt8192: support rt1015p_rt5682s Jiaxin Yu 1 sibling, 0 replies; 6+ messages in thread From: Jiaxin Yu @ 2022-03-01 7:29 UTC (permalink / raw) To: broonie Cc: robh+dt, matthias.bgg, trevor.wu, tzungbi, alsa-devel, devicetree, linux-arm-kernel, linux-mediatek, linux-kernel, Project_Global_Chrome_Upstream_Group, Jiaxin Yu, Jiaxin Yu From: Jiaxin Yu <jiaxin.yu@mediatek.corp-partner.google.com> Adds new compatible string "mt8192_mt6359_rt1015p_rt5682s" for machines with rt1015p and rt5682s. Signed-off-by: Jiaxin Yu <jiaxin.yu@mediatek.com> --- .../devicetree/bindings/sound/mt8192-mt6359-rt1015-rt5682.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/Documentation/devicetree/bindings/sound/mt8192-mt6359-rt1015-rt5682.yaml b/Documentation/devicetree/bindings/sound/mt8192-mt6359-rt1015-rt5682.yaml index a781e7aaaa38..4b0b0478018a 100644 --- a/Documentation/devicetree/bindings/sound/mt8192-mt6359-rt1015-rt5682.yaml +++ b/Documentation/devicetree/bindings/sound/mt8192-mt6359-rt1015-rt5682.yaml @@ -18,6 +18,7 @@ properties: enum: - mediatek,mt8192_mt6359_rt1015_rt5682 - mediatek,mt8192_mt6359_rt1015p_rt5682 + - mediatek,mt8192_mt6359_rt1015p_rt5682s mediatek,platform: $ref: "/schemas/types.yaml#/definitions/phandle" -- 2.18.0 ^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH 2/2] ASoC: mediatek: mt8192: support rt1015p_rt5682s 2022-03-01 7:29 [PATCH 0/2] ASoC: mediatek: mt8192-mt6359: support machine Jiaxin Yu 2022-03-01 7:29 ` [PATCH 1/2] ASoC: dt-bindings: mt8192-mt6359: add new compatible for using rt1015p and rt5682 Jiaxin Yu @ 2022-03-01 7:29 ` Jiaxin Yu 2022-03-01 9:03 ` Tzung-Bi Shih 1 sibling, 1 reply; 6+ messages in thread From: Jiaxin Yu @ 2022-03-01 7:29 UTC (permalink / raw) To: broonie Cc: robh+dt, matthias.bgg, trevor.wu, tzungbi, alsa-devel, devicetree, linux-arm-kernel, linux-mediatek, linux-kernel, Project_Global_Chrome_Upstream_Group, Jiaxin Yu, Jiaxin Yu From: Jiaxin Yu <jiaxin.yu@mediatek.corp-partner.google.com> Supports machines with rt1015p and rt5682s. Uses new proposed compatible string "mt8192_mt6359_rt1015p_rt5682s". Signed-off-by: Jiaxin Yu <jiaxin.yu@mediatek.com> --- sound/soc/mediatek/Kconfig | 1 + .../mt8192/mt8192-mt6359-rt1015-rt5682.c | 87 +++++++++++++++++-- 2 files changed, 83 insertions(+), 5 deletions(-) diff --git a/sound/soc/mediatek/Kconfig b/sound/soc/mediatek/Kconfig index d515613a79da..cacfbab4262d 100644 --- a/sound/soc/mediatek/Kconfig +++ b/sound/soc/mediatek/Kconfig @@ -176,6 +176,7 @@ config SND_SOC_MT8192_MT6359_RT1015_RT5682 select SND_SOC_RT1015 select SND_SOC_RT1015P select SND_SOC_RT5682_I2C + select SND_SOC_RT5682S select SND_SOC_DMIC help This adds ASoC driver for Mediatek MT8192 boards diff --git a/sound/soc/mediatek/mt8192/mt8192-mt6359-rt1015-rt5682.c b/sound/soc/mediatek/mt8192/mt8192-mt6359-rt1015-rt5682.c index a606133951b7..17ca6db5cd64 100644 --- a/sound/soc/mediatek/mt8192/mt8192-mt6359-rt1015-rt5682.c +++ b/sound/soc/mediatek/mt8192/mt8192-mt6359-rt1015-rt5682.c @@ -31,6 +31,9 @@ #define RT5682_CODEC_DAI "rt5682-aif1" #define RT5682_DEV0_NAME "rt5682.1-001a" +#define RT5682S_CODEC_DAI "rt5682s-aif1" +#define RT5682S_DEV0_NAME "rt5682s.1-001a" + struct mt8192_mt6359_priv { struct snd_soc_jack headset_jack; struct snd_soc_jack hdmi_jack; @@ -632,18 +635,30 @@ SND_SOC_DAILINK_DEFS(i2s7, DAILINK_COMP_ARRAY(COMP_DUMMY()), DAILINK_COMP_ARRAY(COMP_EMPTY())); -SND_SOC_DAILINK_DEFS(i2s8, +SND_SOC_DAILINK_DEFS(i2s8_rt5682, DAILINK_COMP_ARRAY(COMP_CPU("I2S8")), DAILINK_COMP_ARRAY(COMP_CODEC(RT5682_DEV0_NAME, RT5682_CODEC_DAI)), DAILINK_COMP_ARRAY(COMP_EMPTY())); -SND_SOC_DAILINK_DEFS(i2s9, +SND_SOC_DAILINK_DEFS(i2s8_rt5682s, + DAILINK_COMP_ARRAY(COMP_CPU("I2S8")), + DAILINK_COMP_ARRAY(COMP_CODEC(RT5682S_DEV0_NAME, + RT5682S_CODEC_DAI)), + DAILINK_COMP_ARRAY(COMP_EMPTY())); + +SND_SOC_DAILINK_DEFS(i2s9_rt5682, DAILINK_COMP_ARRAY(COMP_CPU("I2S9")), DAILINK_COMP_ARRAY(COMP_CODEC(RT5682_DEV0_NAME, RT5682_CODEC_DAI)), DAILINK_COMP_ARRAY(COMP_EMPTY())); +SND_SOC_DAILINK_DEFS(i2s9_rt5682s, + DAILINK_COMP_ARRAY(COMP_CPU("I2S9")), + DAILINK_COMP_ARRAY(COMP_CODEC(RT5682S_DEV0_NAME, + RT5682S_CODEC_DAI)), + DAILINK_COMP_ARRAY(COMP_EMPTY())); + SND_SOC_DAILINK_DEFS(connsys_i2s, DAILINK_COMP_ARRAY(COMP_CPU("CONNSYS_I2S")), DAILINK_COMP_ARRAY(COMP_DUMMY()), @@ -961,7 +976,6 @@ static struct snd_soc_dai_link mt8192_mt6359_dai_links[] = { .ignore_suspend = 1, .init = mt8192_rt5682_init, .be_hw_params_fixup = mt8192_i2s_hw_params_fixup, - SND_SOC_DAILINK_REG(i2s8), .ops = &mt8192_rt5682_i2s_ops, }, { @@ -970,7 +984,6 @@ static struct snd_soc_dai_link mt8192_mt6359_dai_links[] = { .dpcm_playback = 1, .ignore_suspend = 1, .be_hw_params_fixup = mt8192_i2s_hw_params_fixup, - SND_SOC_DAILINK_REG(i2s9), .ops = &mt8192_rt5682_i2s_ops, }, { @@ -1100,6 +1113,19 @@ static struct snd_soc_card mt8192_mt6359_rt1015p_rt5682_card = { .num_dapm_routes = ARRAY_SIZE(mt8192_mt6359_rt1015p_rt5682_routes), }; +static struct snd_soc_card mt8192_mt6359_rt1015p_rt5682s_card = { + .name = "mt8192_mt6359_rt1015p_rt5682s", + .owner = THIS_MODULE, + .dai_link = mt8192_mt6359_dai_links, + .num_links = ARRAY_SIZE(mt8192_mt6359_dai_links), + .controls = mt8192_mt6359_rt1015p_rt5682_controls, + .num_controls = ARRAY_SIZE(mt8192_mt6359_rt1015p_rt5682_controls), + .dapm_widgets = mt8192_mt6359_rt1015p_rt5682_widgets, + .num_dapm_widgets = ARRAY_SIZE(mt8192_mt6359_rt1015p_rt5682_widgets), + .dapm_routes = mt8192_mt6359_rt1015p_rt5682_routes, + .num_dapm_routes = ARRAY_SIZE(mt8192_mt6359_rt1015p_rt5682_routes), +}; + static int mt8192_mt6359_dev_probe(struct platform_device *pdev) { struct snd_soc_card *card; @@ -1139,7 +1165,8 @@ static int mt8192_mt6359_dev_probe(struct platform_device *pdev) dai_link->platforms = i2s3_rt1015_platforms; dai_link->num_platforms = ARRAY_SIZE(i2s3_rt1015_platforms); - } else if (card == &mt8192_mt6359_rt1015p_rt5682_card) { + } else if (card == &mt8192_mt6359_rt1015p_rt5682_card || + card == &mt8192_mt6359_rt1015p_rt5682s_card) { dai_link->cpus = i2s3_rt1015p_cpus; dai_link->num_cpus = ARRAY_SIZE(i2s3_rt1015p_cpus); @@ -1150,6 +1177,52 @@ static int mt8192_mt6359_dev_probe(struct platform_device *pdev) dai_link->num_platforms = ARRAY_SIZE(i2s3_rt1015p_platforms); } + } else if (strcmp(dai_link->name, "I2S8") == 0) { + if (card == &mt8192_mt6359_rt1015_rt5682_card || + card == &mt8192_mt6359_rt1015p_rt5682_card) { + dai_link->cpus = i2s8_rt5682_cpus; + dai_link->num_cpus = + ARRAY_SIZE(i2s8_rt5682_cpus); + dai_link->codecs = i2s8_rt5682_codecs; + dai_link->num_codecs = + ARRAY_SIZE(i2s8_rt5682_codecs); + dai_link->platforms = i2s8_rt5682_platforms; + dai_link->num_platforms = + ARRAY_SIZE(i2s8_rt5682_platforms); + } else if (card == &mt8192_mt6359_rt1015p_rt5682s_card) { + dai_link->cpus = i2s8_rt5682s_cpus; + dai_link->num_cpus = + ARRAY_SIZE(i2s8_rt5682s_cpus); + dai_link->codecs = i2s8_rt5682s_codecs; + dai_link->num_codecs = + ARRAY_SIZE(i2s8_rt5682s_codecs); + dai_link->platforms = i2s8_rt5682s_platforms; + dai_link->num_platforms = + ARRAY_SIZE(i2s8_rt5682s_platforms); + } + } else if (strcmp(dai_link->name, "I2S9") == 0) { + if (card == &mt8192_mt6359_rt1015_rt5682_card || + card == &mt8192_mt6359_rt1015p_rt5682_card) { + dai_link->cpus = i2s9_rt5682_cpus; + dai_link->num_cpus = + ARRAY_SIZE(i2s9_rt5682_cpus); + dai_link->codecs = i2s9_rt5682_codecs; + dai_link->num_codecs = + ARRAY_SIZE(i2s9_rt5682_codecs); + dai_link->platforms = i2s9_rt5682_platforms; + dai_link->num_platforms = + ARRAY_SIZE(i2s9_rt5682_platforms); + } else if (card == &mt8192_mt6359_rt1015p_rt5682s_card) { + dai_link->cpus = i2s9_rt5682s_cpus; + dai_link->num_cpus = + ARRAY_SIZE(i2s9_rt5682s_cpus); + dai_link->codecs = i2s9_rt5682s_codecs; + dai_link->num_codecs = + ARRAY_SIZE(i2s9_rt5682s_codecs); + dai_link->platforms = i2s9_rt5682s_platforms; + dai_link->num_platforms = + ARRAY_SIZE(i2s9_rt5682s_platforms); + } } if (hdmi_codec && strcmp(dai_link->name, "TDM") == 0) { @@ -1185,6 +1258,10 @@ static const struct of_device_id mt8192_mt6359_dt_match[] = { .compatible = "mediatek,mt8192_mt6359_rt1015p_rt5682", .data = &mt8192_mt6359_rt1015p_rt5682_card, }, + { + .compatible = "mediatek,mt8192_mt6359_rt1015p_rt5682s", + .data = &mt8192_mt6359_rt1015p_rt5682s_card, + }, {} }; #endif -- 2.18.0 ^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH 2/2] ASoC: mediatek: mt8192: support rt1015p_rt5682s 2022-03-01 7:29 ` [PATCH 2/2] ASoC: mediatek: mt8192: support rt1015p_rt5682s Jiaxin Yu @ 2022-03-01 9:03 ` Tzung-Bi Shih 2022-03-02 4:07 ` Jiaxin Yu 0 siblings, 1 reply; 6+ messages in thread From: Tzung-Bi Shih @ 2022-03-01 9:03 UTC (permalink / raw) To: Jiaxin Yu Cc: broonie, robh+dt, matthias.bgg, trevor.wu, alsa-devel, devicetree, linux-arm-kernel, linux-mediatek, linux-kernel, Project_Global_Chrome_Upstream_Group, Jiaxin Yu On Tue, Mar 01, 2022 at 03:29:24PM +0800, Jiaxin Yu wrote: > From: Jiaxin Yu <jiaxin.yu@mediatek.corp-partner.google.com> The environment didn't configure properly so that the header showed up. See [1]. [1]: https://git-scm.com/docs/git-send-email#Documentation/git-send-email.txt---fromltaddressgt > diff --git a/sound/soc/mediatek/mt8192/mt8192-mt6359-rt1015-rt5682.c b/sound/soc/mediatek/mt8192/mt8192-mt6359-rt1015-rt5682.c [...] > +static struct snd_soc_card mt8192_mt6359_rt1015p_rt5682s_card = { > + .name = "mt8192_mt6359_rt1015p_rt5682s", > + .owner = THIS_MODULE, > + .dai_link = mt8192_mt6359_dai_links, > + .num_links = ARRAY_SIZE(mt8192_mt6359_dai_links), > + .controls = mt8192_mt6359_rt1015p_rt5682_controls, > + .num_controls = ARRAY_SIZE(mt8192_mt6359_rt1015p_rt5682_controls), > + .dapm_widgets = mt8192_mt6359_rt1015p_rt5682_widgets, > + .num_dapm_widgets = ARRAY_SIZE(mt8192_mt6359_rt1015p_rt5682_widgets), > + .dapm_routes = mt8192_mt6359_rt1015p_rt5682_routes, > + .num_dapm_routes = ARRAY_SIZE(mt8192_mt6359_rt1015p_rt5682_routes), > +}; Are the two cards only different from names (mt8192_mt6359_rt1015p_rt5682_card vs. mt8192_mt6359_rt1015p_rt5682s_card)? > @@ -1150,6 +1177,52 @@ static int mt8192_mt6359_dev_probe(struct platform_device *pdev) > dai_link->num_platforms = > ARRAY_SIZE(i2s3_rt1015p_platforms); > } > + } else if (strcmp(dai_link->name, "I2S8") == 0) { > + if (card == &mt8192_mt6359_rt1015_rt5682_card || > + card == &mt8192_mt6359_rt1015p_rt5682_card) { > + dai_link->cpus = i2s8_rt5682_cpus; > + dai_link->num_cpus = > + ARRAY_SIZE(i2s8_rt5682_cpus); > + dai_link->codecs = i2s8_rt5682_codecs; > + dai_link->num_codecs = > + ARRAY_SIZE(i2s8_rt5682_codecs); > + dai_link->platforms = i2s8_rt5682_platforms; > + dai_link->num_platforms = > + ARRAY_SIZE(i2s8_rt5682_platforms); > + } else if (card == &mt8192_mt6359_rt1015p_rt5682s_card) { > + dai_link->cpus = i2s8_rt5682s_cpus; > + dai_link->num_cpus = > + ARRAY_SIZE(i2s8_rt5682s_cpus); > + dai_link->codecs = i2s8_rt5682s_codecs; > + dai_link->num_codecs = > + ARRAY_SIZE(i2s8_rt5682s_codecs); > + dai_link->platforms = i2s8_rt5682s_platforms; > + dai_link->num_platforms = > + ARRAY_SIZE(i2s8_rt5682s_platforms); > + } > + } else if (strcmp(dai_link->name, "I2S9") == 0) { > + if (card == &mt8192_mt6359_rt1015_rt5682_card || > + card == &mt8192_mt6359_rt1015p_rt5682_card) { > + dai_link->cpus = i2s9_rt5682_cpus; > + dai_link->num_cpus = > + ARRAY_SIZE(i2s9_rt5682_cpus); > + dai_link->codecs = i2s9_rt5682_codecs; > + dai_link->num_codecs = > + ARRAY_SIZE(i2s9_rt5682_codecs); > + dai_link->platforms = i2s9_rt5682_platforms; > + dai_link->num_platforms = > + ARRAY_SIZE(i2s9_rt5682_platforms); > + } else if (card == &mt8192_mt6359_rt1015p_rt5682s_card) { > + dai_link->cpus = i2s9_rt5682s_cpus; > + dai_link->num_cpus = > + ARRAY_SIZE(i2s9_rt5682s_cpus); > + dai_link->codecs = i2s9_rt5682s_codecs; > + dai_link->num_codecs = > + ARRAY_SIZE(i2s9_rt5682s_codecs); > + dai_link->platforms = i2s9_rt5682s_platforms; > + dai_link->num_platforms = > + ARRAY_SIZE(i2s9_rt5682s_platforms); > + } After seeing the code, I am starting to wonder if the reuse is overkill. If they (RT5682 vs. RT5682S) only have some minor differences, probably it could reuse more by: SND_SOC_DAILINK_DEFS(i2s8, ... SND_SOC_DAILINK_DEFS(i2s9, ... ... if (card == &mt8192_mt6359_rt1015p_rt5682s_card) { i2s8_codecs.name = RT5682S_DEV0_NAME; i2s8_codecs.dai_name = RT5682S_CODEC_DAI; ... } Or even uses of_device_is_compatible() if it would like to reuse the struct snd_soc_card. ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH 2/2] ASoC: mediatek: mt8192: support rt1015p_rt5682s 2022-03-01 9:03 ` Tzung-Bi Shih @ 2022-03-02 4:07 ` Jiaxin Yu 2022-03-03 5:16 ` Tzung-Bi Shih 0 siblings, 1 reply; 6+ messages in thread From: Jiaxin Yu @ 2022-03-02 4:07 UTC (permalink / raw) To: Tzung-Bi Shih Cc: broonie, robh+dt, matthias.bgg, trevor.wu, alsa-devel, devicetree, linux-arm-kernel, linux-mediatek, linux-kernel, Project_Global_Chrome_Upstream_Group, Jiaxin Yu On Tue, 2022-03-01 at 17:03 +0800, Tzung-Bi Shih wrote: > On Tue, Mar 01, 2022 at 03:29:24PM +0800, Jiaxin Yu wrote: > > From: Jiaxin Yu <jiaxin.yu@mediatek.corp-partner.google.com> > > The environment didn't configure properly so that the header showed > up. > See [1]. > > [1]: > https://git-scm.com/docs/git-send-email#Documentation/git-send-email.txt---fromltaddressgt > Ok, I will take a look at the "from: " header. > > diff --git a/sound/soc/mediatek/mt8192/mt8192-mt6359-rt1015- > > rt5682.c b/sound/soc/mediatek/mt8192/mt8192-mt6359-rt1015-rt5682.c > > [...] > > +static struct snd_soc_card mt8192_mt6359_rt1015p_rt5682s_card = { > > + .name = "mt8192_mt6359_rt1015p_rt5682s", > > + .owner = THIS_MODULE, > > + .dai_link = mt8192_mt6359_dai_links, > > + .num_links = ARRAY_SIZE(mt8192_mt6359_dai_links), > > + .controls = mt8192_mt6359_rt1015p_rt5682_controls, > > + .num_controls = > > ARRAY_SIZE(mt8192_mt6359_rt1015p_rt5682_controls), > > + .dapm_widgets = mt8192_mt6359_rt1015p_rt5682_widgets, > > + .num_dapm_widgets = > > ARRAY_SIZE(mt8192_mt6359_rt1015p_rt5682_widgets), > > + .dapm_routes = mt8192_mt6359_rt1015p_rt5682_routes, > > + .num_dapm_routes = > > ARRAY_SIZE(mt8192_mt6359_rt1015p_rt5682_routes), > > +}; > > Are the two cards only different from names > (mt8192_mt6359_rt1015p_rt5682_card vs. > mt8192_mt6359_rt1015p_rt5682s_card)? > Yes, they are only different form names. > > @@ -1150,6 +1177,52 @@ static int mt8192_mt6359_dev_probe(struct > > platform_device *pdev) > > dai_link->num_platforms = > > ARRAY_SIZE(i2s3_rt1015p_platfor > > ms); > > } > > + } else if (strcmp(dai_link->name, "I2S8") == 0) { > > + if (card == &mt8192_mt6359_rt1015_rt5682_card > > || > > + card == &mt8192_mt6359_rt1015p_rt5682_card) > > { > > + dai_link->cpus = i2s8_rt5682_cpus; > > + dai_link->num_cpus = > > + ARRAY_SIZE(i2s8_rt5682_cpus); > > + dai_link->codecs = i2s8_rt5682_codecs; > > + dai_link->num_codecs = > > + ARRAY_SIZE(i2s8_rt5682_codecs); > > + dai_link->platforms = > > i2s8_rt5682_platforms; > > + dai_link->num_platforms = > > + ARRAY_SIZE(i2s8_rt5682_platform > > s); > > + } else if (card == > > &mt8192_mt6359_rt1015p_rt5682s_card) { > > + dai_link->cpus = i2s8_rt5682s_cpus; > > + dai_link->num_cpus = > > + ARRAY_SIZE(i2s8_rt5682s_cpus); > > + dai_link->codecs = i2s8_rt5682s_codecs; > > + dai_link->num_codecs = > > + ARRAY_SIZE(i2s8_rt5682s_codecs) > > ; > > + dai_link->platforms = > > i2s8_rt5682s_platforms; > > + dai_link->num_platforms = > > + ARRAY_SIZE(i2s8_rt5682s_platfor > > ms); > > + } > > + } else if (strcmp(dai_link->name, "I2S9") == 0) { > > + if (card == &mt8192_mt6359_rt1015_rt5682_card > > || > > + card == &mt8192_mt6359_rt1015p_rt5682_card) > > { > > + dai_link->cpus = i2s9_rt5682_cpus; > > + dai_link->num_cpus = > > + ARRAY_SIZE(i2s9_rt5682_cpus); > > + dai_link->codecs = i2s9_rt5682_codecs; > > + dai_link->num_codecs = > > + ARRAY_SIZE(i2s9_rt5682_codecs); > > + dai_link->platforms = > > i2s9_rt5682_platforms; > > + dai_link->num_platforms = > > + ARRAY_SIZE(i2s9_rt5682_platform > > s); > > + } else if (card == > > &mt8192_mt6359_rt1015p_rt5682s_card) { > > + dai_link->cpus = i2s9_rt5682s_cpus; > > + dai_link->num_cpus = > > + ARRAY_SIZE(i2s9_rt5682s_cpus); > > + dai_link->codecs = i2s9_rt5682s_codecs; > > + dai_link->num_codecs = > > + ARRAY_SIZE(i2s9_rt5682s_codecs) > > ; > > + dai_link->platforms = > > i2s9_rt5682s_platforms; > > + dai_link->num_platforms = > > + ARRAY_SIZE(i2s9_rt5682s_platfor > > ms); > > + } > > After seeing the code, I am starting to wonder if the reuse is > overkill. If > they (RT5682 vs. RT5682S) only have some minor differences, probably > it could > reuse more by: > > SND_SOC_DAILINK_DEFS(i2s8, ... > SND_SOC_DAILINK_DEFS(i2s9, ... > > ... > > if (card == &mt8192_mt6359_rt1015p_rt5682s_card) { > i2s8_codecs.name = RT5682S_DEV0_NAME; > i2s8_codecs.dai_name = RT5682S_CODEC_DAI; > ... > } > > Or even uses of_device_is_compatible() if it would like to reuse the > struct > snd_soc_card. If we reuse the struct snd_soc_card, the card .name will be same. Should I change the card .name through of_device_is_compatible()? Maybe like below: Remove rt5682x related words for snd_soc_card. static struct snd_soc_card mt8192_mt6359_rt1015p_card = { .owner = THIS_MODULE, .dai_link = mt8192_mt6359_dai_links, .num_links = ARRAY_SIZE(mt8192_mt6359_dai_links), .controls = mt8192_mt6359_rt1015p_controls, .num_controls = ARRAY_SIZE(mt8192_mt6359_rt1015p_controls), .dapm_widgets = mt8192_mt6359_rt1015p_widgets, .num_dapm_widgets = ARRAY_SIZE(mt8192_mt6359_rt1015p_widgets), .dapm_routes = mt8192_mt6359_rt1015p_routes, .num_dapm_routes = ARRAY_SIZE(mt8192_mt6359_rt1015p_routes), }; static const struct of_device_id mt8192_mt6359_dt_match[] = { { .compatible = "mediatek,mt8192_mt6359_rt1015_rt5682", .data = &mt8192_mt6359_rt1015_rt5682_card, }, { .compatible = "mediatek,mt8192_mt6359_rt1015p_rt5682", .data = &mt8192_mt6359_rt1015p_card, }, { .compatible = "mediatek,mt8192_mt6359_rt1015p_rt5682s", .data = &mt8192_mt6359_rt1015p_card, }, {} }; if (of_device_is_compatible(np, "mediatek, mt8192_mt6359_rt1015p_rt5682")) { card.name = "mt8192_mt6359_rt1015p_rt5682"; ... } else if (of_device_is_compatible(np, "mediatek, mt8192_mt6359_rt1015p_rt5682s")) { card.name = "mt8192_mt6359_rt1015p_rt5682s"; ... } ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH 2/2] ASoC: mediatek: mt8192: support rt1015p_rt5682s 2022-03-02 4:07 ` Jiaxin Yu @ 2022-03-03 5:16 ` Tzung-Bi Shih 0 siblings, 0 replies; 6+ messages in thread From: Tzung-Bi Shih @ 2022-03-03 5:16 UTC (permalink / raw) To: Jiaxin Yu Cc: broonie, robh+dt, matthias.bgg, trevor.wu, alsa-devel, devicetree, linux-arm-kernel, linux-mediatek, linux-kernel, Project_Global_Chrome_Upstream_Group, Jiaxin Yu On Wed, Mar 02, 2022 at 12:07:39PM +0800, Jiaxin Yu wrote: > On Tue, 2022-03-01 at 17:03 +0800, Tzung-Bi Shih wrote: > > After seeing the code, I am starting to wonder if the reuse is > > overkill. If > > they (RT5682 vs. RT5682S) only have some minor differences, probably > > it could > > reuse more by: > > > > SND_SOC_DAILINK_DEFS(i2s8, ... > > SND_SOC_DAILINK_DEFS(i2s9, ... > > > > ... > > > > if (card == &mt8192_mt6359_rt1015p_rt5682s_card) { > > i2s8_codecs.name = RT5682S_DEV0_NAME; > > i2s8_codecs.dai_name = RT5682S_CODEC_DAI; > > ... > > } > > > > Or even uses of_device_is_compatible() if it would like to reuse the > > struct > > snd_soc_card. > If we reuse the struct snd_soc_card, the card .name will be same. > Should I change the card .name through of_device_is_compatible()? Exactly yes. ^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2022-03-03 5:16 UTC | newest] Thread overview: 6+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2022-03-01 7:29 [PATCH 0/2] ASoC: mediatek: mt8192-mt6359: support machine Jiaxin Yu 2022-03-01 7:29 ` [PATCH 1/2] ASoC: dt-bindings: mt8192-mt6359: add new compatible for using rt1015p and rt5682 Jiaxin Yu 2022-03-01 7:29 ` [PATCH 2/2] ASoC: mediatek: mt8192: support rt1015p_rt5682s Jiaxin Yu 2022-03-01 9:03 ` Tzung-Bi Shih 2022-03-02 4:07 ` Jiaxin Yu 2022-03-03 5:16 ` Tzung-Bi Shih
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).