From: Hugo Villeneuve <hugo@hugovil.com>
To: Alessandro Zummo <a.zummo@towertech.it>,
Alexandre Belloni <alexandre.belloni@bootlin.com>
Cc: hugo@hugovil.com, Hugo Villeneuve <hvilleneuve@dimonoff.com>,
linux-rtc@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: [PATCH 05/10] rtc: pcf2127: adapt for CLKOUT register at any offset
Date: Tue, 25 Jan 2022 15:00:04 -0500 [thread overview]
Message-ID: <20220125200009.900660-6-hugo@hugovil.com> (raw)
In-Reply-To: <20220125200009.900660-1-hugo@hugovil.com>
From: Hugo Villeneuve <hvilleneuve@dimonoff.com>
This will simplify the implementation of new variants into this driver.
Signed-off-by: Hugo Villeneuve <hvilleneuve@dimonoff.com>
---
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 82e4af999c29..13a7f95f52c5 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 {
@@ -667,6 +668,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,
@@ -676,6 +678,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,
},
};
@@ -743,12 +746,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
next prev parent reply other threads:[~2022-01-25 20:00 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <20220125200009.900660-1-hugo@hugovil.com>
2022-01-25 20:00 ` [PATCH 01/10] rtc: pcf2127: add variant-specific configuration structure Hugo Villeneuve
2022-01-25 20:00 ` [PATCH 02/10] rtc: pcf2127: adapt for time/date registers at any offset Hugo Villeneuve
2022-01-25 20:00 ` [PATCH 03/10] rtc: pcf2127: adapt for alarm " Hugo Villeneuve
2022-01-25 20:00 ` [PATCH 04/10] rtc: pcf2127: adapt for WD " Hugo Villeneuve
2022-01-25 20:00 ` Hugo Villeneuve [this message]
2022-01-25 20:00 ` [PATCH 06/10] rtc: pcf2127: add support for multiple TS functions Hugo Villeneuve
2022-01-25 20:00 ` [PATCH 07/10] rtc: pcf2127: add support for PCF2131 RTC Hugo Villeneuve
2022-01-25 20:00 ` [PATCH 08/10] rtc: pcf2127: add support for PCF2131 alarm interrupt on outputs INT_A/B Hugo Villeneuve
2022-01-25 20:00 ` [PATCH 09/10] dt-bindings: rtc: pcf2127: add PCF2131 Hugo Villeneuve
2022-02-09 3:23 ` Rob Herring
2022-01-25 20:00 ` [PATCH 10/10] dt-bindings: rtc: pcf2127: add PCF2131 INT_A and INT_B support Hugo Villeneuve
2022-02-09 3:20 ` Rob Herring
2022-02-10 22:12 ` Hugo Villeneuve
2022-02-10 22:32 ` Alexandre Belloni
2022-02-10 22:55 ` Hugo Villeneuve
2022-02-11 20:16 ` Hugo Villeneuve
2022-02-11 21:02 ` Alexandre Belloni
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20220125200009.900660-6-hugo@hugovil.com \
--to=hugo@hugovil.com \
--cc=a.zummo@towertech.it \
--cc=alexandre.belloni@bootlin.com \
--cc=hvilleneuve@dimonoff.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-rtc@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®