lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [day] [month] [year] [list]
Message-Id: <20250304125256.3361648-1-zxyan20@163.com>
Date: Tue,  4 Mar 2025 20:52:56 +0800
From: Zxyan Zhu <zxyan20@....com>
To: vireshk@...nel.org
Cc: nm@...com,
	sboyd@...nel.org,
	linux-pm@...r.kernel.org,
	linux-kernel@...r.kernel.org,
	Zxyan Zhu <zxyan20@....com>
Subject: [PATCH 1/1] OPP: Support multiple frequency points with opp-hz-<name>

Current OPP driver only supports a single frequency value per OPP
entry using `opp-hz`. This patch extends the functionality to allow
retrieving named frequency points using `opp-hz-<name>`, improving
flexibility for different operating modes.

Signed-off-by: Zxyan Zhu <zxyan20@....com>
---
 drivers/opp/of.c | 28 ++++++++++++++++++++--------
 1 file changed, 20 insertions(+), 8 deletions(-)

diff --git a/drivers/opp/of.c b/drivers/opp/of.c
index a24f76f5fd01..d20802b0f89c 100644
--- a/drivers/opp/of.c
+++ b/drivers/opp/of.c
@@ -752,18 +752,30 @@ EXPORT_SYMBOL_GPL(dev_pm_opp_of_remove_table);
 static int _read_rate(struct dev_pm_opp *new_opp, struct opp_table *opp_table,
 		      struct device_node *np)
 {
-	struct property *prop;
+	struct property *prop = NULL;
 	int i, count, ret;
 	u64 *rates;
+	char name[NAME_MAX];
 
-	prop = of_find_property(np, "opp-hz", NULL);
-	if (!prop)
-		return -ENODEV;
+	/* Search for "opp-hz-<name>" */
+	if (opp_table->prop_name) {
+		snprintf(name, sizeof(name), "opp-hz-%s",
+			 opp_table->prop_name);
+		prop = of_find_property(np, name, NULL);
+	}
+
+	if (!prop) {
+		/* Search for "opp-hz" */
+		sprintf(name, "opp-hz");
+		prop = of_find_property(np, name, NULL);
+		if (!prop)
+			return -ENODEV;
+	}
 
 	count = prop->length / sizeof(u64);
 	if (opp_table->clk_count != count) {
-		pr_err("%s: Count mismatch between opp-hz and clk_count (%d %d)\n",
-		       __func__, count, opp_table->clk_count);
+		pr_err("%s: Count mismatch between %s and clk_count (%d %d)\n",
+		       __func__, name, count, opp_table->clk_count);
 		return -EINVAL;
 	}
 
@@ -771,9 +783,9 @@ static int _read_rate(struct dev_pm_opp *new_opp, struct opp_table *opp_table,
 	if (!rates)
 		return -ENOMEM;
 
-	ret = of_property_read_u64_array(np, "opp-hz", rates, count);
+	ret = of_property_read_u64_array(np, name, rates, count);
 	if (ret) {
-		pr_err("%s: Error parsing opp-hz: %d\n", __func__, ret);
+		pr_err("%s: Error parsing %s: %d\n", __func__, name, ret);
 	} else {
 		/*
 		 * Rate is defined as an unsigned long in clk API, and so
-- 
2.34.1


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