mirror of
https://github.com/torvalds/linux.git
synced 2026-04-25 18:12:26 -04:00
ASoC: SOF: OF: Avoid reverse module dependency
Similar with commit8a49cd11e6("ASoC: SOF: ACPI: avoid reverse module dependency") we will be having hardware specific drivers that link against a common "helper" framework. sof-of-dev.c becomes a library with the interface defined in the newly created file sof-of-dev.h. This is the final step started with Kconfig simplification in commit7548a391c5("ASoC: SOF: i.MX: simplify Kconfig") Signed-off-by: Daniel Baluta <daniel.baluta@nxp.com> Reviewed-by: Paul Olaru <paul.olaru@oss.nxp.com> Reviewed-by: Péter Ujfalusi <peter.ujfalusi@linux.intel.com> Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com> Link: https://lore.kernel.org/r/20211215085703.137414-1-daniel.baluta@oss.nxp.com Signed-off-by: Mark Brown <broonie@kernel.org>
This commit is contained in:
committed by
Mark Brown
parent
9e376b14ef
commit
28084f4a0e
@@ -11,9 +11,8 @@
|
||||
#include <linux/pm_runtime.h>
|
||||
#include <sound/sof.h>
|
||||
|
||||
#include "sof-of-dev.h"
|
||||
#include "ops.h"
|
||||
#include "imx/imx-ops.h"
|
||||
#include "mediatek/mediatek-ops.h"
|
||||
|
||||
static char *fw_path;
|
||||
module_param(fw_path, charp, 0444);
|
||||
@@ -23,51 +22,14 @@ static char *tplg_path;
|
||||
module_param(tplg_path, charp, 0444);
|
||||
MODULE_PARM_DESC(tplg_path, "alternate path for SOF topology.");
|
||||
|
||||
/* platform specific devices */
|
||||
#if IS_ENABLED(CONFIG_SND_SOC_SOF_IMX8)
|
||||
static struct sof_dev_desc sof_of_imx8qxp_desc = {
|
||||
.default_fw_path = "imx/sof",
|
||||
.default_tplg_path = "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_filename = "sof-imx8.ri",
|
||||
.nocodec_tplg_filename = "sof-imx8-nocodec.tplg",
|
||||
.ops = &sof_imx8_ops,
|
||||
};
|
||||
#endif
|
||||
|
||||
#if IS_ENABLED(CONFIG_SND_SOC_SOF_IMX8M)
|
||||
static struct sof_dev_desc sof_of_imx8mp_desc = {
|
||||
.default_fw_path = "imx/sof",
|
||||
.default_tplg_path = "imx/sof-tplg",
|
||||
.default_fw_filename = "sof-imx8m.ri",
|
||||
.nocodec_tplg_filename = "sof-imx8-nocodec.tplg",
|
||||
.ops = &sof_imx8m_ops,
|
||||
};
|
||||
#endif
|
||||
#if IS_ENABLED(CONFIG_SND_SOC_SOF_MT8195)
|
||||
static const struct sof_dev_desc sof_of_mt8195_desc = {
|
||||
.default_fw_path = "mediatek/sof",
|
||||
.default_tplg_path = "mediatek/sof-tplg",
|
||||
.default_fw_filename = "sof-mt8195.ri",
|
||||
.nocodec_tplg_filename = "sof-mt8195-nocodec.tplg",
|
||||
.ops = &sof_mt8195_ops,
|
||||
};
|
||||
#endif
|
||||
|
||||
static const struct dev_pm_ops sof_of_pm = {
|
||||
const struct dev_pm_ops sof_of_pm = {
|
||||
.prepare = snd_sof_prepare,
|
||||
.complete = snd_sof_complete,
|
||||
SET_SYSTEM_SLEEP_PM_OPS(snd_sof_suspend, snd_sof_resume)
|
||||
SET_RUNTIME_PM_OPS(snd_sof_runtime_suspend, snd_sof_runtime_resume,
|
||||
NULL)
|
||||
};
|
||||
EXPORT_SYMBOL(sof_of_pm);
|
||||
|
||||
static void sof_of_probe_complete(struct device *dev)
|
||||
{
|
||||
@@ -79,7 +41,7 @@ static void sof_of_probe_complete(struct device *dev)
|
||||
pm_runtime_enable(dev);
|
||||
}
|
||||
|
||||
static int sof_of_probe(struct platform_device *pdev)
|
||||
int sof_of_probe(struct platform_device *pdev)
|
||||
{
|
||||
struct device *dev = &pdev->dev;
|
||||
const struct sof_dev_desc *desc;
|
||||
@@ -120,8 +82,9 @@ static int sof_of_probe(struct platform_device *pdev)
|
||||
/* call sof helper for DSP hardware probe */
|
||||
return snd_sof_device_probe(dev, sof_pdata);
|
||||
}
|
||||
EXPORT_SYMBOL(sof_of_probe);
|
||||
|
||||
static int sof_of_remove(struct platform_device *pdev)
|
||||
int sof_of_remove(struct platform_device *pdev)
|
||||
{
|
||||
pm_runtime_disable(&pdev->dev);
|
||||
|
||||
@@ -130,32 +93,6 @@ static int sof_of_remove(struct platform_device *pdev)
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static const struct of_device_id sof_of_ids[] = {
|
||||
#if IS_ENABLED(CONFIG_SND_SOC_SOF_IMX8)
|
||||
{ .compatible = "fsl,imx8qxp-dsp", .data = &sof_of_imx8qxp_desc},
|
||||
{ .compatible = "fsl,imx8qm-dsp", .data = &sof_of_imx8qm_desc},
|
||||
#endif
|
||||
#if IS_ENABLED(CONFIG_SND_SOC_SOF_IMX8M)
|
||||
{ .compatible = "fsl,imx8mp-dsp", .data = &sof_of_imx8mp_desc},
|
||||
#endif
|
||||
#if IS_ENABLED(CONFIG_SND_SOC_SOF_MT8195)
|
||||
{ .compatible = "mediatek,mt8195-dsp", .data = &sof_of_mt8195_desc},
|
||||
#endif
|
||||
{ }
|
||||
};
|
||||
MODULE_DEVICE_TABLE(of, sof_of_ids);
|
||||
|
||||
/* DT driver definition */
|
||||
static struct platform_driver snd_sof_of_driver = {
|
||||
.probe = sof_of_probe,
|
||||
.remove = sof_of_remove,
|
||||
.driver = {
|
||||
.name = "sof-audio-of",
|
||||
.pm = &sof_of_pm,
|
||||
.of_match_table = sof_of_ids,
|
||||
},
|
||||
};
|
||||
module_platform_driver(snd_sof_of_driver);
|
||||
EXPORT_SYMBOL(sof_of_remove);
|
||||
|
||||
MODULE_LICENSE("Dual BSD/GPL");
|
||||
|
||||
Reference in New Issue
Block a user