From patchwork Tue Aug 26 11:37:41 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Javier Martinez Canillas X-Patchwork-Id: 4780601 Return-Path: X-Original-To: patchwork-linux-samsung-soc@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 737A09F383 for ; Tue, 26 Aug 2014 11:37:56 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 7144C201C0 for ; Tue, 26 Aug 2014 11:37:55 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 4F890201D5 for ; Tue, 26 Aug 2014 11:37:54 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754593AbaHZLhx (ORCPT ); Tue, 26 Aug 2014 07:37:53 -0400 Received: from bhuna.collabora.co.uk ([93.93.135.160]:46773 "EHLO bhuna.collabora.co.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754555AbaHZLhx (ORCPT ); Tue, 26 Aug 2014 07:37:53 -0400 Received: from [127.0.0.1] (localhost [127.0.0.1]) (Authenticated sender: javier) with ESMTPSA id 97D10600BE9 From: Javier Martinez Canillas To: Mark Brown Cc: Doug Anderson , Olof Johansson , Yuvaraj Kumar C D , linux-samsung-soc@vger.kernel.org, linux-kernel@vger.kernel.org, Javier Martinez Canillas Subject: [PATCH 1/1] regulator: max77802: set opmode to normal if off is read from hw Date: Tue, 26 Aug 2014 13:37:41 +0200 Message-Id: <1409053061-22568-1-git-send-email-javier.martinez@collabora.co.uk> X-Mailer: git-send-email 2.0.1 Sender: linux-samsung-soc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-samsung-soc@vger.kernel.org X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=ham 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 The max77802 driver reads the default operating mode (opmode) set for regulators when enabled from the hardware registers. But if a regulator is disabled and the system warm restarted, the hardware reports OFF as the opmode so the regulator is not enabled. Default to operating mode NORMAL if OFF is read from the hardware register. Reported-by: Yuvaraj Cd Signed-off-by: Javier Martinez Canillas Reviewed-by: Doug Anderson Tested-by: Yuvaraj Kumar CD --- This patch fixes the issue reported in https://lkml.org/lkml/2014/8/25/69 drivers/regulator/max77802.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/drivers/regulator/max77802.c b/drivers/regulator/max77802.c index ad1caa9..967e109 100644 --- a/drivers/regulator/max77802.c +++ b/drivers/regulator/max77802.c @@ -540,7 +540,17 @@ static int max77802_pmic_probe(struct platform_device *pdev) config.of_node = pdata->regulators[i].of_node; ret = regmap_read(iodev->regmap, regulators[i].enable_reg, &val); - max77802->opmode[id] = val >> shift & MAX77802_OPMODE_MASK; + val = val >> shift & MAX77802_OPMODE_MASK; + + /* + * If the regulator is disabled and the system warm rebooted, + * the hardware reports OFF as the regulator operating mode. + * Default to operating mode NORMAL in that case. + */ + if (val == MAX77802_OPMODE_OFF) + max77802->opmode[id] = MAX77802_OPMODE_NORMAL; + else + max77802->opmode[id] = val; rdev = devm_regulator_register(&pdev->dev, ®ulators[i], &config);