[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20240311013405.3398823-2-mimi05633@gmail.com>
Date: Mon, 11 Mar 2024 09:34:05 +0800
From: Mia Lin <mimi05633@...il.com>
To: avifishman70@...il.com,
tmaimon77@...il.com,
tali.perry1@...il.com,
venture@...gle.com,
yuenn@...gle.com,
benjaminfair@...gle.com,
alexandre.belloni@...tlin.com,
mimi05633@...il.com,
KWLIU@...oton.com,
mylin1@...oton.com
Cc: openbmc@...ts.ozlabs.org,
linux-rtc@...r.kernel.org,
linux-kernel@...r.kernel.org
Subject: [PATCH v1 1/1] 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@...il.com>
---
drivers/rtc/rtc-nct3018y.c | 15 +++++++++------
1 file changed, 9 insertions(+), 6 deletions(-)
diff --git a/drivers/rtc/rtc-nct3018y.c b/drivers/rtc/rtc-nct3018y.c
index f488a189a465..9dce003126a5 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;
+ }
}
}
--
2.25.1
Powered by blists - more mailing lists