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

rtc: nuvoton: Modify part number value

Base on datasheet,
the part number is corresponding to bit 0 and 1 of the part info reg.

Signed-off-by: Mia Lin <mimi05633@gmail.com>
Link: https://lore.kernel.org/r/20240311013405.3398823-2-mimi05633@gmail.com
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>

authored by

Mia Lin and committed by
Alexandre Belloni
8b59a11f 95c46336

+9 -6
+9 -6
drivers/rtc/rtc-nct3018y.c
··· 517 517 if (nct3018y->part_num < 0) { 518 518 dev_dbg(&client->dev, "Failed to read NCT3018Y_REG_PART.\n"); 519 519 return nct3018y->part_num; 520 - } else if (nct3018y->part_num == NCT3018Y_REG_PART_NCT3018Y) { 521 - flags = NCT3018Y_BIT_HF; 522 - err = i2c_smbus_write_byte_data(client, NCT3018Y_REG_CTRL, flags); 523 - if (err < 0) { 524 - dev_dbg(&client->dev, "Unable to write NCT3018Y_REG_CTRL.\n"); 525 - return err; 520 + } else { 521 + nct3018y->part_num &= 0x03; /* Part number is corresponding to bit 0 and 1 */ 522 + if (nct3018y->part_num == NCT3018Y_REG_PART_NCT3018Y) { 523 + flags = NCT3018Y_BIT_HF; 524 + err = i2c_smbus_write_byte_data(client, NCT3018Y_REG_CTRL, flags); 525 + if (err < 0) { 526 + dev_dbg(&client->dev, "Unable to write NCT3018Y_REG_CTRL.\n"); 527 + return err; 528 + } 526 529 } 527 530 } 528 531