Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Deepin-Kernel-SIG] [Upstream] [linux 6.6-y] ASoC: Sync some intel fixes from mainline #518

Merged
merged 3 commits into from
Dec 7, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 26 additions & 6 deletions sound/soc/sof/amd/acp-loader.c
Original file line number Diff line number Diff line change
Expand Up @@ -229,29 +229,49 @@ int acp_sof_load_signed_firmware(struct snd_sof_dev *sdev)
{
struct snd_sof_pdata *plat_data = sdev->pdata;
struct acp_dev_data *adata = plat_data->hw_pdata;
const char *fw_filename;
int ret;

ret = request_firmware(&sdev->basefw.fw, adata->fw_code_bin, sdev->dev);
fw_filename = kasprintf(GFP_KERNEL, "%s/%s",
plat_data->fw_filename_prefix,
adata->fw_code_bin);
if (!fw_filename)
return -ENOMEM;

ret = request_firmware(&sdev->basefw.fw, fw_filename, sdev->dev);
if (ret < 0) {
kfree(fw_filename);
dev_err(sdev->dev, "sof signed firmware code bin is missing\n");
return ret;
} else {
dev_dbg(sdev->dev, "request_firmware %s successful\n", adata->fw_code_bin);
dev_dbg(sdev->dev, "request_firmware %s successful\n", fw_filename);
}
kfree(fw_filename);

ret = snd_sof_dsp_block_write(sdev, SOF_FW_BLK_TYPE_IRAM, 0,
(void *)sdev->basefw.fw->data, sdev->basefw.fw->size);
(void *)sdev->basefw.fw->data,
sdev->basefw.fw->size);

fw_filename = kasprintf(GFP_KERNEL, "%s/%s",
plat_data->fw_filename_prefix,
adata->fw_data_bin);
if (!fw_filename)
return -ENOMEM;

ret = request_firmware(&adata->fw_dbin, adata->fw_data_bin, sdev->dev);
ret = request_firmware(&adata->fw_dbin, fw_filename, sdev->dev);
if (ret < 0) {
kfree(fw_filename);
dev_err(sdev->dev, "sof signed firmware data bin is missing\n");
return ret;

} else {
dev_dbg(sdev->dev, "request_firmware %s successful\n", adata->fw_data_bin);
dev_dbg(sdev->dev, "request_firmware %s successful\n", fw_filename);
}
kfree(fw_filename);

