Linux-mediatek Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Krzysztof Kozlowski <krzk@kernel.org>
To: Echo Zhang <echo.zhang@mediatek.com>,
	Rob Herring <robh@kernel.org>,
	Krzysztof Kozlowski <krzk+dt@kernel.org>,
	Conor Dooley <conor+dt@kernel.org>,
	Matthias Brugger <matthias.bgg@gmail.com>,
	AngeloGioacchino Del Regno
	<angelogioacchino.delregno@collabora.com>,
	Stephen Boyd <sboyd@kernel.org>,
	Brian Masney <bmasney+clk@redhat.com>,
	Jerome Brunet <jbrunet+clk@baylibre.com>,
	Nathan Chancellor <nathan@kernel.org>,
	Nick Desaulniers <ndesaulniers@google.com>,
	Bill Wendling <morbo@google.com>,
	Justin Stitt <justinstitt@google.com>,
	MMDVFS Team <linux-mediatek@lists.infradead.org>,
	kyrie.wu@mediatek.com, ming-fan.chen@mediatek.com,
	devicetree@vger.kernel.org, linux-kernel@vger.kernel.org,
	linux-arm-kernel@lists.infradead.org, linux-clk@vger.kernel.org,
	llvm@lists.linux.dev
Subject: Re: [PATCH 4/7] soc: mediatek: mmdvfs: add VCP backend
Date: Wed, 25 Nov 2026 11:59:17 +0100	[thread overview]
Message-ID: <180e1abc-9463-4973-9cf0-a6e8c86e17fa@kernel.org> (raw)
In-Reply-To: <20261125060037.649659-5-echo.zhang@mediatek.com>

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@mediatek.com>
> ---
>  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


  parent reply	other threads:[~2026-11-25 10:59 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-25  6:00 [PATCH 0/7] soc: mediatek: add MMDVFS support for MT8196 Echo Zhang
2026-11-25  6:00 ` [PATCH 1/7] dt-bindings: clock: mediatek: add MT8196 MMDVFS clock IDs Echo Zhang
2026-11-25 10:55   ` Krzysztof Kozlowski
2026-11-25  6:00 ` [PATCH 2/7] dt-bindings: soc: mediatek: add MMDVFS binding Echo Zhang
2026-11-25  8:32   ` Roman Vivchar
2026-11-25 10:58   ` Krzysztof Kozlowski
2026-11-25  6:00 ` [PATCH 3/7] soc: mediatek: add MMDVFS core driver Echo Zhang
2026-11-25  8:35   ` Roman Vivchar
2026-11-25 10:54   ` Krzysztof Kozlowski
2026-11-25  6:00 ` [PATCH 4/7] soc: mediatek: mmdvfs: add VCP backend Echo Zhang
2026-11-25  8:38   ` Roman Vivchar
2026-11-25 10:59   ` Krzysztof Kozlowski [this message]
2026-11-25 11:00   ` Krzysztof Kozlowski
2026-11-25  6:00 ` [PATCH 5/7] soc: mediatek: mmdvfs: add MT8196 support Echo Zhang
2026-11-25  6:00 ` [PATCH 6/7] soc: mediatek: mmdvfs: add read-only status debug Echo Zhang
2026-11-25  6:00 ` [PATCH 7/7] MAINTAINERS: add MediaTek MMDVFS entry Echo Zhang

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=180e1abc-9463-4973-9cf0-a6e8c86e17fa@kernel.org \
    --to=krzk@kernel.org \
    --cc=angelogioacchino.delregno@collabora.com \
    --cc=bmasney+clk@redhat.com \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=echo.zhang@mediatek.com \
    --cc=jbrunet+clk@baylibre.com \
    --cc=justinstitt@google.com \
    --cc=krzk+dt@kernel.org \
    --cc=kyrie.wu@mediatek.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-clk@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mediatek@lists.infradead.org \
    --cc=llvm@lists.linux.dev \
    --cc=matthias.bgg@gmail.com \
    --cc=ming-fan.chen@mediatek.com \
    --cc=morbo@google.com \
    --cc=nathan@kernel.org \
    --cc=ndesaulniers@google.com \
    --cc=robh@kernel.org \
    --cc=sboyd@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox