Skip to content

Commit 2843d56

Browse files
biwenlialexandrebelloni
authored andcommitted
rtc: pcf2127: properly set flag WD_CD for rtc chips(pcf2129, pca2129)
Properly set flag WD_CD for rtc chips(pcf2129, pca2129) Signed-off-by: Biwen Li <[email protected]> Signed-off-by: Alexandre Belloni <[email protected]> Link: https://lore.kernel.org/r/[email protected]
1 parent 198be98 commit 2843d56

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

drivers/rtc/rtc-pcf2127.c

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -558,7 +558,7 @@ static const struct attribute_group pcf2127_attr_group = {
558558
};
559559

560560
static int pcf2127_probe(struct device *dev, struct regmap *regmap,
561-
int alarm_irq, const char *name, bool has_nvmem)
561+
int alarm_irq, const char *name, bool is_pcf2127)
562562
{
563563
struct pcf2127 *pcf2127;
564564
int ret = 0;
@@ -601,7 +601,7 @@ static int pcf2127_probe(struct device *dev, struct regmap *regmap,
601601
set_bit(RTC_FEATURE_ALARM, pcf2127->rtc->features);
602602
}
603603

604-
if (has_nvmem) {
604+
if (is_pcf2127) {
605605
struct nvmem_config nvmem_cfg = {
606606
.priv = pcf2127,
607607
.reg_read = pcf2127_nvmem_read,
@@ -636,14 +636,18 @@ static int pcf2127_probe(struct device *dev, struct regmap *regmap,
636636
* Watchdog timer enabled and reset pin /RST activated when timed out.
637637
* Select 1Hz clock source for watchdog timer.
638638
* Note: Countdown timer disabled and not available.
639+
* For pca2129, pcf2129, only bit[7] is for Symbol WD_CD
640+
* of register watchdg_tim_ctl. The bit[6] is labeled
641+
* as T. Bits labeled as T must always be written with
642+
* logic 0.
639643
*/
640644
ret = regmap_update_bits(pcf2127->regmap, PCF2127_REG_WD_CTL,
641645
PCF2127_BIT_WD_CTL_CD1 |
642646
PCF2127_BIT_WD_CTL_CD0 |
643647
PCF2127_BIT_WD_CTL_TF1 |
644648
PCF2127_BIT_WD_CTL_TF0,
645649
PCF2127_BIT_WD_CTL_CD1 |
646-
PCF2127_BIT_WD_CTL_CD0 |
650+
(is_pcf2127 ? PCF2127_BIT_WD_CTL_CD0 : 0) |
647651
PCF2127_BIT_WD_CTL_TF1);
648652
if (ret) {
649653
dev_err(dev, "%s: watchdog config (wd_ctl) failed\n", __func__);

0 commit comments

Comments
 (0)