From patchwork Thu Dec 15 15:02:06 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hugo Villeneuve X-Patchwork-Id: 33675 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:e747:0:0:0:0:0 with SMTP id c7csp421127wrn; Thu, 15 Dec 2022 07:19:40 -0800 (PST) X-Google-Smtp-Source: AA0mqf5TppuU2S7k3VrxWUTTXb9gYxNCStpZ/tHyag+TGdImPISpQDisebxSaLNH9D1+4c/enmyd X-Received: by 2002:a17:90a:8a18:b0:219:20b4:9a0e with SMTP id w24-20020a17090a8a1800b0021920b49a0emr28539221pjn.24.1671117579767; 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=ot4N30Euz++CnLJoh3tlg6Q8OeO+Zgna4cXUe5FQJJdv0KGDdXpf26slgCTTFXbifa 8WiKRPOjW4TFVHJrb2pDYRl9ZhwYQLedbA7fRS3i31uUZhdnpA9BpNI1N1iY1x2BZ1Lx fiAGfN1UtANSvEswgUuuaUe/0yEYmWKu2wP/cfEKGNuBEI9xFFX6u09Nw1KjBpqOmUnq 8DGmCq+K4Buf4Ky5MQF/16wn+OOfRat0b5B3yV8ySpfArd3ywirMpl2PKzkC0Rz2bdda BXgAh5aYriJsZtaCXWtJlzE5JLsyBMybxKyA4NMGPzOTYhxrKYjKdWEsOw43NdTysz0Q KsHA== 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 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.19.23; 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=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 + 99 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 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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1752293786942973657?= X-GMAIL-MSGID: =?utf-8?q?1752293786942973657?= From: Hugo Villeneuve This will simplify the implementation of new variants into this driver. Signed-off-by: Hugo Villeneuve Reviewed-by: Bruno Thomsen --- 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;