<feed xmlns='http://www.w3.org/2005/Atom'>
<title>kernel/drivers/remoteproc/mtk_scp.c, branch linux-rolling-lts</title>
<subtitle>Hosts the 0x221E linux distro kernel.</subtitle>
<id>https://universe.0xinfinity.dev/distro/kernel/atom?h=linux-rolling-lts</id>
<link rel='self' href='https://universe.0xinfinity.dev/distro/kernel/atom?h=linux-rolling-lts'/>
<link rel='alternate' type='text/html' href='https://universe.0xinfinity.dev/distro/kernel/'/>
<updated>2026-03-19T15:08:12Z</updated>
<entry>
<title>remoteproc: mediatek: Unprepare SCP clock during system suspend</title>
<updated>2026-03-19T15:08:12Z</updated>
<author>
<name>Tzung-Bi Shih</name>
<email>tzungbi@kernel.org</email>
</author>
<published>2026-02-06T03:30:33Z</published>
<link rel='alternate' type='text/html' href='https://universe.0xinfinity.dev/distro/kernel/commit/?id=ba021fb575084f5bb69e58a0774862e5007b5d58'/>
<id>urn:sha1:ba021fb575084f5bb69e58a0774862e5007b5d58</id>
<content type='text'>
[ Upstream commit 35c3f72a2d55dbf52f28f4ecae51c76be1acf545 ]

Prior to commit d935187cfb27 ("remoteproc: mediatek: Break lock
dependency to prepare_lock"), `scp-&gt;clk` was prepared and enabled only
when it needs to communicate with the SCP.  The commit d935187cfb27
moved the prepare operation to remoteproc's prepare(), keeping the clock
prepared as long as the SCP is running.

The power consumption due to the prolonged clock preparation can be
negligible when the system is running, as SCP is designed to be a very
power efficient processor.

However, the clock remains prepared even when the system enters system
suspend.  This prevents the underlying clock controller (and potentially
the parent PLLs) from shutting down, which increases power consumption
and may block the system from entering deep sleep states.

Add suspend and resume callbacks.  Unprepare the clock in suspend() if
it was active and re-prepare it in resume() to ensure the clock is
properly disabled during system suspend, while maintaining the "always
prepared" semantics while the system is active.  The driver doesn't
implement .attach() callback, hence it only checks for RPROC_RUNNING.

Fixes: d935187cfb27 ("remoteproc: mediatek: Break lock dependency to prepare_lock")
Reviewed-by: AngeloGioacchino Del Regno &lt;angelogioacchino.delregno@collabora.com&gt;
Signed-off-by: Tzung-Bi Shih &lt;tzungbi@kernel.org&gt;
Link: https://lore.kernel.org/r/20260206033034.3031781-1-tzungbi@kernel.org
Signed-off-by: Mathieu Poirier &lt;mathieu.poirier@linaro.org&gt;
Signed-off-by: Sasha Levin &lt;sashal@kernel.org&gt;
</content>
</entry>
<entry>
<title>remoteproc: mediatek: Break lock dependency to `prepare_lock`</title>
<updated>2026-03-04T12:20:30Z</updated>
<author>
<name>Tzung-Bi Shih</name>
<email>tzungbi@kernel.org</email>
</author>
<published>2026-01-12T11:07:55Z</published>
<link rel='alternate' type='text/html' href='https://universe.0xinfinity.dev/distro/kernel/commit/?id=c6bc63adddc35fd14c7e91b29d5afbfcd190544a'/>
<id>urn:sha1:c6bc63adddc35fd14c7e91b29d5afbfcd190544a</id>
<content type='text'>
[ Upstream commit d935187cfb27fc4168f78f3959aef4eafaae76bb ]

A potential circular locking dependency (ABBA deadlock) exists between
`ec_dev-&gt;lock` and the clock framework's `prepare_lock`.

The first order (A -&gt; B) occurs when scp_ipi_send() is called while
`ec_dev-&gt;lock` is held (e.g., within cros_ec_cmd_xfer()):
1. cros_ec_cmd_xfer() acquires `ec_dev-&gt;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-&gt;lock` -&gt; `prepare_lock`)

