[PATCH linux dev-6.6 1/1] rtc: nuvoton: Compatible with NCT3015Y-R and NCT3018Y-R
Andrew Jeffery
andrew at codeconstruct.com.au
Wed Sep 25 11:50:46 AEST 2024
On Wed, 2024-09-25 at 08:46 +0800, Potin Lai wrote:
> From: Mia Lin <mimi05633 at gmail.com>
>
> The NCT3015Y-R and NCT3018Y-R use the same datasheet
> but have different topologies as follows.
> - Topology (Only 1st i2c can set TWO bit and HF bit)
> In NCT3015Y-R,
> rtc 1st i2c is connected to a host CPU
> rtc 2nd i2c is connected to a BMC
> In NCT3018Y-R,
> rtc 1st i2c is connected to a BMC
> rtc 2nd i2c is connected to a host CPU
> In order to be compatible with NCT3015Y-R and NCT3018Y-R,
> - In probe,
> If part number is NCT3018Y-R, only set HF bit to 24-Hour format.
> Else, do nothing
> - In set_time,
> If part number is NCT3018Y-R && TWO bit is 0,
> change TWO bit to 1, and restore TWO bit after updating time.
>
> Signed-off-by: Mia Lin <mimi05633 at gmail.com>
> ---
> drivers/rtc/rtc-nct3018y.c | 52 +++++++++++++++++++++++++++++++++-----
> 1 file changed, 46 insertions(+), 6 deletions(-)
So I looked at the history of this driver upstream, and it appears that
this is (approximately) a backport of an existing change:
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=14688f1a91e1f37bc6bf50ff5241e857f24338e0
In the future, can you please provide such a link in the patch notes
(i.e. here, below the `---` above but before the diff markers below).
I compared what you've sent here and the patch above:
```
0 andrew at heihei:~/src/kernel.org/linux/openbmc ((c58d8005433d...)) $ git diff 14688f1a91e1f37bc6bf50ff5241e857f24338e0 HEAD -- drivers/rtc/rtc-nct3018y.c
diff --git a/drivers/rtc/rtc-nct3018y.c b/drivers/rtc/rtc-nct3018y.c
index f488a189a465..076d8b99f913 100644
--- a/drivers/rtc/rtc-nct3018y.c
+++ b/drivers/rtc/rtc-nct3018y.c
@@ -102,6 +102,8 @@ static int nct3018y_get_alarm_mode(struct i2c_client *client, unsigned char *ala
if (flags < 0)
return flags;
*alarm_enable = flags & NCT3018Y_BIT_AIE;
+ dev_dbg(&client->dev, "%s:alarm_enable:%x\n", __func__, *alarm_enable);
+
}
if (alarm_flag) {
@@ -110,11 +112,9 @@ static int nct3018y_get_alarm_mode(struct i2c_client *client, unsigned char *ala
if (flags < 0)
return flags;
*alarm_flag = flags & NCT3018Y_BIT_AF;
+ dev_dbg(&client->dev, "%s:alarm_flag:%x\n", __func__, *alarm_flag);
}
- dev_dbg(&client->dev, "%s:alarm_enable:%x alarm_flag:%x\n",
- __func__, *alarm_enable, *alarm_flag);
-
return 0;
}
```
Given the hunks are fairly benign I've instead directly backported the
upstream change.
If you have any issues with this, please let me know.
Andrew
More information about the openbmc
mailing list