From patchwork Wed Apr 22 13:43:53 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter 'p2' De Schrijver X-Patchwork-Id: 19354 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 n3MDjLlC012617 for ; Wed, 22 Apr 2009 13:45:21 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752649AbZDVNpT (ORCPT ); Wed, 22 Apr 2009 09:45:19 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1752551AbZDVNpT (ORCPT ); Wed, 22 Apr 2009 09:45:19 -0400 Received: from smtp.nokia.com ([192.100.122.230]:17783 "EHLO mgw-mx03.nokia.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752649AbZDVNpS (ORCPT ); Wed, 22 Apr 2009 09:45:18 -0400 Received: from vaebh105.NOE.Nokia.com (vaebh105.europe.nokia.com [10.160.244.31]) by mgw-mx03.nokia.com (Switch-3.2.6/Switch-3.2.6) with ESMTP id n3MDj9RM021126 for ; Wed, 22 Apr 2009 16:45:13 +0300 Received: from vaebh104.NOE.Nokia.com ([10.160.244.30]) by vaebh105.NOE.Nokia.com with Microsoft SMTPSVC(6.0.3790.3959); Wed, 22 Apr 2009 16:44:02 +0300 Received: from mgw-int02.ntc.nokia.com ([172.21.143.97]) by vaebh104.NOE.Nokia.com over TLS secured channel with Microsoft SMTPSVC(6.0.3790.3959); Wed, 22 Apr 2009 16:43:56 +0300 Received: from localhost.localdomain (esdhcp04238.research.nokia.com [172.21.42.38]) by mgw-int02.ntc.nokia.com (Switch-3.2.5/Switch-3.2.5) with ESMTP id n3MDhrcm013752; Wed, 22 Apr 2009 16:43:55 +0300 From: "Peter 'p2' De Schrijver" To: linux-omap@vger.kernel.org Cc: "Peter 'p2' De Schrijver" Subject: [PATCH] TWL4030: Make sure the regulator is active after calling twl4030reg_enable Date: Wed, 22 Apr 2009 16:43:53 +0300 Message-Id: <1240407833-28060-2-git-send-email-peter.de-schrijver@nokia.com> X-Mailer: git-send-email 1.5.6.3 In-Reply-To: <1240407833-28060-1-git-send-email-peter.de-schrijver@nokia.com> References: <1240407833-28060-1-git-send-email-peter.de-schrijver@nokia.com> X-OriginalArrivalTime: 22 Apr 2009 13:43:56.0374 (UTC) FILETIME=[61E18760:01C9C350] X-Nokia-AV: Clean Sender: linux-omap-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-omap@vger.kernel.org This patch makes sure a regulator is active when enabled. After a warm reboot, only adding a regulator to a power group is not enough to activate it. Signed-off-by: Peter 'p2' De Schrijver --- drivers/regulator/twl4030-regulator.c | 11 +++++++++-- 1 files changed, 9 insertions(+), 2 deletions(-) diff --git a/drivers/regulator/twl4030-regulator.c b/drivers/regulator/twl4030-regulator.c index df9a94b..80a4e10 100644 --- a/drivers/regulator/twl4030-regulator.c +++ b/drivers/regulator/twl4030-regulator.c @@ -177,14 +177,21 @@ static int twl4030reg_is_enabled(struct regulator_dev *rdev) static int twl4030reg_enable(struct regulator_dev *rdev) { struct twlreg_info *info = rdev_get_drvdata(rdev); - int grp; + int grp, status; + unsigned message; grp = twl4030reg_read(info, VREG_GRP); if (grp < 0) return grp; grp |= P1_GRP; - return twl4030reg_write(info, VREG_GRP, grp); + status = twl4030reg_write(info, VREG_GRP, grp); + if (status < 0) + return status; + + message = MSG_SINGULAR(DEV_GRP_P1, info->id, RES_STATE_ACTIVE); + + return twl4030_send_pb_msg(message); } static int twl4030reg_disable(struct regulator_dev *rdev)