Re: [PATCH 4/7] soc: mediatek: mmdvfs: add VCP backend
From: Krzysztof Kozlowski
Date: Wed Nov 25 2026 - 05:59:29 EST
On 25/11/2026 07:00, Echo Zhang wrote:
> Add the VCP transport used by MMDVFS to map AP and firmware shared
> memory, manage feature power references and send IPI commands.
>
> Wait for VCP readiness and handle the selected MMUP or VCP READY
> notification to initialize firmware after boot and resume. Serialize
> IPI transactions while shared memory and acknowledgment state are in
> use.
>
> Signed-off-by: Echo Zhang <echo.zhang@xxxxxxxxxxxx>
> ---
> drivers/soc/mediatek/mmdvfs/Makefile | 2 +
> drivers/soc/mediatek/mmdvfs/mmdvfs-clk.c | 39 +-
> drivers/soc/mediatek/mmdvfs/mmdvfs-core.c | 272 +++--
> drivers/soc/mediatek/mmdvfs/mmdvfs-internal.h | 160 ++-
> drivers/soc/mediatek/mmdvfs/mmdvfs-up-priv.h | 57 +
> drivers/soc/mediatek/mmdvfs/mmdvfs-up.c | 275 +++++
> .../soc/mediatek/mmdvfs/mmdvfs-vcp-memory.h | 104 ++
> drivers/soc/mediatek/mmdvfs/mmdvfs-vcp.c | 1075 +++++++++++++++++
> include/soc/mediatek/mmdvfs.h | 66 +-
> 9 files changed, 1846 insertions(+), 204 deletions(-)
> create mode 100644 drivers/soc/mediatek/mmdvfs/mmdvfs-up-priv.h
> create mode 100644 drivers/soc/mediatek/mmdvfs/mmdvfs-up.c
> create mode 100644 drivers/soc/mediatek/mmdvfs/mmdvfs-vcp-memory.h
> create mode 100644 drivers/soc/mediatek/mmdvfs/mmdvfs-vcp.c
>
> diff --git a/drivers/soc/mediatek/mmdvfs/Makefile b/drivers/soc/mediatek/mmdvfs/Makefile
> index 33a280827006..16ecee30bff6 100644
> --- a/drivers/soc/mediatek/mmdvfs/Makefile
> +++ b/drivers/soc/mediatek/mmdvfs/Makefile
> @@ -4,3 +4,5 @@ obj-$(CONFIG_MTK_MMDVFS) += mtk-mmdvfs.o
>
> mtk-mmdvfs-y += mmdvfs-core.o
> mtk-mmdvfs-y += mmdvfs-clk.o
> +mtk-mmdvfs-y += mmdvfs-up.o
> +mtk-mmdvfs-y += mmdvfs-vcp.o
> diff --git a/drivers/soc/mediatek/mmdvfs/mmdvfs-clk.c b/drivers/soc/mediatek/mmdvfs/mmdvfs-clk.c
> index 114f3148cf46..b9025427782d 100644
> --- a/drivers/soc/mediatek/mmdvfs/mmdvfs-clk.c
> +++ b/drivers/soc/mediatek/mmdvfs/mmdvfs-clk.c
> @@ -15,7 +15,6 @@
> #include <linux/of.h>
> #include <linux/of_platform.h>
> #include <linux/platform_device.h>
> -#include <linux/pm_runtime.h>
Srsly, you just added this. So you add buggy code just to fix it...
> #include <linux/property.h>
> #include <linux/slab.h>
> #include <linux/string.h>
> @@ -27,9 +26,18 @@
>
> static const char *mmdvfs_get_clkdev_name(const char *name, char *buf, size_t size)
> {
> + int ret;
> +
> if (strlen(name) < MMDVFS_CLKDEV_CON_ID_MAX)
> return name;
>
> + if (str_has_prefix(name, "mmdvfs-vcp-")) {
> + ret = snprintf(buf, size, "mmdvfs-v-%s",
> + name + strlen("mmdvfs-vcp-"));
> + if (ret > 0 && ret < (int)size)
> + return buf;
> + }
> +
> return NULL;
> }
>
> @@ -66,7 +74,7 @@ static int mmdvfs_set_rate(struct clk_hw *hw, unsigned long rate,
>
> data = mmdvfs->data;
>
> - if (!data->init_done)
> + if (!READ_ONCE(data->init_done))
> return -EPROBE_DEFER;
>
> if (!mmdvfs_is_valid_user_id(user->id) ||
> @@ -76,12 +84,6 @@ static int mmdvfs_set_rate(struct clk_hw *hw, unsigned long rate,
> return -EINVAL;
> }
>
> - if (rate == 0) {
> - mmdvfs_dbg(mmdvfs->dev, "Zero rate request for user %s\n",
> - user->name);
> - return 0;
> - }
NAK, this is just random coding, without any architectural oversight.
Best regards,
Krzysztof