ASoC: SOF: amd: Enable signed firmware image loading for Vangogh platform

Enable signed firmware loading for Vangogh platform using dmi quirks.

Signed-off-by: Venkata Prasad Potturu <venkataprasad.potturu@amd.com>
Link: https://lore.kernel.org/r/20230809123534.287707-3-venkataprasad.potturu@amd.com
Signed-off-by: Mark Brown <broonie@kernel.org>
This commit is contained in:
Venkata Prasad Potturu 2023-08-09 18:05:22 +05:30 committed by Mark Brown
parent 6a69b724b2
commit f7da88003c
No known key found for this signature in database
GPG key ID: 24D68B725D5487D0
3 changed files with 40 additions and 0 deletions

View file

@ -20,6 +20,22 @@
#include "acp.h"
#include "acp-dsp-offset.h"
#define SECURED_FIRMWARE 1
const struct dmi_system_id acp_sof_quirk_table[] = {
{
/* Valve Jupiter device */
.matches = {
DMI_MATCH(DMI_SYS_VENDOR, "Valve"),
DMI_MATCH(DMI_PRODUCT_NAME, "Galileo"),
DMI_MATCH(DMI_PRODUCT_FAMILY, "Sephiroth"),
},
.driver_data = (void *)SECURED_FIRMWARE,
},
{}
};
EXPORT_SYMBOL_GPL(acp_sof_quirk_table);
static int smn_write(struct pci_dev *dev, u32 smn_addr, u32 data)
{
pci_write_config_dword(dev, 0x60, smn_addr);
@ -468,8 +484,10 @@ EXPORT_SYMBOL_NS(amd_sof_acp_resume, SND_SOC_SOF_AMD_COMMON);
int amd_sof_acp_probe(struct snd_sof_dev *sdev)
{
struct pci_dev *pci = to_pci_dev(sdev->dev);
struct snd_sof_pdata *plat_data = sdev->pdata;
struct acp_dev_data *adata;
const struct sof_amd_acp_desc *chip;
const struct dmi_system_id *dmi_id;
unsigned int addr;
int ret;
@ -531,6 +549,19 @@ int amd_sof_acp_probe(struct snd_sof_dev *sdev)
sdev->debug_box.size = BOX_SIZE_1024;
adata->signed_fw_image = false;
dmi_id = dmi_first_match(acp_sof_quirk_table);
if (dmi_id && dmi_id->driver_data) {
adata->fw_code_bin = kasprintf(GFP_KERNEL, "%s/sof-%s-code.bin",
plat_data->fw_filename_prefix,
chip->name);
adata->fw_data_bin = kasprintf(GFP_KERNEL, "%s/sof-%s-data.bin",
plat_data->fw_filename_prefix,
chip->name);
adata->signed_fw_image = dmi_id->driver_data;
dev_dbg(sdev->dev, "fw_code_bin:%s, fw_data_bin:%s\n", adata->fw_code_bin,
adata->fw_data_bin);
}
acp_memory_init(sdev);
acp_dsp_stream_init(sdev);

View file

@ -11,6 +11,8 @@
#ifndef __SOF_AMD_ACP_H
#define __SOF_AMD_ACP_H
#include <linux/dmi.h>
#include "../sof-priv.h"
#include "../sof-audio.h"
@ -297,4 +299,5 @@ int acp_probes_register(struct snd_sof_dev *sdev);
void acp_probes_unregister(struct snd_sof_dev *sdev);
extern struct snd_soc_acpi_mach snd_soc_acpi_amd_vangogh_sof_machines[];
extern const struct dmi_system_id acp_sof_quirk_table[];
#endif

View file

@ -142,12 +142,18 @@ EXPORT_SYMBOL_NS(sof_vangogh_ops, SND_SOC_SOF_AMD_COMMON);
int sof_vangogh_ops_init(struct snd_sof_dev *sdev)
{
const struct dmi_system_id *dmi_id;
/* common defaults */
memcpy(&sof_vangogh_ops, &sof_acp_common_ops, sizeof(struct snd_sof_dsp_ops));
sof_vangogh_ops.drv = vangogh_sof_dai;
sof_vangogh_ops.num_drv = ARRAY_SIZE(vangogh_sof_dai);
dmi_id = dmi_first_match(acp_sof_quirk_table);
if (dmi_id && dmi_id->driver_data)
sof_vangogh_ops.load_firmware = acp_sof_load_signed_firmware;
return 0;
}