From patchwork Fri Dec 20 06:56:28 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Tobias X-Patchwork-Id: 3386111 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 10BC8C0D4A for ; Fri, 20 Dec 2013 06:57:22 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 52187206D8 for ; Fri, 20 Dec 2013 06:57:21 +0000 (UTC) Received: from casper.infradead.org (casper.infradead.org [85.118.1.10]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 67E38206D7 for ; Fri, 20 Dec 2013 06:57:20 +0000 (UTC) Received: from merlin.infradead.org ([2001:4978:20e::2]) by casper.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1Vtu1K-0000nU-NO; Fri, 20 Dec 2013 06:57:14 +0000 Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1Vtu1I-0000Os-Ex; Fri, 20 Dec 2013 06:57:12 +0000 Received: from mail-pa0-x22d.google.com ([2607:f8b0:400e:c03::22d]) by merlin.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1Vtu1E-0000O9-UK for linux-arm-kernel@lists.infradead.org; Fri, 20 Dec 2013 06:57:09 +0000 Received: by mail-pa0-f45.google.com with SMTP id fb1so2243501pad.4 for ; Thu, 19 Dec 2013 22:56:46 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id; bh=tu4YdXPJvolhPbvicolhpl/EDXWZiUTXh+V7XS5moZo=; b=xmOG/2zU6by1q49XaUDRXL3Ahf7ZPo1xrabDsCPtEW2pNP78/qEcVGw/A5fZbbBiKf A0S6o4+SA98H+GAr6CWpwf6msUqk3nd7ZXXeaGnH9Q4B5kW2czrLyHcQ5T58gkKBg2HU 8cz2LAF92KbJ5mzUpEbAK2UTdOxCR3Kph/l6pcpjhVvcEh21/jDbHx5f8pct03ZpAbuV g8oft+n5fJcoj86Mu3q0ud3YyjOsRJNCKfzKbiiVxV1uMzjycebKTR3hjTDQt6f7MOsq sf6M+5sCHrHHM0Ki+n/6eStH4p0aD11jpw4dKjK7/8sp/NOeeu+obcGChreVvE0vZnxS nP+A== X-Received: by 10.66.233.69 with SMTP id tu5mr6597920pac.78.1387522606067; Thu, 19 Dec 2013 22:56:46 -0800 (PST) Received: from localhost.localdomain ([76.14.57.194]) by mx.google.com with ESMTPSA id z10sm15665800pas.6.2013.12.19.22.56.42 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 19 Dec 2013 22:56:43 -0800 (PST) From: John Tobias To: linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-pm@vger.kernel.org, cpufreq@vger.kernel.org, rjw@rjwysocki.net, shawn.guo@linaro.org, festevam@gmail.com, b20788@freescale.com, viresh.kumar@linaro.org Subject: [PATCH v3] cpufreq: imx6q: add of_init_opp_table Date: Thu, 19 Dec 2013 22:56:28 -0800 Message-Id: <1387522588-13114-1-git-send-email-john.tobias.ph@gmail.com> X-Mailer: git-send-email 1.8.3.2 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20131220_015709_049652_429C18DB X-CRM114-Status: GOOD ( 11.85 ) X-Spam-Score: -2.0 (--) Cc: John Tobias X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-4.6 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_MED, RP_MATCHES_RCVD, T_DKIM_INVALID, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Add a routine check to see if the platform supplied the OPP table. Incase there's no OPP table exist, it will try to initialise it. It's been tested on iMX6SL board where the platform doesn't have an OPP table. Signed-off-by: John Tobias Acked-by: Shawn Guo --- drivers/cpufreq/imx6q-cpufreq.c | 21 +++++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) diff --git a/drivers/cpufreq/imx6q-cpufreq.c b/drivers/cpufreq/imx6q-cpufreq.c index 4b3f18e..e125aed 100644 --- a/drivers/cpufreq/imx6q-cpufreq.c +++ b/drivers/cpufreq/imx6q-cpufreq.c @@ -187,12 +187,25 @@ static int imx6q_cpufreq_probe(struct platform_device *pdev) goto put_node; } - /* We expect an OPP table supplied by platform */ + /* + * We expect an OPP table supplied by platform. + * Just, incase the platform did not supply the OPP + * table, it will try to get it. + */ num = dev_pm_opp_get_opp_count(cpu_dev); if (num < 0) { - ret = num; - dev_err(cpu_dev, "no OPP table is found: %d\n", ret); - goto put_node; + ret = of_init_opp_table(cpu_dev); + if (ret < 0) { + dev_err(cpu_dev, "failed to init OPP table: %d\n", ret); + goto put_node; + } + + num = dev_pm_opp_get_opp_count(cpu_dev); + if (num < 0) { + ret = num; + dev_err(cpu_dev, "no OPP table is found: %d\n", ret); + goto put_node; + } } ret = dev_pm_opp_init_cpufreq_table(cpu_dev, &freq_table);