From patchwork Fri Dec 20 04:15:29 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Tobias X-Patchwork-Id: 3385731 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 05A0DC0D4A for ; Fri, 20 Dec 2013 04:16:54 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 400CD206D7 for ; Fri, 20 Dec 2013 04:16:53 +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 4D958206DD for ; Fri, 20 Dec 2013 04:16:52 +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 1VtrVe-00056J-36; Fri, 20 Dec 2013 04:16:22 +0000 Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1VtrVU-0006Mb-2C; Fri, 20 Dec 2013 04:16:12 +0000 Received: from mail-pa0-x236.google.com ([2607:f8b0:400e:c03::236]) by merlin.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1VtrVH-0006LQ-61 for linux-arm-kernel@lists.infradead.org; Fri, 20 Dec 2013 04:15:59 +0000 Received: by mail-pa0-f54.google.com with SMTP id rd3so2073665pab.41 for ; Thu, 19 Dec 2013 20:15:37 -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:in-reply-to:references; bh=U+Wwqla+PfsT/czEExdUyWvGG0SRQnyNF4LIAQzzdCg=; b=ootA4D2HVdko+FDhPYBWXRRzF9sGc0HPBLKCj8FXMl/rrRAq8emQX5Qd8nLyUywM7G IrsFxgeb7J2788yWA4PBVmym5ySrPRLqZOeeWs9P1CC+ZU/TnoF4WrdUCXb2InOeEaqO hU8z4tM4r/i/79H43a2VGrQJNmpQ/PonTzM/7rM9MIrv3iKGhyLWUEN1r2n9hml0MZTK GRAnPUXn6JxyDnicWJhSS5Thq6rfiTW4iAtFarujc3Tv7/HadTohF5FckJp7UEom60Ja YAbQT0FZQBfOB3FAdPAQ4zvC+O3453ScLX/BQWkjuWklNs4Uiw6U32U9QkSvXur5Vk3g z53g== X-Received: by 10.66.25.134 with SMTP id c6mr5987318pag.60.1387512937792; Thu, 19 Dec 2013 20:15:37 -0800 (PST) Received: from localhost.localdomain (morse-p.static.monkeybrains.net. [208.90.214.40]) by mx.google.com with ESMTPSA id xe9sm14391990pab.0.2013.12.19.20.15.35 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 19 Dec 2013 20:15:37 -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 2/2] cpufreq: imx6q: add of_init_opp_table Date: Thu, 19 Dec 2013 20:15:29 -0800 Message-Id: <1387512929-7304-2-git-send-email-john.tobias.ph@gmail.com> X-Mailer: git-send-email 1.8.3.2 In-Reply-To: <1387512929-7304-1-git-send-email-john.tobias.ph@gmail.com> References: <1387512929-7304-1-git-send-email-john.tobias.ph@gmail.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20131219_231559_311223_8901E08E X-CRM114-Status: GOOD ( 11.86 ) 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 not OPP table exist, it will try to get it. Signed-off-by: John Tobias --- 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..f261a88 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\n"); + ret = -ENODEV; + 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);