From: Peng Fan <peng.fan@oss.nxp.com>
To: Frank Li <Frank.li@nxp.com>
Cc: Peng Fan <peng.fan@nxp.com>,
Bjorn Andersson <andersson@kernel.org>,
Mathieu Poirier <mathieu.poirier@linaro.org>,
Shawn Guo <shawnguo@kernel.org>,
Sascha Hauer <s.hauer@pengutronix.de>,
Pengutronix Kernel Team <kernel@pengutronix.de>,
Fabio Estevam <festevam@gmail.com>,
Philipp Zabel <p.zabel@pengutronix.de>,
Shengjiu Wang <shengjiu.wang@nxp.com>,
Daniel Baluta <daniel.baluta@nxp.com>,
Iuliana Prodan <iuliana.prodan@nxp.com>,
linux-remoteproc@vger.kernel.org, imx@lists.linux.dev,
linux-arm-kernel@lists.infradead.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH 06/11] remoteproc: imx_dsp_rproc: Use start/stop/detect_mode ops from imx_rproc_dcfg
Date: Tue, 4 Nov 2025 12:24:12 +0800 [thread overview]
Message-ID: <20251104042334.GA11714@nxa18884-linux.ap.freescale.net> (raw)
In-Reply-To: <aQUIR9YhTPxY0SpX@lizhi-Precision-Tower-5810>
On Fri, Oct 31, 2025 at 03:04:39PM -0400, Frank Li wrote:
>On Fri, Oct 31, 2025 at 05:08:35PM +0800, Peng Fan wrote:
>> 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.
>>
>> 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;
>
>not sure if error message is important, maybe
I would like to keep the error message. Since this patch is just to prepare
for ops introducton, I would not change the original behavior.
Thanks,
Peng
>
> return dcfg->ops->start(rproc);
>
>Frank
>> + }
>> +
>> 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
>>
next prev parent reply other threads:[~2025-11-04 3:12 UTC|newest]
Thread overview: 30+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-10-31 9:08 [PATCH 00/11] remoteproc: imx_dsp_rproc: Refactor to use new ops and remove switch-case logic Peng Fan
2025-10-31 9:08 ` [PATCH 01/11] remoteproc: imx_dsp_rproc: simplify power domain attach and error handling Peng Fan
2025-10-31 18:46 ` Frank Li
2025-10-31 9:08 ` [PATCH 02/11] remoteproc: imx_dsp_rproc: Use devm_rproc_add() helper Peng Fan
2025-10-31 18:47 ` Frank Li
2025-10-31 9:08 ` [PATCH 03/11] remoteproc: imx_dsp_rproc: Use devm_pm_runtime_enable() helper Peng Fan
2025-10-31 18:49 ` Frank Li
2025-11-05 9:24 ` Daniel Baluta
2025-10-31 9:08 ` [PATCH 04/11] remoteproc: imx_dsp_rproc: Use dev_err_probe() for firmware and mode errors Peng Fan
2025-10-31 18:50 ` Frank Li
2025-10-31 9:08 ` [PATCH 05/11] remoteproc: imx_dsp_rproc: Drop extra space Peng Fan
2025-10-31 18:51 ` Frank Li
2025-10-31 9:08 ` [PATCH 06/11] remoteproc: imx_dsp_rproc: Use start/stop/detect_mode ops from imx_rproc_dcfg Peng Fan
2025-10-31 19:04 ` Frank Li
2025-11-04 4:24 ` Peng Fan [this message]
2025-10-31 9:08 ` [PATCH 07/11] remoteproc: imx_dsp_rproc: Move imx_dsp_rproc_dcfg closer to imx_dsp_rproc_of_match Peng Fan
2025-10-31 19:05 ` Frank Li
2025-10-31 9:08 ` [PATCH 08/11] remoteproc: imx_dsp_rproc: Simplify IMX_RPROC_MMIO switch case Peng Fan
2025-10-31 19:09 ` Frank Li
2025-11-04 4:25 ` Peng Fan
2025-10-31 9:08 ` [PATCH 09/11] remoteproc: imx_dsp_rproc: Simplify IMX_RPROC_SCU_API " Peng Fan
2025-10-31 19:12 ` Frank Li
2025-10-31 9:08 ` [PATCH 10/11] remoteproc: imx_dsp_rproc: Simplify IMX_RPROC_RESET_CONTROLLER " Peng Fan
2025-10-31 19:13 ` Frank Li
2025-10-31 9:08 ` [PATCH 11/11] remoteproc: imx_rproc: Remove enum imx_rproc_method Peng Fan
2025-10-31 19:15 ` Frank Li
2025-11-05 8:04 ` [PATCH 00/11] remoteproc: imx_dsp_rproc: Refactor to use new ops and remove switch-case logic Shengjiu Wang
2025-11-05 9:31 ` Daniel Baluta
-- strict thread matches above, loose matches on Subject: below --
2025-11-06 3:30 Peng Fan
2025-11-06 3:30 ` [PATCH 06/11] remoteproc: imx_dsp_rproc: Use start/stop/detect_mode ops from imx_rproc_dcfg Peng Fan
2025-11-06 16:10 ` Frank Li
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20251104042334.GA11714@nxa18884-linux.ap.freescale.net \
--to=peng.fan@oss.nxp.com \
--cc=Frank.li@nxp.com \
--cc=andersson@kernel.org \
--cc=daniel.baluta@nxp.com \
--cc=festevam@gmail.com \
--cc=imx@lists.linux.dev \
--cc=iuliana.prodan@nxp.com \
--cc=kernel@pengutronix.de \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-remoteproc@vger.kernel.org \
--cc=mathieu.poirier@linaro.org \
--cc=p.zabel@pengutronix.de \
--cc=peng.fan@nxp.com \
--cc=s.hauer@pengutronix.de \
--cc=shawnguo@kernel.org \
--cc=shengjiu.wang@nxp.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox