[PATCH 4/7] soc: mediatek: mmdvfs: add VCP backend

Roman Vivchar rva333 at protonmail.com
Wed Nov 25 00:38:37 PST 2026


On Wednesday, November 25th, 2026 at 8:01 AM, Echo Zhang <echo.zhang at mediatek.com> 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 at mediatek.com>
> ---

...

> diff --git a/drivers/soc/mediatek/mmdvfs/mmdvfs-core.c b/drivers/soc/mediatek/mmdvfs/mmdvfs-core.c
> index c32fa11557af..3388a5a3a145 100644
> --- a/drivers/soc/mediatek/mmdvfs/mmdvfs-core.c
> +++ b/drivers/soc/mediatek/mmdvfs/mmdvfs-core.c
> @@ -7,22 +7,23 @@
> 
>  #include <linux/atomic.h>
>  #include <linux/clk-provider.h>
> +#include <linux/delay.h>
>  #include <linux/device.h>
>  #include <linux/err.h>
>  #include <linux/io.h>
> +#include <linux/kthread.h>
>  #include <linux/module.h>
>  #include <linux/mutex.h>
> -#include <linux/notifier.h>
>  #include <linux/of.h>
>  #include <linux/of_address.h>
>  #include <linux/platform_device.h>
> +#include <linux/remoteproc/mtk_vcp_public.h>
>  #include <linux/sched/clock.h>
>  #include <linux/slab.h>
>  #include <linux/string.h>
> -#include <linux/suspend.h>
> -#include <linux/workqueue.h>
> 
>  #include "mmdvfs-internal.h"
> +#include "mmdvfs-up-priv.h"
> 
>  static int mmdvfs_register_device(struct mmdvfs_device *mmdvfs);
>  static void mmdvfs_unregister_device(struct mmdvfs_device *mmdvfs);
> @@ -34,14 +35,13 @@ struct mmdvfs_device *mmdvfs_find_device_any(void)
>  {
>  	return mmdvfs_find_device_by_version(MMDVFS_VERSION_HWCCF_DVFS_VOTER);
>  }
> -EXPORT_SYMBOL_GPL(mmdvfs_find_device_any);
> 
>  /**
>   * mmdvfs_get_version - Get MMDVFS voting mechanism type
>   *
>   * Return:
>   *   0 - No hardware voter
> - *   1 - HWCCF DVFS voter
> + *   1 - HWCCF DVFS voter (VCP IPI with MMUP SRAM)
>   */
>  u32 mmdvfs_get_version(void)
>  {
> @@ -96,7 +96,8 @@ static int mmdvfs_validate_topology(struct mmdvfs_device *mmdvfs)
>  			return -EINVAL;
>  		}
> 
> -		if (mux->freq_num == 0 || mux->freq_num > MMDVFS_MAX_LEVELS) {
> +		if (mux->freq_num == 0 || mux->freq_num > rc->level_num ||
> +		    mux->freq_num > MMDVFS_MAX_LEVELS) {
>  			mmdvfs_err(mmdvfs->dev,
>  				   "MUX %d (%s): invalid freq_num: %d\n",
>  				   i, mux->name, mux->freq_num);
> @@ -112,10 +113,11 @@ static int mmdvfs_validate_topology(struct mmdvfs_device *mmdvfs)
>  			}
> 
>  			if (j > 0 && mux->freq[j] <= mux->freq[j - 1]) {
> -				mmdvfs_warn(mmdvfs->dev,
> -					    "MUX %d (%s): freq not ascending: freq[%d]=%llu <= freq[%d]=%llu\n",
> -					    i, mux->name, j, mux->freq[j],
> -					    j - 1, mux->freq[j - 1]);
> +				mmdvfs_err(mmdvfs->dev,
> +					   "MUX %d (%s): freq not ascending: freq[%d]=%llu <= freq[%d]=%llu\n",
> +					   i, mux->name, j, mux->freq[j],
> +					   j - 1, mux->freq[j - 1]);
> +				return -EINVAL;

Why this can't be in the previous patch?

...

> diff --git a/drivers/soc/mediatek/mmdvfs/mmdvfs-vcp.c b/drivers/soc/mediatek/mmdvfs/mmdvfs-vcp.c
> new file mode 100644
> index 000000000000..fc6db1c89294
> --- /dev/null
> +++ b/drivers/soc/mediatek/mmdvfs/mmdvfs-vcp.c

...

> +/*
> + * mmdvfs_get_bootmode - Get system boot mode
> + *
> + * Query boot mode from device tree /chosen node
> + */
> +static void mmdvfs_get_bootmode(void)
> +{
> +	struct device_node *np_chosen;
> +	struct tag_bootmode {
> +		u32 size;
> +		u32 tag;
> +		u32 bootmode;
> +		u32 boottype;
> +	} *tag;
> +
> +	if (bootmode < UNKNOWN_BOOT)
> +		return;
> +
> +	np_chosen = of_find_node_by_path("/chosen");
> +	if (!np_chosen) {
> +		bootmode = NORMAL_BOOT;
> +		return;
> +	}
> +
> +	tag = (struct tag_bootmode *)of_get_property(np_chosen, "atag,boot", NULL);
> +	of_node_put(np_chosen);
> +
> +	if (tag)
> +		bootmode = tag->bootmode;
> +	else
> +		bootmode = NORMAL_BOOT;
> +}

No. Please don't add your downstream code.

I'll stop here. This patch modifies too many things from the previous
one, and the series overall needs more cleanup.

Best regards,
Roman



More information about the linux-arm-kernel mailing list