mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Roman Vivchar via B4 Relay <devnull+rva333.protonmail.com@kernel.org>
To: Srinivas Kandagatla <srini@kernel.org>,
	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>,
	 Andrew-CT Chen <andrew-ct.chen@mediatek.com>,
	 Lala Lin <lala.lin@mediatek.com>
Cc: devicetree@vger.kernel.org, linux-kernel@vger.kernel.org,
	 linux-arm-kernel@lists.infradead.org,
	linux-mediatek@lists.infradead.org,
	 Roman Vivchar <rva333@protonmail.com>
Subject: [PATCH v6 3/4] nvmem: mtk-efuse: add CPU speedbin post-processing
Date: Mon, 23 Nov 2026 23:02:33 +0200	[thread overview]
Message-ID: <20261123-6572-nvmem-v6-3-7ba710b15657@protonmail.com> (raw)
In-Reply-To: <20261123-6572-nvmem-v6-0-7ba710b15657@protonmail.com>

From: Roman Vivchar <rva333@protonmail.com>

MediaTek SoCs are often released under the same marketing name, but with
different suffix for the speedbin. For example, mt6572m has 1 GHz limit,
mt6572a - 1.2 GHz, mt6572w - 1.4 GHz.

Since CPU speedbin is stored as a number in the efuse, similar to GPU,
rename mtk_efuse_gpu_speedbin_pp() to mtk_efuse_speedbin_pp() and add
check for cpu-speedbin node to fixup the value for supported-hw usage in
OPP tables.

Signed-off-by: Roman Vivchar <rva333@protonmail.com>
---
 drivers/nvmem/mtk-efuse.c | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)

diff --git a/drivers/nvmem/mtk-efuse.c b/drivers/nvmem/mtk-efuse.c
index 980c29d01337..2c09649ce7f9 100644
--- a/drivers/nvmem/mtk-efuse.c
+++ b/drivers/nvmem/mtk-efuse.c
@@ -59,8 +59,8 @@ static int mtk_reg_read(void *context,
 	return 0;
 }
 
-static int mtk_efuse_gpu_speedbin_pp(void *context, const char *id, int index,
-				     unsigned int offset, void *data, size_t bytes)
+static int mtk_efuse_speedbin_pp(void *context, const char *id, int index,
+				 unsigned int offset, void *data, size_t bytes)
 {
 	u8 *val = data;
 
@@ -76,13 +76,14 @@ static void mtk_efuse_fixup_dt_cell_info(struct nvmem_device *nvmem,
 	size_t sz = strlen(cell->name);
 
 	/*
-	 * On some SoCs, the GPU speedbin is not read as bitmask but as
+	 * On some SoCs, the CPU/GPU speedbin is not read as bitmask but as
 	 * a number with range [0-7] (max 3 bits): post process to use
 	 * it in OPP tables to describe supported-hw.
 	 */
 	if (cell->nbits <= 3 &&
-	    strncmp(cell->name, "gpu-speedbin", min(sz, strlen("gpu-speedbin"))) == 0)
-		cell->read_post_process = mtk_efuse_gpu_speedbin_pp;
+	    (strncmp(cell->name, "gpu-speedbin", min(sz, strlen("gpu-speedbin"))) == 0 ||
+	     strncmp(cell->name, "cpu-speedbin", min(sz, strlen("cpu-speedbin"))) == 0))
+		cell->read_post_process = mtk_efuse_speedbin_pp;
 }
 
 static int mtk_efuse_probe(struct platform_device *pdev)

-- 
2.56.1



  parent reply	other threads:[~2026-11-23 21:05 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-23 21:02 [PATCH v6 0/4] nvmem: mtk-efuse: mt6572 support Roman Vivchar via B4 Relay
2026-11-23 21:02 ` [PATCH v6 1/4] dt-bindings: nvmem: mediatek: efuse: add mt6572 Roman Vivchar via B4 Relay
2026-11-23 21:02 ` [PATCH v6 2/4] nvmem: mtk-efuse: add support for 32-bit aligned reads Roman Vivchar via B4 Relay
2026-11-23 21:02 ` Roman Vivchar via B4 Relay [this message]
2026-11-23 21:02 ` [PATCH v6 4/4] nvmem: mtk-efuse: add mt6572 support Roman Vivchar via B4 Relay

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=20261123-6572-nvmem-v6-3-7ba710b15657@protonmail.com \
    --to=devnull+rva333.protonmail.com@kernel.org \
    --cc=andrew-ct.chen@mediatek.com \
    --cc=angelogioacchino.delregno@collabora.com \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=krzk+dt@kernel.org \
    --cc=lala.lin@mediatek.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mediatek@lists.infradead.org \
    --cc=matthias.bgg@gmail.com \
    --cc=robh@kernel.org \
    --cc=rva333@protonmail.com \
    --cc=srini@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

all inboxes | Powered by JetHome®