ret = snd_sof_dsp_block_write(sdev, SOF_FW_BLK_TYPE_DRAM, 0,
(void *)adata->fw_dbin->data, adata->fw_dbin->size);
(void *)adata->fw_dbin->data,
adata->fw_dbin->size);
return ret;
}
EXPORT_SYMBOL_NS(acp_sof_load_signed_firmware, SND_SOC_SOF_AMD_COMMON);
7 changes: 2 additions & 5 deletions sound/soc/sof/amd/acp.c
Original file line number Diff line number Diff line change
Expand Up @@ -494,7 +494,6 @@ 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;
Expand Down Expand Up @@ -562,17 +561,15 @@ int amd_sof_acp_probe(struct snd_sof_dev *sdev)
dmi_id = dmi_first_match(acp_sof_quirk_table);
if (dmi_id && dmi_id->driver_data) {
adata->fw_code_bin = devm_kasprintf(sdev->dev, GFP_KERNEL,
"%s/sof-%s-code.bin",
plat_data->fw_filename_prefix,
"sof-%s-code.bin",
chip->name);
if (!adata->fw_code_bin) {
ret = -ENOMEM;
goto free_ipc_irq;
}

adata->fw_data_bin = devm_kasprintf(sdev->dev, GFP_KERNEL,
"%s/sof-%s-data.bin",
plat_data->fw_filename_prefix,
"sof-%s-data.bin",
chip->name);
if (!adata->fw_data_bin) {
ret = -ENOMEM;
Expand Down
22 changes: 22 additions & 0 deletions sound/soc/sof/core.c
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,28 @@ void sof_set_fw_state(struct snd_sof_dev *sdev, enum sof_fw_state new_state)
}
EXPORT_SYMBOL(sof_set_fw_state);

static struct snd_sof_of_mach *sof_of_machine_select(struct snd_sof_dev *sdev)
{
struct snd_sof_pdata *sof_pdata = sdev->pdata;
const struct sof_dev_desc *desc = sof_pdata->desc;
struct snd_sof_of_mach *mach = desc->of_machines;

if (!mach)
return NULL;

for (; mach->compatible; mach++) {
if (of_machine_is_compatible(mach->compatible)) {
sof_pdata->tplg_filename = mach->sof_tplg_filename;
if (mach->fw_filename)
sof_pdata->fw_filename = mach->fw_filename;

return mach;
}
}

return NULL;
}

/* SOF Driver enumeration */
static int sof_machine_check(struct snd_sof_dev *sdev)
{
Expand Down
10 changes: 8 additions & 2 deletions sound/soc/sof/ipc4-topology.c
Original file line number Diff line number Diff line change
Expand Up @@ -2999,8 +2999,14 @@ static int sof_ipc4_dai_config(struct snd_sof_dev *sdev, struct snd_sof_widget *
return 0;

if (pipeline->use_chain_dma) {
pipeline->msg.primary &= ~SOF_IPC4_GLB_CHAIN_DMA_LINK_ID_MASK;
pipeline->msg.primary |= SOF_IPC4_GLB_CHAIN_DMA_LINK_ID(data->dai_data);
/*
* Only configure the DMA Link ID for ChainDMA when this op is
* invoked with SOF_DAI_CONFIG_FLAGS_HW_PARAMS
*/
if (flags & SOF_DAI_CONFIG_FLAGS_HW_PARAMS) {
pipeline->msg.primary &= ~SOF_IPC4_GLB_CHAIN_DMA_LINK_ID_MASK;
pipeline->msg.primary |= SOF_IPC4_GLB_CHAIN_DMA_LINK_ID(data->dai_data);
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

WARNING: Prefer a maximum 75 chars per line (possible unwrapped commit description?)

}
return 0;
}

Expand Down
23 changes: 0 additions & 23 deletions sound/soc/sof/sof-of-dev.c
Original file line number Diff line number Diff line change
Expand Up @@ -41,29 +41,6 @@ static void sof_of_probe_complete(struct device *dev)
pm_runtime_enable(dev);
}

struct snd_sof_of_mach *sof_of_machine_select(struct snd_sof_dev *sdev)
{
struct snd_sof_pdata *sof_pdata = sdev->pdata;
const struct sof_dev_desc *desc = sof_pdata->desc;
struct snd_sof_of_mach *mach = desc->of_machines;

if (!mach)
return NULL;

for (; mach->compatible; mach++) {
if (of_machine_is_compatible(mach->compatible)) {
sof_pdata->tplg_filename = mach->sof_tplg_filename;
if (mach->fw_filename)
sof_pdata->fw_filename = mach->fw_filename;

return mach;
}
}

return NULL;
}
EXPORT_SYMBOL(sof_of_machine_select);

int sof_of_probe(struct platform_device *pdev)
{
struct device *dev = &pdev->dev;
Expand Down
9 changes: 0 additions & 9 deletions sound/soc/sof/sof-of-dev.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,6 @@ struct snd_sof_of_mach {
const char *sof_tplg_filename;
};

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

WARNING: Prefer a maximum 75 chars per line (possible unwrapped commit description?)

#if IS_ENABLED(CONFIG_SND_SOC_SOF_OF_DEV)
struct snd_sof_of_mach *sof_of_machine_select(struct snd_sof_dev *sdev);
#else
static inline struct snd_sof_of_mach *sof_of_machine_select(struct snd_sof_dev *sdev)
{
return NULL;
}
#endif

extern const struct dev_pm_ops sof_of_pm;

int sof_of_probe(struct platform_device *pdev);
Expand Down
Loading