Unverified Commit f7da8800 authored by Venkata Prasad Potturu's avatar Venkata Prasad Potturu Committed by Mark Brown
Browse files

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



Enable signed firmware loading for Vangogh platform using dmi quirks.

Signed-off-by: default avatarVenkata Prasad Potturu <venkataprasad.potturu@amd.com>
Link: https://lore.kernel.org/r/20230809123534.287707-3-venkataprasad.potturu@amd.com


Signed-off-by: default avatarMark Brown <broonie@kernel.org>
parent 6a69b724
Loading
Loading
Loading
Loading
+31 −0
Original line number Diff line number Diff line
@@ -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);
+3 −0
Original line number Diff line number Diff line
@@ -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
+6 −0
Original line number Diff line number Diff line
@@ -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;
}