Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1590976

[PATCH] cpufreq: mt8173: Add support for MT8176 and MT817x compatibles

Path csiph.com!news.redatomik.org!aioe.org!bofh.it!news.nic.it!robomod
From Daniel Kurtz <djkurtz@chromium.org>
Newsgroups linux.kernel
Subject [PATCH] cpufreq: mt8173: Add support for MT8176 and MT817x compatibles
Date Thu, 02 Mar 2017 11:50:02 +0100
Message-ID <tgwt4-13g-5@gated-at.bofh.it> (permalink)
X-Original-To unlisted-recipients:; (no To-header on input)
Dkim-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id; bh=/F5UHiJxhaa8zwzB10SfagGUtO2hpo1zp5oh15sB+Jo=; b=JnLcKSD7R+j60x2USPfhLyOyZkqZsqzF7oMFdQcJ+8jnqxSvEjUUI4PH0E77fEXeUW J0IBgvPc79FaJkDqLBK1gcAFtfMB5eVE9ApqogFygsCKoo9bvZ34TIeERJb1xKVNUcNS 3fkR4jko/zK+sQTIQR2p2gmFdZkIPEdC4b8Ew=
X-Google-Dkim-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=/F5UHiJxhaa8zwzB10SfagGUtO2hpo1zp5oh15sB+Jo=; b=GXvacY1fVxeOhKxDbVlCMpLR8Ua4eGVmZDqC+5SjfCQ++yVaf4n+095lXS93l5dbA0 u6mTb1iHPq4YWTrmg7kfncEHIE6B0Iwyw8hwkjVjAuXiR+6h/I7G0RVNIaKFpmpOJg+O yF1YhrBCktQ7WXCSOLJJxou+7Cnl+NNIAB/jb5J2QUW0V7MzyHsaAnF+wBemG67tNW5r 2Mc+gE+7lA7VqTkA/IfAMaeJq55VRzuLrdeXOTFUMv4YG1EzLJwJpzgHKP7lQ0JmKNLr k7dDI5/H118Z0xdHKqm7mjWNgUtT0FAZ0T+GdMl7Yw7xhBlL147+u8AtFpmQd1iKIpXB aGQQ==
X-Gm-Message-State AMke39kTRgfZak9CNXI9louM/lxlRN1gfVfVLrtcC1VcWOrXkGCXICVjndOBJ95ciayqIb23
X-Received by 10.99.136.74 with SMTP id l71mr14596801pgd.143.1488450997536; Thu, 02 Mar 2017 02:36:37 -0800 (PST)
X-Mailer git-send-email 2.12.0.rc1.440.g5b76565f74-goog
Sender robomod@news.nic.it
List-ID <linux-kernel.vger.kernel.org>
X-Mailing-List linux-kernel@vger.kernel.org
Approved robomod@news.nic.it
Lines 62
Organization linux.* mail to news gateway
X-Original-Cc Yidi Lin <yidi.lin@mediatek.com>, Nicolas Boichat <drinkcat@chromium.org>, Daniel Kurtz <djkurtz@chromium.org>, "Rafael J. Wysocki" <rjw@rjwysocki.net>, Viresh Kumar <viresh.kumar@linaro.org>, Matthias Brugger <matthias.bgg@gmail.com>, linux-pm@vger.kernel.org (open list:CPU FREQUENCY DRIVERS), linux-kernel@vger.kernel.org (open list), linux-arm-kernel@lists.infradead.org (moderated list:ARM/Mediatek SoC support), linux-mediatek@lists.infradead.org (moderated list:ARM/Mediatek SoC support)
X-Original-Date Thu, 2 Mar 2017 18:36:26 +0800
X-Original-Message-ID <20170302103626.69195-1-djkurtz@chromium.org>
X-Original-Sender linux-kernel-owner@vger.kernel.org
Xref csiph.com linux.kernel:1590976

Show key headers only | View raw


The Mediatek MT8173 is just on of several SOCs from the same MT817x family,
including the 6-core (4-little/2-big) MT8176.

The mt8173-cpufreq driver supports all of these SOCs, however, machines
using them may use a different machine compatible.

Since this driver checks explicitly for the machine compatible string, add
support for the whole family.

Signed-off-by: Daniel Kurtz <djkurtz@chromium.org>
---
This patch is based on the compatibles added by the MT8176 series:

 https://patchwork.kernel.org/patch/9573209/
 https://patchwork.kernel.org/patch/9573213/

 drivers/cpufreq/mt8173-cpufreq.c | 25 +++++++++++++++++++++++--
 1 file changed, 23 insertions(+), 2 deletions(-)

diff --git a/drivers/cpufreq/mt8173-cpufreq.c b/drivers/cpufreq/mt8173-cpufreq.c
index ab25b1235a5e..07f7aac56f31 100644
--- a/drivers/cpufreq/mt8173-cpufreq.c
+++ b/drivers/cpufreq/mt8173-cpufreq.c
@@ -573,13 +573,34 @@ static struct platform_driver mt8173_cpufreq_platdrv = {
 	.probe		= mt8173_cpufreq_probe,
 };
 
+/* List of machine compatible strings supported by this driver */
+static const char *mt8173_cpufreq_machines[] = {
+	"mediatek,mt817x",
+	"mediatek,mt8173",
+	"mediatek,mt8176",
+};
+
+static int mt8173_cpufreq_is_compatible(void)
+{
+	int i;
+
+	for (i = 0; i < ARRAY_SIZE(mt8173_cpufreq_machines); i++)
+		if (of_machine_is_compatible(mt8173_cpufreq_machines[i]))
+			return 0;
+
+	return -ENODEV;
+}
+
 static int mt8173_cpufreq_driver_init(void)
 {
 	struct platform_device *pdev;
 	int err;
 
-	if (!of_machine_is_compatible("mediatek,mt8173"))
-		return -ENODEV;
+	err = mt8173_cpufreq_is_compatible();
+	if (err) {
+		pr_err("Machine is not compatible with 'mediatek,mt8173'\n");
+		return err;
+	}
 
 	err = platform_driver_register(&mt8173_cpufreq_platdrv);
 	if (err)
-- 
2.12.0.rc1.440.g5b76565f74-goog

Back to linux.kernel | Previous | Next — Next in thread | Find similar | Unroll thread


Thread

[PATCH] cpufreq: mt8173: Add support for MT8176 and MT817x compatibles Daniel Kurtz <djkurtz@chromium.org> - 2017-03-02 11:50 +0100
  Re: [PATCH] cpufreq: mt8173: Add support for MT8176 and MT817x  compatibles Viresh Kumar <viresh.kumar@linaro.org> - 2017-03-02 12:00 +0100

csiph-web