From patchwork Thu Mar 2 11:03:45 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Kurtz X-Patchwork-Id: 9600133 X-Patchwork-Delegate: rjw@sisk.pl Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id A202C60414 for ; Thu, 2 Mar 2017 12:18:55 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 8FECA285B1 for ; Thu, 2 Mar 2017 12:18:55 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 8486D285B5; Thu, 2 Mar 2017 12:18:55 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,T_DKIM_INVALID autolearn=unavailable version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 2C8C4285B1 for ; Thu, 2 Mar 2017 12:18:55 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752090AbdCBMSx (ORCPT ); Thu, 2 Mar 2017 07:18:53 -0500 Received: from mail-pg0-f48.google.com ([74.125.83.48]:34451 "EHLO mail-pg0-f48.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751233AbdCBMSw (ORCPT ); Thu, 2 Mar 2017 07:18:52 -0500 Received: by mail-pg0-f48.google.com with SMTP id p5so31864159pga.1 for ; Thu, 02 Mar 2017 04:17:02 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=3tFz6WDmU+9DJ9zPFpfzzo/se66tOf43ZYaD1Jo+srw=; b=bEB14Df1mwpFLYwR+Zntig9dQ63GNqAFBsawLPNYQh4PDnTxz/nHsb6i5a6RQtt7K+ ciUabMmke5+K65EAFGoPrJvIA4DKztNRTzhIvPfwQcuoK/6tIGCcy1zv3YM1Y3C48KK1 D5KbZ8IcM/jKa9ZkWVKu1BiSvv88ji2nPreg0= 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:in-reply-to :references; bh=3tFz6WDmU+9DJ9zPFpfzzo/se66tOf43ZYaD1Jo+srw=; b=KtPCtveyUsSxbcyidzhbxtOXmRDXoaq0T0WA3BG+Am9xO4NXmlJS7akf0YTzHHD03o /ypuPYfjb74OyLfJKmt8Q5dR5bdnaoW8Ye/kqxG+QhRmis+GSiEoVQ4ENnoykJCL/nrs j84rK7kA4iMqhpMIc/89/CAMrv0qpTYcF0R9vD4XLU06he/y+5xhBsue6gyghzWY2g0j YllGZ34TtdHnTfx6IQedAuJXWHrYd/4GXEOrHevbmrVZdp6Yk0Ik1UASkmyeLZWcFJh8 O76KAmHfoS+jOZo8beLfnDJYYTNZmhpf83+YtuybeFcfyw5L2jexPYAbYJEGXi0Oih5R LMeg== X-Gm-Message-State: AMke39n+wTgR+h8hTPCMf+54ZRgwCNQR8OsbscKAZ7KWsIAXgluyS3I1/zL4/FwHTSxIzyyi X-Received: by 10.99.121.78 with SMTP id u75mr14788748pgc.202.1488452635809; Thu, 02 Mar 2017 03:03:55 -0800 (PST) Received: from djkurtz-z840.tpe.corp.google.com ([172.30.210.11]) by smtp.gmail.com with ESMTPSA id 129sm16433846pgj.59.2017.03.02.03.03.53 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 02 Mar 2017 03:03:55 -0800 (PST) From: Daniel Kurtz Cc: Yidi Lin , Nicolas Boichat , Daniel Kurtz , "Rafael J. Wysocki" , Viresh Kumar , Matthias Brugger , 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) Subject: [PATCH 2/2 v2] cpufreq: mediatek: Add support for MT8176 and MT817x Date: Thu, 2 Mar 2017 19:03:45 +0800 Message-Id: <20170302110345.184924-2-djkurtz@chromium.org> X-Mailer: git-send-email 2.12.0.rc1.440.g5b76565f74-goog In-Reply-To: <20170302110345.184924-1-djkurtz@chromium.org> References: <20170302110345.184924-1-djkurtz@chromium.org> To: unlisted-recipients:; (no To-header on input) Sender: linux-pm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP The Mediatek MT8173 is just one 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 --- This patch is based on the compatibles added by the MT8176 series: https://patchwork.kernel.org/patch/9573209/ https://patchwork.kernel.org/patch/9573213/ v2: - use of_match_node (Thanks, Viresh!) drivers/cpufreq/mt8173-cpufreq.c | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/drivers/cpufreq/mt8173-cpufreq.c b/drivers/cpufreq/mt8173-cpufreq.c index 72bc1192bd30..fd1886faf33a 100644 --- a/drivers/cpufreq/mt8173-cpufreq.c +++ b/drivers/cpufreq/mt8173-cpufreq.c @@ -573,14 +573,33 @@ static struct platform_driver mt8173_cpufreq_platdrv = { .probe = mt8173_cpufreq_probe, }; +/* List of machines supported by this driver */ +static const struct of_device_id mt8173_cpufreq_machines[] __initconst = { + { .compatible = "mediatek,mt817x", }, + { .compatible = "mediatek,mt8173", }, + { .compatible = "mediatek,mt8176", }, + + { } +}; + static int __init mt8173_cpufreq_driver_init(void) { + struct device_node *np; + const struct of_device_id *match; struct platform_device *pdev; int err; - if (!of_machine_is_compatible("mediatek,mt8173")) + np = of_find_node_by_path("/"); + if (!np) return -ENODEV; + match = of_match_node(mt8173_cpufreq_machines, np); + of_node_put(np); + if (!match) { + pr_warn("Machine is not compatible with mt8173-cpufreq\n"); + return -ENODEV; + } + err = platform_driver_register(&mt8173_cpufreq_platdrv); if (err) return err;