OSDN Git Service

ASoC: SOF: add path indirection to each IPC type
authorPierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Thu, 14 Apr 2022 18:48:04 +0000 (13:48 -0500)
committerMark Brown <broonie@kernel.org>
Tue, 19 Apr 2022 11:03:32 +0000 (12:03 +0100)
With the addition of the IPCv4, we need the ability to select
different paths for firmware and topologies.

First add an indirection. Follow-up patches will add mechanisms to
select a default IPC or override it.

No functionality change in this patch.

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Bard Liao <yung-chuan.liao@linux.intel.com>
Reviewed-by: Rander Wang <rander.wang@intel.com>
Reviewed-by: Péter Ujfalusi <peter.ujfalusi@linux.intel.com>
Link: https://lore.kernel.org/r/20220414184817.362215-3-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
15 files changed:
include/sound/sof.h
sound/soc/sof/amd/pci-rn.c
sound/soc/sof/imx/imx8.c
sound/soc/sof/imx/imx8m.c
sound/soc/sof/intel/bdw.c
sound/soc/sof/intel/byt.c
sound/soc/sof/intel/pci-apl.c
sound/soc/sof/intel/pci-cnl.c
sound/soc/sof/intel/pci-icl.c
sound/soc/sof/intel/pci-tgl.c
sound/soc/sof/intel/pci-tng.c
sound/soc/sof/mediatek/mt8195/mt8195.c
sound/soc/sof/sof-acpi-dev.c
sound/soc/sof/sof-of-dev.c
sound/soc/sof/sof-pci-dev.c

index 2658a38..69066fe 100644 (file)
@@ -125,8 +125,8 @@ struct sof_dev_desc {
        const char *nocodec_tplg_filename;
 
        /* defaults paths for firmware and topology files */
-       const char *default_fw_path;
-       const char *default_tplg_path;
+       const char *default_fw_path[SOF_IPC_TYPE_COUNT];
+       const char *default_tplg_path[SOF_IPC_TYPE_COUNT];
 
        /* default firmware name */
        const char *default_fw_filename;
index 392ffbd..e2dfe60 100644 (file)
@@ -54,8 +54,12 @@ static const struct sof_dev_desc renoir_desc = {
        .resindex_imr_base      = -1,
        .irqindex_host_ipc      = -1,
        .chip_info              = &renoir_chip_info,
-       .default_fw_path        = "amd/sof",
-       .default_tplg_path      = "amd/sof-tplg",
+       .default_fw_path = {
+               [SOF_IPC] = "amd/sof",
+       },
+       .default_tplg_path = {
+               [SOF_IPC] = "amd/sof-tplg",
+       },
        .default_fw_filename    = "sof-rn.ri",
        .nocodec_tplg_filename  = "sof-acp.tplg",
        .ops                    = &sof_renoir_ops,
index 825bd2b..d2c9e6d 100644 (file)
@@ -613,16 +613,24 @@ static const struct snd_sof_dsp_ops sof_imx8x_ops = {
 };
 
 static struct sof_dev_desc sof_of_imx8qxp_desc = {
-       .default_fw_path = "imx/sof",
-       .default_tplg_path = "imx/sof-tplg",
+       .default_fw_path = {
+               [SOF_IPC] = "imx/sof",
+       },
+       .default_tplg_path = {
+               [SOF_IPC] = "imx/sof-tplg",
+       },
        .default_fw_filename = "sof-imx8x.ri",
        .nocodec_tplg_filename = "sof-imx8-nocodec.tplg",
        .ops = &sof_imx8x_ops,
 };
 
 static struct sof_dev_desc sof_of_imx8qm_desc = {
-       .default_fw_path = "imx/sof",
-       .default_tplg_path = "imx/sof-tplg",
+       .default_fw_path = {
+               [SOF_IPC] = "imx/sof",
+       },
+       .default_tplg_path = {
+               [SOF_IPC] = "imx/sof-tplg",
+       },
        .default_fw_filename = "sof-imx8.ri",
        .nocodec_tplg_filename = "sof-imx8-nocodec.tplg",
        .ops = &sof_imx8_ops,
index 803d6be..7aa695a 100644 (file)
@@ -473,8 +473,12 @@ static const struct snd_sof_dsp_ops sof_imx8m_ops = {
 };
 
 static struct sof_dev_desc sof_of_imx8mp_desc = {
-       .default_fw_path = "imx/sof",
-       .default_tplg_path = "imx/sof-tplg",
+       .default_fw_path = {
+               [SOF_IPC] = "imx/sof",
+       },
+       .default_tplg_path = {
+               [SOF_IPC] = "imx/sof-tplg",
+       },
        .default_fw_filename = "sof-imx8m.ri",
        .nocodec_tplg_filename = "sof-imx8-nocodec.tplg",
        .ops = &sof_imx8m_ops,
index fb9682b..bc06f18 100644 (file)
@@ -646,8 +646,12 @@ static const struct sof_dev_desc sof_acpi_broadwell_desc = {
        .resindex_imr_base = -1,
        .irqindex_host_ipc = 0,
        .chip_info = &bdw_chip_info,
-       .default_fw_path = "intel/sof",
-       .default_tplg_path = "intel/sof-tplg",
+       .default_fw_path = {
+               [SOF_IPC] = "intel/sof",
+       },
+       .default_tplg_path = {
+               [SOF_IPC] = "intel/sof-tplg",
+       },
        .default_fw_filename = "sof-bdw.ri",
        .nocodec_tplg_filename = "sof-bdw-nocodec.tplg",
        .ops = &sof_bdw_ops,
index bb84a4a..5281509 100644 (file)
@@ -388,8 +388,12 @@ static const struct sof_dev_desc sof_acpi_baytrailcr_desc = {
        .resindex_imr_base = 2,
        .irqindex_host_ipc = 0,
        .chip_info = &byt_chip_info,
-       .default_fw_path = "intel/sof",
-       .default_tplg_path = "intel/sof-tplg",
+       .default_fw_path = {
+               [SOF_IPC] = "intel/sof",
+       },
+       .default_tplg_path = {
+               [SOF_IPC] = "intel/sof-tplg",
+       },
        .default_fw_filename = "sof-byt.ri",
        .nocodec_tplg_filename = "sof-byt-nocodec.tplg",
        .ops = &sof_byt_ops,
@@ -402,8 +406,12 @@ static const struct sof_dev_desc sof_acpi_baytrail_desc = {
        .resindex_imr_base = 2,
        .irqindex_host_ipc = 5,
        .chip_info = &byt_chip_info,
-       .default_fw_path = "intel/sof",
-       .default_tplg_path = "intel/sof-tplg",
+       .default_fw_path = {
+               [SOF_IPC] = "intel/sof",
+       },
+       .default_tplg_path = {
+               [SOF_IPC] = "intel/sof-tplg",
+       },
        .default_fw_filename = "sof-byt.ri",
        .nocodec_tplg_filename = "sof-byt-nocodec.tplg",
        .ops = &sof_byt_ops,
@@ -416,8 +424,12 @@ static const struct sof_dev_desc sof_acpi_cherrytrail_desc = {
        .resindex_imr_base = 2,
        .irqindex_host_ipc = 5,
        .chip_info = &cht_chip_info,
-       .default_fw_path = "intel/sof",
-       .default_tplg_path = "intel/sof-tplg",
+       .default_fw_path = {
+               [SOF_IPC] = "intel/sof",
+       },
+       .default_tplg_path = {
+               [SOF_IPC] = "intel/sof-tplg",
+       },
        .default_fw_filename = "sof-cht.ri",
        .nocodec_tplg_filename = "sof-cht-nocodec.tplg",
        .ops = &sof_cht_ops,
index a023b3c..802480a 100644 (file)
@@ -27,8 +27,12 @@ static const struct sof_dev_desc bxt_desc = {
        .resindex_imr_base      = -1,
        .irqindex_host_ipc      = -1,
        .chip_info = &apl_chip_info,
-       .default_fw_path = "intel/sof",
-       .default_tplg_path = "intel/sof-tplg",
+       .default_fw_path = {
+               [SOF_IPC] = "intel/sof",
+       },
+       .default_tplg_path = {
+               [SOF_IPC] = "intel/sof-tplg",
+       },
        .default_fw_filename = "sof-apl.ri",
        .nocodec_tplg_filename = "sof-apl-nocodec.tplg",
        .ops = &sof_apl_ops,
@@ -42,8 +46,12 @@ static const struct sof_dev_desc glk_desc = {
        .resindex_imr_base      = -1,
        .irqindex_host_ipc      = -1,
        .chip_info = &apl_chip_info,
-       .default_fw_path = "intel/sof",
-       .default_tplg_path = "intel/sof-tplg",
+       .default_fw_path = {
+               [SOF_IPC] = "intel/sof",
+       },
+       .default_tplg_path = {
+               [SOF_IPC] = "intel/sof-tplg",
+       },
        .default_fw_filename = "sof-glk.ri",
        .nocodec_tplg_filename = "sof-glk-nocodec.tplg",
        .ops = &sof_apl_ops,
index 40cf1cd..b8206a9 100644 (file)
@@ -28,8 +28,12 @@ static const struct sof_dev_desc cnl_desc = {
        .resindex_imr_base      = -1,
        .irqindex_host_ipc      = -1,
        .chip_info = &cnl_chip_info,
-       .default_fw_path = "intel/sof",
-       .default_tplg_path = "intel/sof-tplg",
+       .default_fw_path = {
+               [SOF_IPC] = "intel/sof",
+       },
+       .default_tplg_path = {
+               [SOF_IPC] = "intel/sof-tplg",
+       },
        .default_fw_filename = "sof-cnl.ri",
        .nocodec_tplg_filename = "sof-cnl-nocodec.tplg",
        .ops = &sof_cnl_ops,
@@ -44,8 +48,12 @@ static const struct sof_dev_desc cfl_desc = {
        .resindex_imr_base      = -1,
        .irqindex_host_ipc      = -1,
        .chip_info = &cnl_chip_info,
-       .default_fw_path = "intel/sof",
-       .default_tplg_path = "intel/sof-tplg",
+       .default_fw_path = {
+               [SOF_IPC] = "intel/sof",
+       },
+       .default_tplg_path = {
+               [SOF_IPC] = "intel/sof-tplg",
+       },
        .default_fw_filename = "sof-cfl.ri",
        .nocodec_tplg_filename = "sof-cnl-nocodec.tplg",
        .ops = &sof_cnl_ops,
@@ -60,8 +68,12 @@ static const struct sof_dev_desc cml_desc = {
        .resindex_imr_base      = -1,
        .irqindex_host_ipc      = -1,
        .chip_info = &cnl_chip_info,
-       .default_fw_path = "intel/sof",
-       .default_tplg_path = "intel/sof-tplg",
+       .default_fw_path = {
+               [SOF_IPC] = "intel/sof",
+       },
+       .default_tplg_path = {
+               [SOF_IPC] = "intel/sof-tplg",
+       },
        .default_fw_filename = "sof-cml.ri",
        .nocodec_tplg_filename = "sof-cnl-nocodec.tplg",
        .ops = &sof_cnl_ops,
index 39c8412..a27cd4f 100644 (file)
@@ -28,8 +28,12 @@ static const struct sof_dev_desc icl_desc = {
        .resindex_imr_base      = -1,
        .irqindex_host_ipc      = -1,
        .chip_info = &icl_chip_info,
-       .default_fw_path = "intel/sof",
-       .default_tplg_path = "intel/sof-tplg",
+       .default_fw_path = {
+               [SOF_IPC] = "intel/sof",
+       },
+       .default_tplg_path = {
+               [SOF_IPC] = "intel/sof-tplg",
+       },
        .default_fw_filename = "sof-icl.ri",
        .nocodec_tplg_filename = "sof-icl-nocodec.tplg",
        .ops = &sof_icl_ops,
@@ -43,8 +47,12 @@ static const struct sof_dev_desc jsl_desc = {
        .resindex_imr_base      = -1,
        .irqindex_host_ipc      = -1,
        .chip_info = &jsl_chip_info,
-       .default_fw_path = "intel/sof",
-       .default_tplg_path = "intel/sof-tplg",
+       .default_fw_path = {
+               [SOF_IPC] = "intel/sof",
+       },
+       .default_tplg_path = {
+               [SOF_IPC] = "intel/sof-tplg",
+       },
        .default_fw_filename = "sof-jsl.ri",
        .nocodec_tplg_filename = "sof-jsl-nocodec.tplg",
        .ops = &sof_cnl_ops,
index feaec25..49d165f 100644 (file)
@@ -28,8 +28,12 @@ static const struct sof_dev_desc tgl_desc = {
        .resindex_imr_base      = -1,
        .irqindex_host_ipc      = -1,
        .chip_info = &tgl_chip_info,
-       .default_fw_path = "intel/sof",
-       .default_tplg_path = "intel/sof-tplg",
+       .default_fw_path = {
+               [SOF_IPC] = "intel/sof",
+       },
+       .default_tplg_path = {
+               [SOF_IPC] = "intel/sof-tplg",
+       },
        .default_fw_filename = "sof-tgl.ri",
        .nocodec_tplg_filename = "sof-tgl-nocodec.tplg",
        .ops = &sof_tgl_ops,
@@ -44,8 +48,12 @@ static const struct sof_dev_desc tglh_desc = {
        .resindex_imr_base      = -1,
        .irqindex_host_ipc      = -1,
        .chip_info = &tglh_chip_info,
-       .default_fw_path = "intel/sof",
-       .default_tplg_path = "intel/sof-tplg",
+       .default_fw_path = {
+               [SOF_IPC] = "intel/sof",
+       },
+       .default_tplg_path = {
+               [SOF_IPC] = "intel/sof-tplg",
+       },
        .default_fw_filename = "sof-tgl-h.ri",
        .nocodec_tplg_filename = "sof-tgl-nocodec.tplg",
        .ops = &sof_tgl_ops,
@@ -59,8 +67,12 @@ static const struct sof_dev_desc ehl_desc = {
        .resindex_imr_base      = -1,
        .irqindex_host_ipc      = -1,
        .chip_info = &ehl_chip_info,
-       .default_fw_path = "intel/sof",
-       .default_tplg_path = "intel/sof-tplg",
+       .default_fw_path = {
+               [SOF_IPC] = "intel/sof",
+       },
+       .default_tplg_path = {
+               [SOF_IPC] = "intel/sof-tplg",
+       },
        .default_fw_filename = "sof-ehl.ri",
        .nocodec_tplg_filename = "sof-ehl-nocodec.tplg",
        .ops = &sof_tgl_ops,
@@ -75,8 +87,12 @@ static const struct sof_dev_desc adls_desc = {
        .resindex_imr_base      = -1,
        .irqindex_host_ipc      = -1,
        .chip_info = &adls_chip_info,
-       .default_fw_path = "intel/sof",
-       .default_tplg_path = "intel/sof-tplg",
+       .default_fw_path = {
+               [SOF_IPC] = "intel/sof",
+       },
+       .default_tplg_path = {
+               [SOF_IPC] = "intel/sof-tplg",
+       },
        .default_fw_filename = "sof-adl-s.ri",
        .nocodec_tplg_filename = "sof-adl-nocodec.tplg",
        .ops = &sof_tgl_ops,
@@ -91,8 +107,12 @@ static const struct sof_dev_desc adl_desc = {
        .resindex_imr_base      = -1,
        .irqindex_host_ipc      = -1,
        .chip_info = &tgl_chip_info,
-       .default_fw_path = "intel/sof",
-       .default_tplg_path = "intel/sof-tplg",
+       .default_fw_path = {
+               [SOF_IPC] = "intel/sof",
+       },
+       .default_tplg_path = {
+               [SOF_IPC] = "intel/sof-tplg",
+       },
        .default_fw_filename = "sof-adl.ri",
        .nocodec_tplg_filename = "sof-adl-nocodec.tplg",
        .ops = &sof_tgl_ops,
index 7d502cc..d8d0180 100644 (file)
@@ -219,8 +219,12 @@ static const struct sof_dev_desc tng_desc = {
        .resindex_imr_base      = 0,
        .irqindex_host_ipc      = -1,
        .chip_info = &tng_chip_info,
-       .default_fw_path = "intel/sof",
-       .default_tplg_path = "intel/sof-tplg",
+       .default_fw_path = {
+               [SOF_IPC] = "intel/sof",
+       },
+       .default_tplg_path = {
+               [SOF_IPC] = "intel/sof-tplg",
+       },
        .default_fw_filename = "sof-byt.ri",
        .nocodec_tplg_filename = "sof-byt.tplg",
        .ops = &sof_tng_ops,
index b5e2fd7..0982bf1 100644 (file)
@@ -440,8 +440,12 @@ static const struct snd_sof_dsp_ops sof_mt8195_ops = {
 };
 
 static const struct sof_dev_desc sof_of_mt8195_desc = {
-       .default_fw_path = "mediatek/sof",
-       .default_tplg_path = "mediatek/sof-tplg",
+       .default_fw_path = {
+               [SOF_IPC] = "mediatek/sof",
+       },
+       .default_tplg_path = {
+               [SOF_IPC] = "mediatek/sof-tplg",
+       },
        .default_fw_filename = "sof-mt8195.ri",
        .nocodec_tplg_filename = "sof-mt8195-nocodec.tplg",
        .ops = &sof_mt8195_ops,
index 74982c0..8bbc0c5 100644 (file)
@@ -81,13 +81,13 @@ int sof_acpi_probe(struct platform_device *pdev, const struct sof_dev_desc *desc
                sof_pdata->fw_filename_prefix = fw_path;
        else
                sof_pdata->fw_filename_prefix =
-                       sof_pdata->desc->default_fw_path;
+                       sof_pdata->desc->default_fw_path[SOF_IPC];
 
        if (tplg_path)
                sof_pdata->tplg_filename_prefix = tplg_path;
        else
                sof_pdata->tplg_filename_prefix =
-                       sof_pdata->desc->default_tplg_path;
+                       sof_pdata->desc->default_tplg_path[SOF_IPC];
 
        /* set callback to be called on successful device probe to enable runtime_pm */
        sof_pdata->sof_probe_complete = sof_acpi_probe_complete;
index 18c0f3c..9e2fb9a 100644 (file)
@@ -69,12 +69,12 @@ int sof_of_probe(struct platform_device *pdev)
        if (fw_path)
                sof_pdata->fw_filename_prefix = fw_path;
        else
-               sof_pdata->fw_filename_prefix = sof_pdata->desc->default_fw_path;
+               sof_pdata->fw_filename_prefix = sof_pdata->desc->default_fw_path[SOF_IPC];
 
        if (tplg_path)
                sof_pdata->tplg_filename_prefix = tplg_path;
        else
-               sof_pdata->tplg_filename_prefix = sof_pdata->desc->default_tplg_path;
+               sof_pdata->tplg_filename_prefix = sof_pdata->desc->default_tplg_path[SOF_IPC];
 
        /* set callback to be called on successful device probe to enable runtime_pm */
        sof_pdata->sof_probe_complete = sof_of_probe_complete;
index 12f5cff..a0a7fa6 100644 (file)
@@ -193,7 +193,7 @@ int sof_pci_probe(struct pci_dev *pci, const struct pci_device_id *pci_id)
        } else if (dmi_check_system(community_key_platforms)) {
                sof_pdata->fw_filename_prefix =
                        devm_kasprintf(dev, GFP_KERNEL, "%s/%s",
-                                      sof_pdata->desc->default_fw_path,
+                                      sof_pdata->desc->default_fw_path[SOF_IPC],
                                       "community");
 
                dev_dbg(dev,
@@ -201,14 +201,14 @@ int sof_pci_probe(struct pci_dev *pci, const struct pci_device_id *pci_id)
                        sof_pdata->fw_filename_prefix);
        } else {
                sof_pdata->fw_filename_prefix =
-                       sof_pdata->desc->default_fw_path;
+                       sof_pdata->desc->default_fw_path[SOF_IPC];
        }
 
        if (tplg_path)
                sof_pdata->tplg_filename_prefix = tplg_path;
        else
                sof_pdata->tplg_filename_prefix =
-                       sof_pdata->desc->default_tplg_path;
+                       sof_pdata->desc->default_tplg_path[SOF_IPC];
 
        dmi_check_system(sof_tplg_table);
        if (sof_override_tplg_name)