* [PATCH v4 00/12] remoteproc: imx_dsp_rproc: Refactor to use new ops and remove switch-case logic
@ 2025-11-19 4:21 Peng Fan (OSS)
2025-11-19 4:21 ` [PATCH v4 01/12] remoteproc: imx_dsp_rproc: simplify power domain attach and error handling Peng Fan (OSS)
` (12 more replies)
0 siblings, 13 replies; 16+ messages in thread
From: Peng Fan (OSS) @ 2025-11-19 4:21 UTC (permalink / raw)
To: Bjorn Andersson, Mathieu Poirier, Shawn Guo, Sascha Hauer,
Pengutronix Kernel Team, Fabio Estevam, Philipp Zabel, Frank Li,
Daniel Baluta, Shengjiu Wang, Iuliana Prodan
Cc: linux-remoteproc, imx, linux-arm-kernel, linux-kernel, Peng Fan
This patchset aligns imx_dsp_rproc with the cleanup and modernization
previously applied to imx_rproc.c. The goal is to simplify the driver by
transitioning to the new ops-based method, eliminating the legacy
switch-case logic for a cleaner and more maintainable design.
Patches 1–5: General cleanup, including code simplification and adoption
of the devres API.
Patches 6–10: Transition to the new ops-based approach, removing the
switch-case structure.
Patch 11: Remove the obsolete enum imx_rproc_method.
Patch 12: Cleanup goto based logic.
Signed-off-by: Peng Fan <peng.fan@nxp.com>
---
Changes in v4:
- Collected R-b and T-b
- Address the build warning in patch 1
- Add a new patch 12 to cleanup the goto based logic
- Link to V3: https://lore.kernel.org/imx/20251111-imx-dsp-2025-11-11-v3-0-d05dcba737fa@nxp.com/
Changes in v3:
- Collected R-b
- Simplify commit log for patch 4 per Frank.
- Link to V2: https://lore.kernel.org/all/20251106-imx-dsp-2025-11-06-v1-0-46028bc3459a@nxp.com/
Changes in v2:
- Collected R-b
- Patch 3: Update commit per Frank/Daniel
- patch 8: Use priv->dsp_dcfg->dcfg to avoid adding "const struct imx_rproc_dsp_dcfg *dsp_dcfg"
- Link to v1: https://lore.kernel.org/linux-remoteproc/CAEnQRZAOTFw=sBppHTYQAdfDBuNqkqk6gVO4FyP0EBsva3Oi+Q@mail.gmail.com/T/#m27c93af9fb1e7fdeb0766bdbffbaae39d79eefab
---
Peng Fan (12):
remoteproc: imx_dsp_rproc: simplify power domain attach and error handling
remoteproc: imx_dsp_rproc: Use devm_rproc_add() helper
remoteproc: imx_dsp_rproc: Use devm_pm_runtime_enable() helper
remoteproc: imx_dsp_rproc: Use dev_err_probe() for firmware and mode errors
remoteproc: imx_dsp_rproc: Drop extra space
remoteproc: imx_dsp_rproc: Use start/stop/detect_mode ops from imx_rproc_dcfg
remoteproc: imx_dsp_rproc: Move imx_dsp_rproc_dcfg closer to imx_dsp_rproc_of_match
remoteproc: imx_dsp_rproc: Simplify IMX_RPROC_MMIO switch case
remoteproc: imx_dsp_rproc: Simplify IMX_RPROC_SCU_API switch case
remoteproc: imx_dsp_rproc: Simplify IMX_RPROC_RESET_CONTROLLER switch case
remoteproc: imx_rproc: Remove enum imx_rproc_method
remoteproc: imx_dsp_rproc: simplify start/stop error handling
drivers/remoteproc/imx_dsp_rproc.c | 353 +++++++++++++++++++------------------
drivers/remoteproc/imx_rproc.h | 14 --
2 files changed, 186 insertions(+), 181 deletions(-)
---
base-commit: 187dac290bfd0741b9d7d5490af825c33fd9baa4
change-id: 20251119-imx-dsp-2025-11-19-fa99d7c84c91
Best regards,
--
Peng Fan <peng.fan@nxp.com>
^ permalink raw reply [flat|nested] 16+ messages in thread
* [PATCH v4 01/12] remoteproc: imx_dsp_rproc: simplify power domain attach and error handling
2025-11-19 4:21 [PATCH v4 00/12] remoteproc: imx_dsp_rproc: Refactor to use new ops and remove switch-case logic Peng Fan (OSS)
@ 2025-11-19 4:21 ` Peng Fan (OSS)
2025-11-19 4:21 ` [PATCH v4 02/12] remoteproc: imx_dsp_rproc: Use devm_rproc_add() helper Peng Fan (OSS)
` (11 subsequent siblings)
12 siblings, 0 replies; 16+ messages in thread
From: Peng Fan (OSS) @ 2025-11-19 4:21 UTC (permalink / raw)
To: Bjorn Andersson, Mathieu Poirier, Shawn Guo, Sascha Hauer,
Pengutronix Kernel Team, Fabio Estevam, Philipp Zabel, Frank Li,
Daniel Baluta, Shengjiu Wang, Iuliana Prodan
Cc: linux-remoteproc, imx, linux-arm-kernel, linux-kernel, Peng Fan
From: Peng Fan <peng.fan@nxp.com>
Refactor imx_dsp_attach_pm_domains() to use devm_pm_domain_attach_list()
directly, removing manual detach logic and simplifying resource management.
Also replace verbose error handling in imx_dsp_rproc_probe() with
dev_err_probe() for cleaner and more consistent error reporting.
No functional changes.
Reviewed-by: Frank Li <Frank.Li@nxp.com>
Reviewed-by: Daniel Baluta <daniel.baluta@nxp.com>
Reviewed-by: Shengjiu Wang <shengjiu.wang@nxp.com>
Reviewed-by: Iuliana Prodan <iuliana.prodan@nxp.com>
Tested-by: Iuliana Prodan <iuliana.prodan@nxp.com>
Signed-off-by: Peng Fan <peng.fan@nxp.com>
---
drivers/remoteproc/imx_dsp_rproc.c | 30 ++++++++----------------------
1 file changed, 8 insertions(+), 22 deletions(-)
diff --git a/drivers/remoteproc/imx_dsp_rproc.c b/drivers/remoteproc/imx_dsp_rproc.c
index 6e78a01755c7bdc28cd93f00fe6f74affc3d96b0..1f7d15227ce4fad46ab4c6d71774cf0560b9529e 100644
--- a/drivers/remoteproc/imx_dsp_rproc.c
+++ b/drivers/remoteproc/imx_dsp_rproc.c
@@ -1062,14 +1062,12 @@ static const struct rproc_ops imx_dsp_rproc_ops = {
static int imx_dsp_attach_pm_domains(struct imx_dsp_rproc *priv)
{
struct device *dev = priv->rproc->dev.parent;
- int ret;
/* A single PM domain is already attached. */
if (dev->pm_domain)
return 0;
- ret = dev_pm_domain_attach_list(dev, NULL, &priv->pd_list);
- return ret < 0 ? ret : 0;
+ return devm_pm_domain_attach_list(dev, NULL, &priv->pd_list);
}
/**
@@ -1186,45 +1184,33 @@ static int imx_dsp_rproc_probe(struct platform_device *pdev)
/* There are multiple power domains required by DSP on some platform */
ret = imx_dsp_attach_pm_domains(priv);
- if (ret) {
- dev_err(dev, "failed on imx_dsp_attach_pm_domains\n");
- return ret;
- }
+ if (ret < 0)
+ return dev_err_probe(dev, ret, "failed on imx_dsp_attach_pm_domains\n");
+
/* Get clocks */
ret = imx_dsp_rproc_clk_get(priv);
- if (ret) {
- dev_err(dev, "failed on imx_dsp_rproc_clk_get\n");
- goto err_detach_domains;
- }
+ if (ret)
+ return dev_err_probe(dev, ret, "failed on imx_dsp_rproc_clk_get\n");
init_completion(&priv->pm_comp);
rproc->auto_boot = false;
ret = rproc_add(rproc);
- if (ret) {
- dev_err(dev, "rproc_add failed\n");
- goto err_detach_domains;
- }
+ if (ret)
+ return dev_err_probe(dev, ret, "rproc_add failed\n");
rproc_coredump_set_elf_info(rproc, ELFCLASS32, EM_XTENSA);
pm_runtime_enable(dev);
return 0;
-
-err_detach_domains:
- dev_pm_domain_detach_list(priv->pd_list);
-
- return ret;
}
static void imx_dsp_rproc_remove(struct platform_device *pdev)
{
struct rproc *rproc = platform_get_drvdata(pdev);
- struct imx_dsp_rproc *priv = rproc->priv;
pm_runtime_disable(&pdev->dev);
rproc_del(rproc);
- dev_pm_domain_detach_list(priv->pd_list);
}
/* pm runtime functions */
--
2.37.1
^ permalink raw reply related [flat|nested] 16+ messages in thread
* [PATCH v4 02/12] remoteproc: imx_dsp_rproc: Use devm_rproc_add() helper
2025-11-19 4:21 [PATCH v4 00/12] remoteproc: imx_dsp_rproc: Refactor to use new ops and remove switch-case logic Peng Fan (OSS)
2025-11-19 4:21 ` [PATCH v4 01/12] remoteproc: imx_dsp_rproc: simplify power domain attach and error handling Peng Fan (OSS)
@ 2025-11-19 4:21 ` Peng Fan (OSS)
2025-11-19 4:21 ` [PATCH v4 03/12] remoteproc: imx_dsp_rproc: Use devm_pm_runtime_enable() helper Peng Fan (OSS)
` (10 subsequent siblings)
12 siblings, 0 replies; 16+ messages in thread
From: Peng Fan (OSS) @ 2025-11-19 4:21 UTC (permalink / raw)
To: Bjorn Andersson, Mathieu Poirier, Shawn Guo, Sascha Hauer,
Pengutronix Kernel Team, Fabio Estevam, Philipp Zabel, Frank Li,
Daniel Baluta, Shengjiu Wang, Iuliana Prodan
Cc: linux-remoteproc, imx, linux-arm-kernel, linux-kernel, Peng Fan
From: Peng Fan <peng.fan@nxp.com>
Replace manual rproc_add() and cleanup logic with devm_rproc_add(), which
ties the remoteproc lifecycle to the device's lifecycle. This simplifies
error handling and ensures proper cleanup.
No functional changes.
Reviewed-by: Frank Li <Frank.Li@nxp.com>
Reviewed-by: Daniel Baluta <daniel.baluta@nxp.com>
Reviewed-by: Shengjiu Wang <shengjiu.wang@nxp.com>
Reviewed-by: Iuliana Prodan <iuliana.prodan@nxp.com>
Tested-by: Iuliana Prodan <iuliana.prodan@nxp.com>
Signed-off-by: Peng Fan <peng.fan@nxp.com>
---
drivers/remoteproc/imx_dsp_rproc.c | 5 +----
1 file changed, 1 insertion(+), 4 deletions(-)
diff --git a/drivers/remoteproc/imx_dsp_rproc.c b/drivers/remoteproc/imx_dsp_rproc.c
index 1f7d15227ce4fad46ab4c6d71774cf0560b9529e..418bd3ac70a4aa294b89c5d646a89e4da5ad2c35 100644
--- a/drivers/remoteproc/imx_dsp_rproc.c
+++ b/drivers/remoteproc/imx_dsp_rproc.c
@@ -1194,7 +1194,7 @@ static int imx_dsp_rproc_probe(struct platform_device *pdev)
init_completion(&priv->pm_comp);
rproc->auto_boot = false;
- ret = rproc_add(rproc);
+ ret = devm_rproc_add(dev, rproc);
if (ret)
return dev_err_probe(dev, ret, "rproc_add failed\n");
@@ -1207,10 +1207,7 @@ static int imx_dsp_rproc_probe(struct platform_device *pdev)
static void imx_dsp_rproc_remove(struct platform_device *pdev)
{
- struct rproc *rproc = platform_get_drvdata(pdev);
-
pm_runtime_disable(&pdev->dev);
- rproc_del(rproc);
}
/* pm runtime functions */
--
2.37.1
^ permalink raw reply related [flat|nested] 16+ messages in thread
* [PATCH v4 03/12] remoteproc: imx_dsp_rproc: Use devm_pm_runtime_enable() helper
2025-11-19 4:21 [PATCH v4 00/12] remoteproc: imx_dsp_rproc: Refactor to use new ops and remove switch-case logic Peng Fan (OSS)
2025-11-19 4:21 ` [PATCH v4 01/12] remoteproc: imx_dsp_rproc: simplify power domain attach and error handling Peng Fan (OSS)
2025-11-19 4:21 ` [PATCH v4 02/12] remoteproc: imx_dsp_rproc: Use devm_rproc_add() helper Peng Fan (OSS)
@ 2025-11-19 4:21 ` Peng Fan (OSS)
2025-11-19 4:21 ` [PATCH v4 04/12] remoteproc: imx_dsp_rproc: Use dev_err_probe() for firmware and mode errors Peng Fan (OSS)
` (9 subsequent siblings)
12 siblings, 0 replies; 16+ messages in thread
From: Peng Fan (OSS) @ 2025-11-19 4:21 UTC (permalink / raw)
To: Bjorn Andersson, Mathieu Poirier, Shawn Guo, Sascha Hauer,
Pengutronix Kernel Team, Fabio Estevam, Philipp Zabel, Frank Li,
Daniel Baluta, Shengjiu Wang, Iuliana Prodan
Cc: linux-remoteproc, imx, linux-arm-kernel, linux-kernel, Peng Fan
From: Peng Fan <peng.fan@nxp.com>
Current code on the cleanup path just disables runtime PM for a device.
Using resource managed version devm_pm_runtime_enable() registers a cleanup
callback that sets autosuspend to false and then disables runtime PM for
a device. So, basically the same functionality as we don't use autosuspend
anyway.
As a result, the .remove callback is no longer needed, reducing boilerplate
code.
Reviewed-by: Frank Li <Frank.Li@nxp.com>
Reviewed-by: Daniel Baluta <daniel.baluta@nxp.com>
Reviewed-by: Shengjiu Wang <shengjiu.wang@nxp.com>
Reviewed-by: Iuliana Prodan <iuliana.prodan@nxp.com>
Tested-by: Iuliana Prodan <iuliana.prodan@nxp.com>
Signed-off-by: Peng Fan <peng.fan@nxp.com>
---
drivers/remoteproc/imx_dsp_rproc.c | 10 +---------
1 file changed, 1 insertion(+), 9 deletions(-)
diff --git a/drivers/remoteproc/imx_dsp_rproc.c b/drivers/remoteproc/imx_dsp_rproc.c
index 418bd3ac70a4aa294b89c5d646a89e4da5ad2c35..f5d0aec52c56664d6074272e276edb0c4175c9ea 100644
--- a/drivers/remoteproc/imx_dsp_rproc.c
+++ b/drivers/remoteproc/imx_dsp_rproc.c
@@ -1200,14 +1200,7 @@ static int imx_dsp_rproc_probe(struct platform_device *pdev)
rproc_coredump_set_elf_info(rproc, ELFCLASS32, EM_XTENSA);
- pm_runtime_enable(dev);
-
- return 0;
-}
-
-static void imx_dsp_rproc_remove(struct platform_device *pdev)
-{
- pm_runtime_disable(&pdev->dev);
+ return devm_pm_runtime_enable(dev);
}
/* pm runtime functions */
@@ -1358,7 +1351,6 @@ MODULE_DEVICE_TABLE(of, imx_dsp_rproc_of_match);
static struct platform_driver imx_dsp_rproc_driver = {
.probe = imx_dsp_rproc_probe,
- .remove = imx_dsp_rproc_remove,
.driver = {
.name = "imx-dsp-rproc",
.of_match_table = imx_dsp_rproc_of_match,
--
2.37.1
^ permalink raw reply related [flat|nested] 16+ messages in thread
* [PATCH v4 04/12] remoteproc: imx_dsp_rproc: Use dev_err_probe() for firmware and mode errors
2025-11-19 4:21 [PATCH v4 00/12] remoteproc: imx_dsp_rproc: Refactor to use new ops and remove switch-case logic Peng Fan (OSS)
` (2 preceding siblings ...)
2025-11-19 4:21 ` [PATCH v4 03/12] remoteproc: imx_dsp_rproc: Use devm_pm_runtime_enable() helper Peng Fan (OSS)
@ 2025-11-19 4:21 ` Peng Fan (OSS)
2025-11-19 4:21 ` [PATCH v4 05/12] remoteproc: imx_dsp_rproc: Drop extra space Peng Fan (OSS)
` (8 subsequent siblings)
12 siblings, 0 replies; 16+ messages in thread
From: Peng Fan (OSS) @ 2025-11-19 4:21 UTC (permalink / raw)
To: Bjorn Andersson, Mathieu Poirier, Shawn Guo, Sascha Hauer,
Pengutronix Kernel Team, Fabio Estevam, Philipp Zabel, Frank Li,
Daniel Baluta, Shengjiu Wang, Iuliana Prodan
Cc: linux-remoteproc, imx, linux-arm-kernel, linux-kernel, Peng Fan
From: Peng Fan <peng.fan@nxp.com>
Use dev_err_probe() to simplify the code. No functional change.
Reviewed-by: Daniel Baluta <daniel.baluta@nxp.com>
Reviewed-by: Shengjiu Wang <shengjiu.wang@nxp.com>
Reviewed-by: Frank Li <Frank.Li@nxp.com>
Reviewed-by: Iuliana Prodan <iuliana.prodan@nxp.com>
Tested-by: Iuliana Prodan <iuliana.prodan@nxp.com>
Signed-off-by: Peng Fan <peng.fan@nxp.com>
---
drivers/remoteproc/imx_dsp_rproc.c | 13 ++++---------
1 file changed, 4 insertions(+), 9 deletions(-)
diff --git a/drivers/remoteproc/imx_dsp_rproc.c b/drivers/remoteproc/imx_dsp_rproc.c
index f5d0aec52c56664d6074272e276edb0c4175c9ea..87f4a026c05fbf1c9371058290b2d33cb94b9e54 100644
--- a/drivers/remoteproc/imx_dsp_rproc.c
+++ b/drivers/remoteproc/imx_dsp_rproc.c
@@ -1150,11 +1150,8 @@ static int imx_dsp_rproc_probe(struct platform_device *pdev)
return -ENODEV;
ret = rproc_of_parse_firmware(dev, 0, &fw_name);
- if (ret) {
- dev_err(dev, "failed to parse firmware-name property, ret = %d\n",
- ret);
- return ret;
- }
+ if (ret)
+ return dev_err_probe(dev, ret, "failed to parse firmware-name property\n");
rproc = devm_rproc_alloc(dev, "imx-dsp-rproc", &imx_dsp_rproc_ops,
fw_name, sizeof(*priv));
@@ -1177,10 +1174,8 @@ static int imx_dsp_rproc_probe(struct platform_device *pdev)
INIT_WORK(&priv->rproc_work, imx_dsp_rproc_vq_work);
ret = imx_dsp_rproc_detect_mode(priv);
- if (ret) {
- dev_err(dev, "failed on imx_dsp_rproc_detect_mode\n");
- return ret;
- }
+ if (ret)
+ return dev_err_probe(dev, ret, "failed on imx_dsp_rproc_detect_mode\n");
/* There are multiple power domains required by DSP on some platform */
ret = imx_dsp_attach_pm_domains(priv);
--
2.37.1
^ permalink raw reply related [flat|nested] 16+ messages in thread
* [PATCH v4 05/12] remoteproc: imx_dsp_rproc: Drop extra space
2025-11-19 4:21 [PATCH v4 00/12] remoteproc: imx_dsp_rproc: Refactor to use new ops and remove switch-case logic Peng Fan (OSS)
` (3 preceding siblings ...)
2025-11-19 4:21 ` [PATCH v4 04/12] remoteproc: imx_dsp_rproc: Use dev_err_probe() for firmware and mode errors Peng Fan (OSS)
@ 2025-11-19 4:21 ` Peng Fan (OSS)
2025-11-19 4:21 ` [PATCH v4 06/12] remoteproc: imx_dsp_rproc: Use start/stop/detect_mode ops from imx_rproc_dcfg Peng Fan (OSS)
` (7 subsequent siblings)
12 siblings, 0 replies; 16+ messages in thread
From: Peng Fan (OSS) @ 2025-11-19 4:21 UTC (permalink / raw)
To: Bjorn Andersson, Mathieu Poirier, Shawn Guo, Sascha Hauer,
Pengutronix Kernel Team, Fabio Estevam, Philipp Zabel, Frank Li,
Daniel Baluta, Shengjiu Wang, Iuliana Prodan
Cc: linux-remoteproc, imx, linux-arm-kernel, linux-kernel, Peng Fan
From: Peng Fan <peng.fan@nxp.com>
Drop extra space between return and zero.
Reviewed-by: Frank Li <Frank.Li@nxp.com>
Reviewed-by: Daniel Baluta <daniel.baluta@nxp.com>
Reviewed-by: Shengjiu Wang <shengjiu.wang@nxp.com>
Reviewed-by: Iuliana Prodan <iuliana.prodan@nxp.com>
Tested-by: Iuliana Prodan <iuliana.prodan@nxp.com>
Signed-off-by: Peng Fan <peng.fan@nxp.com>
---
drivers/remoteproc/imx_dsp_rproc.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/remoteproc/imx_dsp_rproc.c b/drivers/remoteproc/imx_dsp_rproc.c
index 87f4a026c05fbf1c9371058290b2d33cb94b9e54..1726aaa1eafb9ac1a913e3e2caea73801b86dc09 100644
--- a/drivers/remoteproc/imx_dsp_rproc.c
+++ b/drivers/remoteproc/imx_dsp_rproc.c
@@ -784,7 +784,7 @@ static int imx_dsp_rproc_prepare(struct rproc *rproc)
pm_runtime_get_sync(dev);
- return 0;
+ return 0;
}
/* Unprepare function for rproc_ops */
@@ -792,7 +792,7 @@ static int imx_dsp_rproc_unprepare(struct rproc *rproc)
{
pm_runtime_put_sync(rproc->dev.parent);
- return 0;
+ return 0;
}
/* Kick function for rproc_ops */
--
2.37.1
^ permalink raw reply related [flat|nested] 16+ messages in thread
* [PATCH v4 06/12] remoteproc: imx_dsp_rproc: Use start/stop/detect_mode ops from imx_rproc_dcfg
2025-11-19 4:21 [PATCH v4 00/12] remoteproc: imx_dsp_rproc: Refactor to use new ops and remove switch-case logic Peng Fan (OSS)
` (4 preceding siblings ...)
2025-11-19 4:21 ` [PATCH v4 05/12] remoteproc: imx_dsp_rproc: Drop extra space Peng Fan (OSS)
@ 2025-11-19 4:21 ` Peng Fan (OSS)
2025-11-19 4:21 ` [PATCH v4 07/12] remoteproc: imx_dsp_rproc: Move imx_dsp_rproc_dcfg closer to imx_dsp_rproc_of_match Peng Fan (OSS)
` (6 subsequent siblings)
12 siblings, 0 replies; 16+ messages in thread
From: Peng Fan (OSS) @ 2025-11-19 4:21 UTC (permalink / raw)
To: Bjorn Andersson, Mathieu Poirier, Shawn Guo, Sascha Hauer,
Pengutronix Kernel Team, Fabio Estevam, Philipp Zabel, Frank Li,
Daniel Baluta, Shengjiu Wang, Iuliana Prodan
Cc: linux-remoteproc, imx, linux-arm-kernel, linux-kernel, Peng Fan
From: Peng Fan <peng.fan@nxp.com>
Allow each platform to provide its own implementation of start/stop/
detect_mode operations, and prepare to eliminate the need for multiple
switch-case statements.
Improve code readability and maintainability by encapsulating
platform-specific behavior.
No functional changes.
Reviewed-by: Daniel Baluta <daniel.baluta@nxp.com>
Reviewed-by: Shengjiu Wang <shengjiu.wang@nxp.com>
Reviewed-by: Frank Li <Frank.Li@nxp.com>
Reviewed-by: Iuliana Prodan <iuliana.prodan@nxp.com>
Tested-by: Iuliana Prodan <iuliana.prodan@nxp.com>
Signed-off-by: Peng Fan <peng.fan@nxp.com>
---
drivers/remoteproc/imx_dsp_rproc.c | 16 ++++++++++++++++
1 file changed, 16 insertions(+)
diff --git a/drivers/remoteproc/imx_dsp_rproc.c b/drivers/remoteproc/imx_dsp_rproc.c
index 1726aaa1eafb9ac1a913e3e2caea73801b86dc09..833b1bd4019614157f0bedf09bd348caab802eef 100644
--- a/drivers/remoteproc/imx_dsp_rproc.c
+++ b/drivers/remoteproc/imx_dsp_rproc.c
@@ -404,6 +404,11 @@ static int imx_dsp_rproc_start(struct rproc *rproc)
struct device *dev = rproc->dev.parent;
int ret;
+ if (dcfg->ops && dcfg->ops->start) {
+ ret = dcfg->ops->start(rproc);
+ goto start_ret;
+ }
+
switch (dcfg->method) {
case IMX_RPROC_MMIO:
ret = regmap_update_bits(priv->regmap,
@@ -424,6 +429,7 @@ static int imx_dsp_rproc_start(struct rproc *rproc)
return -EOPNOTSUPP;
}
+start_ret:
if (ret)
dev_err(dev, "Failed to enable remote core!\n");
else if (priv->flags & WAIT_FW_READY)
@@ -449,6 +455,11 @@ static int imx_dsp_rproc_stop(struct rproc *rproc)
return 0;
}
+ if (dcfg->ops && dcfg->ops->stop) {
+ ret = dcfg->ops->stop(rproc);
+ goto stop_ret;
+ }
+
switch (dcfg->method) {
case IMX_RPROC_MMIO:
ret = regmap_update_bits(priv->regmap, dcfg->src_reg, dcfg->src_mask,
@@ -467,6 +478,7 @@ static int imx_dsp_rproc_stop(struct rproc *rproc)
return -EOPNOTSUPP;
}
+stop_ret:
if (ret)
dev_err(dev, "Failed to stop remote core\n");
else
@@ -1085,10 +1097,14 @@ static int imx_dsp_attach_pm_domains(struct imx_dsp_rproc *priv)
static int imx_dsp_rproc_detect_mode(struct imx_dsp_rproc *priv)
{
const struct imx_dsp_rproc_dcfg *dsp_dcfg = priv->dsp_dcfg;
+ const struct imx_rproc_dcfg *dcfg = dsp_dcfg->dcfg;
struct device *dev = priv->rproc->dev.parent;
struct regmap *regmap;
int ret = 0;
+ if (dcfg->ops && dcfg->ops->detect_mode)
+ return dcfg->ops->detect_mode(priv->rproc);
+
switch (dsp_dcfg->dcfg->method) {
case IMX_RPROC_SCU_API:
ret = imx_scu_get_handle(&priv->ipc_handle);
--
2.37.1
^ permalink raw reply related [flat|nested] 16+ messages in thread
* [PATCH v4 07/12] remoteproc: imx_dsp_rproc: Move imx_dsp_rproc_dcfg closer to imx_dsp_rproc_of_match
2025-11-19 4:21 [PATCH v4 00/12] remoteproc: imx_dsp_rproc: Refactor to use new ops and remove switch-case logic Peng Fan (OSS)
` (5 preceding siblings ...)
2025-11-19 4:21 ` [PATCH v4 06/12] remoteproc: imx_dsp_rproc: Use start/stop/detect_mode ops from imx_rproc_dcfg Peng Fan (OSS)
@ 2025-11-19 4:21 ` Peng Fan (OSS)
2025-11-19 4:21 ` [PATCH v4 08/12] remoteproc: imx_dsp_rproc: Simplify IMX_RPROC_MMIO switch case Peng Fan (OSS)
` (5 subsequent siblings)
12 siblings, 0 replies; 16+ messages in thread
From: Peng Fan (OSS) @ 2025-11-19 4:21 UTC (permalink / raw)
To: Bjorn Andersson, Mathieu Poirier, Shawn Guo, Sascha Hauer,
Pengutronix Kernel Team, Fabio Estevam, Philipp Zabel, Frank Li,
Daniel Baluta, Shengjiu Wang, Iuliana Prodan
Cc: linux-remoteproc, imx, linux-arm-kernel, linux-kernel, Peng Fan
From: Peng Fan <peng.fan@nxp.com>
Move the imx_dsp_rproc_dcfg structure definitions closer to
imx_dsp_rproc_of_match to prepare for adding start/stop/detect_mode ops for
each i.MX variant.
Avoids the need to declare function prototypes such as
'static int imx_dsp_rproc_mbox_init(struct imx_dsp_rproc *priv)' at the
beginning of the file, improving code organization and readability.
No functional changes.
Reviewed-by: Frank Li <Frank.Li@nxp.com>
Reviewed-by: Daniel Baluta <daniel.baluta@nxp.com>
Reviewed-by: Shengjiu Wang <shengjiu.wang@nxp.com>
Reviewed-by: Iuliana Prodan <iuliana.prodan@nxp.com>
Tested-by: Iuliana Prodan <iuliana.prodan@nxp.com>
Signed-off-by: Peng Fan <peng.fan@nxp.com>
---
drivers/remoteproc/imx_dsp_rproc.c | 100 ++++++++++++++++++-------------------
1 file changed, 50 insertions(+), 50 deletions(-)
diff --git a/drivers/remoteproc/imx_dsp_rproc.c b/drivers/remoteproc/imx_dsp_rproc.c
index 833b1bd4019614157f0bedf09bd348caab802eef..f28d25cab3f1d89e5cde37a04b528870a59abeed 100644
--- a/drivers/remoteproc/imx_dsp_rproc.c
+++ b/drivers/remoteproc/imx_dsp_rproc.c
@@ -261,56 +261,6 @@ static int imx8ulp_dsp_reset(struct imx_dsp_rproc *priv)
return 0;
}
-/* Specific configuration for i.MX8MP */
-static const struct imx_rproc_dcfg dsp_rproc_cfg_imx8mp = {
- .att = imx_dsp_rproc_att_imx8mp,
- .att_size = ARRAY_SIZE(imx_dsp_rproc_att_imx8mp),
- .method = IMX_RPROC_RESET_CONTROLLER,
-};
-
-static const struct imx_dsp_rproc_dcfg imx_dsp_rproc_cfg_imx8mp = {
- .dcfg = &dsp_rproc_cfg_imx8mp,
- .reset = imx8mp_dsp_reset,
-};
-
-/* Specific configuration for i.MX8ULP */
-static const struct imx_rproc_dcfg dsp_rproc_cfg_imx8ulp = {
- .src_reg = IMX8ULP_SIM_LPAV_REG_SYSCTRL0,
- .src_mask = IMX8ULP_SYSCTRL0_DSP_STALL,
- .src_start = 0,
- .src_stop = IMX8ULP_SYSCTRL0_DSP_STALL,
- .att = imx_dsp_rproc_att_imx8ulp,
- .att_size = ARRAY_SIZE(imx_dsp_rproc_att_imx8ulp),
- .method = IMX_RPROC_MMIO,
-};
-
-static const struct imx_dsp_rproc_dcfg imx_dsp_rproc_cfg_imx8ulp = {
- .dcfg = &dsp_rproc_cfg_imx8ulp,
- .reset = imx8ulp_dsp_reset,
-};
-
-/* Specific configuration for i.MX8QXP */
-static const struct imx_rproc_dcfg dsp_rproc_cfg_imx8qxp = {
- .att = imx_dsp_rproc_att_imx8qxp,
- .att_size = ARRAY_SIZE(imx_dsp_rproc_att_imx8qxp),
- .method = IMX_RPROC_SCU_API,
-};
-
-static const struct imx_dsp_rproc_dcfg imx_dsp_rproc_cfg_imx8qxp = {
- .dcfg = &dsp_rproc_cfg_imx8qxp,
-};
-
-/* Specific configuration for i.MX8QM */
-static const struct imx_rproc_dcfg dsp_rproc_cfg_imx8qm = {
- .att = imx_dsp_rproc_att_imx8qm,
- .att_size = ARRAY_SIZE(imx_dsp_rproc_att_imx8qm),
- .method = IMX_RPROC_SCU_API,
-};
-
-static const struct imx_dsp_rproc_dcfg imx_dsp_rproc_cfg_imx8qm = {
- .dcfg = &dsp_rproc_cfg_imx8qm,
-};
-
static int imx_dsp_rproc_ready(struct rproc *rproc)
{
struct imx_dsp_rproc *priv = rproc->priv;
@@ -1351,6 +1301,56 @@ static const struct dev_pm_ops imx_dsp_rproc_pm_ops = {
RUNTIME_PM_OPS(imx_dsp_runtime_suspend, imx_dsp_runtime_resume, NULL)
};
+/* Specific configuration for i.MX8MP */
+static const struct imx_rproc_dcfg dsp_rproc_cfg_imx8mp = {
+ .att = imx_dsp_rproc_att_imx8mp,
+ .att_size = ARRAY_SIZE(imx_dsp_rproc_att_imx8mp),
+ .method = IMX_RPROC_RESET_CONTROLLER,
+};
+
+static const struct imx_dsp_rproc_dcfg imx_dsp_rproc_cfg_imx8mp = {
+ .dcfg = &dsp_rproc_cfg_imx8mp,
+ .reset = imx8mp_dsp_reset,
+};
+
+/* Specific configuration for i.MX8ULP */
+static const struct imx_rproc_dcfg dsp_rproc_cfg_imx8ulp = {
+ .src_reg = IMX8ULP_SIM_LPAV_REG_SYSCTRL0,
+ .src_mask = IMX8ULP_SYSCTRL0_DSP_STALL,
+ .src_start = 0,
+ .src_stop = IMX8ULP_SYSCTRL0_DSP_STALL,
+ .att = imx_dsp_rproc_att_imx8ulp,
+ .att_size = ARRAY_SIZE(imx_dsp_rproc_att_imx8ulp),
+ .method = IMX_RPROC_MMIO,
+};
+
+static const struct imx_dsp_rproc_dcfg imx_dsp_rproc_cfg_imx8ulp = {
+ .dcfg = &dsp_rproc_cfg_imx8ulp,
+ .reset = imx8ulp_dsp_reset,
+};
+
+/* Specific configuration for i.MX8QXP */
+static const struct imx_rproc_dcfg dsp_rproc_cfg_imx8qxp = {
+ .att = imx_dsp_rproc_att_imx8qxp,
+ .att_size = ARRAY_SIZE(imx_dsp_rproc_att_imx8qxp),
+ .method = IMX_RPROC_SCU_API,
+};
+
+static const struct imx_dsp_rproc_dcfg imx_dsp_rproc_cfg_imx8qxp = {
+ .dcfg = &dsp_rproc_cfg_imx8qxp,
+};
+
+/* Specific configuration for i.MX8QM */
+static const struct imx_rproc_dcfg dsp_rproc_cfg_imx8qm = {
+ .att = imx_dsp_rproc_att_imx8qm,
+ .att_size = ARRAY_SIZE(imx_dsp_rproc_att_imx8qm),
+ .method = IMX_RPROC_SCU_API,
+};
+
+static const struct imx_dsp_rproc_dcfg imx_dsp_rproc_cfg_imx8qm = {
+ .dcfg = &dsp_rproc_cfg_imx8qm,
+};
+
static const struct of_device_id imx_dsp_rproc_of_match[] = {
{ .compatible = "fsl,imx8qxp-hifi4", .data = &imx_dsp_rproc_cfg_imx8qxp },
{ .compatible = "fsl,imx8qm-hifi4", .data = &imx_dsp_rproc_cfg_imx8qm },
--
2.37.1
^ permalink raw reply related [flat|nested] 16+ messages in thread
* [PATCH v4 08/12] remoteproc: imx_dsp_rproc: Simplify IMX_RPROC_MMIO switch case
2025-11-19 4:21 [PATCH v4 00/12] remoteproc: imx_dsp_rproc: Refactor to use new ops and remove switch-case logic Peng Fan (OSS)
` (6 preceding siblings ...)
2025-11-19 4:21 ` [PATCH v4 07/12] remoteproc: imx_dsp_rproc: Move imx_dsp_rproc_dcfg closer to imx_dsp_rproc_of_match Peng Fan (OSS)
@ 2025-11-19 4:21 ` Peng Fan (OSS)
2025-11-19 4:21 ` [PATCH v4 09/12] remoteproc: imx_dsp_rproc: Simplify IMX_RPROC_SCU_API " Peng Fan (OSS)
` (4 subsequent siblings)
12 siblings, 0 replies; 16+ messages in thread
From: Peng Fan (OSS) @ 2025-11-19 4:21 UTC (permalink / raw)
To: Bjorn Andersson, Mathieu Poirier, Shawn Guo, Sascha Hauer,
Pengutronix Kernel Team, Fabio Estevam, Philipp Zabel, Frank Li,
Daniel Baluta, Shengjiu Wang, Iuliana Prodan
Cc: linux-remoteproc, imx, linux-arm-kernel, linux-kernel, Peng Fan
From: Peng Fan <peng.fan@nxp.com>
Introduce imx_dsp_rproc_mmio_{start, stop, detect_mode}() helper functions
for i.MX variants using IMX_RPROC_MMIO to manage remote processors.
Allows the removal of the IMX_RPROC_MMIO switch-case blocks from
imx_dsp_rproc_[start,stop,detect_mode](), resulting in cleaner and more
maintainable code.
No functional changes.
Reviewed-by: Daniel Baluta <daniel.baluta@nxp.com>
Reviewed-by: Shengjiu Wang <shengjiu.wang@nxp.com>
Reviewed-by: Frank Li <Frank.Li@nxp.com>
Reviewed-by: Iuliana Prodan <iuliana.prodan@nxp.com>
Tested-by: Iuliana Prodan <iuliana.prodan@nxp.com>
Signed-off-by: Peng Fan <peng.fan@nxp.com>
---
drivers/remoteproc/imx_dsp_rproc.c | 61 +++++++++++++++++++++++++-------------
drivers/remoteproc/imx_rproc.h | 2 --
2 files changed, 40 insertions(+), 23 deletions(-)
diff --git a/drivers/remoteproc/imx_dsp_rproc.c b/drivers/remoteproc/imx_dsp_rproc.c
index f28d25cab3f1d89e5cde37a04b528870a59abeed..71776816c3508a86bf7b8a09ac45827a83a7bb3a 100644
--- a/drivers/remoteproc/imx_dsp_rproc.c
+++ b/drivers/remoteproc/imx_dsp_rproc.c
@@ -338,6 +338,14 @@ static int imx_dsp_rproc_handle_rsc(struct rproc *rproc, u32 rsc_type,
return RSC_HANDLED;
}
+static int imx_dsp_rproc_mmio_start(struct rproc *rproc)
+{
+ struct imx_dsp_rproc *priv = rproc->priv;
+ const struct imx_rproc_dcfg *dcfg = priv->dsp_dcfg->dcfg;
+
+ return regmap_update_bits(priv->regmap, dcfg->src_reg, dcfg->src_mask, dcfg->src_start);
+}
+
/*
* Start function for rproc_ops
*
@@ -360,12 +368,6 @@ static int imx_dsp_rproc_start(struct rproc *rproc)
}
switch (dcfg->method) {
- case IMX_RPROC_MMIO:
- ret = regmap_update_bits(priv->regmap,
- dcfg->src_reg,
- dcfg->src_mask,
- dcfg->src_start);
- break;
case IMX_RPROC_SCU_API:
ret = imx_sc_pm_cpu_start(priv->ipc_handle,
IMX_SC_R_DSP,
@@ -388,6 +390,14 @@ static int imx_dsp_rproc_start(struct rproc *rproc)
return ret;
}
+static int imx_dsp_rproc_mmio_stop(struct rproc *rproc)
+{
+ struct imx_dsp_rproc *priv = rproc->priv;
+ const struct imx_rproc_dcfg *dcfg = priv->dsp_dcfg->dcfg;
+
+ return regmap_update_bits(priv->regmap, dcfg->src_reg, dcfg->src_mask, dcfg->src_stop);
+}
+
/*
* Stop function for rproc_ops
* It clears the REMOTE_IS_READY flags
@@ -411,10 +421,6 @@ static int imx_dsp_rproc_stop(struct rproc *rproc)
}
switch (dcfg->method) {
- case IMX_RPROC_MMIO:
- ret = regmap_update_bits(priv->regmap, dcfg->src_reg, dcfg->src_mask,
- dcfg->src_stop);
- break;
case IMX_RPROC_SCU_API:
ret = imx_sc_pm_cpu_start(priv->ipc_handle,
IMX_SC_R_DSP,
@@ -1032,6 +1038,23 @@ static int imx_dsp_attach_pm_domains(struct imx_dsp_rproc *priv)
return devm_pm_domain_attach_list(dev, NULL, &priv->pd_list);
}
+static int imx_dsp_rproc_mmio_detect_mode(struct rproc *rproc)
+{
+ struct imx_dsp_rproc *priv = rproc->priv;
+ struct device *dev = rproc->dev.parent;
+ struct regmap *regmap;
+
+ regmap = syscon_regmap_lookup_by_phandle(dev->of_node, "fsl,dsp-ctrl");
+ if (IS_ERR(regmap)) {
+ dev_err(dev, "failed to find syscon\n");
+ return PTR_ERR(regmap);
+ }
+
+ priv->regmap = regmap;
+
+ return 0;
+}
+
/**
* imx_dsp_rproc_detect_mode() - detect DSP control mode
* @priv: private data pointer
@@ -1049,7 +1072,6 @@ static int imx_dsp_rproc_detect_mode(struct imx_dsp_rproc *priv)
const struct imx_dsp_rproc_dcfg *dsp_dcfg = priv->dsp_dcfg;
const struct imx_rproc_dcfg *dcfg = dsp_dcfg->dcfg;
struct device *dev = priv->rproc->dev.parent;
- struct regmap *regmap;
int ret = 0;
if (dcfg->ops && dcfg->ops->detect_mode)
@@ -1061,15 +1083,6 @@ static int imx_dsp_rproc_detect_mode(struct imx_dsp_rproc *priv)
if (ret)
return ret;
break;
- case IMX_RPROC_MMIO:
- regmap = syscon_regmap_lookup_by_phandle(dev->of_node, "fsl,dsp-ctrl");
- if (IS_ERR(regmap)) {
- dev_err(dev, "failed to find syscon\n");
- return PTR_ERR(regmap);
- }
-
- priv->regmap = regmap;
- break;
case IMX_RPROC_RESET_CONTROLLER:
priv->run_stall = devm_reset_control_get_exclusive(dev, "runstall");
if (IS_ERR(priv->run_stall)) {
@@ -1301,6 +1314,12 @@ static const struct dev_pm_ops imx_dsp_rproc_pm_ops = {
RUNTIME_PM_OPS(imx_dsp_runtime_suspend, imx_dsp_runtime_resume, NULL)
};
+static const struct imx_rproc_plat_ops imx_dsp_rproc_ops_mmio = {
+ .start = imx_dsp_rproc_mmio_start,
+ .stop = imx_dsp_rproc_mmio_stop,
+ .detect_mode = imx_dsp_rproc_mmio_detect_mode,
+};
+
/* Specific configuration for i.MX8MP */
static const struct imx_rproc_dcfg dsp_rproc_cfg_imx8mp = {
.att = imx_dsp_rproc_att_imx8mp,
@@ -1321,7 +1340,7 @@ static const struct imx_rproc_dcfg dsp_rproc_cfg_imx8ulp = {
.src_stop = IMX8ULP_SYSCTRL0_DSP_STALL,
.att = imx_dsp_rproc_att_imx8ulp,
.att_size = ARRAY_SIZE(imx_dsp_rproc_att_imx8ulp),
- .method = IMX_RPROC_MMIO,
+ .ops = &imx_dsp_rproc_ops_mmio,
};
static const struct imx_dsp_rproc_dcfg imx_dsp_rproc_cfg_imx8ulp = {
diff --git a/drivers/remoteproc/imx_rproc.h b/drivers/remoteproc/imx_rproc.h
index aeed08bdfb5619c7afd7201589f417cfd6745818..912827c39c0dedeed76c13740efd42a8e7cf9c45 100644
--- a/drivers/remoteproc/imx_rproc.h
+++ b/drivers/remoteproc/imx_rproc.h
@@ -18,8 +18,6 @@ struct imx_rproc_att {
/* Remote core start/stop method */
enum imx_rproc_method {
IMX_RPROC_NONE,
- /* Through syscon regmap */
- IMX_RPROC_MMIO,
/* Through ARM SMCCC */
IMX_RPROC_SMC,
/* Through System Control Unit API */
--
2.37.1
^ permalink raw reply related [flat|nested] 16+ messages in thread
* [PATCH v4 09/12] remoteproc: imx_dsp_rproc: Simplify IMX_RPROC_SCU_API switch case
2025-11-19 4:21 [PATCH v4 00/12] remoteproc: imx_dsp_rproc: Refactor to use new ops and remove switch-case logic Peng Fan (OSS)
` (7 preceding siblings ...)
2025-11-19 4:21 ` [PATCH v4 08/12] remoteproc: imx_dsp_rproc: Simplify IMX_RPROC_MMIO switch case Peng Fan (OSS)
@ 2025-11-19 4:21 ` Peng Fan (OSS)
2025-11-19 4:21 ` [PATCH v4 10/12] remoteproc: imx_dsp_rproc: Simplify IMX_RPROC_RESET_CONTROLLER " Peng Fan (OSS)
` (3 subsequent siblings)
12 siblings, 0 replies; 16+ messages in thread
From: Peng Fan (OSS) @ 2025-11-19 4:21 UTC (permalink / raw)
To: Bjorn Andersson, Mathieu Poirier, Shawn Guo, Sascha Hauer,
Pengutronix Kernel Team, Fabio Estevam, Philipp Zabel, Frank Li,
Daniel Baluta, Shengjiu Wang, Iuliana Prodan
Cc: linux-remoteproc, imx, linux-arm-kernel, linux-kernel, Peng Fan
From: Peng Fan <peng.fan@nxp.com>
Introduce imx_dsp_rproc_scu_api_{start, stop, detect_mode}() helper
functions for i.MX variants using IMX_RPROC_SCU_API to manage remote
processors.
Allows the removal of the IMX_RPROC_SCU_API switch-case blocks from
imx_dsp_rproc_[start,stop,detect_mode](), resulting in cleaner and more
maintainable code.
No functional changes.
Reviewed-by: Frank Li <Frank.Li@nxp.com>
Reviewed-by: Daniel Baluta <daniel.baluta@nxp.com>
Reviewed-by: Shengjiu Wang <shengjiu.wang@nxp.com>
Reviewed-by: Iuliana Prodan <iuliana.prodan@nxp.com>
Tested-by: Iuliana Prodan <iuliana.prodan@nxp.com>
Signed-off-by: Peng Fan <peng.fan@nxp.com>
---
drivers/remoteproc/imx_dsp_rproc.c | 48 +++++++++++++++++++++++---------------
drivers/remoteproc/imx_rproc.h | 2 --
2 files changed, 29 insertions(+), 21 deletions(-)
diff --git a/drivers/remoteproc/imx_dsp_rproc.c b/drivers/remoteproc/imx_dsp_rproc.c
index 71776816c3508a86bf7b8a09ac45827a83a7bb3a..91d041c15ac19f527f48c8189421f71fb7c9745e 100644
--- a/drivers/remoteproc/imx_dsp_rproc.c
+++ b/drivers/remoteproc/imx_dsp_rproc.c
@@ -346,6 +346,13 @@ static int imx_dsp_rproc_mmio_start(struct rproc *rproc)
return regmap_update_bits(priv->regmap, dcfg->src_reg, dcfg->src_mask, dcfg->src_start);
}
+static int imx_dsp_rproc_scu_api_start(struct rproc *rproc)
+{
+ struct imx_dsp_rproc *priv = rproc->priv;
+
+ return imx_sc_pm_cpu_start(priv->ipc_handle, IMX_SC_R_DSP, true, rproc->bootaddr);
+}
+
/*
* Start function for rproc_ops
*
@@ -368,12 +375,6 @@ static int imx_dsp_rproc_start(struct rproc *rproc)
}
switch (dcfg->method) {
- case IMX_RPROC_SCU_API:
- ret = imx_sc_pm_cpu_start(priv->ipc_handle,
- IMX_SC_R_DSP,
- true,
- rproc->bootaddr);
- break;
case IMX_RPROC_RESET_CONTROLLER:
ret = reset_control_deassert(priv->run_stall);
break;
@@ -398,6 +399,13 @@ static int imx_dsp_rproc_mmio_stop(struct rproc *rproc)
return regmap_update_bits(priv->regmap, dcfg->src_reg, dcfg->src_mask, dcfg->src_stop);
}
+static int imx_dsp_rproc_scu_api_stop(struct rproc *rproc)
+{
+ struct imx_dsp_rproc *priv = rproc->priv;
+
+ return imx_sc_pm_cpu_start(priv->ipc_handle, IMX_SC_R_DSP, false, rproc->bootaddr);
+}
+
/*
* Stop function for rproc_ops
* It clears the REMOTE_IS_READY flags
@@ -421,12 +429,6 @@ static int imx_dsp_rproc_stop(struct rproc *rproc)
}
switch (dcfg->method) {
- case IMX_RPROC_SCU_API:
- ret = imx_sc_pm_cpu_start(priv->ipc_handle,
- IMX_SC_R_DSP,
- false,
- rproc->bootaddr);
- break;
case IMX_RPROC_RESET_CONTROLLER:
ret = reset_control_assert(priv->run_stall);
break;
@@ -1055,6 +1057,13 @@ static int imx_dsp_rproc_mmio_detect_mode(struct rproc *rproc)
return 0;
}
+static int imx_dsp_rproc_scu_api_detect_mode(struct rproc *rproc)
+{
+ struct imx_dsp_rproc *priv = rproc->priv;
+
+ return imx_scu_get_handle(&priv->ipc_handle);
+}
+
/**
* imx_dsp_rproc_detect_mode() - detect DSP control mode
* @priv: private data pointer
@@ -1078,11 +1087,6 @@ static int imx_dsp_rproc_detect_mode(struct imx_dsp_rproc *priv)
return dcfg->ops->detect_mode(priv->rproc);
switch (dsp_dcfg->dcfg->method) {
- case IMX_RPROC_SCU_API:
- ret = imx_scu_get_handle(&priv->ipc_handle);
- if (ret)
- return ret;
- break;
case IMX_RPROC_RESET_CONTROLLER:
priv->run_stall = devm_reset_control_get_exclusive(dev, "runstall");
if (IS_ERR(priv->run_stall)) {
@@ -1320,6 +1324,12 @@ static const struct imx_rproc_plat_ops imx_dsp_rproc_ops_mmio = {
.detect_mode = imx_dsp_rproc_mmio_detect_mode,
};
+static const struct imx_rproc_plat_ops imx_dsp_rproc_ops_scu_api = {
+ .start = imx_dsp_rproc_scu_api_start,
+ .stop = imx_dsp_rproc_scu_api_stop,
+ .detect_mode = imx_dsp_rproc_scu_api_detect_mode,
+};
+
/* Specific configuration for i.MX8MP */
static const struct imx_rproc_dcfg dsp_rproc_cfg_imx8mp = {
.att = imx_dsp_rproc_att_imx8mp,
@@ -1352,7 +1362,7 @@ static const struct imx_dsp_rproc_dcfg imx_dsp_rproc_cfg_imx8ulp = {
static const struct imx_rproc_dcfg dsp_rproc_cfg_imx8qxp = {
.att = imx_dsp_rproc_att_imx8qxp,
.att_size = ARRAY_SIZE(imx_dsp_rproc_att_imx8qxp),
- .method = IMX_RPROC_SCU_API,
+ .ops = &imx_dsp_rproc_ops_scu_api,
};
static const struct imx_dsp_rproc_dcfg imx_dsp_rproc_cfg_imx8qxp = {
@@ -1363,7 +1373,7 @@ static const struct imx_dsp_rproc_dcfg imx_dsp_rproc_cfg_imx8qxp = {
static const struct imx_rproc_dcfg dsp_rproc_cfg_imx8qm = {
.att = imx_dsp_rproc_att_imx8qm,
.att_size = ARRAY_SIZE(imx_dsp_rproc_att_imx8qm),
- .method = IMX_RPROC_SCU_API,
+ .ops = &imx_dsp_rproc_ops_scu_api,
};
static const struct imx_dsp_rproc_dcfg imx_dsp_rproc_cfg_imx8qm = {
diff --git a/drivers/remoteproc/imx_rproc.h b/drivers/remoteproc/imx_rproc.h
index 912827c39c0dedeed76c13740efd42a8e7cf9c45..a6b4625e8be76c6eb6a5d8ef45eb5f3aec5fe375 100644
--- a/drivers/remoteproc/imx_rproc.h
+++ b/drivers/remoteproc/imx_rproc.h
@@ -20,8 +20,6 @@ enum imx_rproc_method {
IMX_RPROC_NONE,
/* Through ARM SMCCC */
IMX_RPROC_SMC,
- /* Through System Control Unit API */
- IMX_RPROC_SCU_API,
/* Through Reset Controller API */
IMX_RPROC_RESET_CONTROLLER,
};
--
2.37.1
^ permalink raw reply related [flat|nested] 16+ messages in thread
* [PATCH v4 10/12] remoteproc: imx_dsp_rproc: Simplify IMX_RPROC_RESET_CONTROLLER switch case
2025-11-19 4:21 [PATCH v4 00/12] remoteproc: imx_dsp_rproc: Refactor to use new ops and remove switch-case logic Peng Fan (OSS)
` (8 preceding siblings ...)
2025-11-19 4:21 ` [PATCH v4 09/12] remoteproc: imx_dsp_rproc: Simplify IMX_RPROC_SCU_API " Peng Fan (OSS)
@ 2025-11-19 4:21 ` Peng Fan (OSS)
2025-11-19 4:21 ` [PATCH v4 11/12] remoteproc: imx_rproc: Remove enum imx_rproc_method Peng Fan (OSS)
` (2 subsequent siblings)
12 siblings, 0 replies; 16+ messages in thread
From: Peng Fan (OSS) @ 2025-11-19 4:21 UTC (permalink / raw)
To: Bjorn Andersson, Mathieu Poirier, Shawn Guo, Sascha Hauer,
Pengutronix Kernel Team, Fabio Estevam, Philipp Zabel, Frank Li,
Daniel Baluta, Shengjiu Wang, Iuliana Prodan
Cc: linux-remoteproc, imx, linux-arm-kernel, linux-kernel, Peng Fan
From: Peng Fan <peng.fan@nxp.com>
Introduce imx_dsp_rproc_reset_ctr_{start, stop, detect_mode}() helper
functions for i.MX variants using IMX_RPROC_RESET_CONTROLLER to manage
remote processors.
Allows the removal of the IMX_RPROC_RESET_CONTROLLER switch-case blocks
from imx_dsp_rproc_[start,stop,detect_mode](), resulting in cleaner and
more maintainable code.
No functional changes.
Reviewed-by: Frank Li <Frank.Li@nxp.com>
Reviewed-by: Daniel Baluta <daniel.baluta@nxp.com>
Reviewed-by: Shengjiu Wang <shengjiu.wang@nxp.com>
Reviewed-by: Iuliana Prodan <iuliana.prodan@nxp.com>
Tested-by: Iuliana Prodan <iuliana.prodan@nxp.com>
Signed-off-by: Peng Fan <peng.fan@nxp.com>
---
drivers/remoteproc/imx_dsp_rproc.c | 69 +++++++++++++++++++++-----------------
drivers/remoteproc/imx_rproc.h | 2 --
2 files changed, 38 insertions(+), 33 deletions(-)
diff --git a/drivers/remoteproc/imx_dsp_rproc.c b/drivers/remoteproc/imx_dsp_rproc.c
index 91d041c15ac19f527f48c8189421f71fb7c9745e..6237e8db2eff759c2b7fcce5fb4a44e4ebaec8cf 100644
--- a/drivers/remoteproc/imx_dsp_rproc.c
+++ b/drivers/remoteproc/imx_dsp_rproc.c
@@ -346,6 +346,13 @@ static int imx_dsp_rproc_mmio_start(struct rproc *rproc)
return regmap_update_bits(priv->regmap, dcfg->src_reg, dcfg->src_mask, dcfg->src_start);
}
+static int imx_dsp_rproc_reset_ctrl_start(struct rproc *rproc)
+{
+ struct imx_dsp_rproc *priv = rproc->priv;
+
+ return reset_control_deassert(priv->run_stall);
+}
+
static int imx_dsp_rproc_scu_api_start(struct rproc *rproc)
{
struct imx_dsp_rproc *priv = rproc->priv;
@@ -374,13 +381,7 @@ static int imx_dsp_rproc_start(struct rproc *rproc)
goto start_ret;
}
- switch (dcfg->method) {
- case IMX_RPROC_RESET_CONTROLLER:
- ret = reset_control_deassert(priv->run_stall);
- break;
- default:
- return -EOPNOTSUPP;
- }
+ return -EOPNOTSUPP;
start_ret:
if (ret)
@@ -399,6 +400,13 @@ static int imx_dsp_rproc_mmio_stop(struct rproc *rproc)
return regmap_update_bits(priv->regmap, dcfg->src_reg, dcfg->src_mask, dcfg->src_stop);
}
+static int imx_dsp_rproc_reset_ctrl_stop(struct rproc *rproc)
+{
+ struct imx_dsp_rproc *priv = rproc->priv;
+
+ return reset_control_assert(priv->run_stall);
+}
+
static int imx_dsp_rproc_scu_api_stop(struct rproc *rproc)
{
struct imx_dsp_rproc *priv = rproc->priv;
@@ -428,13 +436,7 @@ static int imx_dsp_rproc_stop(struct rproc *rproc)
goto stop_ret;
}
- switch (dcfg->method) {
- case IMX_RPROC_RESET_CONTROLLER:
- ret = reset_control_assert(priv->run_stall);
- break;
- default:
- return -EOPNOTSUPP;
- }
+ return -EOPNOTSUPP;
stop_ret:
if (ret)
@@ -1057,6 +1059,20 @@ static int imx_dsp_rproc_mmio_detect_mode(struct rproc *rproc)
return 0;
}
+static int imx_dsp_rproc_reset_ctrl_detect_mode(struct rproc *rproc)
+{
+ struct imx_dsp_rproc *priv = rproc->priv;
+ struct device *dev = rproc->dev.parent;
+
+ priv->run_stall = devm_reset_control_get_exclusive(dev, "runstall");
+ if (IS_ERR(priv->run_stall)) {
+ dev_err(dev, "Failed to get DSP runstall reset control\n");
+ return PTR_ERR(priv->run_stall);
+ }
+
+ return 0;
+}
+
static int imx_dsp_rproc_scu_api_detect_mode(struct rproc *rproc)
{
struct imx_dsp_rproc *priv = rproc->priv;
@@ -1080,26 +1096,11 @@ static int imx_dsp_rproc_detect_mode(struct imx_dsp_rproc *priv)
{
const struct imx_dsp_rproc_dcfg *dsp_dcfg = priv->dsp_dcfg;
const struct imx_rproc_dcfg *dcfg = dsp_dcfg->dcfg;
- struct device *dev = priv->rproc->dev.parent;
- int ret = 0;
if (dcfg->ops && dcfg->ops->detect_mode)
return dcfg->ops->detect_mode(priv->rproc);
- switch (dsp_dcfg->dcfg->method) {
- case IMX_RPROC_RESET_CONTROLLER:
- priv->run_stall = devm_reset_control_get_exclusive(dev, "runstall");
- if (IS_ERR(priv->run_stall)) {
- dev_err(dev, "Failed to get DSP runstall reset control\n");
- return PTR_ERR(priv->run_stall);
- }
- break;
- default:
- ret = -EOPNOTSUPP;
- break;
- }
-
- return ret;
+ return -EOPNOTSUPP;
}
static const char *imx_dsp_clks_names[DSP_RPROC_CLK_MAX] = {
@@ -1324,6 +1325,12 @@ static const struct imx_rproc_plat_ops imx_dsp_rproc_ops_mmio = {
.detect_mode = imx_dsp_rproc_mmio_detect_mode,
};
+static const struct imx_rproc_plat_ops imx_dsp_rproc_ops_reset_ctrl = {
+ .start = imx_dsp_rproc_reset_ctrl_start,
+ .stop = imx_dsp_rproc_reset_ctrl_stop,
+ .detect_mode = imx_dsp_rproc_reset_ctrl_detect_mode,
+};
+
static const struct imx_rproc_plat_ops imx_dsp_rproc_ops_scu_api = {
.start = imx_dsp_rproc_scu_api_start,
.stop = imx_dsp_rproc_scu_api_stop,
@@ -1334,7 +1341,7 @@ static const struct imx_rproc_plat_ops imx_dsp_rproc_ops_scu_api = {
static const struct imx_rproc_dcfg dsp_rproc_cfg_imx8mp = {
.att = imx_dsp_rproc_att_imx8mp,
.att_size = ARRAY_SIZE(imx_dsp_rproc_att_imx8mp),
- .method = IMX_RPROC_RESET_CONTROLLER,
+ .ops = &imx_dsp_rproc_ops_reset_ctrl,
};
static const struct imx_dsp_rproc_dcfg imx_dsp_rproc_cfg_imx8mp = {
diff --git a/drivers/remoteproc/imx_rproc.h b/drivers/remoteproc/imx_rproc.h
index a6b4625e8be76c6eb6a5d8ef45eb5f3aec5fe375..6a7359f05178a937d02b027fe4166319068bd65c 100644
--- a/drivers/remoteproc/imx_rproc.h
+++ b/drivers/remoteproc/imx_rproc.h
@@ -20,8 +20,6 @@ enum imx_rproc_method {
IMX_RPROC_NONE,
/* Through ARM SMCCC */
IMX_RPROC_SMC,
- /* Through Reset Controller API */
- IMX_RPROC_RESET_CONTROLLER,
};
/* dcfg flags */
--
2.37.1
^ permalink raw reply related [flat|nested] 16+ messages in thread
* [PATCH v4 11/12] remoteproc: imx_rproc: Remove enum imx_rproc_method
2025-11-19 4:21 [PATCH v4 00/12] remoteproc: imx_dsp_rproc: Refactor to use new ops and remove switch-case logic Peng Fan (OSS)
` (9 preceding siblings ...)
2025-11-19 4:21 ` [PATCH v4 10/12] remoteproc: imx_dsp_rproc: Simplify IMX_RPROC_RESET_CONTROLLER " Peng Fan (OSS)
@ 2025-11-19 4:21 ` Peng Fan (OSS)
2025-11-19 4:21 ` [PATCH v4 12/12] remoteproc: imx_dsp_rproc: simplify start/stop error handling Peng Fan (OSS)
2025-11-19 16:22 ` [PATCH v4 00/12] remoteproc: imx_dsp_rproc: Refactor to use new ops and remove switch-case logic Mathieu Poirier
12 siblings, 0 replies; 16+ messages in thread
From: Peng Fan (OSS) @ 2025-11-19 4:21 UTC (permalink / raw)
To: Bjorn Andersson, Mathieu Poirier, Shawn Guo, Sascha Hauer,
Pengutronix Kernel Team, Fabio Estevam, Philipp Zabel, Frank Li,
Daniel Baluta, Shengjiu Wang, Iuliana Prodan
Cc: linux-remoteproc, imx, linux-arm-kernel, linux-kernel, Peng Fan
From: Peng Fan <peng.fan@nxp.com>
There is no user of enum imx_rproc_method after moved to ops based
method. Remove it.
Reviewed-by: Frank Li <Frank.Li@nxp.com>
Reviewed-by: Daniel Baluta <daniel.baluta@nxp.com>
Reviewed-by: Shengjiu Wang <shengjiu.wang@nxp.com>
Reviewed-by: Iuliana Prodan <iuliana.prodan@nxp.com>
Tested-by: Iuliana Prodan <iuliana.prodan@nxp.com>
Signed-off-by: Peng Fan <peng.fan@nxp.com>
---
drivers/remoteproc/imx_rproc.h | 8 --------
1 file changed, 8 deletions(-)
diff --git a/drivers/remoteproc/imx_rproc.h b/drivers/remoteproc/imx_rproc.h
index 6a7359f05178a937d02b027fe4166319068bd65c..1b2d9f4d6d19dcdc215be97f7e2ab3488281916a 100644
--- a/drivers/remoteproc/imx_rproc.h
+++ b/drivers/remoteproc/imx_rproc.h
@@ -15,13 +15,6 @@ struct imx_rproc_att {
int flags;
};
-/* Remote core start/stop method */
-enum imx_rproc_method {
- IMX_RPROC_NONE,
- /* Through ARM SMCCC */
- IMX_RPROC_SMC,
-};
-
/* dcfg flags */
#define IMX_RPROC_NEED_SYSTEM_OFF BIT(0)
#define IMX_RPROC_NEED_CLKS BIT(1)
@@ -42,7 +35,6 @@ struct imx_rproc_dcfg {
u32 gpr_wait;
const struct imx_rproc_att *att;
size_t att_size;
- enum imx_rproc_method method;
u32 flags;
const struct imx_rproc_plat_ops *ops;
};
--
2.37.1
^ permalink raw reply related [flat|nested] 16+ messages in thread
* [PATCH v4 12/12] remoteproc: imx_dsp_rproc: simplify start/stop error handling
2025-11-19 4:21 [PATCH v4 00/12] remoteproc: imx_dsp_rproc: Refactor to use new ops and remove switch-case logic Peng Fan (OSS)
` (10 preceding siblings ...)
2025-11-19 4:21 ` [PATCH v4 11/12] remoteproc: imx_rproc: Remove enum imx_rproc_method Peng Fan (OSS)
@ 2025-11-19 4:21 ` Peng Fan (OSS)
2025-11-19 13:52 ` Daniel Baluta
2025-11-19 15:55 ` Frank Li
2025-11-19 16:22 ` [PATCH v4 00/12] remoteproc: imx_dsp_rproc: Refactor to use new ops and remove switch-case logic Mathieu Poirier
12 siblings, 2 replies; 16+ messages in thread
From: Peng Fan (OSS) @ 2025-11-19 4:21 UTC (permalink / raw)
To: Bjorn Andersson, Mathieu Poirier, Shawn Guo, Sascha Hauer,
Pengutronix Kernel Team, Fabio Estevam, Philipp Zabel, Frank Li,
Daniel Baluta, Shengjiu Wang, Iuliana Prodan
Cc: linux-remoteproc, imx, linux-arm-kernel, linux-kernel, Peng Fan
From: Peng Fan <peng.fan@nxp.com>
Replace goto-based error handling with early return pattern in
imx_dsp_rproc_{start,stop}() functions, and simplify if-else logic.
No functional changes, only code structure improvements for better
maintainability.
Signed-off-by: Peng Fan <peng.fan@nxp.com>
---
drivers/remoteproc/imx_dsp_rproc.c | 39 ++++++++++++++++++--------------------
1 file changed, 18 insertions(+), 21 deletions(-)
diff --git a/drivers/remoteproc/imx_dsp_rproc.c b/drivers/remoteproc/imx_dsp_rproc.c
index 6237e8db2eff759c2b7fcce5fb4a44e4ebaec8cf..1a1438823e7fc0a65ba15142abdd97e59692801c 100644
--- a/drivers/remoteproc/imx_dsp_rproc.c
+++ b/drivers/remoteproc/imx_dsp_rproc.c
@@ -376,20 +376,19 @@ static int imx_dsp_rproc_start(struct rproc *rproc)
struct device *dev = rproc->dev.parent;
int ret;
- if (dcfg->ops && dcfg->ops->start) {
- ret = dcfg->ops->start(rproc);
- goto start_ret;
- }
-
- return -EOPNOTSUPP;
+ if (!dcfg->ops || !dcfg->ops->start)
+ return -EOPNOTSUPP;
-start_ret:
- if (ret)
+ ret = dcfg->ops->start(rproc);
+ if (ret) {
dev_err(dev, "Failed to enable remote core!\n");
- else if (priv->flags & WAIT_FW_READY)
+ return ret;
+ }
+
+ if (priv->flags & WAIT_FW_READY)
return imx_dsp_rproc_ready(rproc);
- return ret;
+ return 0;
}
static int imx_dsp_rproc_mmio_stop(struct rproc *rproc)
@@ -431,20 +430,18 @@ static int imx_dsp_rproc_stop(struct rproc *rproc)
return 0;
}
- if (dcfg->ops && dcfg->ops->stop) {
- ret = dcfg->ops->stop(rproc);
- goto stop_ret;
- }
-
- return -EOPNOTSUPP;
+ if (!dcfg->ops || !dcfg->ops->stop)
+ return -EOPNOTSUPP;
-stop_ret:
- if (ret)
+ ret = dcfg->ops->stop(rproc);
+ if (ret) {
dev_err(dev, "Failed to stop remote core\n");
- else
- priv->flags &= ~REMOTE_IS_READY;
+ return ret;
+ }
- return ret;
+ priv->flags &= ~REMOTE_IS_READY;
+
+ return 0;
}
/**
--
2.37.1
^ permalink raw reply related [flat|nested] 16+ messages in thread
* Re: [PATCH v4 12/12] remoteproc: imx_dsp_rproc: simplify start/stop error handling
2025-11-19 4:21 ` [PATCH v4 12/12] remoteproc: imx_dsp_rproc: simplify start/stop error handling Peng Fan (OSS)
@ 2025-11-19 13:52 ` Daniel Baluta
2025-11-19 15:55 ` Frank Li
1 sibling, 0 replies; 16+ messages in thread
From: Daniel Baluta @ 2025-11-19 13:52 UTC (permalink / raw)
To: Peng Fan (OSS)
Cc: Bjorn Andersson, Mathieu Poirier, Shawn Guo, Sascha Hauer,
Pengutronix Kernel Team, Fabio Estevam, Philipp Zabel, Frank Li,
Daniel Baluta, Shengjiu Wang, Iuliana Prodan, linux-remoteproc,
imx, linux-arm-kernel, linux-kernel, Peng Fan
On Wed, Nov 19, 2025 at 6:27 AM Peng Fan (OSS) <peng.fan@oss.nxp.com> wrote:
>
> From: Peng Fan <peng.fan@nxp.com>
>
> Replace goto-based error handling with early return pattern in
> imx_dsp_rproc_{start,stop}() functions, and simplify if-else logic.
>
> No functional changes, only code structure improvements for better
> maintainability.
>
> Signed-off-by: Peng Fan <peng.fan@nxp.com>
Reviewed-by: Daniel Baluta <daniel.baluta@nxp.com>
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [PATCH v4 12/12] remoteproc: imx_dsp_rproc: simplify start/stop error handling
2025-11-19 4:21 ` [PATCH v4 12/12] remoteproc: imx_dsp_rproc: simplify start/stop error handling Peng Fan (OSS)
2025-11-19 13:52 ` Daniel Baluta
@ 2025-11-19 15:55 ` Frank Li
1 sibling, 0 replies; 16+ messages in thread
From: Frank Li @ 2025-11-19 15:55 UTC (permalink / raw)
To: Peng Fan (OSS)
Cc: Bjorn Andersson, Mathieu Poirier, Shawn Guo, Sascha Hauer,
Pengutronix Kernel Team, Fabio Estevam, Philipp Zabel,
Daniel Baluta, Shengjiu Wang, Iuliana Prodan, linux-remoteproc,
imx, linux-arm-kernel, linux-kernel, Peng Fan
On Wed, Nov 19, 2025 at 12:21:57PM +0800, Peng Fan (OSS) wrote:
> From: Peng Fan <peng.fan@nxp.com>
>
> Replace goto-based error handling with early return pattern in
> imx_dsp_rproc_{start,stop}() functions, and simplify if-else logic.
>
> No functional changes, only code structure improvements for better
> maintainability.
>
> Signed-off-by: Peng Fan <peng.fan@nxp.com>
Reviewed-by: Frank Li <Frank.Li@nxp.com>
> ---
> drivers/remoteproc/imx_dsp_rproc.c | 39 ++++++++++++++++++--------------------
> 1 file changed, 18 insertions(+), 21 deletions(-)
>
> diff --git a/drivers/remoteproc/imx_dsp_rproc.c b/drivers/remoteproc/imx_dsp_rproc.c
> index 6237e8db2eff759c2b7fcce5fb4a44e4ebaec8cf..1a1438823e7fc0a65ba15142abdd97e59692801c 100644
> --- a/drivers/remoteproc/imx_dsp_rproc.c
> +++ b/drivers/remoteproc/imx_dsp_rproc.c
> @@ -376,20 +376,19 @@ static int imx_dsp_rproc_start(struct rproc *rproc)
> struct device *dev = rproc->dev.parent;
> int ret;
>
> - if (dcfg->ops && dcfg->ops->start) {
> - ret = dcfg->ops->start(rproc);
> - goto start_ret;
> - }
> -
> - return -EOPNOTSUPP;
> + if (!dcfg->ops || !dcfg->ops->start)
> + return -EOPNOTSUPP;
>
> -start_ret:
> - if (ret)
> + ret = dcfg->ops->start(rproc);
> + if (ret) {
> dev_err(dev, "Failed to enable remote core!\n");
> - else if (priv->flags & WAIT_FW_READY)
> + return ret;
> + }
> +
> + if (priv->flags & WAIT_FW_READY)
> return imx_dsp_rproc_ready(rproc);
>
> - return ret;
> + return 0;
> }
>
> static int imx_dsp_rproc_mmio_stop(struct rproc *rproc)
> @@ -431,20 +430,18 @@ static int imx_dsp_rproc_stop(struct rproc *rproc)
> return 0;
> }
>
> - if (dcfg->ops && dcfg->ops->stop) {
> - ret = dcfg->ops->stop(rproc);
> - goto stop_ret;
> - }
> -
> - return -EOPNOTSUPP;
> + if (!dcfg->ops || !dcfg->ops->stop)
> + return -EOPNOTSUPP;
>
> -stop_ret:
> - if (ret)
> + ret = dcfg->ops->stop(rproc);
> + if (ret) {
> dev_err(dev, "Failed to stop remote core\n");
> - else
> - priv->flags &= ~REMOTE_IS_READY;
> + return ret;
> + }
>
> - return ret;
> + priv->flags &= ~REMOTE_IS_READY;
> +
> + return 0;
> }
>
> /**
>
> --
> 2.37.1
>
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [PATCH v4 00/12] remoteproc: imx_dsp_rproc: Refactor to use new ops and remove switch-case logic
2025-11-19 4:21 [PATCH v4 00/12] remoteproc: imx_dsp_rproc: Refactor to use new ops and remove switch-case logic Peng Fan (OSS)
` (11 preceding siblings ...)
2025-11-19 4:21 ` [PATCH v4 12/12] remoteproc: imx_dsp_rproc: simplify start/stop error handling Peng Fan (OSS)
@ 2025-11-19 16:22 ` Mathieu Poirier
12 siblings, 0 replies; 16+ messages in thread
From: Mathieu Poirier @ 2025-11-19 16:22 UTC (permalink / raw)
To: Peng Fan (OSS)
Cc: Bjorn Andersson, Shawn Guo, Sascha Hauer, Pengutronix Kernel Team,
Fabio Estevam, Philipp Zabel, Frank Li, Daniel Baluta,
Shengjiu Wang, Iuliana Prodan, linux-remoteproc, imx,
linux-arm-kernel, linux-kernel, Peng Fan
On Wed, Nov 19, 2025 at 12:21:45PM +0800, Peng Fan (OSS) wrote:
> This patchset aligns imx_dsp_rproc with the cleanup and modernization
> previously applied to imx_rproc.c. The goal is to simplify the driver by
> transitioning to the new ops-based method, eliminating the legacy
> switch-case logic for a cleaner and more maintainable design.
>
> Patches 1–5: General cleanup, including code simplification and adoption
> of the devres API.
> Patches 6–10: Transition to the new ops-based approach, removing the
> switch-case structure.
> Patch 11: Remove the obsolete enum imx_rproc_method.
> Patch 12: Cleanup goto based logic.
>
> Signed-off-by: Peng Fan <peng.fan@nxp.com>
> ---
> Changes in v4:
> - Collected R-b and T-b
> - Address the build warning in patch 1
> - Add a new patch 12 to cleanup the goto based logic
> - Link to V3: https://lore.kernel.org/imx/20251111-imx-dsp-2025-11-11-v3-0-d05dcba737fa@nxp.com/
>
> Changes in v3:
> - Collected R-b
> - Simplify commit log for patch 4 per Frank.
> - Link to V2: https://lore.kernel.org/all/20251106-imx-dsp-2025-11-06-v1-0-46028bc3459a@nxp.com/
>
> Changes in v2:
> - Collected R-b
> - Patch 3: Update commit per Frank/Daniel
> - patch 8: Use priv->dsp_dcfg->dcfg to avoid adding "const struct imx_rproc_dsp_dcfg *dsp_dcfg"
> - Link to v1: https://lore.kernel.org/linux-remoteproc/CAEnQRZAOTFw=sBppHTYQAdfDBuNqkqk6gVO4FyP0EBsva3Oi+Q@mail.gmail.com/T/#m27c93af9fb1e7fdeb0766bdbffbaae39d79eefab
>
> ---
> Peng Fan (12):
> remoteproc: imx_dsp_rproc: simplify power domain attach and error handling
> remoteproc: imx_dsp_rproc: Use devm_rproc_add() helper
> remoteproc: imx_dsp_rproc: Use devm_pm_runtime_enable() helper
> remoteproc: imx_dsp_rproc: Use dev_err_probe() for firmware and mode errors
> remoteproc: imx_dsp_rproc: Drop extra space
> remoteproc: imx_dsp_rproc: Use start/stop/detect_mode ops from imx_rproc_dcfg
> remoteproc: imx_dsp_rproc: Move imx_dsp_rproc_dcfg closer to imx_dsp_rproc_of_match
> remoteproc: imx_dsp_rproc: Simplify IMX_RPROC_MMIO switch case
> remoteproc: imx_dsp_rproc: Simplify IMX_RPROC_SCU_API switch case
> remoteproc: imx_dsp_rproc: Simplify IMX_RPROC_RESET_CONTROLLER switch case
> remoteproc: imx_rproc: Remove enum imx_rproc_method
> remoteproc: imx_dsp_rproc: simplify start/stop error handling
>
> drivers/remoteproc/imx_dsp_rproc.c | 353 +++++++++++++++++++------------------
> drivers/remoteproc/imx_rproc.h | 14 --
I have applied this set.
Thanks,
Mathieu
> 2 files changed, 186 insertions(+), 181 deletions(-)
> ---
> base-commit: 187dac290bfd0741b9d7d5490af825c33fd9baa4
> change-id: 20251119-imx-dsp-2025-11-19-fa99d7c84c91
>
> Best regards,
> --
> Peng Fan <peng.fan@nxp.com>
>
^ permalink raw reply [flat|nested] 16+ messages in thread
end of thread, other threads:[~2025-11-19 16:22 UTC | newest]
Thread overview: 16+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-11-19 4:21 [PATCH v4 00/12] remoteproc: imx_dsp_rproc: Refactor to use new ops and remove switch-case logic Peng Fan (OSS)
2025-11-19 4:21 ` [PATCH v4 01/12] remoteproc: imx_dsp_rproc: simplify power domain attach and error handling Peng Fan (OSS)
2025-11-19 4:21 ` [PATCH v4 02/12] remoteproc: imx_dsp_rproc: Use devm_rproc_add() helper Peng Fan (OSS)
2025-11-19 4:21 ` [PATCH v4 03/12] remoteproc: imx_dsp_rproc: Use devm_pm_runtime_enable() helper Peng Fan (OSS)
2025-11-19 4:21 ` [PATCH v4 04/12] remoteproc: imx_dsp_rproc: Use dev_err_probe() for firmware and mode errors Peng Fan (OSS)
2025-11-19 4:21 ` [PATCH v4 05/12] remoteproc: imx_dsp_rproc: Drop extra space Peng Fan (OSS)
2025-11-19 4:21 ` [PATCH v4 06/12] remoteproc: imx_dsp_rproc: Use start/stop/detect_mode ops from imx_rproc_dcfg Peng Fan (OSS)
2025-11-19 4:21 ` [PATCH v4 07/12] remoteproc: imx_dsp_rproc: Move imx_dsp_rproc_dcfg closer to imx_dsp_rproc_of_match Peng Fan (OSS)
2025-11-19 4:21 ` [PATCH v4 08/12] remoteproc: imx_dsp_rproc: Simplify IMX_RPROC_MMIO switch case Peng Fan (OSS)
2025-11-19 4:21 ` [PATCH v4 09/12] remoteproc: imx_dsp_rproc: Simplify IMX_RPROC_SCU_API " Peng Fan (OSS)
2025-11-19 4:21 ` [PATCH v4 10/12] remoteproc: imx_dsp_rproc: Simplify IMX_RPROC_RESET_CONTROLLER " Peng Fan (OSS)
2025-11-19 4:21 ` [PATCH v4 11/12] remoteproc: imx_rproc: Remove enum imx_rproc_method Peng Fan (OSS)
2025-11-19 4:21 ` [PATCH v4 12/12] remoteproc: imx_dsp_rproc: simplify start/stop error handling Peng Fan (OSS)
2025-11-19 13:52 ` Daniel Baluta
2025-11-19 15:55 ` Frank Li
2025-11-19 16:22 ` [PATCH v4 00/12] remoteproc: imx_dsp_rproc: Refactor to use new ops and remove switch-case logic Mathieu Poirier
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.