From patchwork Sat Mar 26 08:28:14 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ivaylo Dimitrov X-Patchwork-Id: 8674351 Return-Path: X-Original-To: patchwork-linux-omap@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 8FE74C0553 for ; Sat, 26 Mar 2016 08:30:19 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id A7568202B8 for ; Sat, 26 Mar 2016 08:30:18 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id C45EB20220 for ; Sat, 26 Mar 2016 08:30:17 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753608AbcCZIaQ (ORCPT ); Sat, 26 Mar 2016 04:30:16 -0400 Received: from mail-wm0-f65.google.com ([74.125.82.65]:34382 "EHLO mail-wm0-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752679AbcCZI3a (ORCPT ); Sat, 26 Mar 2016 04:29:30 -0400 Received: by mail-wm0-f65.google.com with SMTP id p65so8539742wmp.1; Sat, 26 Mar 2016 01:29:29 -0700 (PDT) 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=4z1DZzLqsLzVKWcfadnUsPQXsbtNAjbHWi2i/olkbkc=; b=0MYNjg4U8qoh9COB9uvycjxG216tcXhjxYeKCKd3CWRApsjndNabtSDj4jadsgG0eS t85EMCn/stx6e62ARPst6oRhq5hzd8luhefm3fqehynvUmsMOM/5gjV0DvO209VjQVFZ xL42MgyL6E/KUGL+s0jArbAYpXTDR7stkz9FCka4Uz/Dz+LYFpcMy0tkK+tslCygTS5C JBMOYA1XeprPp0PopeSqGcKI5WJzpd3nlILm84ue0lpA/f7w/gXuI9o67XGs19n2h7gM Yy11azAlwhjRBNhmjHFdtsYEwcQGRiCWZjH1wYBO7r7yd/DfFbWS5X9N+aBzmgoc9eFs 7srg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=4z1DZzLqsLzVKWcfadnUsPQXsbtNAjbHWi2i/olkbkc=; b=Og6LrBpawi9RL8yxeLz50mSl1u0oTTKdoW89lRKjgoUfx9hpI/19N87fCzYumgbAyg iIYui7UXS7e0+YMbFnH9a2kh58irhMkP4IEPDwglfVyfljUWvmkuFr6DkNYHjyHvkvs2 l3A3jxkg9KUXeQHLz5GnmBKGPNRzAwochg1EZXU9629G7vG5XpmF8MLCVSFKgwlcg5P0 KBuh+3YzOzf2julADdkFU2eNzXr5SNxD95puknCQFeCrfEioSvvHG0wEnIDQrRfCbTlK 8pRXcUdw9mLyaBdwZ+yj/mNGnqBZtX50mrOINkoKtGuApbnHO3jahU125WS+vztQ/6B1 PJxQ== X-Gm-Message-State: AD7BkJItKnkMP4a6vrq7iknpZtXlHw6eeO5lQKMpy+uo82GS2yPKl1oOEETCsyjyo9T3XQ== X-Received: by 10.194.23.67 with SMTP id k3mr18312191wjf.177.1458980968777; Sat, 26 Mar 2016 01:29:28 -0700 (PDT) Received: from localhost.localdomain ([46.249.74.23]) by smtp.gmail.com with ESMTPSA id u3sm670429wmg.15.2016.03.26.01.29.27 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Sat, 26 Mar 2016 01:29:28 -0700 (PDT) From: Ivaylo Dimitrov To: tony@atomide.com, lgirdwood@gmail.com, broonie@kernel.org Cc: sre@kernel.org, pali.rohar@gmail.com, linux-omap@vger.kernel.org, linux-kernel@vger.kernel.org, Ivaylo Dimitrov Subject: [PATCH 2/3] regulator: twl: Provide of_map_mode for twl4030 Date: Sat, 26 Mar 2016 10:28:14 +0200 Message-Id: <1458980895-10240-3-git-send-email-ivo.g.dimitrov.75@gmail.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1458980895-10240-1-git-send-email-ivo.g.dimitrov.75@gmail.com> References: <1458980895-10240-1-git-send-email-ivo.g.dimitrov.75@gmail.com> Sender: linux-omap-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-omap@vger.kernel.org X-Spam-Status: No, score=-7.8 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, 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 of_map_mode is needed so to be possible to set initial regulators mode from the board DTS. Otherwise, for DT boot, regulators are left in their default state after reset/reboot. Signed-off-by: Ivaylo Dimitrov --- drivers/regulator/twl-regulator.c | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/drivers/regulator/twl-regulator.c b/drivers/regulator/twl-regulator.c index aad748b0..be8d05e 100644 --- a/drivers/regulator/twl-regulator.c +++ b/drivers/regulator/twl-regulator.c @@ -395,6 +395,12 @@ static int twl4030reg_set_mode(struct regulator_dev *rdev, unsigned mode) return twl4030_send_pb_msg(message); } +static inline unsigned int twl4030reg_map_mode(unsigned int mode) +{ + return mode == RES_STATE_ACTIVE ? + REGULATOR_MODE_NORMAL : REGULATOR_MODE_STANDBY; +} + static int twl6030reg_set_mode(struct regulator_dev *rdev, unsigned mode) { struct twlreg_info *info = rdev_get_drvdata(rdev); @@ -897,10 +903,11 @@ static struct regulator_ops twlsmps_ops = { #define TWL4030_FIXED_LDO(label, offset, mVolts, num, turnon_delay, \ remap_conf) \ TWL_FIXED_LDO(label, offset, mVolts, num, turnon_delay, \ - remap_conf, TWL4030, twl4030fixed_ops) + remap_conf, TWL4030, twl4030fixed_ops, \ + twl4030reg_map_mode) #define TWL6030_FIXED_LDO(label, offset, mVolts, turnon_delay) \ TWL_FIXED_LDO(label, offset, mVolts, 0x0, turnon_delay, \ - 0x0, TWL6030, twl6030fixed_ops) + 0x0, TWL6030, twl6030fixed_ops, 0x0) #define TWL4030_ADJUSTABLE_LDO(label, offset, num, turnon_delay, remap_conf) \ static const struct twlreg_info TWL4030_INFO_##label = { \ @@ -917,6 +924,7 @@ static const struct twlreg_info TWL4030_INFO_##label = { \ .type = REGULATOR_VOLTAGE, \ .owner = THIS_MODULE, \ .enable_time = turnon_delay, \ + .of_map_mode = twl4030reg_map_mode, \ }, \ } @@ -932,6 +940,7 @@ static const struct twlreg_info TWL4030_INFO_##label = { \ .type = REGULATOR_VOLTAGE, \ .owner = THIS_MODULE, \ .enable_time = turnon_delay, \ + .of_map_mode = twl4030reg_map_mode, \ }, \ } @@ -977,7 +986,7 @@ static const struct twlreg_info TWL6032_INFO_##label = { \ } #define TWL_FIXED_LDO(label, offset, mVolts, num, turnon_delay, remap_conf, \ - family, operations) \ + family, operations, map_mode) \ static const struct twlreg_info TWLFIXED_INFO_##label = { \ .base = offset, \ .id = num, \ @@ -992,6 +1001,7 @@ static const struct twlreg_info TWLFIXED_INFO_##label = { \ .owner = THIS_MODULE, \ .min_uV = mVolts * 1000, \ .enable_time = turnon_delay, \ + .of_map_mode = map_mode, \ }, \ }