ASoC: mediatek: mt8192: support new machine rt1015p_rt5682
Subsystems (4)
cover ASoC: mediatek: mt8192: support new machine rt1015p_rt5682
The series supports new machines with rt1015p and rt5682. Reuses most of the code in mt8192-mt6359-rt1015-rt5682.c.
The first 3 patches refactor the existing mt8192-mt6359-rt1015-rt5682.c. For easier to support newly added components later.
The 4th patch fixes a typo in DT bindings document.
The 5th patch proposes a new compatible string "mt8192_mt6359_rt1015p_rt5682" for machines with rt1015p and rt5682.
The 6th patch reuses the existing machine driver to support machines with rt1015p and rt5682.
Tzung-Bi Shih (6):
ASoC: mediatek: mt8192: rename common symbols
ASoC: mediatek: mt8192: extract rt1015_rt5682 specific DAI link
ASoC: mediatek: mt8192: move rt1015_rt5682 specific data
ASoC: dt-bindings: mt8192-mt6359: fix typo in the example
ASoC: dt-bindings: mt8192-mt6359: add new compatible for using rt1015p
ASoC: mediatek: mt8192: support rt1015p_rt5682
.../sound/mt8192-mt6359-rt1015-rt5682.yaml | 6 +- sound/soc/mediatek/Kconfig | 1 + .../mt8192/mt8192-mt6359-rt1015-rt5682.c | 171 +++++++++++++----- 3 files changed, 129 insertions(+), 49 deletions(-)
Signature · 1 line
2.29.2.454.gaff20da3a2-goog
PATCH 1/6 ASoC: mediatek: mt8192: rename common symbols
Renames common symbols from "mt8192_mt6359_rt1015_rt5682" to "mt8192_mt6359".
They will share between a few machine drivers on MT8192 and MT6359 with some different audio components.
--- .../mt8192/mt8192-mt6359-rt1015-rt5682.c | 28 +++++++++---------- 1 file changed, 14 insertions(+), 14 deletions(-)
sound/soc/mediatek/mt8192/mt8192-mt6359-rt1015-rt5682.c +14 -14
@@ -631,7 +631,7 @@ SND_SOC_DAILINK_DEFS(tdm,DAILINK_COMP_ARRAY (COMP_DUMMY ()), DAILINK_COMP_ARRAY(COMP_EMPTY())); -static struct snd_soc_dai_link mt8192_mt6359_rt1015_rt5682_dai_links[] = { +static struct snd_soc_dai_link mt8192_mt6359_dai_links[] = {/* Front End DAI links */ { .name ="Playback_1" ,
@@ -986,8 +986,8 @@ static struct snd_soc_codec_conf rt1015_amp_conf[] = {static struct snd_soc_card mt8192_mt6359_rt1015_rt5682_soc_card = { .name ="mt8192_mt6359_rt1015_rt5682" , .owner =THIS_MODULE , - .dai_link = mt8192_mt6359_rt1015_rt5682_dai_links, - .num_links =ARRAY_SIZE (mt8192_mt6359_rt1015_rt5682_dai_links), + .dai_link = mt8192_mt6359_dai_links, + .num_links =ARRAY_SIZE (mt8192_mt6359_dai_links), .controls = mt8192_mt6359_rt1015_rt5682_controls, .num_controls =ARRAY_SIZE (mt8192_mt6359_rt1015_rt5682_controls), .dapm_widgets = mt8192_mt6359_rt1015_rt5682_widgets,
@@ -998,7 +998,7 @@ static struct snd_soc_card mt8192_mt6359_rt1015_rt5682_soc_card = { .num_configs = ARRAY_SIZE(rt1015_amp_conf), }; -static int mt8192_mt6359_rt1015_rt5682_dev_probe (struct platform_device *pdev) +static int mt8192_mt6359_dev_probe (struct platform_device *pdev) {struct snd_soc_card *card = &mt8192_mt6359_rt1015_rt5682_soc_card;struct device_node *platform_node;
@@ -1029,32 +1029,32 @@ static int mt8192_mt6359_rt1015_rt5682_dev_probe(struct platform_device *pdev) }#ifdef CONFIG_OF -static const struct of_device_id mt8192_mt6359_rt1015_rt5682_dt_match[] = { +static const struct of_device_id mt8192_mt6359_dt_match[] = { {.compatible ="mediatek,mt8192_mt6359_rt1015_rt5682" ,}, {} };#endif -static const struct dev_pm_ops mt8192_mt6359_rt1015_rt5682_pm_ops = { +static const struct dev_pm_ops mt8192_mt6359_pm_ops = { .poweroff = snd_soc_poweroff, .restore = snd_soc_resume, }; -static struct platform_driver mt8192_mt6359_rt1015_rt5682_driver = { +static struct platform_driver mt8192_mt6359_driver = { .driver = { - .name ="mt8192_mt6359_rt1015_rt5682" , + .name ="mt8192_mt6359" , #ifdef CONFIG_OF - .of_match_table = mt8192_mt6359_rt1015_rt5682_dt_match, + .of_match_table = mt8192_mt6359_dt_match, #endif - .pm = &mt8192_mt6359_rt1015_rt5682_pm_ops, + .pm = &mt8192_mt6359_pm_ops, }, - .probe = mt8192_mt6359_rt1015_rt5682_dev_probe, + .probe = mt8192_mt6359_dev_probe, }; -module_platform_driver (mt8192_mt6359_rt1015_rt5682_driver); +module_platform_driver (mt8192_mt6359_driver);/* Module information */ -MODULE_DESCRIPTION ("MT8192-MT6359-RT1015-RT5682 ALSA SoC machine driver" ); +MODULE_DESCRIPTION ("MT8192-MT6359 ALSA SoC machine driver" );MODULE_AUTHOR ("Jiaxin Yu <[email protected]>" );MODULE_LICENSE ("GPL v2" ); -MODULE_ALIAS ("mt8192_mt6359_rt1015_rt5682 soc card" ); +MODULE_ALIAS ("mt8192_mt6359 soc card" );
Signature · 1 line
2.29.2.454.gaff20da3a2-goog
PATCH 2/6 ASoC: mediatek: mt8192: extract rt1015_rt5682 specific DAI link
In reply to Tzung-Bi ShihExtracts rt1015_rt5682 specific DAI link from the common one. Fills the DAI link data according to of_match.
--- .../mt8192/mt8192-mt6359-rt1015-rt5682.c | 39 +++++++++++++++---- 1 file changed, 31 insertions(+), 8 deletions(-)
sound/soc/mediatek/mt8192/mt8192-mt6359-rt1015-rt5682.c +31 -8
@@ -9,6 +9,7 @@#include <linux/input.h> #include <linux/module.h> +#include <linux/of_device.h> #include <linux/pm_runtime.h> #include <sound/jack.h> #include <sound/pcm_params.h>
@@ -576,7 +577,7 @@ SND_SOC_DAILINK_DEFS(i2s2,DAILINK_COMP_ARRAY (COMP_DUMMY ()), DAILINK_COMP_ARRAY(COMP_EMPTY())); -SND_SOC_DAILINK_DEFS(i2s3, +SND_SOC_DAILINK_DEFS(i2s3_rt1015, DAILINK_COMP_ARRAY(COMP_CPU("I2S3")), DAILINK_COMP_ARRAY(COMP_CODEC(RT1015_DEV0_NAME, RT1015_CODEC_DAI),
@@ -894,8 +895,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 (i2s3), - .ops = &mt8192_rt1015_i2s_ops, }, { .name = "I2S5",
@@ -983,7 +982,7 @@ static struct snd_soc_codec_conf rt1015_amp_conf[] = { }, }; -static struct snd_soc_card mt8192_mt6359_rt1015_rt5682_soc_card = { +static struct snd_soc_card mt8192_mt6359_rt1015_rt5682_card = { .name ="mt8192_mt6359_rt1015_rt5682" , .owner =THIS_MODULE , .dai_link = mt8192_mt6359_dai_links,
@@ -1000,12 +999,11 @@ static struct snd_soc_card mt8192_mt6359_rt1015_rt5682_soc_card = {static int mt8192_mt6359_dev_probe (struct platform_device *pdev) { -struct snd_soc_card *card = &mt8192_mt6359_rt1015_rt5682_soc_card; +struct snd_soc_card *card;struct device_node *platform_node;int ret, i;struct snd_soc_dai_link *dai_link; - - card->dev = &pdev->dev; +const struct of_device_id *match; platform_node =of_parse_phandle (pdev->dev.of_node,"mediatek,platform" ,0 );
@@ -1014,7 +1012,29 @@ static int mt8192_mt6359_dev_probe(struct platform_device *pdev)return -EINVAL ; } + match =of_match_device (pdev->dev.driver->of_match_table, &pdev->dev); +if (!match || !match->data) +return -EINVAL ; + + card = (struct snd_soc_card *)match->data; + card->dev = &pdev->dev; +for_each_card_prelinks (card, i, dai_link) { +if (strcmp (dai_link->name,"I2S3" ) ==0 ) { +if (card == &mt8192_mt6359_rt1015_rt5682_card) { + dai_link->ops = &mt8192_rt1015_i2s_ops; + dai_link->cpus = i2s3_rt1015_cpus; + dai_link->num_cpus = +ARRAY_SIZE (i2s3_rt1015_cpus); + dai_link->codecs = i2s3_rt1015_codecs; + dai_link->num_codecs = +ARRAY_SIZE (i2s3_rt1015_codecs); + dai_link->platforms = i2s3_rt1015_platforms; + dai_link->num_platforms = +ARRAY_SIZE (i2s3_rt1015_platforms); + } + } +if (!dai_link->platforms->name) dai_link->platforms->of_node = platform_node; }
@@ -1030,7 +1050,10 @@ static int mt8192_mt6359_dev_probe(struct platform_device *pdev)#ifdef CONFIG_OF static const struct of_device_id mt8192_mt6359_dt_match[] = { - {.compatible ="mediatek,mt8192_mt6359_rt1015_rt5682" ,}, + { + .compatible ="mediatek,mt8192_mt6359_rt1015_rt5682" , + .data = &mt8192_mt6359_rt1015_rt5682_card, + }, {} };#endif
Signature · 1 line
2.29.2.454.gaff20da3a2-goog
PATCH 3/6 ASoC: mediatek: mt8192: move rt1015_rt5682 specific data
In reply to Tzung-Bi ShihMoves rt1015_rt5682 specific data right before the snd_soc_card definition for neat purpose.
--- .../mt8192/mt8192-mt6359-rt1015-rt5682.c | 50 +++++++++---------- 1 file changed, 25 insertions(+), 25 deletions(-)
sound/soc/mediatek/mt8192/mt8192-mt6359-rt1015-rt5682.c +25 -25
@@ -33,31 +33,6 @@static struct snd_soc_jack headset_jack; -static const struct snd_soc_dapm_widget -mt8192_mt6359_rt1015_rt5682_widgets[] = { -SND_SOC_DAPM_SPK ("Left Spk" ,NULL ), -SND_SOC_DAPM_SPK ("Right Spk" ,NULL ), -SND_SOC_DAPM_HP ("Headphone Jack" ,NULL ), -SND_SOC_DAPM_MIC ("Headset Mic" ,NULL ), -}; - -static const struct snd_soc_dapm_route mt8192_mt6359_rt1015_rt5682_routes[] = { -/* speaker */ - {"Left Spk" ,NULL ,"Left SPO" }, - {"Right Spk" ,NULL ,"Right SPO" }, -/* headset */ - {"Headphone Jack" ,NULL ,"HPOL" }, - {"Headphone Jack" ,NULL ,"HPOR" }, - {"IN1P" ,NULL ,"Headset Mic" }, -}; - -static const struct snd_kcontrol_new mt8192_mt6359_rt1015_rt5682_controls[] = { -SOC_DAPM_PIN_SWITCH ("Left Spk" ), -SOC_DAPM_PIN_SWITCH ("Right Spk" ), -SOC_DAPM_PIN_SWITCH ("Headphone Jack" ), -SOC_DAPM_PIN_SWITCH ("Headset Mic" ), -}; -static int mt8192_rt1015_i2s_hw_params (struct snd_pcm_substream *substream,struct snd_pcm_hw_params *params) {
@@ -971,6 +946,31 @@ static struct snd_soc_dai_link mt8192_mt6359_dai_links[] = { }, }; +static const struct snd_soc_dapm_widget +mt8192_mt6359_rt1015_rt5682_widgets[] = { +SND_SOC_DAPM_SPK ("Left Spk" ,NULL ), +SND_SOC_DAPM_SPK ("Right Spk" ,NULL ), +SND_SOC_DAPM_HP ("Headphone Jack" ,NULL ), +SND_SOC_DAPM_MIC ("Headset Mic" ,NULL ), +}; + +static const struct snd_soc_dapm_route mt8192_mt6359_rt1015_rt5682_routes[] = { +/* speaker */ + {"Left Spk" ,NULL ,"Left SPO" }, + {"Right Spk" ,NULL ,"Right SPO" }, +/* headset */ + {"Headphone Jack" ,NULL ,"HPOL" }, + {"Headphone Jack" ,NULL ,"HPOR" }, + {"IN1P" ,NULL ,"Headset Mic" }, +}; + +static const struct snd_kcontrol_new mt8192_mt6359_rt1015_rt5682_controls[] = { +SOC_DAPM_PIN_SWITCH ("Left Spk" ), +SOC_DAPM_PIN_SWITCH ("Right Spk" ), +SOC_DAPM_PIN_SWITCH ("Headphone Jack" ), +SOC_DAPM_PIN_SWITCH ("Headset Mic" ), +}; +static struct snd_soc_codec_conf rt1015_amp_conf[] = { { .dlc =COMP_CODEC_CONF (RT1015_DEV0_NAME ),
Signature · 1 line
2.29.2.454.gaff20da3a2-goog
PATCH 4/6 ASoC: dt-bindings: mt8192-mt6359: fix typo in the example
In reply to Tzung-Bi ShihBoth driver "sound/soc/mediatek/mt8192/mt8192-mt6359-rt1015-rt5682.c" and DT binding property use underscore version compatible string.
Fixes the typo in the example.
--- .../devicetree/bindings/sound/mt8192-mt6359-rt1015-rt5682.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
Documentation/devicetree/bindings/sound/mt8192-mt6359-rt1015-rt5682.yaml +1 -1
@@ -31,7 +31,7 @@ examples: - | sound: mt8192-sound { - compatible = "mediatek,mt8192-mt6359-rt1015-rt5682"; + compatible = "mediatek,mt8192_mt6359_rt1015_rt5682"; mediatek,platform = <&afe>; pinctrl-names = "aud_clk_mosi_off", "aud_clk_mosi_on";
Signature · 1 line
2.29.2.454.gaff20da3a2-goog
PATCH 5/6 ASoC: dt-bindings: mt8192-mt6359: add new compatible for using rt1015p
In reply to Tzung-Bi ShihAdds new compatible string "mt8192_mt6359_rt1015p_rt5682" for machines with rt1015p and rt5682.
--- .../bindings/sound/mt8192-mt6359-rt1015-rt5682.yaml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
Documentation/devicetree/bindings/sound/mt8192-mt6359-rt1015-rt5682.yaml +3 -1
@@ -15,7 +15,9 @@ description: properties: compatible: - const: mediatek,mt8192_mt6359_rt1015_rt5682 + enum: + - mediatek,mt8192_mt6359_rt1015_rt5682 + - mediatek,mt8192_mt6359_rt1015p_rt5682 mediatek,platform: $ref: "/schemas/types.yaml#/definitions/phandle"
Signature · 1 line
2.29.2.454.gaff20da3a2-goog
PATCH 6/6 ASoC: mediatek: mt8192: support rt1015p_rt5682
In reply to Tzung-Bi ShihSupports machines with rt1015p and rt5682. Uses new proposed compatible string "mt8192_mt6359_rt1015p_rt5682".
--- sound/soc/mediatek/Kconfig | 1 + .../mt8192/mt8192-mt6359-rt1015-rt5682.c | 54 +++++++++++++++++++ 2 files changed, 55 insertions(+)
sound/soc/mediatek/Kconfig +1 -0
@@ -175,6 +175,7 @@ config SND_SOC_MT8192_MT6359_RT1015_RT5682 depends on SND_SOC_MT8192 select SND_SOC_MT6359 select SND_SOC_RT1015 + select SND_SOC_RT1015P select SND_SOC_RT5682_I2C select SND_SOC_DMIC help
sound/soc/mediatek/mt8192/mt8192-mt6359-rt1015-rt5682.c +54 -0
78 lines not on this page · raw message
Signature · 1 line
2.29.2.454.gaff20da3a2-goog