The reverse order (B -&gt; 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-&gt;lock`:
1. Something calls clk_prepare(), which acquires `prepare_lock`.  It
   then triggers genpd operations like genpd_runtime_resume(), which
   takes `&amp;genpd-&gt;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-&gt;lock`.
See #1 ~ #6 in the following example calling trace.
(Lock Order: `prepare_lock` -&gt; `&amp;genpd-&gt;mlock` -&gt; ... -&gt; `&amp;ec_dev-&gt;lock`)

Move the clk_prepare()/clk_unprepare() operations for `scp-&gt;clk` to the
remoteproc prepare()/unprepare() callbacks.  This ensures `prepare_lock`
is only acquired in prepare()/unprepare() callbacks.  Since
`ec_dev-&gt;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:
&gt; -&gt; #6 (&amp;ec_dev-&gt;lock)
&gt;        cros_ec_cmd_xfer
&gt;        cros_ec_cmd_xfer_status
&gt;        cros_usbpd_charger_get_port_status
&gt;        cros_usbpd_charger_get_prop
&gt;        power_supply_get_property
&gt;        power_supply_show_property
&gt;        power_supply_uevent
&gt;        dev_uevent
&gt;        uevent_show
&gt;        dev_attr_show
&gt;        sysfs_kf_seq_show
&gt;        kernfs_seq_show
&gt; -&gt; #5 (kn-&gt;active#2)
&gt;        kernfs_drain
&gt;        __kernfs_remove
&gt;        kernfs_remove_by_name_ns
&gt;        sysfs_remove_file_ns
&gt;        device_del
&gt;        __device_link_del
&gt;        device_links_driver_bound
&gt; -&gt; #4 (device_links_lock)
&gt;        device_link_remove
&gt;        _regulator_put
&gt;        regulator_put
&gt; -&gt; #3 (regulator_list_mutex)
&gt;        regulator_lock_dependent
&gt;        regulator_disable
&gt;        scpsys_power_off
&gt;        _genpd_power_off
&gt;        genpd_power_off
&gt; -&gt; #2 (&amp;genpd-&gt;mlock/1)
&gt;        genpd_add_subdomain
&gt;        pm_genpd_add_subdomain
&gt;        scpsys_add_subdomain
&gt;        scpsys_probe
&gt; -&gt; #1 (&amp;genpd-&gt;mlock)
&gt;        genpd_runtime_resume
&gt;        __rpm_callback
&gt;        rpm_callback
&gt;        rpm_resume
&gt;        __pm_runtime_resume
&gt;        clk_core_prepare
&gt;        clk_prepare
&gt; -&gt; #0 (prepare_lock)
&gt;        clk_prepare
&gt;        scp_ipi_send
&gt;        scp_send_ipi
&gt;        mtk_rpmsg_send
&gt;        rpmsg_send
&gt;        cros_ec_pkt_xfer_rpmsg

Signed-off-by: Tzung-Bi Shih &lt;tzungbi@kernel.org&gt;
Reviewed-by: Chen-Yu Tsai &lt;wenst@chromium.org&gt;
Tested-by: Chen-Yu Tsai &lt;wenst@chromium.org&gt;
Link: https://lore.kernel.org/r/20260112110755.2435899-1-tzungbi@kernel.org
Signed-off-by: Mathieu Poirier &lt;mathieu.poirier@linaro.org&gt;
Signed-off-by: Sasha Levin &lt;sashal@kernel.org&gt;
</content>
</entry>
<entry>
<title>remoteproc: mtk_scp: Only populate devices for SCP cores</title>
<updated>2024-12-16T16:31:33Z</updated>
<author>
<name>Chen-Yu Tsai</name>
<email>wenst@chromium.org</email>
</author>
<published>2024-12-11T07:20:07Z</published>
<link rel='alternate' type='text/html' href='https://universe.0xinfinity.dev/distro/kernel/commit/?id=dbb9c372555c0b2a5a9264418bfba6d017752808'/>
<id>urn:sha1:dbb9c372555c0b2a5a9264418bfba6d017752808</id>
<content type='text'>
When multi-core SCP support was added, the driver was made to populate
platform devices for all the sub-nodes. This ended up adding platform
devices for the rpmsg sub-nodes as well, which never actually get used,
since rpmsg devices are registered through the rpmsg interface.

Limit of_platform_populate() to just populating the SCP cores with a
compatible string match list.

Fixes: 1fdbf0cdde98 ("remoteproc: mediatek: Probe SCP cluster on multi-core SCP")
Cc: Tinghan Shen &lt;tinghan.shen@mediatek.com&gt;
Signed-off-by: Chen-Yu Tsai &lt;wenst@chromium.org&gt;
Link: https://lore.kernel.org/r/20241211072009.120511-1-wenst@chromium.org
Signed-off-by: Mathieu Poirier &lt;mathieu.poirier@linaro.org&gt;
</content>
</entry>
<entry>
<title>remoteproc: Switch back to struct platform_driver::remove()</title>
<updated>2024-10-29T17:27:37Z</updated>
<author>
<name>Uwe Kleine-König</name>
<email>u.kleine-koenig@baylibre.com</email>
</author>
<published>2024-10-25T13:13:41Z</published>
<link rel='alternate' type='text/html' href='https://universe.0xinfinity.dev/distro/kernel/commit/?id=ad64a7c4a49d30c5d909a35e2c7882d3870ddafc'/>
<id>urn:sha1:ad64a7c4a49d30c5d909a35e2c7882d3870ddafc</id>
<content type='text'>
After commit 0edb555a65d1 ("platform: Make platform_driver::remove()
return void") .remove() is (again) the right callback to implement for
platform drivers.

Convert all platform drivers below drivers/remoteproc to use .remove(),
with the eventual goal to drop struct platform_driver::remove_new(). As
.remove() and .remove_new() have the same prototypes, conversion is done
by just changing the structure member name in the driver initializer.

Signed-off-by: Uwe Kleine-König &lt;u.kleine-koenig@baylibre.com&gt;
Link: https://lore.kernel.org/r/20241025131340.258233-2-u.kleine-koenig@baylibre.com
Signed-off-by: Mathieu Poirier &lt;mathieu.poirier@linaro.org&gt;
</content>
</entry>
<entry>
<title>remoteproc: mediatek: Increase MT8188/MT8195 SCP core0 DRAM size</title>
<updated>2024-07-08T15:57:16Z</updated>
<author>
<name>Jason Chen</name>
<email>Jason-ch.Chen@mediatek.com</email>
</author>
<published>2024-07-03T03:44:09Z</published>
<link rel='alternate' type='text/html' href='https://universe.0xinfinity.dev/distro/kernel/commit/?id=19cb6058620620e68f1a9aed99393be5c3629db4'/>
<id>urn:sha1:19cb6058620620e68f1a9aed99393be5c3629db4</id>
<content type='text'>
The current DRAM size is insufficient for the HEVC feature, which
requires more memory for proper functionality. This change ensures the
feature has the necessary resources.

Signed-off-by: Jason Chen &lt;Jason-ch.Chen@mediatek.com&gt;
Reviewed-by: AngeloGioacchino Del Regno &lt;angelogioacchino.delregno@collabora.com&gt;
Cc: stable@vger.kernel.org
Link: https://lore.kernel.org/r/20240703034409.698-1-Jason-ch.Chen@mediatek.com
Signed-off-by: Mathieu Poirier &lt;mathieu.poirier@linaro.org&gt;
</content>
</entry>
<entry>
<title>remoteproc: mediatek: Don't attempt to remap l1tcm memory if missing</title>
<updated>2024-06-28T17:56:24Z</updated>
<author>
<name>Nícolas F. R. A. Prado</name>
<email>nfraprado@collabora.com</email>
</author>
<published>2024-06-27T21:20:55Z</published>
<link rel='alternate' type='text/html' href='https://universe.0xinfinity.dev/distro/kernel/commit/?id=67ca3f98070ffdf308b91e08a477fcb1e9684ae8'/>
<id>urn:sha1:67ca3f98070ffdf308b91e08a477fcb1e9684ae8</id>
<content type='text'>
The current code doesn't check whether platform_get_resource_byname()
succeeded to get the l1tcm memory, which is optional, before attempting
to map it. This results in the following error message when it is
missing:

  mtk-scp 10500000.scp: error -EINVAL: invalid resource (null)

Add a check so that the remapping is only attempted if the memory region
exists. This also allows to simplify the logic handling failure to
remap, since a failure then is always a failure.

Fixes: ca23ecfdbd44 ("remoteproc/mediatek: support L1TCM")
Signed-off-by: Nícolas F. R. A. Prado &lt;nfraprado@collabora.com&gt;
Reviewed-by: Tzung-Bi Shih &lt;tzungbi@kernel.org&gt;
Reviewed-by: AngeloGioacchino Del Regno &lt;angelogioacchino.delregno@collabora.com&gt;
Link: https://lore.kernel.org/r/20240627-scp-invalid-resource-l1tcm-v1-1-7d221e6c495a@collabora.com
Signed-off-by: Mathieu Poirier &lt;mathieu.poirier@linaro.org&gt;
</content>
</entry>
<entry>
<title>remoteproc: mediatek: Zero out only remaining bytes of IPI buffer</title>
<updated>2024-05-28T18:49:46Z</updated>
<author>
<name>AngeloGioacchino Del Regno</name>
<email>angelogioacchino.delregno@collabora.com</email>
</author>
<published>2024-05-20T11:27:24Z</published>
<link rel='alternate' type='text/html' href='https://universe.0xinfinity.dev/distro/kernel/commit/?id=9dbd9962cfe56d210be5232349851420b5f9c8f6'/>
<id>urn:sha1:9dbd9962cfe56d210be5232349851420b5f9c8f6</id>
<content type='text'>
In scp_ipi_handler(), instead of zeroing out the entire shared
buffer, which may be as large as 600 bytes, overwrite it with the
received data, then zero out only the remaining bytes.

Signed-off-by: AngeloGioacchino Del Regno &lt;angelogioacchino.delregno@collabora.com&gt;
Link: https://lore.kernel.org/r/20240520112724.139945-1-angelogioacchino.delregno@collabora.com
Signed-off-by: Mathieu Poirier &lt;mathieu.poirier@linaro.org&gt;
</content>
</entry>
<entry>
<title>remoteproc: mediatek: Fix error code in scp_rproc_init()</title>
<updated>2024-05-06T19:30:08Z</updated>
<author>
<name>Dan Carpenter</name>
<email>dan.carpenter@linaro.org</email>
</author>
<published>2024-05-04T11:26:46Z</published>
<link rel='alternate' type='text/html' href='https://universe.0xinfinity.dev/distro/kernel/commit/?id=47558cbaa842c4561d08512e531b88cc92d35837'/>
<id>urn:sha1:47558cbaa842c4561d08512e531b88cc92d35837</id>
<content type='text'>
Set the error code to ERR_PTR(-ENOMEM).  Otherwise if there is an
allocation failure it leads to a NULL dereference in the caller.

Fixes: c08a82494500 ("remoteproc: mediatek: Support setting DRAM and IPI shared buffer sizes")
Signed-off-by: Dan Carpenter &lt;dan.carpenter@linaro.org&gt;
Reviewed-by: AngeloGioacchino Del Regno &lt;angelogioacchino.delregno@collabora.com&gt;
Link: https://lore.kernel.org/r/b2114e3c-fa64-4edb-a1ff-d2009e544c3f@moroto.mountain
Signed-off-by: Mathieu Poirier &lt;mathieu.poirier@linaro.org&gt;
</content>
</entry>
<entry>
<title>remoteproc: mediatek: Support setting DRAM and IPI shared buffer sizes</title>
<updated>2024-04-30T16:43:59Z</updated>
<author>
<name>Olivia Wen</name>
<email>olivia.wen@mediatek.com</email>
</author>
<published>2024-04-30T01:15:33Z</published>
<link rel='alternate' type='text/html' href='https://universe.0xinfinity.dev/distro/kernel/commit/?id=c08a824945009aefcb4d70705f195ad15fe26e64'/>
<id>urn:sha1:c08a824945009aefcb4d70705f195ad15fe26e64</id>
<content type='text'>
The SCP on different chips will require different DRAM sizes and IPI
shared buffer sizes based on varying requirements.

Signed-off-by: Olivia Wen &lt;olivia.wen@mediatek.com&gt;
Reviewed-by: AngeloGioacchino Del Regno &lt;angelogioacchino.delregno@collabora.com&gt;
Link: https://lore.kernel.org/r/20240430011534.9587-4-olivia.wen@mediatek.com
Signed-off-by: Mathieu Poirier &lt;mathieu.poirier@linaro.org&gt;
</content>
</entry>
<entry>
<title>remoteproc: mediatek: Support MT8188 SCP core 1</title>
<updated>2024-04-30T16:42:57Z</updated>
<author>
<name>Olivia Wen</name>
<email>olivia.wen@mediatek.com</email>
</author>
<published>2024-04-30T01:15:32Z</published>
<link rel='alternate' type='text/html' href='https://universe.0xinfinity.dev/distro/kernel/commit/?id=928a55ab1b419ba160e33c1bdee86904f110b638'/>
<id>urn:sha1:928a55ab1b419ba160e33c1bdee86904f110b638</id>
<content type='text'>
MT8188 SCP has two RISC-V cores which is similar to MT8195 but without
L1TCM. We've added MT8188-specific functions to configure L1TCM in
multicore setups.

Signed-off-by: Olivia Wen &lt;olivia.wen@mediatek.com&gt;
Reviewed-by: AngeloGioacchino Del Regno &lt;angelogioacchino.delregno@collabora.com&gt;
Link: https://lore.kernel.org/r/20240430011534.9587-3-olivia.wen@mediatek.com
Signed-off-by: Mathieu Poirier &lt;mathieu.poirier@linaro.org&gt;
</content>
</entry>
</feed>
