* [PATCH AUTOSEL 6.19-6.1] remoteproc: imx_dsp_rproc: Skip RP_MBOX_SUSPEND_SYSTEM when mailbox TX channel is uninitialized
[not found] <20260215174120.2390402-1-sashal@kernel.org>
@ 2026-02-15 17:41 ` Sasha Levin
2026-02-15 17:41 ` [PATCH AUTOSEL 6.19-6.1] mailbox: imx: Skip the suspend flag for i.MX7ULP Sasha Levin
2026-02-15 17:41 ` [PATCH AUTOSEL 6.19-5.15] remoteproc: mediatek: Break lock dependency to `prepare_lock` Sasha Levin
2 siblings, 0 replies; 3+ messages in thread
From: Sasha Levin @ 2026-02-15 17:41 UTC (permalink / raw)
To: patches, stable
Cc: Iuliana Prodan, Mathieu Poirier, Sasha Levin, andersson, Frank.Li,
linux-remoteproc, imx, linux-arm-kernel
From: Iuliana Prodan <iuliana.prodan@nxp.com>
[ Upstream commit d62e0e92e589c53c4320ed5914af5fe103f5ce7e ]
Firmwares that do not use mailbox communication (e.g., the hello_world
sample) leave priv->tx_ch as NULL. The current suspend logic
unconditionally sends RP_MBOX_SUSPEND_SYSTEM, which is invalid without
an initialized TX channel.
Detect the no_mailboxes case early and skip sending the suspend
message. Instead, proceed directly to the runtime PM suspend path,
which is the correct behavior for firmwares that cannot respond to
mailbox requests.
Signed-off-by: Iuliana Prodan <iuliana.prodan@nxp.com>
Link: https://lore.kernel.org/r/20251204122825.756106-1-iuliana.prodan@oss.nxp.com
Signed-off-by: Mathieu Poirier <mathieu.poirier@linaro.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
LLM Generated explanations, may be completely bogus:
So `no_mailboxes` was introduced in v6.4. This means the bug only
affects kernels v6.4+. Let me check which stable trees are currently
maintained.
Now let me understand the actual bug severity more precisely. From the
code analysis:
1. When `no_mailboxes=1` is set, `imx_dsp_rproc_mbox_no_alloc()` is
used, which is a no-op — `priv->tx_ch` stays NULL.
2. During suspend, `imx_dsp_suspend()` calls
`mbox_send_message(priv->tx_ch, ...)` where `priv->tx_ch` is NULL.
3. `mbox_send_message()` checks `if (!chan || !chan->cl)` and returns
`-EINVAL` — so it **does NOT crash**.
4. However, the return value is `-EINVAL` (negative), so the error path
is taken: `dev_err()` is printed and the function returns the error
code.
5. This causes **suspend to fail** with an error, which means the system
**cannot suspend** when using `no_mailboxes` mode.
This is a real functional bug — suspend is broken when the
`no_mailboxes` module parameter is used. It won't crash, but it prevents
the system from suspending, which is a significant issue for
embedded/power-managed systems.
## Summary of Analysis
### What the commit fixes
When the `no_mailboxes` module parameter is set (firmware doesn't use
mailbox communication), `priv->tx_ch` remains NULL. The suspend function
`imx_dsp_suspend()` unconditionally tries to send a message via the
mailbox TX channel, which fails with `-EINVAL` when the channel is NULL.
This causes **system suspend to fail** for all users of the
`no_mailboxes` configuration.
The fix adds a NULL check for `priv->tx_ch` before the
`mbox_send_message()` call, skipping the mailbox communication and going
directly to the PM runtime suspend path — which is the correct behavior
for firmwares that don't use mailbox.
### Stable kernel criteria assessment
1. **Obviously correct and tested**: Yes — a simple NULL check that
mirrors the existing pattern in `imx_dsp_rproc_kick()` (line 764).
Signed off by the NXP developer and the remoteproc maintainer.
2. **Fixes a real bug**: Yes — suspend is broken when `no_mailboxes=1`.
3. **Important issue**: Moderate — it prevents system suspend for
affected configurations (embedded i.MX DSP users with no-mailbox
firmwares). On embedded/battery-powered devices, inability to suspend
is a significant problem.
4. **Small and contained**: Yes — 9 lines added (NULL check + comment +
debug message), single file, single function.
5. **No new features**: Correct — this is purely a bug fix.
### Risk assessment
- **Very low risk**: The added NULL check only triggers when
`priv->tx_ch` is NULL (the no-mailbox case). It has zero impact on the
normal mailbox path.
- The pattern is already established in the same driver
(`imx_dsp_rproc_kick()` at line 764).
- The fix is self-contained with no dependencies on other patches.
### Affected versions
The `no_mailboxes` module parameter was introduced in commit
`11bb42a94648a` which landed in v6.4. The bug exists from v6.4 onwards.
Currently maintained stable trees v6.6.y and v6.12.y would both be
affected.
### Verification
- **Verified**: `mbox_send_message()` in `drivers/mailbox/mailbox.c:249`
returns `-EINVAL` when `chan` is NULL (not a crash, but causes suspend
failure since the error is propagated).
- **Verified**: `priv->tx_ch` starts as NULL (zeroed by
`devm_rproc_alloc`) and remains NULL when
`imx_dsp_rproc_mbox_no_alloc()` is used (it's a no-op, confirmed at
line 635-638).
- **Verified**: `no_mailboxes` module parameter was introduced in commit
`11bb42a94648a` (v6.4 cycle), confirmed via `git log -S
"no_mailboxes"`.
- **Verified**: The existing `imx_dsp_rproc_kick()` function already has
an identical defensive NULL check for `priv->tx_ch` at line 764,
confirming the fix pattern is established.
- **Verified**: The `imx_dsp_suspend()` function returns the error from
`mbox_send_message()` (line 1251), so a `-EINVAL` return causes
suspend to fail entirely.
- **Verified**: The driver was introduced in `ec0e5549f3586d` (Oct 2021,
v5.16 cycle), so it exists in multiple stable trees.
- **Verified**: The patch was reviewed and merged by remoteproc
maintainer Mathieu Poirier, with a Link to the mailing list
discussion.
This is a clean, small, obviously correct bug fix for a real problem
(broken suspend) in a specific but important use case (no-mailbox
firmware on i.MX DSP). It follows an established pattern in the same
driver and has very low regression risk.
**YES**
drivers/remoteproc/imx_dsp_rproc.c | 9 +++++++++
1 file changed, 9 insertions(+)
diff --git a/drivers/remoteproc/imx_dsp_rproc.c b/drivers/remoteproc/imx_dsp_rproc.c
index 5130a35214c92..f51deaacc7008 100644
--- a/drivers/remoteproc/imx_dsp_rproc.c
+++ b/drivers/remoteproc/imx_dsp_rproc.c
@@ -1242,6 +1242,15 @@ static int imx_dsp_suspend(struct device *dev)
if (rproc->state != RPROC_RUNNING)
goto out;
+ /*
+ * No channel available for sending messages;
+ * indicates no mailboxes present, so trigger PM runtime suspend
+ */
+ if (!priv->tx_ch) {
+ dev_dbg(dev, "No initialized mbox tx channel, suspend directly.\n");
+ goto out;
+ }
+
reinit_completion(&priv->pm_comp);
/* Tell DSP that suspend is happening */
--
2.51.0
^ permalink raw reply related [flat|nested] 3+ messages in thread* [PATCH AUTOSEL 6.19-6.1] mailbox: imx: Skip the suspend flag for i.MX7ULP
[not found] <20260215174120.2390402-1-sashal@kernel.org>
2026-02-15 17:41 ` [PATCH AUTOSEL 6.19-6.1] remoteproc: imx_dsp_rproc: Skip RP_MBOX_SUSPEND_SYSTEM when mailbox TX channel is uninitialized Sasha Levin
@ 2026-02-15 17:41 ` Sasha Levin
2026-02-15 17:41 ` [PATCH AUTOSEL 6.19-5.15] remoteproc: mediatek: Break lock dependency to `prepare_lock` Sasha Levin
2 siblings, 0 replies; 3+ messages in thread
From: Sasha Levin @ 2026-02-15 17:41 UTC (permalink / raw)
To: patches, stable
Cc: Jacky Bai, Peng Fan, Jassi Brar, Sasha Levin, Frank.Li,
linux-kernel, imx, linux-arm-kernel
From: Jacky Bai <ping.bai@nxp.com>
[ Upstream commit 673b570825ace0dcb2ac0c676080559d505c6f40 ]
In current imx-mailbox driver, the MU IRQ is configured with
'IRQF_NO_SUSPEND' flag set. So during linux suspend/resume flow,
the MU IRQ is always enabled. With commit 892cb524ae8a ("mailbox: imx:
fix wakeup failure from freeze mode"), if the MU IRQ is triggered after
the priv->suspended flag has been set, the system suspend will be
aborted.
On i.MX7ULP platform, certain drivers that depend on rpmsg may need
to send rpmsg request and receive an acknowledgment from the remote
core during the late_suspend stage. Early suspend abort is not
expected, and the i.MX7ULP already has additional hardware and
software to make sure the system can be wakeup from freeze mode
correctly when MU IRQ is trigger.
Skip the 'suspend' flag handling logic on i.MX7ULP to avoid the
early abort when doing suspend.
Signed-off-by: Jacky Bai <ping.bai@nxp.com>
Reviewed-by: Peng Fan <peng.fan@nxp.com>
Signed-off-by: Jassi Brar <jassisinghbrar@gmail.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
LLM Generated explanations, may be completely bogus:
Now I understand the full picture:
1. Commit 892cb524ae8a added `priv->suspend` flag and
`pm_system_wakeup()` call in the ISR to handle freeze mode wakeup.
2. `pm_system_wakeup()` aborts the ongoing suspend process.
3. On i.MX7ULP, during `late_suspend`, drivers send rpmsg to the remote
core and expect a response. This triggers the MU IRQ, which in turn
calls `pm_system_wakeup()` and aborts suspend — an undesirable
behavior on this platform.
4. The fix adds a per-platform flag `skip_suspend_flag` to skip the
suspend flag logic for i.MX7ULP, which has its own hardware
mechanisms for handling wakeup.
### Stable Kernel Assessment
**Bug severity**: This is a **suspend failure** on i.MX7ULP — the system
cannot properly enter suspend/freeze mode. This is a significant
functional regression for i.MX7ULP users caused by commit 892cb524ae8a.
**Fix quality**:
- Small, contained (adds 1 bool field + 1 config line + 2 conditional
checks)
- Platform-specific — only affects i.MX7ULP; all other platforms are
unchanged
- Low regression risk — it simply disables a feature that was causing
problems on this specific platform
- Reviewed by Peng Fan (NXP maintainer)
**Fits stable criteria**:
- Fixes a real bug (suspend failure)
- Small and contained
- Obviously correct
- Platform-specific quirk/workaround — this falls squarely in the
"hardware quirk" category
**Dependencies**: Requires commit 892cb524ae8a ("mailbox: imx: fix
wakeup failure from freeze mode") to be present. That commit is in
v5.18+, so applicable stable trees (6.1.y, 6.6.y, 6.12.y) all have it.
**Risk**: Very low. The change only affects the i.MX7ULP platform and
simply skips suspend flag logic that was causing problems. If the bool
field is false (default for all other platforms), behavior is completely
unchanged.
### Verification
- **git show 892cb524ae8a**: Verified that commit introduced the
`priv->suspend` flag and `pm_system_wakeup()` call in `imx_mu_isr()`,
confirming the mechanism described in the commit message.
- **git tag --contains 892cb524ae8a**: Confirmed the prerequisite commit
is in v5.18+, so all active LTS trees (6.1.y, 6.6.y, 6.12.y) contain
it.
- **git tag --contains 673b570825ace**: Confirmed the commit under
review is post-v6.19 (in development tree).
- **Grep for `priv->suspend`**: Verified the ISR check at line 564 —
when suspend flag is set and MU IRQ fires, `pm_system_wakeup()` is
called, which aborts suspend.
- **Code review of diff**: Verified only i.MX7ULP config gets
`skip_suspend_flag = true`; all other platform configs default to
false (zero-initialized), so behavior is unchanged for non-i.MX7ULP
platforms.
- **Unverified**: Cannot directly verify user reports of suspend failure
on i.MX7ULP, but the commit message clearly describes the mechanism
and the author is from NXP (the SoC vendor).
### Conclusion
This is a platform-specific hardware workaround that fixes suspend
failure on i.MX7ULP. It's small, well-scoped, reviewed by the subsystem
maintainer, and has essentially zero regression risk for other
platforms. It fits the "hardware quirk" exception category for stable
backports. The prerequisite commit exists in all active LTS trees.
**YES**
drivers/mailbox/imx-mailbox.c | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/drivers/mailbox/imx-mailbox.c b/drivers/mailbox/imx-mailbox.c
index 6778afc64a048..003f9236c35e0 100644
--- a/drivers/mailbox/imx-mailbox.c
+++ b/drivers/mailbox/imx-mailbox.c
@@ -122,6 +122,7 @@ struct imx_mu_dcfg {
u32 xRR; /* Receive Register0 */
u32 xSR[IMX_MU_xSR_MAX]; /* Status Registers */
u32 xCR[IMX_MU_xCR_MAX]; /* Control Registers */
+ bool skip_suspend_flag;
};
#define IMX_MU_xSR_GIPn(type, x) (type & IMX_MU_V2 ? BIT(x) : BIT(28 + (3 - (x))))
@@ -988,6 +989,7 @@ static const struct imx_mu_dcfg imx_mu_cfg_imx7ulp = {
.xRR = 0x40,
.xSR = {0x60, 0x60, 0x60, 0x60},
.xCR = {0x64, 0x64, 0x64, 0x64, 0x64},
+ .skip_suspend_flag = true,
};
static const struct imx_mu_dcfg imx_mu_cfg_imx8ulp = {
@@ -1071,7 +1073,8 @@ static int __maybe_unused imx_mu_suspend_noirq(struct device *dev)
priv->xcr[i] = imx_mu_read(priv, priv->dcfg->xCR[i]);
}
- priv->suspend = true;
+ if (!priv->dcfg->skip_suspend_flag)
+ priv->suspend = true;
return 0;
}
@@ -1094,7 +1097,8 @@ static int __maybe_unused imx_mu_resume_noirq(struct device *dev)
imx_mu_write(priv, priv->xcr[i], priv->dcfg->xCR[i]);
}
- priv->suspend = false;
+ if (!priv->dcfg->skip_suspend_flag)
+ priv->suspend = false;
return 0;
}
--
2.51.0
^ permalink raw reply related [flat|nested] 3+ messages in thread* [PATCH AUTOSEL 6.19-5.15] remoteproc: mediatek: Break lock dependency to `prepare_lock`
[not found] <20260215174120.2390402-1-sashal@kernel.org>
2026-02-15 17:41 ` [PATCH AUTOSEL 6.19-6.1] remoteproc: imx_dsp_rproc: Skip RP_MBOX_SUSPEND_SYSTEM when mailbox TX channel is uninitialized Sasha Levin
2026-02-15 17:41 ` [PATCH AUTOSEL 6.19-6.1] mailbox: imx: Skip the suspend flag for i.MX7ULP Sasha Levin
@ 2026-02-15 17:41 ` Sasha Levin
2 siblings, 0 replies; 3+ messages in thread
From: Sasha Levin @ 2026-02-15 17:41 UTC (permalink / raw)
To: patches, stable
Cc: Tzung-Bi Shih, Chen-Yu Tsai, Mathieu Poirier, Sasha Levin,
andersson, matthias.bgg, angelogioacchino.delregno,
linux-remoteproc, linux-kernel, linux-arm-kernel, linux-mediatek
From: Tzung-Bi Shih <tzungbi@kernel.org>
[ Upstream commit d935187cfb27fc4168f78f3959aef4eafaae76bb ]
A potential circular locking dependency (ABBA deadlock) exists between
`ec_dev->lock` and the clock framework's `prepare_lock`.
The first order (A -> B) occurs when scp_ipi_send() is called while
`ec_dev->lock` is held (e.g., within cros_ec_cmd_xfer()):
1. cros_ec_cmd_xfer() acquires `ec_dev->lock` and calls scp_ipi_send().
2. scp_ipi_send() calls clk_prepare_enable(), which acquires
`prepare_lock`.
See #0 in the following example calling trace.
(Lock Order: `ec_dev->lock` -> `prepare_lock`)
The reverse order (B -> A) is more complex and has been observed
(learned) by lockdep. It involves the clock prepare operation
triggering power domain changes, which then propagates through sysfs
and power supply uevents, eventually calling back into the ChromeOS EC
driver and attempting to acquire `ec_dev->lock`:
1. Something calls clk_prepare(), which acquires `prepare_lock`. It
then triggers genpd operations like genpd_runtime_resume(), which
takes `&genpd->mlock`.
2. Power domain changes can trigger regulator changes; regulator
changes can then trigger device link changes; device link changes
can then trigger sysfs changes. Eventually, power_supply_uevent()
is called.
3. This leads to calls like cros_usbpd_charger_get_prop(), which calls
cros_ec_cmd_xfer_status(), which then attempts to acquire
`ec_dev->lock`.
See #1 ~ #6 in the following example calling trace.
(Lock Order: `prepare_lock` -> `&genpd->mlock` -> ... -> `&ec_dev->lock`)
Move the clk_prepare()/clk_unprepare() operations for `scp->clk` to the
remoteproc prepare()/unprepare() callbacks. This ensures `prepare_lock`
is only acquired in prepare()/unprepare() callbacks. Since
`ec_dev->lock` is not involved in the callbacks, the dependency loop is
broken.
This means the clock is always "prepared" when the SCP is running. The
prolonged "prepared time" for the clock should be acceptable as SCP is
designed to be a very power efficient processor. The power consumption
impact can be negligible.
A simplified calling trace reported by lockdep:
> -> #6 (&ec_dev->lock)
> cros_ec_cmd_xfer
> cros_ec_cmd_xfer_status
> cros_usbpd_charger_get_port_status
> cros_usbpd_charger_get_prop
> power_supply_get_property
> power_supply_show_property
> power_supply_uevent
> dev_uevent
> uevent_show
> dev_attr_show
> sysfs_kf_seq_show
> kernfs_seq_show
> -> #5 (kn->active#2)
> kernfs_drain
> __kernfs_remove
> kernfs_remove_by_name_ns
> sysfs_remove_file_ns
> device_del
> __device_link_del
> device_links_driver_bound
> -> #4 (device_links_lock)
> device_link_remove
> _regulator_put
> regulator_put
> -> #3 (regulator_list_mutex)
> regulator_lock_dependent
> regulator_disable
> scpsys_power_off
> _genpd_power_off
> genpd_power_off
> -> #2 (&genpd->mlock/1)
> genpd_add_subdomain
> pm_genpd_add_subdomain
> scpsys_add_subdomain
> scpsys_probe
> -> #1 (&genpd->mlock)
> genpd_runtime_resume
> __rpm_callback
> rpm_callback
> rpm_resume
> __pm_runtime_resume
> clk_core_prepare
> clk_prepare
> -> #0 (prepare_lock)
> clk_prepare
> scp_ipi_send
> scp_send_ipi
> mtk_rpmsg_send
> rpmsg_send
> cros_ec_pkt_xfer_rpmsg
Signed-off-by: Tzung-Bi Shih <tzungbi@kernel.org>
Reviewed-by: Chen-Yu Tsai <wenst@chromium.org>
Tested-by: Chen-Yu Tsai <wenst@chromium.org>
Link: https://lore.kernel.org/r/20260112110755.2435899-1-tzungbi@kernel.org
Signed-off-by: Mathieu Poirier <mathieu.poirier@linaro.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
LLM Generated explanations, may be completely bogus:
Good - the `prepare`/`unprepare` ops were added in 2020, well before any
current stable tree branch point. They exist in 5.10, 5.15, 6.1, and all
newer stable trees.
### 5. User Impact Assessment
This affects **MediaTek SCP on ChromeOS devices** (Chromebooks with
MediaTek SoCs). The deadlock scenario involves:
- ChromeOS EC communication via rpmsg (SCP IPI)
- Clock framework interactions
- Power domain/regulator/device link chains
This is a real-world deadlock that lockdep detected. ChromeOS devices
are widely deployed, and a deadlock in the EC communication path could
cause a complete system hang.
### 6. Risk Assessment
**Changes are mechanical and low-risk:**
- All `clk_prepare_enable()` → `clk_enable()` (7 call sites)
- All `clk_disable_unprepare()` → `clk_disable()` (7 call sites)
- New `scp_prepare()`/`scp_unprepare()` callbacks added to `scp_ops`
(simple wrappers)
**The pattern is well-established** - `clk_prepare()` is meant to be
called in sleepable context, `clk_enable()` can be called from any
context including IRQ. Separating them is a standard clock framework
pattern.
**Total: 30 insertions, 13 deletions** across 2 files - small and
contained.
### 7. Dependency Check
The commit is self-contained:
- No subsequent commits in these files depend on it
- The `rproc_ops.prepare`/`.unprepare` callbacks exist since 2020
(present in all stable trees: 5.10+)
- No other infrastructure changes needed
### Verification
- **git log master** confirmed commit d935187cfb27f is the exact commit
being analyzed
- **git log --oneline d935187cfb27f..master** confirmed no subsequent
commits modify the same files (no dependencies)
- **git log/show 33467ac3c8dc8** confirmed `prepare`/`unprepare` ops
were added to `rproc_ops` in April 2020, present in stable trees 5.10+
- **Code review of remoteproc_internal.h** confirmed
`rproc_prepare_device()`/`rproc_unprepare_device()` wrappers exist and
are called in `rproc_fw_boot()` and `rproc_shutdown()` paths
- **Reviewed-by and Tested-by** from Chen-Yu Tsai (wenst@chromium.org)
confirms the fix was tested on real hardware
- **Lockdep call trace** in commit message confirms this is a real
detected lock ordering issue, not theoretical
- The commit is a standalone single patch (not part of a series) -
confirmed by lore.kernel.org link format (single patch, not X/Y)
### Summary
This commit fixes a **lockdep-detected ABBA deadlock** in the MediaTek
SCP remoteproc driver. The deadlock involves the clock framework's
`prepare_lock` and the ChromeOS EC's `ec_dev->lock`. The fix is
mechanically simple (splitting `clk_prepare_enable` into separate
`clk_prepare` + `clk_enable` calls), uses existing remoteproc framework
infrastructure (`prepare`/`unprepare` callbacks available since 2020),
and has been reviewed and tested. The scope is limited to 2 files with
30 insertions/13 deletions. The risk of regression is very low as it
uses a well-established clock framework pattern, and the benefit is
preventing a real deadlock on ChromeOS devices with MediaTek SoCs.
**YES**
drivers/remoteproc/mtk_scp.c | 39 +++++++++++++++++++++++---------
drivers/remoteproc/mtk_scp_ipi.c | 4 ++--
2 files changed, 30 insertions(+), 13 deletions(-)
diff --git a/drivers/remoteproc/mtk_scp.c b/drivers/remoteproc/mtk_scp.c
index db8fd045468d9..98d00bd5200cc 100644
--- a/drivers/remoteproc/mtk_scp.c
+++ b/drivers/remoteproc/mtk_scp.c
@@ -283,7 +283,7 @@ static irqreturn_t scp_irq_handler(int irq, void *priv)
struct mtk_scp *scp = priv;
int ret;
- ret = clk_prepare_enable(scp->clk);
+ ret = clk_enable(scp->clk);
if (ret) {
dev_err(scp->dev, "failed to enable clocks\n");
return IRQ_NONE;
@@ -291,7 +291,7 @@ static irqreturn_t scp_irq_handler(int irq, void *priv)
scp->data->scp_irq_handler(scp);
- clk_disable_unprepare(scp->clk);
+ clk_disable(scp->clk);
return IRQ_HANDLED;
}
@@ -665,7 +665,7 @@ static int scp_load(struct rproc *rproc, const struct firmware *fw)
struct device *dev = scp->dev;
int ret;
- ret = clk_prepare_enable(scp->clk);
+ ret = clk_enable(scp->clk);
if (ret) {
dev_err(dev, "failed to enable clocks\n");
return ret;
@@ -680,7 +680,7 @@ static int scp_load(struct rproc *rproc, const struct firmware *fw)
ret = scp_elf_load_segments(rproc, fw);
leave:
- clk_disable_unprepare(scp->clk);
+ clk_disable(scp->clk);
return ret;
}
@@ -691,14 +691,14 @@ static int scp_parse_fw(struct rproc *rproc, const struct firmware *fw)
struct device *dev = scp->dev;
int ret;
- ret = clk_prepare_enable(scp->clk);
+ ret = clk_enable(scp->clk);
if (ret) {
dev_err(dev, "failed to enable clocks\n");
return ret;
}
ret = scp_ipi_init(scp, fw);
- clk_disable_unprepare(scp->clk);
+ clk_disable(scp->clk);
return ret;
}
@@ -709,7 +709,7 @@ static int scp_start(struct rproc *rproc)
struct scp_run *run = &scp->run;
int ret;
- ret = clk_prepare_enable(scp->clk);
+ ret = clk_enable(scp->clk);
if (ret) {
dev_err(dev, "failed to enable clocks\n");
return ret;
@@ -734,14 +734,14 @@ static int scp_start(struct rproc *rproc)
goto stop;
}
- clk_disable_unprepare(scp->clk);
+ clk_disable(scp->clk);
dev_info(dev, "SCP is ready. FW version %s\n", run->fw_ver);
return 0;
stop:
scp->data->scp_reset_assert(scp);
- clk_disable_unprepare(scp->clk);
+ clk_disable(scp->clk);
return ret;
}
@@ -909,7 +909,7 @@ static int scp_stop(struct rproc *rproc)
struct mtk_scp *scp = rproc->priv;
int ret;
- ret = clk_prepare_enable(scp->clk);
+ ret = clk_enable(scp->clk);
if (ret) {
dev_err(scp->dev, "failed to enable clocks\n");
return ret;
@@ -917,12 +917,29 @@ static int scp_stop(struct rproc *rproc)
scp->data->scp_reset_assert(scp);
scp->data->scp_stop(scp);
- clk_disable_unprepare(scp->clk);
+ clk_disable(scp->clk);
return 0;
}
+static int scp_prepare(struct rproc *rproc)
+{
+ struct mtk_scp *scp = rproc->priv;
+
+ return clk_prepare(scp->clk);
+}
+
+static int scp_unprepare(struct rproc *rproc)
+{
+ struct mtk_scp *scp = rproc->priv;
+
+ clk_unprepare(scp->clk);
+ return 0;
+}
+
static const struct rproc_ops scp_ops = {
+ .prepare = scp_prepare,
+ .unprepare = scp_unprepare,
.start = scp_start,
.stop = scp_stop,
.load = scp_load,
diff --git a/drivers/remoteproc/mtk_scp_ipi.c b/drivers/remoteproc/mtk_scp_ipi.c
index c068227e251e7..7a37e273b3af8 100644
--- a/drivers/remoteproc/mtk_scp_ipi.c
+++ b/drivers/remoteproc/mtk_scp_ipi.c
@@ -171,7 +171,7 @@ int scp_ipi_send(struct mtk_scp *scp, u32 id, void *buf, unsigned int len,
WARN_ON(len > scp_sizes->ipi_share_buffer_size) || WARN_ON(!buf))
return -EINVAL;
- ret = clk_prepare_enable(scp->clk);
+ ret = clk_enable(scp->clk);
if (ret) {
dev_err(scp->dev, "failed to enable clock\n");
return ret;
@@ -211,7 +211,7 @@ int scp_ipi_send(struct mtk_scp *scp, u32 id, void *buf, unsigned int len,
unlock_mutex:
mutex_unlock(&scp->send_lock);
- clk_disable_unprepare(scp->clk);
+ clk_disable(scp->clk);
return ret;
}
--
2.51.0
^ permalink raw reply related [flat|nested] 3+ messages in thread