Commit f107ffca authored by Mark Brown's avatar Mark Brown

ASoC: SOF: amd: Skip IRAM/DRAM size modification

Merge series from Cristian Ciocaltea <cristian.ciocaltea@collabora.com>:

This patch series restores audio support on Valve's Steam Deck OLED model, which
broke after the recent introduction of ACP/PSP communication for IRAM/DRAM fence
register programming.
parents 37bee185 094d1176
...@@ -173,7 +173,7 @@ int acp_dsp_pre_fw_run(struct snd_sof_dev *sdev) ...@@ -173,7 +173,7 @@ int acp_dsp_pre_fw_run(struct snd_sof_dev *sdev)
adata = sdev->pdata->hw_pdata; adata = sdev->pdata->hw_pdata;
if (adata->signed_fw_image) if (adata->quirks && adata->quirks->signed_fw_image)
size_fw = adata->fw_bin_size - ACP_FIRMWARE_SIGNATURE; size_fw = adata->fw_bin_size - ACP_FIRMWARE_SIGNATURE;
else else
size_fw = adata->fw_bin_size; size_fw = adata->fw_bin_size;
......
...@@ -20,12 +20,15 @@ ...@@ -20,12 +20,15 @@
#include "acp.h" #include "acp.h"
#include "acp-dsp-offset.h" #include "acp-dsp-offset.h"
#define SECURED_FIRMWARE 1
static bool enable_fw_debug; static bool enable_fw_debug;
module_param(enable_fw_debug, bool, 0444); module_param(enable_fw_debug, bool, 0444);
MODULE_PARM_DESC(enable_fw_debug, "Enable Firmware debug"); MODULE_PARM_DESC(enable_fw_debug, "Enable Firmware debug");
static struct acp_quirk_entry quirk_valve_galileo = {
.signed_fw_image = true,
.skip_iram_dram_size_mod = true,
};
const struct dmi_system_id acp_sof_quirk_table[] = { const struct dmi_system_id acp_sof_quirk_table[] = {
{ {
/* Steam Deck OLED device */ /* Steam Deck OLED device */
...@@ -33,7 +36,7 @@ const struct dmi_system_id acp_sof_quirk_table[] = { ...@@ -33,7 +36,7 @@ const struct dmi_system_id acp_sof_quirk_table[] = {
DMI_MATCH(DMI_SYS_VENDOR, "Valve"), DMI_MATCH(DMI_SYS_VENDOR, "Valve"),
DMI_MATCH(DMI_PRODUCT_NAME, "Galileo"), DMI_MATCH(DMI_PRODUCT_NAME, "Galileo"),
}, },
.driver_data = (void *)SECURED_FIRMWARE, .driver_data = &quirk_valve_galileo,
}, },
{} {}
}; };
...@@ -254,7 +257,7 @@ int configure_and_run_sha_dma(struct acp_dev_data *adata, void *image_addr, ...@@ -254,7 +257,7 @@ int configure_and_run_sha_dma(struct acp_dev_data *adata, void *image_addr,
} }
} }
if (adata->signed_fw_image) if (adata->quirks && adata->quirks->signed_fw_image)
snd_sof_dsp_write(sdev, ACP_DSP_BAR, ACP_SHA_DMA_INCLUDE_HDR, ACP_SHA_HEADER); snd_sof_dsp_write(sdev, ACP_DSP_BAR, ACP_SHA_DMA_INCLUDE_HDR, ACP_SHA_HEADER);
snd_sof_dsp_write(sdev, ACP_DSP_BAR, ACP_SHA_DMA_STRT_ADDR, start_addr); snd_sof_dsp_write(sdev, ACP_DSP_BAR, ACP_SHA_DMA_STRT_ADDR, start_addr);
...@@ -278,7 +281,7 @@ int configure_and_run_sha_dma(struct acp_dev_data *adata, void *image_addr, ...@@ -278,7 +281,7 @@ int configure_and_run_sha_dma(struct acp_dev_data *adata, void *image_addr,
} }
/* psp_send_cmd only required for vangogh platform (rev - 5) */ /* psp_send_cmd only required for vangogh platform (rev - 5) */
if (desc->rev == 5) { if (desc->rev == 5 && !(adata->quirks && adata->quirks->skip_iram_dram_size_mod)) {
/* Modify IRAM and DRAM size */ /* Modify IRAM and DRAM size */
ret = psp_send_cmd(adata, MBOX_ACP_IRAM_DRAM_FENCE_COMMAND | IRAM_DRAM_FENCE_2); ret = psp_send_cmd(adata, MBOX_ACP_IRAM_DRAM_FENCE_COMMAND | IRAM_DRAM_FENCE_2);
if (ret) if (ret)
...@@ -738,9 +741,11 @@ int amd_sof_acp_probe(struct snd_sof_dev *sdev) ...@@ -738,9 +741,11 @@ int amd_sof_acp_probe(struct snd_sof_dev *sdev)
sdev->debug_box.offset = sdev->host_box.offset + sdev->host_box.size; sdev->debug_box.offset = sdev->host_box.offset + sdev->host_box.size;
sdev->debug_box.size = BOX_SIZE_1024; sdev->debug_box.size = BOX_SIZE_1024;
adata->signed_fw_image = false;
dmi_id = dmi_first_match(acp_sof_quirk_table); dmi_id = dmi_first_match(acp_sof_quirk_table);
if (dmi_id && dmi_id->driver_data) { if (dmi_id) {
adata->quirks = dmi_id->driver_data;
if (adata->quirks->signed_fw_image) {
adata->fw_code_bin = devm_kasprintf(sdev->dev, GFP_KERNEL, adata->fw_code_bin = devm_kasprintf(sdev->dev, GFP_KERNEL,
"sof-%s-code.bin", "sof-%s-code.bin",
chip->name); chip->name);
...@@ -756,8 +761,7 @@ int amd_sof_acp_probe(struct snd_sof_dev *sdev) ...@@ -756,8 +761,7 @@ int amd_sof_acp_probe(struct snd_sof_dev *sdev)
ret = -ENOMEM; ret = -ENOMEM;
goto free_ipc_irq; goto free_ipc_irq;
} }
}
adata->signed_fw_image = dmi_id->driver_data;
} }
adata->enable_fw_debug = enable_fw_debug; adata->enable_fw_debug = enable_fw_debug;
......
...@@ -207,6 +207,11 @@ struct sof_amd_acp_desc { ...@@ -207,6 +207,11 @@ struct sof_amd_acp_desc {
u64 sdw_acpi_dev_addr; u64 sdw_acpi_dev_addr;
}; };
struct acp_quirk_entry {
bool signed_fw_image;
bool skip_iram_dram_size_mod;
};
/* Common device data struct for ACP devices */ /* Common device data struct for ACP devices */
struct acp_dev_data { struct acp_dev_data {
struct snd_sof_dev *dev; struct snd_sof_dev *dev;
...@@ -236,7 +241,7 @@ struct acp_dev_data { ...@@ -236,7 +241,7 @@ struct acp_dev_data {
u8 *data_buf; u8 *data_buf;
dma_addr_t sram_dma_addr; dma_addr_t sram_dma_addr;
u8 *sram_data_buf; u8 *sram_data_buf;
bool signed_fw_image; struct acp_quirk_entry *quirks;
struct dma_descriptor dscr_info[ACP_MAX_DESC]; struct dma_descriptor dscr_info[ACP_MAX_DESC];
struct acp_dsp_stream stream_buf[ACP_MAX_STREAM]; struct acp_dsp_stream stream_buf[ACP_MAX_STREAM];
struct acp_dsp_stream *dtrace_stream; struct acp_dsp_stream *dtrace_stream;
......
...@@ -143,6 +143,7 @@ EXPORT_SYMBOL_NS(sof_vangogh_ops, SND_SOC_SOF_AMD_COMMON); ...@@ -143,6 +143,7 @@ EXPORT_SYMBOL_NS(sof_vangogh_ops, SND_SOC_SOF_AMD_COMMON);
int sof_vangogh_ops_init(struct snd_sof_dev *sdev) int sof_vangogh_ops_init(struct snd_sof_dev *sdev)
{ {
const struct dmi_system_id *dmi_id; const struct dmi_system_id *dmi_id;
struct acp_quirk_entry *quirks;
/* common defaults */ /* common defaults */
memcpy(&sof_vangogh_ops, &sof_acp_common_ops, sizeof(struct snd_sof_dsp_ops)); memcpy(&sof_vangogh_ops, &sof_acp_common_ops, sizeof(struct snd_sof_dsp_ops));
...@@ -151,8 +152,12 @@ int sof_vangogh_ops_init(struct snd_sof_dev *sdev) ...@@ -151,8 +152,12 @@ int sof_vangogh_ops_init(struct snd_sof_dev *sdev)
sof_vangogh_ops.num_drv = ARRAY_SIZE(vangogh_sof_dai); sof_vangogh_ops.num_drv = ARRAY_SIZE(vangogh_sof_dai);
dmi_id = dmi_first_match(acp_sof_quirk_table); dmi_id = dmi_first_match(acp_sof_quirk_table);
if (dmi_id && dmi_id->driver_data) if (dmi_id) {
quirks = dmi_id->driver_data;
if (quirks->signed_fw_image)
sof_vangogh_ops.load_firmware = acp_sof_load_signed_firmware; sof_vangogh_ops.load_firmware = acp_sof_load_signed_firmware;
}
return 0; return 0;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment