Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp3450041rwb; Sun, 20 Nov 2022 14:31:22 -0800 (PST) X-Google-Smtp-Source: AA0mqf4NxwwmfoOYaoLZAZJ6ZbAIFNUGoUbKrsKOr8YMghNQ1K84KJ9eiZHLdZextV5j/Eb0ichP X-Received: by 2002:a63:4d09:0:b0:477:7dc8:57a8 with SMTP id a9-20020a634d09000000b004777dc857a8mr538735pgb.506.1668983481951; Sun, 20 Nov 2022 14:31:21 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1668983481; cv=none; d=google.com; s=arc-20160816; b=cXF6Wb+tmWErTp/jb2/4TqcaPtYxk4koTSuPAwzUE+2ZjZQFrr5yqY88Oe9csG4+CW mfx/xcPIYVtY7N1umGmEHjNuEnbiHZbr3Iq0yZID633WdqWDwIyJ28X/cUBr7mPTc/jS W+16II/9gAL10NeaQ7nXp5/mmIiacCBBVgqPdg6lYNXhsOiCMIxmvHuTQiGPctnyR75A DE3keRHaidsu5rk95KfLLJ+cJzTMXmdoa/sCsM6ABkzQnv6D83cqpzqA6WPEOigV1APc sWKlhO/cUm6TH2UCYW42QvCtQBFzuHJ5RebM7QnNJQ+8BIk6DzH8NbtBBRu9VxKF6cRF bYDA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=/bcYYEBupthiwQFde2svNyfveIgcGiNItZQIVI9J6Ss=; b=dzj+vkSE5kmq9YT3HUNn6JHk4r9sBnpQn8Rhjjx+pkkgX9FyYW1gOPZNuDJJwBDXET p5JoRg5A7CNQGo8d69DRZFcmNe93O+Bq3aM3VZKRnS9kKeAvpvRoUw7/PhsHhWKsZxEY Dh60i49NPrxxStW0ywM0GrCGjTZ7ZeZ/Kr5dyxEMYNWAt1jrbL34Dwb1K9GJl3IFf+q5 RNwrN+UBpM2MLPS+e6G6tN8ZsFlo3GG0Nsh1lZWxQ747zn+6MBVENwroiCC+AWPkhG6b AJJghn/JxYuuHchbQAXKLO9puRHlPK3cNcD04a15L3nR+j/01PxSa3jWyIrwLJSLoQN9 mHMw== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@kemnade.info header.s=20220719 header.b=Bg5jbkqH; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id w64-20020a638243000000b00476f59d849fsi529374pgd.601.2022.11.20.14.31.10; Sun, 20 Nov 2022 14:31:21 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=fail header.i=@kemnade.info header.s=20220719 header.b=Bg5jbkqH; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229798AbiKTWMc (ORCPT + 90 others); Sun, 20 Nov 2022 17:12:32 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56186 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229622AbiKTWMY (ORCPT ); Sun, 20 Nov 2022 17:12:24 -0500 Received: from mail.andi.de1.cc (mail.andi.de1.cc [IPv6:2a01:238:4321:8900:456f:ecd6:43e:202c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id ECAF626552; Sun, 20 Nov 2022 14:12:22 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=kemnade.info; s=20220719; h=Content-Transfer-Encoding:MIME-Version: References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Sender:Reply-To: Content-Type:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help: List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=/bcYYEBupthiwQFde2svNyfveIgcGiNItZQIVI9J6Ss=; b=Bg5jbkqHupRZJTsHapmaeOsvZu LI4K4Y8mGOaSMFKqz5evy0COP2ho8d+q8mprBht9AgcaCGFKGllwhdifTJwEjEwhK/Nt+/sN1wbGN ukDZ821qV4C40N3IEbjBWAmiAnfEhQ9PYWLwITdcAUPFcUVYHbQTJY+c4VyZrHNUKbl6fktJv7DXs b71/72DRPJywmI4p//ikfup3Hxj6D5Fqn7oDhTFqAMAoSbotFcDNYKyx99RBlrPQlXl7DEqZmUhI2 0JU3HqPd5Cs0mThu8P1skZ5/WDMkYnPdNIh45ki/alZXXCux9+znFmKRHIPZaRSSMDuvOOQYtJt/f j7Ruz+fA==; Received: from p200300ccff43b2001a3da2fffebfd33a.dip0.t-ipconnect.de ([2003:cc:ff43:b200:1a3d:a2ff:febf:d33a] helo=aktux) by mail.andi.de1.cc with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.89) (envelope-from ) id 1owsXw-00069B-6U; Sun, 20 Nov 2022 23:12:16 +0100 Received: from andi by aktux with local (Exim 4.94.2) (envelope-from ) id 1owsXv-00Cypm-CX; Sun, 20 Nov 2022 23:12:15 +0100 From: Andreas Kemnade To: tony@atomide.com, lgirdwood@gmail.com, broonie@kernel.org, Nicolae_Rosia@mentor.com, linux-omap@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Andreas Kemnade Subject: [PATCH 2/2] regulator: twl6030: fix get status of twl6032 regulators Date: Sun, 20 Nov 2022 23:12:08 +0100 Message-Id: <20221120221208.3093727-3-andreas@kemnade.info> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20221120221208.3093727-1-andreas@kemnade.info> References: <20221120221208.3093727-1-andreas@kemnade.info> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Score: -1.0 (-) X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Status is reported as always off in the 6032 case. Status reporting now matches the logic in the setters. Once of the differences to the 6030 is that there are no groups, therefore the state needs to be read out in the lower bits. Signed-off-by: Andreas Kemnade --- drivers/regulator/twl6030-regulator.c | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/drivers/regulator/twl6030-regulator.c b/drivers/regulator/twl6030-regulator.c index 7c7e3648ea4b..f3856750944f 100644 --- a/drivers/regulator/twl6030-regulator.c +++ b/drivers/regulator/twl6030-regulator.c @@ -67,6 +67,7 @@ struct twlreg_info { #define TWL6030_CFG_STATE_SLEEP 0x03 #define TWL6030_CFG_STATE_GRP_SHIFT 5 #define TWL6030_CFG_STATE_APP_SHIFT 2 +#define TWL6030_CFG_STATE_MASK 0x03 #define TWL6030_CFG_STATE_APP_MASK (0x03 << TWL6030_CFG_STATE_APP_SHIFT) #define TWL6030_CFG_STATE_APP(v) (((v) & TWL6030_CFG_STATE_APP_MASK) >>\ TWL6030_CFG_STATE_APP_SHIFT) @@ -128,13 +129,14 @@ static int twl6030reg_is_enabled(struct regulator_dev *rdev) if (grp < 0) return grp; grp &= P1_GRP_6030; + val = twlreg_read(info, TWL_MODULE_PM_RECEIVER, VREG_STATE); + val = TWL6030_CFG_STATE_APP(val); } else { + val = twlreg_read(info, TWL_MODULE_PM_RECEIVER, VREG_STATE); + val &= TWL6030_CFG_STATE_MASK; grp = 1; } - val = twlreg_read(info, TWL_MODULE_PM_RECEIVER, VREG_STATE); - val = TWL6030_CFG_STATE_APP(val); - return grp && (val == TWL6030_CFG_STATE_ON); } @@ -187,7 +189,12 @@ static int twl6030reg_get_status(struct regulator_dev *rdev) val = twlreg_read(info, TWL_MODULE_PM_RECEIVER, VREG_STATE); - switch (TWL6030_CFG_STATE_APP(val)) { + if (info->features & TWL6032_SUBCLASS) + val &= TWL6030_CFG_STATE_MASK; + else + val = TWL6030_CFG_STATE_APP(val); + + switch (val) { case TWL6030_CFG_STATE_ON: return REGULATOR_STATUS_NORMAL; -- 2.30.2