Skip to content

Commit 8b59a11

Browse files
minying0829alexandrebelloni
authored andcommitted
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 <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Alexandre Belloni <[email protected]>
1 parent 95c4633 commit 8b59a11

File tree

1 file changed

+9
-6
lines changed

1 file changed

+9
-6
lines changed

drivers/rtc/rtc-nct3018y.c

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -517,12 +517,15 @@ static int nct3018y_probe(struct i2c_client *client)
517517
if (nct3018y->part_num < 0) {
518518
dev_dbg(&client->dev, "Failed to read NCT3018Y_REG_PART.\n");
519519
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+
}
526529
}
527530
}
528531

0 commit comments

Comments
 (0)