Skip to content

Commit 6e90d8f

Browse files
ASoC: Intel: sof_rt5682: override tplg and quirk data for tgl_max98373_rt5682
Below changes are done in this patch: 1) A Chrome System based on tgl_max98373_rt5682 has different SSP and tplg configurations. Using DMI data of this variant DUT, overiride quirk and tplg information. 2) Machine driver's platform data has a copy of acpi mach data. So, override tplg info on this platform data and use this tplg info while loading tplg binary. Updated sof pcm.c accordingly. Signed-off-by: Sathyanarayana Nujella <sathyanarayana.nujella@intel.com> Signed-off-by: Mac Chiang <mac.chiang@intel.com>
1 parent 9724bf0 commit 6e90d8f

2 files changed

Lines changed: 42 additions & 1 deletion

File tree

sound/soc/intel/boards/sof_rt5682.c

Lines changed: 36 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,12 +66,29 @@ struct sof_card_private {
6666
bool common_hdmi_codec_drv;
6767
};
6868

69+
const char *sof_override_tplg_name;
70+
6971
static int sof_rt5682_quirk_cb(const struct dmi_system_id *id)
7072
{
7173
sof_rt5682_quirk = (unsigned long)id->driver_data;
7274
return 1;
7375
}
74-
76+
static int sof_rt5682_tplg_cb(const struct dmi_system_id *id)
77+
{
78+
sof_override_tplg_name = (const char *)id->driver_data;
79+
return 1;
80+
}
81+
static const struct dmi_system_id sof_rt5682_tplg_table[] = {
82+
{
83+
.callback = sof_rt5682_tplg_cb,
84+
.matches = {
85+
DMI_MATCH(DMI_PRODUCT_FAMILY, "Google_Volteer"),
86+
DMI_MATCH(DMI_PRODUCT_NAME, "Terrador"),
87+
},
88+
.driver_data = (void *)("sof-tgl-max98373-rt5682-ssp2.tplg"),
89+
},
90+
{}
91+
};
7592
static const struct dmi_system_id sof_rt5682_quirk_table[] = {
7693
{
7794
.callback = sof_rt5682_quirk_cb,
@@ -119,6 +136,19 @@ static const struct dmi_system_id sof_rt5682_quirk_table[] = {
119136
.driver_data = (void *)(SOF_RT5682_MCLK_EN |
120137
SOF_RT5682_SSP_CODEC(0)),
121138
},
139+
{
140+
.callback = sof_rt5682_quirk_cb,
141+
.matches = {
142+
DMI_MATCH(DMI_PRODUCT_FAMILY, "Google_Volteer"),
143+
DMI_MATCH(DMI_PRODUCT_NAME, "Terrador"),
144+
},
145+
.driver_data = (void *)(SOF_RT5682_MCLK_EN |
146+
SOF_RT5682_SSP_CODEC(0) |
147+
SOF_SPEAKER_AMP_PRESENT |
148+
SOF_MAX98373_SPEAKER_AMP_PRESENT |
149+
SOF_RT5682_SSP_AMP(2) |
150+
SOF_RT5682_NUM_HDMIDEV(4)),
151+
},
122152
{}
123153
};
124154

@@ -734,6 +764,11 @@ static int sof_audio_probe(struct platform_device *pdev)
734764

735765
mach = pdev->dev.platform_data;
736766

767+
dmi_check_system(sof_rt5682_tplg_table);
768+
769+
if (sof_override_tplg_name)
770+
mach->sof_tplg_filename = sof_override_tplg_name;
771+
737772
/* A speaker amp might not be present when the quirk claims one is.
738773
* Detect this via whether the machine driver match includes quirk_data.
739774
*/

sound/soc/sof/pcm.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -756,6 +756,12 @@ static int sof_pcm_probe(struct snd_soc_component *component)
756756
struct snd_sof_pdata *plat_data = sdev->pdata;
757757
const char *tplg_filename;
758758
int ret;
759+
struct platform_device *pdev = plat_data->pdev_mach;
760+
struct snd_soc_acpi_mach *mach = pdev->dev.platform_data;
761+
762+
/* Machine drivers may override tplg file name */
763+
if (mach)
764+
plat_data->tplg_filename = mach->sof_tplg_filename;
759765

760766
/* load the default topology */
761767
sdev->component = component;

0 commit comments

Comments
 (0)