From patchwork Fri Sep 25 23:14:52 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nishanth Menon X-Patchwork-Id: 50193 X-Patchwork-Delegate: khilman@deeprootsystems.com Received: from vger.kernel.org (vger.kernel.org [209.132.176.167]) by demeter.kernel.org (8.14.2/8.14.2) with ESMTP id n8PNEtK6015078 for ; Fri, 25 Sep 2009 23:14:55 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751377AbZIYXOu (ORCPT ); Fri, 25 Sep 2009 19:14:50 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1751715AbZIYXOu (ORCPT ); Fri, 25 Sep 2009 19:14:50 -0400 Received: from bear.ext.ti.com ([192.94.94.41]:40514 "EHLO bear.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750946AbZIYXOu (ORCPT ); Fri, 25 Sep 2009 19:14:50 -0400 Received: from dlep34.itg.ti.com ([157.170.170.115]) by bear.ext.ti.com (8.13.7/8.13.7) with ESMTP id n8PNEroo026686 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Fri, 25 Sep 2009 18:14:53 -0500 Received: from legion.dal.design.ti.com (localhost [127.0.0.1]) by dlep34.itg.ti.com (8.13.7/8.13.7) with ESMTP id n8PNEqqs010123; Fri, 25 Sep 2009 18:14:53 -0500 (CDT) Received: from senorita (senorita.am.dhcp.ti.com [128.247.75.1]) by legion.dal.design.ti.com (8.11.7p1+Sun/8.11.7) with ESMTP id n8PNEqZ18543; Fri, 25 Sep 2009 18:14:52 -0500 (CDT) Received: by senorita (Postfix, from userid 1000) id BC931C139; Fri, 25 Sep 2009 18:14:52 -0500 (CDT) From: Nishanth Menon To: linux-omap Cc: Kevin H , Nishanth Menon Subject: [PATCH] OMAP3:PM: reject disabled OPP Date: Fri, 25 Sep 2009 18:14:52 -0500 Message-Id: <1253920492-28628-1-git-send-email-nm@ti.com> X-Mailer: git-send-email 1.6.0.4 Sender: linux-omap-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-omap@vger.kernel.org when the omap_opp structures are disabled by setting the frequency as 0 as below (as an example) {0, VDD2_OPP1, 0x1E}, program_opp attempts to set voltage even after frequency setting fails. we can instead return if we see invalid values for either frequency or voltage Signed-off-by: Nishanth Menon --- arch/arm/mach-omap2/resource34xx.c | 5 +++++ 1 files changed, 5 insertions(+), 0 deletions(-) diff --git a/arch/arm/mach-omap2/resource34xx.c b/arch/arm/mach-omap2/resource34xx.c index 1693e9b..491e1dc 100644 --- a/arch/arm/mach-omap2/resource34xx.c +++ b/arch/arm/mach-omap2/resource34xx.c @@ -282,6 +282,11 @@ static int program_opp(int res, struct omap_opp *opp, int target_level, t_opp = ID_VDD(res) | ID_OPP_NO(opp[target_level].opp_id); c_opp = ID_VDD(res) | ID_OPP_NO(opp[current_level].opp_id); #endif + + /* Sanity check of the OPP params before attempting to set */ + if (!opp[target_level].rate || !opp[target_level].vsel) + return -EINVAL; + if (target_level > current_level) raise = 1; else