From patchwork Thu Dec 15 15:02:10 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hugo Villeneuve X-Patchwork-Id: 33676 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:e747:0:0:0:0:0 with SMTP id c7csp421130wrn; Thu, 15 Dec 2022 07:19:40 -0800 (PST) X-Google-Smtp-Source: AA0mqf6sIJJrdKfyqsII2T5OcS0SHPH4Kw5DYdZbD/N/lyMnNsPDaxJ1I9bPg7oiV+mqDnrHr1Em X-Received: by 2002:a17:90a:ce16:b0:218:a672:bcab with SMTP id f22-20020a17090ace1600b00218a672bcabmr28894152pju.14.1671117579744; Thu, 15 Dec 2022 07:19:39 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1671117579; cv=none; d=google.com; s=arc-20160816; b=cjNfvxbVwfCrpR+VhQY6I+tYvNB2tOIUKyx/eRxe6F/k4EjbeazWcEnUomYHFslN/e T3SqCNAA6wmPqm679FNy2qMZn6zBdU8HAO7mAnru558JGClJT06ThIDjyJLfIcOY59cP hqvwpj6zdfqNZ74eApLzYpaZg5xPxlDaqEROAxv2NREDaVYm4wu3Yk9gfHcQGaxvBxSV yw+ZNEAR9l9P0vVCMVbv7QxuDootym2IMGXtMkf3xNyE0hURGBwR89VQj8SpOv6Yvcey a0sWGjiUn9lYnWN0LnhmwwS4MeG0gBSEB9wOPlt8QFpw+w3WCp4JsnI7FGK8HUjvxuio PgbQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:subject:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:cc:to:from:dkim-signature; bh=z+IHwHSu5unAUaaw4EDPAX6GeAr53Ixz/aN3zTKz0e8=; b=ICONoYPRqiz6RYGIbBCLTOVKP7TxPXU/XFAXXRJ7Ifoehh7WFa+HtsBB/UQsOi2d5m /WLndhxocofcmvi04Tq+BOMfJ4pI5+0hhpW+EtO7YdwpmIMsCuVB16KyI841WdpNgJhB RsTLt7afp4qC8GUYmgLQBLEXR7GoIOqhSQjgi9GMuQM2fYS/uC2vSnRhEJw3zBHPI5OR 7eGaC8M9gN86OV4jD/5pBp4oaXEYisi4CA5Qo+Rx42TSozpexw2d4g6Qi8WknNqSuQBP /Wm8aAu1vdbPCK5LZgYtVJqy2akjtEJ/sqMtOtAsOzzc0DsOs/tBC2aWHIB5FfUQrV3B o+lQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@hugovil.com header.s=x header.b=Qku3p+XT; 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: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id pf4-20020a17090b1d8400b00218ceebbcafsi5868224pjb.130.2022.12.15.07.19.25; Thu, 15 Dec 2022 07:19:39 -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=@hugovil.com header.s=x header.b=Qku3p+XT; 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 S229720AbiLOPSH (ORCPT + 99 others); Thu, 15 Dec 2022 10:18:07 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46008 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229469AbiLOPSE (ORCPT ); Thu, 15 Dec 2022 10:18:04 -0500 Received: from mail.hugovil.com (mail.hugovil.com [162.243.120.170]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 80E6C19F; Thu, 15 Dec 2022 07:18:03 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=hugovil.com ; s=x; h=Subject:Content-Transfer-Encoding:MIME-Version:References: In-Reply-To:Message-Id:Date: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=z+IHwHSu5unAUaaw4EDPAX6GeAr53Ixz/aN3zTKz0e8=; b=Qku3p+XT555mojQSydWem3v8Yu 4EdXOoOaYhhR0PqwTE6//CqdXVbuZuAbLuh8SRYy5VeN4VYAgHOZPvqUTP11SIA7rfdhX2b5iH0SU m+KitC3I3DikYQdv+e+pNipccXr3B7J44CYgxgYo7KsucDRgjAERvYj0/NpMlJIsiZQg=; Received: from modemcable168.174-80-70.mc.videotron.ca ([70.80.174.168]:48102 helo=pettiford.lan) by mail.hugovil.com with esmtpa (Exim 4.92) (envelope-from ) id 1p5pmK-0000EC-D5; Thu, 15 Dec 2022 10:04:09 -0500 From: Hugo Villeneuve To: a.zummo@towertech.it, alexandre.belloni@bootlin.com, robh+dt@kernel.org, krzysztof.kozlowski+dt@linaro.org Cc: linux-rtc@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, hugo@hugovil.com, Hugo Villeneuve Date: Thu, 15 Dec 2022 10:02:10 -0500 Message-Id: <20221215150214.1109074-10-hugo@hugovil.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20221215150214.1109074-1-hugo@hugovil.com> References: <20221215150214.1109074-1-hugo@hugovil.com> MIME-Version: 1.0 X-SA-Exim-Connect-IP: 70.80.174.168 X-SA-Exim-Mail-From: hugo@hugovil.com X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net X-Spam-Level: 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_PASS,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 Subject: [PATCH v3 09/14] rtc: pcf2127: set PWRMNG value for PCF2131 X-SA-Exim-Version: 4.2.1 (built Wed, 08 May 2019 21:11:16 +0000) X-SA-Exim-Scanned: Yes (on mail.hugovil.com) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1752293787002185328?= X-GMAIL-MSGID: =?utf-8?q?1752293787002185328?= From: Hugo Villeneuve Default PWRMNG[2:0] bits are set to 000b for PCF2127/29, but to 111b for PCF2131. Set these bits to 000b to select same mode as PCF2127/29. Signed-off-by: Hugo Villeneuve Reviewed-by: Bruno Thomsen --- drivers/rtc/rtc-pcf2127.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/drivers/rtc/rtc-pcf2127.c b/drivers/rtc/rtc-pcf2127.c index 68af4d0438b8..241189ee4a05 100644 --- a/drivers/rtc/rtc-pcf2127.c +++ b/drivers/rtc/rtc-pcf2127.c @@ -53,6 +53,7 @@ #define PCF2127_BIT_CTRL3_BLF BIT(2) #define PCF2127_BIT_CTRL3_BF BIT(3) #define PCF2127_BIT_CTRL3_BTSE BIT(4) +#define PCF2127_CTRL3_PWRMNG_MASK GENMASK(7, 5) /* Control register 4 */ #define PCF2131_REG_CTRL4 0x03 #define PCF2131_BIT_CTRL4_TSF4 BIT(4) @@ -1129,6 +1130,20 @@ static int pcf2127_probe(struct device *dev, struct regmap *regmap, regmap_clear_bits(pcf2127->regmap, PCF2127_REG_CTRL1, PCF2127_BIT_CTRL1_POR_OVRD); + /* Make sure PWRMNG[2:0] is set to 000b. This is the default for + * PCF2127/29, but not for PCF2131 (default of 111b). + * + * PWRMNG[2:0] = 000b: + * battery switch-over function is enabled in standard mode; + * battery low detection function is enabled + */ + ret = regmap_clear_bits(pcf2127->regmap, PCF2127_REG_CTRL3, + PCF2127_CTRL3_PWRMNG_MASK); + if (ret < 0) { + dev_err(dev, "PWRMNG config failed\n"); + return ret; + } + ret = regmap_read(pcf2127->regmap, pcf2127->cfg->reg_clkout, &val); if (ret < 0) return ret;