-
Notifications
You must be signed in to change notification settings - Fork 143
ASoC: Intel: Boards: cml_rt1011_rt5682: use statically define codec c… #2173
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -34,7 +34,6 @@ | |
| #define SOF_RT1011_SPEAKER_WR BIT(1) | ||
| #define SOF_RT1011_SPEAKER_TL BIT(2) | ||
| #define SOF_RT1011_SPEAKER_TR BIT(3) | ||
| #define SPK_CH 4 | ||
|
|
||
| /* Default: Woofer speakers */ | ||
| static unsigned long sof_rt1011_quirk = SOF_RT1011_SPEAKER_WL | | ||
|
|
@@ -376,10 +375,17 @@ SND_SOC_DAILINK_DEF(ssp0_codec, | |
|
|
||
| SND_SOC_DAILINK_DEF(ssp1_pin, | ||
| DAILINK_COMP_ARRAY(COMP_CPU("SSP1 Pin"))); | ||
| SND_SOC_DAILINK_DEF(ssp1_codec, | ||
| SND_SOC_DAILINK_DEF(ssp1_codec_2spk, | ||
| DAILINK_COMP_ARRAY( | ||
| /* WL */ COMP_CODEC("i2c-10EC1011:00", CML_RT1011_CODEC_DAI), | ||
| /* WR */ COMP_CODEC("i2c-10EC1011:01", CML_RT1011_CODEC_DAI))); | ||
| SND_SOC_DAILINK_DEF(ssp1_codec_4spk, | ||
| DAILINK_COMP_ARRAY( | ||
| /* WL */ COMP_CODEC("i2c-10EC1011:00", CML_RT1011_CODEC_DAI), | ||
| /* WR */ COMP_CODEC("i2c-10EC1011:01", CML_RT1011_CODEC_DAI), | ||
| /* TL */ COMP_CODEC("i2c-10EC1011:02", CML_RT1011_CODEC_DAI), | ||
| /* TR */ COMP_CODEC("i2c-10EC1011:03", CML_RT1011_CODEC_DAI))); | ||
|
|
||
fredoh9 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
| SND_SOC_DAILINK_DEF(dmic_pin, | ||
| DAILINK_COMP_ARRAY(COMP_CPU("DMIC01 Pin"))); | ||
|
|
@@ -475,7 +481,7 @@ static struct snd_soc_dai_link cml_rt1011_rt5682_dailink[] = { | |
| .no_pcm = 1, | ||
| .init = cml_rt1011_spk_init, | ||
| .ops = &cml_rt1011_ops, | ||
| SND_SOC_DAILINK_REG(ssp1_pin, ssp1_codec, platform), | ||
| SND_SOC_DAILINK_REG(ssp1_pin, ssp1_codec_2spk, platform), | ||
| }, | ||
| }; | ||
|
|
||
|
|
@@ -488,6 +494,15 @@ static struct snd_soc_codec_conf rt1011_conf[] = { | |
| .dlc = COMP_CODEC_CONF("i2c-10EC1011:01"), | ||
| .name_prefix = "WR", | ||
| }, | ||
| /* single configuration structure for 2 and 4 channels */ | ||
| { | ||
plbossart marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| .dlc = COMP_CODEC_CONF("i2c-10EC1011:02"), | ||
| .name_prefix = "TL", | ||
| }, | ||
| { | ||
| .dlc = COMP_CODEC_CONF("i2c-10EC1011:03"), | ||
| .name_prefix = "TR", | ||
| }, | ||
fredoh9 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| }; | ||
|
|
||
| /* Cometlake audio machine driver for RT1011 and RT5682 */ | ||
|
|
@@ -509,8 +524,7 @@ static struct snd_soc_card snd_soc_card_cml = { | |
|
|
||
| static int snd_cml_rt1011_probe(struct platform_device *pdev) | ||
| { | ||
| struct snd_soc_dai_link_component *rt1011_dais_components; | ||
| struct snd_soc_codec_conf *rt1011_dais_confs; | ||
| struct snd_soc_dai_link *dai_link; | ||
| struct card_private *ctx; | ||
| struct snd_soc_acpi_mach *mach; | ||
| const char *platform_name; | ||
|
|
@@ -527,67 +541,16 @@ static int snd_cml_rt1011_probe(struct platform_device *pdev) | |
|
|
||
| dmi_check_system(sof_rt1011_quirk_table); | ||
|
|
||
| dev_info(&pdev->dev, "sof_rt1011_quirk = %lx\n", sof_rt1011_quirk); | ||
| dev_dbg(&pdev->dev, "sof_rt1011_quirk = %lx\n", sof_rt1011_quirk); | ||
ranj063 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
| /* when 4 speaker is available, update codec config */ | ||
| if (sof_rt1011_quirk & (SOF_RT1011_SPEAKER_TL | | ||
| SOF_RT1011_SPEAKER_TR)) { | ||
| rt1011_dais_confs = devm_kzalloc(&pdev->dev, | ||
| sizeof(struct snd_soc_codec_conf) * | ||
| SPK_CH, GFP_KERNEL); | ||
|
|
||
| if (!rt1011_dais_confs) | ||
| return -ENOMEM; | ||
|
|
||
| rt1011_dais_components = devm_kzalloc(&pdev->dev, | ||
| sizeof(struct snd_soc_dai_link_component) * | ||
| SPK_CH, GFP_KERNEL); | ||
|
|
||
| if (!rt1011_dais_components) | ||
| return -ENOMEM; | ||
|
|
||
| for (i = 0; i < SPK_CH; i++) { | ||
| rt1011_dais_confs[i].dlc.name = devm_kasprintf(&pdev->dev, | ||
| GFP_KERNEL, | ||
| "i2c-10EC1011:0%d", | ||
| i); | ||
|
|
||
| if (!rt1011_dais_confs[i].dlc.name) | ||
| return -ENOMEM; | ||
|
|
||
| switch (i) { | ||
| case 0: | ||
| rt1011_dais_confs[i].name_prefix = "WL"; | ||
| break; | ||
| case 1: | ||
| rt1011_dais_confs[i].name_prefix = "WR"; | ||
| break; | ||
| case 2: | ||
| rt1011_dais_confs[i].name_prefix = "TL"; | ||
| break; | ||
| case 3: | ||
| rt1011_dais_confs[i].name_prefix = "TR"; | ||
| break; | ||
| default: | ||
| return -EINVAL; | ||
| } | ||
| rt1011_dais_components[i].name = devm_kasprintf(&pdev->dev, | ||
| GFP_KERNEL, | ||
| "i2c-10EC1011:0%d", | ||
| i); | ||
| if (!rt1011_dais_components[i].name) | ||
| return -ENOMEM; | ||
|
|
||
| rt1011_dais_components[i].dai_name = CML_RT1011_CODEC_DAI; | ||
| } | ||
|
|
||
| snd_soc_card_cml.codec_conf = rt1011_dais_confs; | ||
| snd_soc_card_cml.num_configs = SPK_CH; | ||
|
|
||
| for (i = 0; i < ARRAY_SIZE(cml_rt1011_rt5682_dailink); i++) { | ||
| for_each_card_prelinks(&snd_soc_card_cml, i, dai_link) { | ||
| if (!strcmp(cml_rt1011_rt5682_dailink[i].codecs->dai_name, | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. cml_rt1011_rt5682_dailink[i].codecs is an array, It is harmless, but I think using
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. yes, this will have to be a separate patch anyway though |
||
| CML_RT1011_CODEC_DAI)) { | ||
| cml_rt1011_rt5682_dailink[i].codecs = rt1011_dais_components; | ||
| cml_rt1011_rt5682_dailink[i].num_codecs = SPK_CH; | ||
| CML_RT1011_CODEC_DAI)) { | ||
| dai_link->codecs = ssp1_codec_4spk; | ||
| dai_link->num_codecs = ARRAY_SIZE(ssp1_codec_4spk); | ||
| } | ||
| } | ||
| } | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.