<feed xmlns='http://www.w3.org/2005/Atom'>
<title>kernel.git/drivers/remoteproc/mtk_scp.c, branch master</title>
<subtitle>Hosts the 0x221E linux distro kernel.
</subtitle>
<id>https://git.0xinfinity.dev/distro/kernel.git/atom?h=master</id>
<link rel='self' href='https://git.0xinfinity.dev/distro/kernel.git/atom?h=master'/>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/'/>
<updated>2026-03-05T17:14:36Z</updated>
<entry>
<title>remoteproc: mediatek: Unprepare SCP clock during system suspend</title>
<updated>2026-03-05T17:14:36Z</updated>
<author>
<name>Tzung-Bi Shih</name>
</author>
<published>2026-02-06T03:30:33Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=35c3f72a2d55dbf52f28f4ecae51c76be1acf545'/>
<id>urn:sha1:35c3f72a2d55dbf52f28f4ecae51c76be1acf545</id>
<content type='text'>
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;
</content>
</entry>
<entry>
<title>remoteproc: mediatek: Break lock dependency to `prepare_lock`</title>
<updated>2026-01-26T15:45:49Z</updated>
<author>
<name>Tzung-Bi Shih</name>
</author>
<published>2026-01-12T11:07:55Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=d935187cfb27fc4168f78f3959aef4eafaae76bb'/>
<id>urn:sha1:d935187cfb27fc4168f78f3959aef4eafaae76bb</id>
<content type='text'>
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;
</content>
</entry>
<entry>
<title>remoteproc: mtk_scp: Simplify with scoped for each OF child loop</title>
<updated>2026-01-05T21:28:33Z</updated>
<author>
<name>Krzysztof Kozlowski</name>
</author>
<published>2026-01-02T12:48:28Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=6d183d0530b5dc77ddd7d829bdfcb62a365a210f'/>
<id>urn:sha1:6d183d0530b5dc77ddd7d829bdfcb62a365a210f</id>
<content type='text'>
Use scoped for-each loop when iterating over device nodes to make code a
bit simpler.

Signed-off-by: Krzysztof Kozlowski &lt;krzysztof.kozlowski@oss.qualcomm.com&gt;
Link: https://lore.kernel.org/r/20260102124827.64355-3-krzysztof.kozlowski@oss.qualcomm.com
Signed-off-by: Mathieu Poirier &lt;mathieu.poirier@linaro.org&gt;
</content>
</entry>
<entry>
<title>remoteproc: mediatek: Change the snprintf() checking</title>
<updated>2025-11-10T17:40:44Z</updated>
<author>
<name>Dan Carpenter</name>
</author>
<published>2025-10-27T07:08:51Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=5a3d530caab22c235c994b38a860549da04171a4'/>
<id>urn:sha1:5a3d530caab22c235c994b38a860549da04171a4</id>
<content type='text'>
The snprintf() calls here work but they have several minor style issues:

1) It uses ARRAY_SIZE() which is the number of elements in an array.
   Since were talking about char that works, but it's more common to
   use sizeof() which is the number of bytes.
2) The printf format is "%1d".  The "1" ensures we always print at
   least 1 character but since numbers all have at least 1 digit this
   can be removed.
3) The kernel implementation of snprintf() cannot return negative error
   codes.  Also these particular calls to snprintf() can't return zero
   and the code to handle that zero return is sort of questionable.
4) In the current kernel the only "core_id" we print is "0" but if it
   was more than 9 then the output would be truncated so GCC complains.
   Add an "a &gt;= sizeof(scp_fw_file)" check for output which is too long.

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/aP8agyKj73bLZrTQ@stanley.mountain
Signed-off-by: Mathieu Poirier &lt;mathieu.poirier@linaro.org&gt;
</content>
</entry>
<entry>
<title>remoteproc: mtk_scp: Construct FW path if firmware-name not present</title>
<updated>2025-10-20T15:16:11Z</updated>
<author>
<name>AngeloGioacchino Del Regno</name>
</author>
<published>2025-10-15T08:41:03Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=8fd705c5e72776c2f1a0212bdedcb9a9753b5bce'/>
<id>urn:sha1:8fd705c5e72776c2f1a0212bdedcb9a9753b5bce</id>
<content type='text'>
After a reply on the mailing lists [1] it emerged that the DT
property "firmware-name" should not be relied on because of
possible issues with firmware versions.
For MediaTek SCP, there has never been any firmware version vs
driver version desync issue but, regardless, the firmwares are
always using the same name and they're always located in a path
with a specific pattern.

Instead of unconditionally always relying on the firmware-name
devicetree property to get a path to the SCP FW file, drivers
should construct a name based on what firmware it knows and
what hardware it is running on.

In order to do that, add a `scp_get_default_fw_path()` function
that constructs the path and filename based on two of the infos
that the driver can get:
 1. The compatible string with the highest priority (so, the
    first one at index 0); and
 2. The type of SCP HW - single-core or multi-core.

This means that the default firmware path is generated as:
 - Single core SCP: mediatek/(soc_model)/scp.img
   for example:     mediatek/mt8183/scp.img;

 - Multi core SCP:  mediatek/(soc_model)/scp_c(core_number).img
   for example:     mediatek/mt8188/scp_c0.img for Core 0, and
                    mediatek/mt8188/scp_c1.img for Core 1.

Note that the generated firmware path is being used only if the
"firmware-name" devicetree property is not present in the SCP
node or in the SCP Core node(s).

[1 - Reply regarding firmware-name property]
Link: https://lore.kernel.org/all/7e8718b0-df78-44a6-a102-89529d6abcce@app.fastmail.com/
Signed-off-by: AngeloGioacchino Del Regno &lt;angelogioacchino.delregno@collabora.com&gt;
Reviewed-by: Arnd Bergmann &lt;arnd@arndb.de&gt;
Link: https://lore.kernel.org/r/20251015084103.10737-1-angelogioacchino.delregno@collabora.com
Signed-off-by: Mathieu Poirier &lt;mathieu.poirier@linaro.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>
</author>
<published>2024-12-11T07:20:07Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/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>
</author>
<published>2024-10-25T13:13:41Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/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>
</author>
<published>2024-07-03T03:44:09Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/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>
</author>
<published>2024-06-27T21:20:55Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/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>
</author>
<published>2024-05-20T11:27:24Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/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>
</feed>
