diff options
author | Mia Lin <mimi05633@gmail.com> | 2024-03-11 09:34:05 +0800 |
---|---|---|
committer | Alexandre Belloni <alexandre.belloni@bootlin.com> | 2024-03-29 15:59:02 +0100 |
commit | 8b59a11fb8e60540ee00ea054afd8dbe9dd3ba00 (patch) | |
tree | 53ab43a49762910e3416e53919f4f43f6560286b /drivers/rtc | |
parent | 95c46336ab4785701a506e94fbd6256c7859be7b (diff) |
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>
Diffstat (limited to 'drivers/rtc')
-rw-r--r-- | drivers/rtc/rtc-nct3018y.c | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/drivers/rtc/rtc-nct3018y.c b/drivers/rtc/rtc-nct3018y.c index 076d8b99f913..7a8b4de893b8 100644 --- a/drivers/rtc/rtc-nct3018y.c +++ b/drivers/rtc/rtc-nct3018y.c @@ -517,12 +517,15 @@ static int nct3018y_probe(struct i2c_client *client) if (nct3018y->part_num < 0) { dev_dbg(&client->dev, "Failed to read NCT3018Y_REG_PART.\n"); return nct3018y->part_num; - } else if (nct3018y->part_num == NCT3018Y_REG_PART_NCT3018Y) { - flags = NCT3018Y_BIT_HF; - err = i2c_smbus_write_byte_data(client, NCT3018Y_REG_CTRL, flags); - if (err < 0) { - dev_dbg(&client->dev, "Unable to write NCT3018Y_REG_CTRL.\n"); - return err; + } else { + nct3018y->part_num &= 0x03; /* Part number is corresponding to bit 0 and 1 */ + if (nct3018y->part_num == NCT3018Y_REG_PART_NCT3018Y) { + flags = NCT3018Y_BIT_HF; + err = i2c_smbus_write_byte_data(client, NCT3018Y_REG_CTRL, flags); + if (err < 0) { + dev_dbg(&client->dev, "Unable to write NCT3018Y_REG_CTRL.\n"); + return err; + } } } |