Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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 <biwen.li@nxp.com>
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
Link: https://lore.kernel.org/r/20201202031840.15582-1-biwen.li@oss.nxp.com

authored by

Biwen Li and committed by
Alexandre Belloni
2843d565 198be989

+7 -3
+7 -3
drivers/rtc/rtc-pcf2127.c
··· 558 558 }; 559 559 560 560 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) 562 562 { 563 563 struct pcf2127 *pcf2127; 564 564 int ret = 0; ··· 601 601 set_bit(RTC_FEATURE_ALARM, pcf2127->rtc->features); 602 602 } 603 603 604 - if (has_nvmem) { 604 + if (is_pcf2127) { 605 605 struct nvmem_config nvmem_cfg = { 606 606 .priv = pcf2127, 607 607 .reg_read = pcf2127_nvmem_read, ··· 636 636 * Watchdog timer enabled and reset pin /RST activated when timed out. 637 637 * Select 1Hz clock source for watchdog timer. 638 638 * 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. 639 643 */ 640 644 ret = regmap_update_bits(pcf2127->regmap, PCF2127_REG_WD_CTL, 641 645 PCF2127_BIT_WD_CTL_CD1 | ··· 647 643 PCF2127_BIT_WD_CTL_TF1 | 648 644 PCF2127_BIT_WD_CTL_TF0, 649 645 PCF2127_BIT_WD_CTL_CD1 | 650 - PCF2127_BIT_WD_CTL_CD0 | 646 + (is_pcf2127 ? PCF2127_BIT_WD_CTL_CD0 : 0) | 651 647 PCF2127_BIT_WD_CTL_TF1); 652 648 if (ret) { 653 649 dev_err(dev, "%s: watchdog config (wd_ctl) failed\n", __func__);