All of lore.kernel.org
 help / color / mirror / Atom feed
* Re: Patch "rtc: ds1307: remove clear of oscillator stop flag (OSF) in probe" has been added to the 5.4-stable tree
       [not found] <20250817154824.2401461-1-sashal@kernel.org>
@ 2025-08-18 16:43 ` Meagan Lloyd
  2025-08-19  2:03   ` Sasha Levin
  0 siblings, 1 reply; 3+ messages in thread
From: Meagan Lloyd @ 2025-08-18 16:43 UTC (permalink / raw)
  To: Sasha Levin; +Cc: Alexandre Belloni, stable-commits, stable

On 8/17/2025 8:48 AM, Sasha Levin wrote:
> This is a note to let you know that I've just added the patch titled
>
>     rtc: ds1307: remove clear of oscillator stop flag (OSF) in probe
>
> to the 5.4-stable tree which can be found at:
>     http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

Hi Sasha,

FYI, patch 2/2 of the series wasn't applied to 5.4, but was applied to all the other trees.

"rtc: ds1307: handle oscillator stop flag (OSF) for ds1341"

[PATCH 2/2] rtc: ds1307: handle oscillator stop flag (OSF) for ds1341 - Meagan Lloyd <https://lore.kernel.org/all/1749665656-30108-3-git-send-email-meaganlloyd@linux.microsoft.com/>

(upstream commit 523923cfd5d622b8f4ba893fdaf29fa6adeb8c3e)

Thank you,

Meagan


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Patch "rtc: ds1307: remove clear of oscillator stop flag (OSF) in probe" has been added to the 5.4-stable tree
  2025-08-18 16:43 ` Patch "rtc: ds1307: remove clear of oscillator stop flag (OSF) in probe" has been added to the 5.4-stable tree Meagan Lloyd
@ 2025-08-19  2:03   ` Sasha Levin
  2025-08-20 23:06     ` [PATCH 5.4.y] rtc: ds1307: handle oscillator stop flag (OSF) for ds1341 Meagan Lloyd
  0 siblings, 1 reply; 3+ messages in thread
From: Sasha Levin @ 2025-08-19  2:03 UTC (permalink / raw)
  To: Meagan Lloyd; +Cc: Alexandre Belloni, stable-commits, stable

On Mon, Aug 18, 2025 at 09:43:35AM -0700, Meagan Lloyd wrote:
>On 8/17/2025 8:48 AM, Sasha Levin wrote:
>> This is a note to let you know that I've just added the patch titled
>>
>>     rtc: ds1307: remove clear of oscillator stop flag (OSF) in probe
>>
>> to the 5.4-stable tree which can be found at:
>>     http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary
>
>Hi Sasha,
>
>FYI, patch 2/2 of the series wasn't applied to 5.4, but was applied to all the other trees.
>
>"rtc: ds1307: handle oscillator stop flag (OSF) for ds1341"
>
>[PATCH 2/2] rtc: ds1307: handle oscillator stop flag (OSF) for ds1341 - Meagan Lloyd <https://lore.kernel.org/all/1749665656-30108-3-git-send-email-meaganlloyd@linux.microsoft.com/>
>
>(upstream commit 523923cfd5d622b8f4ba893fdaf29fa6adeb8c3e)

Looks like it failed to apply :(

Could you send a backport to 5.4 please? Or should I just patch 1/2 from 5.4?

-- 
Thanks,
Sasha

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [PATCH 5.4.y] rtc: ds1307: handle oscillator stop flag (OSF) for ds1341
  2025-08-19  2:03   ` Sasha Levin
@ 2025-08-20 23:06     ` Meagan Lloyd
  0 siblings, 0 replies; 3+ messages in thread
From: Meagan Lloyd @ 2025-08-20 23:06 UTC (permalink / raw)
  To: sashal; +Cc: alexandre.belloni, meaganlloyd, stable-commits, stable

[ Upstream commit 523923cfd5d622b8f4ba893fdaf29fa6adeb8c3e ]

In using CONFIG_RTC_HCTOSYS, rtc_hctosys() will sync the RTC time to the
kernel time as long as rtc_read_time() succeeds. In some power loss
situations, our supercapacitor-backed DS1342 RTC comes up with either an
unpredictable future time or the default 01/01/00 from the datasheet.
The oscillator stop flag (OSF) is set in these scenarios due to the
power loss and can be used to determine the validity of the RTC data.

This change expands the oscillator stop flag (OSF) handling that has
already been implemented for some chips to the ds1341 chip (DS1341 and
DS1342 share a datasheet). This handling manages the validity of the RTC
data in .read_time and .set_time based on the OSF.

Signed-off-by: Meagan Lloyd <meaganlloyd@linux.microsoft.com>
Reviewed-by: Tyler Hicks <code@tyhicks.com>
Acked-by: Rodolfo Giometti <giometti@enneenne.com>
Link: https://lore.kernel.org/r/1749665656-30108-3-git-send-email-meaganlloyd@linux.microsoft.com
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>

[ Git was trying to insert the code above the ds_1388 case statement block (in
each respective function) which don't exist in the v5.4.296 rtc-ds1307 driver,
thus a manual fixup was required. ]
Signed-off-by: Meagan Lloyd <meaganlloyd@linux.microsoft.com>
---
Here's the backport of patch 2/2 of the series for v5.4.
---
 drivers/rtc/rtc-ds1307.c | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/drivers/rtc/rtc-ds1307.c b/drivers/rtc/rtc-ds1307.c
index bb65767996d7..0afc2b14f059 100644
--- a/drivers/rtc/rtc-ds1307.c
+++ b/drivers/rtc/rtc-ds1307.c
@@ -252,6 +252,13 @@ static int ds1307_get_time(struct device *dev, struct rtc_time *t)
 		if (tmp & DS1340_BIT_OSF)
 			return -EINVAL;
 		break;
+	case ds_1341:
+		ret = regmap_read(ds1307->regmap, DS1337_REG_STATUS, &tmp);
+		if (ret)
+			return ret;
+		if (tmp & DS1337_BIT_OSF)
+			return -EINVAL;
+		break;
 	case mcp794xx:
 		if (!(tmp & MCP794XX_BIT_ST))
 			return -EINVAL;
@@ -343,6 +350,10 @@ static int ds1307_set_time(struct device *dev, struct rtc_time *t)
 		regmap_update_bits(ds1307->regmap, DS1340_REG_FLAG,
 				   DS1340_BIT_OSF, 0);
 		break;
+	case ds_1341:
+		regmap_update_bits(ds1307->regmap, DS1337_REG_STATUS,
+				   DS1337_BIT_OSF, 0);
+		break;
 	case mcp794xx:
 		/*
 		 * these bits were cleared when preparing the date/time
-- 
2.49.0


^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2025-08-20 23:06 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <20250817154824.2401461-1-sashal@kernel.org>
2025-08-18 16:43 ` Patch "rtc: ds1307: remove clear of oscillator stop flag (OSF) in probe" has been added to the 5.4-stable tree Meagan Lloyd
2025-08-19  2:03   ` Sasha Levin
2025-08-20 23:06     ` [PATCH 5.4.y] rtc: ds1307: handle oscillator stop flag (OSF) for ds1341 Meagan Lloyd

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.