Request for stable backport of sound quirk for Steam Deck
PATCH 1/1 Request for stable backport of sound quirk for Steam Deck
Hi Greg / Sasha (and everyone CCed here),
I'd like to please request the backport of the following commit to the stable branches 7.0.y, 6.18.y and 6.12.y:
b0f6f4ac7d5d ("ASoC: amd: acp: Add DMI quirk for Valve Steam Deck OLED")
I've tried myself, build-tested and all of them are working fine. I am including the backports I did for testing in this thread, in case you prefer (but last time I recall the suggestion was to just ask the backport providing the commit id, so here it is). The 6.12.y version has slight adjustment due to context, but no difference in code, etc.
Let me know if you have any questions, and thanks in advance! Cheers,
Guilherme
PATCH 1/1 ASoC: amd: acp: Add DMI quirk for Valve Steam Deck OLED
commit b0f6f4ac7d5d04fe2adcdd63ed1cd1ad505b8958 upstream.
Commit 671dd2ffbd8b ("ASoC: amd: acp: Add new cpu dai and dailink creation for I2S BT instance") introduced a change that "broke" Steam Deck's audio probe, in the OLED
model, as observed in the following dmesg snippet:
[...]snd_sof_amd_vangogh 0000:04:00.5: Topology: ABI 3:26:0 Kernel ABI 3:23:1sof_mach nau8821-max: ASoC: physical link acp-bt-codec (id 2) not existsof_mach nau8821-max: ASoC: topology: could not load header: -22snd_sof_amd_vangogh 0000:04:00.5: tplg amd/sof-tplg/sof-vangogh-nau8821-max.tplg component load failed -22 snd_sof_amd_vangogh 0000:04:00.5: error: failed to load DSP topology -22 snd_sof_amd_vangogh 0000:04:00.5: ASoC error (-22): at snd_soc_component_probe() on 0000:04:00.5 sof_mach nau8821-max: ASoC: failed to instantiate card -22sof_mach nau8821-max: error -EINVAL: Failed to register card(sof-nau8821-max)sof_mach nau8821-max: probe with driver sof_mach failed with error -22
[...]
Notice the quotes in "broke": it's not really a bug in such commit, but instead a problem with a topology file from Steam Deck OLED. This was discussed to great extent in [1], and Cristian proposed a pretty simple and functional change that resolved the issue for the Deck's issue. That change, though, would break other devices, so it wasn't accepted upstream. And the proper suggested solution (fix the topology) was never implemented, so Valve's kernel (and anyone that wants to boot the mainline on Steam Deck OLED) is carrying that fix downstream.
So, we propose hereby a different approach: a DMI quirk, as many already present in the sound drivers, to address this issue solely on Steam Deck OLED, not breaking other devices and as a bonus, allowing simple patch up in case eventually the topology file gets fixed (we'd just need to check against any DMI info reflecting that or the topology/FW versions).
The motivation of such upstream quirk is related to users that want to test latest kernel trees on their devices and get no only non-working sound device, but seems some games (like Ori and the Blind Forest) can't properly work without a proper functional audio device. Example of such report can be seen at [2].
--- sound/soc/amd/acp/acp-legacy-mach.c | 2 +- sound/soc/amd/acp/acp-mach-common.c | 22 +++++++++++++++++++--- sound/soc/amd/acp/acp-mach.h | 4 ++++ sound/soc/amd/acp/acp-sof-mach.c | 2 +- 4 files changed, 25 insertions(+), 5 deletions(-)
sound/soc/amd/acp/acp-legacy-mach.c +1 -1
@@ -174,7 +174,7 @@ static int acp_asoc_probe(struct platform_device *pdev) acp_card_drvdata->platform = *((int *)dev->platform_data); dmi_id =dmi_first_match (acp_quirk_table); -if (dmi_id && dmi_id->driver_data) +if (dmi_id && dmi_id->driver_data == (void *)QUIRK_TDM_MODE_ENABLE ) acp_card_drvdata->tdm_mode = dmi_id->driver_data; ret =acp_legacy_dai_links_create (card);
sound/soc/amd/acp/acp-mach-common.c +19 -3
@@ -20,6 +20,7 @@#include <sound/soc.h> #include <linux/input.h> #include <linux/module.h> +#include <linux/dmi.h> #include "../../codecs/rt5682.h" #include "../../codecs/rt1019.h"
@@ -37,15 +38,21 @@#define NAU8821_FREQ_OUT 12288000#define MAX98388_CODEC_DAI "max98388-aif1" -#define TDM_MODE_ENABLE 1 -const struct dmi_system_id acp_quirk_table[] = { {/* Google skyrim proto-0 */ .matches = {DMI_EXACT_MATCH (DMI_PRODUCT_FAMILY ,"Google_Skyrim" ), }, - .driver_data = (void *)TDM_MODE_ENABLE , + .driver_data = (void *)QUIRK_TDM_MODE_ENABLE , + }, + { +/* Valve Steam Deck OLED */ + .matches = { +DMI_MATCH (DMI_SYS_VENDOR ,"Valve" ), +DMI_MATCH (DMI_PRODUCT_NAME ,"Galileo" ), + }, + .driver_data = (void *)QUIRK_REMAP_DMIC_BT , }, {} };
@@ -1385,6 +1392,7 @@ int acp_sofdsp_dai_links_create(struct snd_soc_card *card)struct snd_soc_dai_link *links;struct device *dev = card->dev;struct acp_card_drvdata *drv_data = card->drvdata; +const struct dmi_system_id *dmi_id =dmi_first_match (acp_quirk_table);int i =0 , num_links =0 ;if (drv_data->hs_cpu_id)
@@ -1562,6 +1570,9 @@ int acp_sofdsp_dai_links_create(struct snd_soc_card *card) links[i].codecs = &snd_soc_dummy_dlc; links[i].num_codecs =1 ; } + +if (dmi_id && dmi_id->driver_data == (void *)QUIRK_REMAP_DMIC_BT ) + links[i].id =DMIC_BE_ID ; i++; }
@@ -1577,6 +1588,11 @@ int acp_sofdsp_dai_links_create(struct snd_soc_card *card) links[i].dpcm_capture =1 ; links[i].nonatomic = true; links[i].no_pcm =1 ; + +if (dmi_id && dmi_id->driver_data == (void *)QUIRK_REMAP_DMIC_BT ) { + links[i].id =BT_BE_ID ; +dev_dbg (dev,"quirk REMAP_DMIC_BT enabled\n" ); + } } card->dai_link = links;
sound/soc/amd/acp/acp-mach.h +4 -0
@@ -24,6 +24,10 @@#define acp_get_drvdata (card) ((struct acp_card_drvdata *)(card)->drvdata) +/* List of DMI quirks - check acp-mach-common.c for usage. */ +#define QUIRK_TDM_MODE_ENABLE 1 +#define QUIRK_REMAP_DMIC_BT 2 +enum be_id {HEADSET_BE_ID =0 ,AMP_BE_ID ,
sound/soc/amd/acp/acp-sof-mach.c +1 -1
@@ -113,7 +113,7 @@ static int acp_sof_probe(struct platform_device *pdev) acp_card_drvdata = card->drvdata; dmi_id =dmi_first_match (acp_quirk_table); -if (dmi_id && dmi_id->driver_data) +if (dmi_id && dmi_id->driver_data == (void *)QUIRK_TDM_MODE_ENABLE ) acp_card_drvdata->tdm_mode = dmi_id->driver_data; ret =acp_sofdsp_dai_links_create (card);
Signature · 1 line
2.50.1
PATCH 1/1 ASoC: amd: acp: Add DMI quirk for Valve Steam Deck OLED
In reply to Guilherme G. Piccolicommit b0f6f4ac7d5d04fe2adcdd63ed1cd1ad505b8958 upstream.
Commit 671dd2ffbd8b ("ASoC: amd: acp: Add new cpu dai and dailink creation for I2S BT instance") introduced a change that "broke" Steam Deck's audio probe, in the OLED
model, as observed in the following dmesg snippet:
[...]snd_sof_amd_vangogh 0000:04:00.5: Topology: ABI 3:26:0 Kernel ABI 3:23:1sof_mach nau8821-max: ASoC: physical link acp-bt-codec (id 2) not existsof_mach nau8821-max: ASoC: topology: could not load header: -22snd_sof_amd_vangogh 0000:04:00.5: tplg amd/sof-tplg/sof-vangogh-nau8821-max.tplg component load failed -22 snd_sof_amd_vangogh 0000:04:00.5: error: failed to load DSP topology -22 snd_sof_amd_vangogh 0000:04:00.5: ASoC error (-22): at snd_soc_component_probe() on 0000:04:00.5 sof_mach nau8821-max: ASoC: failed to instantiate card -22sof_mach nau8821-max: error -EINVAL: Failed to register card(sof-nau8821-max)sof_mach nau8821-max: probe with driver sof_mach failed with error -22
[...]
Notice the quotes in "broke": it's not really a bug in such commit, but instead a problem with a topology file from Steam Deck OLED. This was discussed to great extent in [1], and Cristian proposed a pretty simple and functional change that resolved the issue for the Deck's issue. That change, though, would break other devices, so it wasn't accepted upstream. And the proper suggested solution (fix the topology) was never implemented, so Valve's kernel (and anyone that wants to boot the mainline on Steam Deck OLED) is carrying that fix downstream.
So, we propose hereby a different approach: a DMI quirk, as many already present in the sound drivers, to address this issue solely on Steam Deck OLED, not breaking other devices and as a bonus, allowing simple patch up in case eventually the topology file gets fixed (we'd just need to check against any DMI info reflecting that or the topology/FW versions).
The motivation of such upstream quirk is related to users that want to test latest kernel trees on their devices and get no only non-working sound device, but seems some games (like Ori and the Blind Forest) can't properly work without a proper functional audio device. Example of such report can be seen at [2].
--- sound/soc/amd/acp/acp-legacy-mach.c | 2 +- sound/soc/amd/acp/acp-mach-common.c | 22 +++++++++++++++++++--- sound/soc/amd/acp/acp-mach.h | 4 ++++ sound/soc/amd/acp/acp-sof-mach.c | 2 +- 4 files changed, 25 insertions(+), 5 deletions(-)
sound/soc/amd/acp/acp-legacy-mach.c +1 -1
@@ -174,7 +174,7 @@ static int acp_asoc_probe(struct platform_device *pdev) acp_card_drvdata->acp_rev = mach->mach_params.subsystem_rev; dmi_id =dmi_first_match (acp_quirk_table); -if (dmi_id && dmi_id->driver_data) +if (dmi_id && dmi_id->driver_data == (void *)QUIRK_TDM_MODE_ENABLE ) acp_card_drvdata->tdm_mode = dmi_id->driver_data; ret =acp_legacy_dai_links_create (card);
sound/soc/amd/acp/acp-mach-common.c +19 -3
@@ -20,6 +20,7 @@#include <sound/soc.h> #include <linux/input.h> #include <linux/module.h> +#include <linux/dmi.h> #include "../../codecs/rt5682.h" #include "../../codecs/rt1019.h"
@@ -37,15 +38,21 @@#define NAU8821_FREQ_OUT 12288000#define MAX98388_CODEC_DAI "max98388-aif1" -#define TDM_MODE_ENABLE 1 -const struct dmi_system_id acp_quirk_table[] = { {/* Google skyrim proto-0 */ .matches = {DMI_EXACT_MATCH (DMI_PRODUCT_FAMILY ,"Google_Skyrim" ), }, - .driver_data = (void *)TDM_MODE_ENABLE , + .driver_data = (void *)QUIRK_TDM_MODE_ENABLE , + }, + { +/* Valve Steam Deck OLED */ + .matches = { +DMI_MATCH (DMI_SYS_VENDOR ,"Valve" ), +DMI_MATCH (DMI_PRODUCT_NAME ,"Galileo" ), + }, + .driver_data = (void *)QUIRK_REMAP_DMIC_BT , }, {} };
@@ -1401,6 +1408,7 @@ int acp_sofdsp_dai_links_create(struct snd_soc_card *card)struct snd_soc_dai_link *links;struct device *dev = card->dev;struct acp_card_drvdata *drv_data = card->drvdata; +const struct dmi_system_id *dmi_id =dmi_first_match (acp_quirk_table);int i =0 , num_links =0 ;if (drv_data->hs_cpu_id)
@@ -1572,6 +1580,9 @@ int acp_sofdsp_dai_links_create(struct snd_soc_card *card) links[i].codecs = &snd_soc_dummy_dlc; links[i].num_codecs =1 ; } + +if (dmi_id && dmi_id->driver_data == (void *)QUIRK_REMAP_DMIC_BT ) + links[i].id =DMIC_BE_ID ; i++; }
@@ -1587,6 +1598,11 @@ int acp_sofdsp_dai_links_create(struct snd_soc_card *card) links[i].capture_only =1 ; links[i].nonatomic = true; links[i].no_pcm =1 ; + +if (dmi_id && dmi_id->driver_data == (void *)QUIRK_REMAP_DMIC_BT ) { + links[i].id =BT_BE_ID ; +dev_dbg (dev,"quirk REMAP_DMIC_BT enabled\n" ); + } } card->dai_link = links;
sound/soc/amd/acp/acp-mach.h +4 -0
@@ -26,6 +26,10 @@#define acp_get_drvdata (card) ((struct acp_card_drvdata *)(card)->drvdata) +/* List of DMI quirks - check acp-mach-common.c for usage. */ +#define QUIRK_TDM_MODE_ENABLE 1 +#define QUIRK_REMAP_DMIC_BT 2 +enum be_id {HEADSET_BE_ID =0 ,AMP_BE_ID ,
sound/soc/amd/acp/acp-sof-mach.c +1 -1
@@ -110,7 +110,7 @@ static int acp_sof_probe(struct platform_device *pdev) acp_card_drvdata = card->drvdata; dmi_id =dmi_first_match (acp_quirk_table); -if (dmi_id && dmi_id->driver_data) +if (dmi_id && dmi_id->driver_data == (void *)QUIRK_TDM_MODE_ENABLE ) acp_card_drvdata->tdm_mode = dmi_id->driver_data; acp_card_drvdata->acp_rev = mach->mach_params.subsystem_rev;
Signature · 1 line
2.50.1