Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp1184608rwb; Thu, 15 Dec 2022 07:20:14 -0800 (PST) X-Google-Smtp-Source: AA0mqf7nSXeQvbelv6XcpSaC+aVxt1AzKOn5MbsPOjJup5TbhepkVF2wq97Zh0pWO1GsGXgAfOLE X-Received: by 2002:a17:90a:b10f:b0:220:7147:c981 with SMTP id z15-20020a17090ab10f00b002207147c981mr22643464pjq.29.1671117614662; Thu, 15 Dec 2022 07:20:14 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1671117614; cv=none; d=google.com; s=arc-20160816; b=hnne9cQoviBBazy3T4k6EWD8VWJrktuG+az7BODAqyhXgxLS9/sJ94y8VXpLAr2X/l fgCv12ZcU2Yn6/CqxccypcqZKvpdyT/EaLNXjuiFvkvdumCy3i2R13PtKLw8EP843mQo cDrkZMbDxcE/LkzYi12OcpZyGYGA77hWGsSijAGszDdyc3Z4eRFlE6KisHtPZyVhtUQR e+cHjnIFMsBjrkT0TeJLLTOS/GTv/56btHOu0tf4Pi/Z9sPnxD504xsyoUhQy54+p/lJ anh1H2t4ij+GHi3WH6+crvV7MPkBc2xMjf+Iz1Kk+boR07skMgtHiRFns4MK/C28sqAz QiXw== 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=S8d6dn8OKytIYHpmifekb67q4TLdM6m9YnqemmeSLaQ=; b=pt8jsDGoO8QE3IhzgdkkdzIq9yGNe5hZmBXDsNnj2X1vKzP+7ONth+W2mPxrWaYfV6 tEvl68XcrgEaUEZnuXGR9tmKQSQtLS+n+WE+tMRUgyZg6ZBRSwxzJEe7aKKENyvPSUZB Va5Z8eASFq/TQYRzP1/gIftNZj+7uEQ5aq/j3jjglEwSoLPUqoLJsKKIu1Aq9tyQvb9I WgF9se4Wxm75DC2uEBcT6EPtV/wQggy46HLKAzg0VEM331srZN/OQ2TtxgBEhxIFR2el 2R5ohbY3g0TjO/c69Mutu0ofRdYvl3IuoKIPjgYpgd5bXm744p6HvtX0kW6d0RwTYekw HXeg== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@hugovil.com header.s=x header.b=c2sQ5iNV; 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 oe11-20020a17090b394b00b0021984a8bdbesi5026536pjb.47.2022.12.15.07.20.06; Thu, 15 Dec 2022 07:20:14 -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=c2sQ5iNV; 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 S229825AbiLOPSL (ORCPT + 69 others); Thu, 15 Dec 2022 10:18:11 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46014 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229554AbiLOPSG (ORCPT ); Thu, 15 Dec 2022 10:18:06 -0500 Received: from mail.hugovil.com (mail.hugovil.com [162.243.120.170]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 26D58E0; Thu, 15 Dec 2022 07:18:05 -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=S8d6dn8OKytIYHpmifekb67q4TLdM6m9YnqemmeSLaQ=; b=c2sQ5iNVADjuPd8lr3keKGO5j1 U9La64lwX/gD0ex83K9JpMYq6+FJfByQkhSoN+6pZLcCrHSUn0ElCMdY7dwU5rpWZ7agLHF1SaYVt nIlDCNnDWSfn3sYLKQc2+ObWLxhjrjRmBsa+qQYzun3CicfFUEW/azP0XEp1ZZpZddWE=; 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 1p5pmC-0000EC-V6; Thu, 15 Dec 2022 10:04:01 -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:06 -0500 Message-Id: <20221215150214.1109074-6-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 Content-Transfer-Encoding: 8bit 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 05/14] rtc: pcf2127: adapt for CLKOUT register at any offset 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 From: Hugo Villeneuve This will simplify the implementation of new variants into this driver. Signed-off-by: Hugo Villeneuve --- drivers/rtc/rtc-pcf2127.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/drivers/rtc/rtc-pcf2127.c b/drivers/rtc/rtc-pcf2127.c index 5d8c06e32dce..38816ad065eb 100644 --- a/drivers/rtc/rtc-pcf2127.c +++ b/drivers/rtc/rtc-pcf2127.c @@ -116,6 +116,7 @@ struct pcf21xx_config { u8 regs_alarm_base; /* Alarm function base registers. */ u8 reg_wd_ctl; /* Watchdog control register. */ u8 reg_wd_val; /* Watchdog value register. */ + u8 reg_clkout; /* Clkout register. */ }; struct pcf2127 { @@ -668,6 +669,7 @@ static struct pcf21xx_config pcf21xx_cfg[] = { .regs_alarm_base = PCF2127_REG_ALARM_BASE, .reg_wd_ctl = PCF2127_REG_WD_CTL, .reg_wd_val = PCF2127_REG_WD_VAL, + .reg_clkout = PCF2127_REG_CLKOUT, }, [PCF2129] = { .max_register = 0x19, @@ -677,6 +679,7 @@ static struct pcf21xx_config pcf21xx_cfg[] = { .regs_alarm_base = PCF2127_REG_ALARM_BASE, .reg_wd_ctl = PCF2127_REG_WD_CTL, .reg_wd_val = PCF2127_REG_WD_VAL, + .reg_clkout = PCF2127_REG_CLKOUT, }, }; @@ -756,12 +759,12 @@ static int pcf2127_probe(struct device *dev, struct regmap *regmap, regmap_clear_bits(pcf2127->regmap, PCF2127_REG_CTRL1, PCF2127_BIT_CTRL1_POR_OVRD); - ret = regmap_read(pcf2127->regmap, PCF2127_REG_CLKOUT, &val); + ret = regmap_read(pcf2127->regmap, pcf2127->cfg->reg_clkout, &val); if (ret < 0) return ret; if (!(val & PCF2127_BIT_CLKOUT_OTPR)) { - ret = regmap_set_bits(pcf2127->regmap, PCF2127_REG_CLKOUT, + ret = regmap_set_bits(pcf2127->regmap, pcf2127->cfg->reg_clkout, PCF2127_BIT_CLKOUT_OTPR); if (ret < 0) return ret; -- 2.30.2