Commit 8b59a11f authored by Mia Lin's avatar Mia Lin Committed by Alexandre Belloni

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: default avatarMia Lin <mimi05633@gmail.com>
Link: https://lore.kernel.org/r/20240311013405.3398823-2-mimi05633@gmail.comSigned-off-by: default avatarAlexandre Belloni <alexandre.belloni@bootlin.com>
parent 95c46336
......@@ -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;
}
}
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment