Skip to content

Commit 286d658

Browse files
TE-N-ShengjiuWangbroonie
authored andcommitted
ASoC: fsl_asrc: register m2m platform device
Register m2m platform device, that user can use M2M feature. Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com> Acked-by: Jaroslav Kysela <perex@perex.cz> Link: https://patch.msgid.link/20241212074509.3445859-6-shengjiu.wang@nxp.com Signed-off-by: Mark Brown <broonie@kernel.org>
1 parent 24a0171 commit 286d658

File tree

1 file changed

+33
-4
lines changed

1 file changed

+33
-4
lines changed

sound/soc/fsl/fsl_asrc.c

Lines changed: 33 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1384,6 +1384,12 @@ static int fsl_asrc_probe(struct platform_device *pdev)
13841384
goto err_pm_get_sync;
13851385
}
13861386

1387+
ret = fsl_asrc_m2m_init(asrc);
1388+
if (ret) {
1389+
dev_err(&pdev->dev, "failed to init m2m device %d\n", ret);
1390+
return ret;
1391+
}
1392+
13871393
return 0;
13881394

13891395
err_pm_get_sync:
@@ -1396,6 +1402,10 @@ static int fsl_asrc_probe(struct platform_device *pdev)
13961402

13971403
static void fsl_asrc_remove(struct platform_device *pdev)
13981404
{
1405+
struct fsl_asrc *asrc = dev_get_drvdata(&pdev->dev);
1406+
1407+
fsl_asrc_m2m_exit(asrc);
1408+
13991409
pm_runtime_disable(&pdev->dev);
14001410
if (!pm_runtime_status_suspended(&pdev->dev))
14011411
fsl_asrc_runtime_suspend(&pdev->dev);
@@ -1497,10 +1507,29 @@ static int fsl_asrc_runtime_suspend(struct device *dev)
14971507
return 0;
14981508
}
14991509

1510+
static int fsl_asrc_suspend(struct device *dev)
1511+
{
1512+
struct fsl_asrc *asrc = dev_get_drvdata(dev);
1513+
int ret;
1514+
1515+
fsl_asrc_m2m_suspend(asrc);
1516+
ret = pm_runtime_force_suspend(dev);
1517+
return ret;
1518+
}
1519+
1520+
static int fsl_asrc_resume(struct device *dev)
1521+
{
1522+
struct fsl_asrc *asrc = dev_get_drvdata(dev);
1523+
int ret;
1524+
1525+
ret = pm_runtime_force_resume(dev);
1526+
fsl_asrc_m2m_resume(asrc);
1527+
return ret;
1528+
}
1529+
15001530
static const struct dev_pm_ops fsl_asrc_pm = {
1501-
SET_RUNTIME_PM_OPS(fsl_asrc_runtime_suspend, fsl_asrc_runtime_resume, NULL)
1502-
SET_SYSTEM_SLEEP_PM_OPS(pm_runtime_force_suspend,
1503-
pm_runtime_force_resume)
1531+
RUNTIME_PM_OPS(fsl_asrc_runtime_suspend, fsl_asrc_runtime_resume, NULL)
1532+
SYSTEM_SLEEP_PM_OPS(fsl_asrc_suspend, fsl_asrc_resume)
15041533
};
15051534

15061535
static const struct fsl_asrc_soc_data fsl_asrc_imx35_data = {
@@ -1538,7 +1567,7 @@ static struct platform_driver fsl_asrc_driver = {
15381567
.driver = {
15391568
.name = "fsl-asrc",
15401569
.of_match_table = fsl_asrc_ids,
1541-
.pm = &fsl_asrc_pm,
1570+
.pm = pm_ptr(&fsl_asrc_pm),
15421571
},
15431572
};
15441573
module_platform_driver(fsl_asrc_driver);

0 commit comments

Comments
 (0)