All of lore.kernel.org
 help / color / mirror / Atom feed
* [rtc-linux] [PATCH v2 1/4] NTP: rtc: Add CONFIG_RTC_SYSTOHC_DEVICE for NTP synchronization
@ 2015-06-02  9:14 ` Xunlei Pang
  0 siblings, 0 replies; 16+ messages in thread
From: Xunlei Pang @ 2015-06-02  9:14 UTC (permalink / raw)
  To: linux-kernel
  Cc: rtc-linux, Alessandro Zummo, Alexandre Belloni, John Stultz,
	Arnd Bergmann, Xunlei Pang, Paul Bolle

From: Xunlei Pang <pang.xunlei@linaro.org>

Currently, CONFIG_RTC_SYSTOHC uses CONFIG_RTC_HCTOSYS_DEVICE which
is originally used by CONFIG_RTC_HCTOSYS, but this rtc device has
some limiations, for example, it must be battery-backed, be able
to work with irq off and through system suspension, etc.

So add CONFIG_RTC_SYSTOHC_DEVICE used exclusively for CONFIG_RTC_SYSTOHC,
it is more lenient compared to CONFIG_RTC_HCTOSYS_DEVICE, and could
be assigned any available RTC in the system. Default value is "rtc0".

After this patch, NTP will sync up "rtc0" by default.

Cc: Paul Bolle <pebolle@tiscali.nl>
Signed-off-by: Xunlei Pang <pang.xunlei@linaro.org>
---
v1->v2:
Change "depends on RTC_XX = y" to "depends on RTC_XXX".

 drivers/rtc/Kconfig   | 28 +++++++++++++++++++---------
 drivers/rtc/systohc.c |  2 +-
 2 files changed, 20 insertions(+), 10 deletions(-)

diff --git a/drivers/rtc/Kconfig b/drivers/rtc/Kconfig
index 0fe4ad8..f422a46 100644
--- a/drivers/rtc/Kconfig
+++ b/drivers/rtc/Kconfig
@@ -25,17 +25,9 @@ config RTC_HCTOSYS
 	  the value read from a specified RTC device. This is useful to avoid
 	  unnecessary fsck runs at boot time, and to network better.
 
-config RTC_SYSTOHC
-	bool "Set the RTC time based on NTP synchronization"
-	default y
-	help
-	  If you say yes here, the system time (wall clock) will be stored
-	  in the RTC specified by RTC_HCTOSYS_DEVICE approximately every 11
-	  minutes if userspace reports synchronized NTP status.
-
 config RTC_HCTOSYS_DEVICE
 	string "RTC used to set the system time"
-	depends on RTC_HCTOSYS = y || RTC_SYSTOHC = y
+	depends on RTC_HCTOSYS
 	default "rtc0"
 	help
 	  The RTC device that will be used to (re)initialize the system
@@ -56,6 +48,24 @@ config RTC_HCTOSYS_DEVICE
 	  sleep states. Do not specify an RTC here unless it stays powered
 	  during all this system's supported sleep states.
 
+config RTC_SYSTOHC
+	bool "Set the RTC time based on NTP synchronization"
+	default y
+	help
+	  If you say yes here, the system time (wall clock) will be stored
+	  in the RTC specified by RTC_HCTOSYS_DEVICE approximately every 11
+	  minutes if userspace reports synchronized NTP status.
+
+config RTC_SYSTOHC_DEVICE
+	string "RTC used to synchronize NTP adjustment"
+	depends on RTC_SYSTOHC
+	default "rtc0"
+	help
+	  The RTC device used for NTP synchronization. The main difference
+	  between RTC_HCTOSYS_DEVICE and RTC_SYSTOHC_DEVICE is that this
+	  one can sleep when setting time, because it runs in the workqueue
+	  context.
+
 config RTC_DEBUG
 	bool "RTC debug support"
 	help
diff --git a/drivers/rtc/systohc.c b/drivers/rtc/systohc.c
index 7728d5e..b4a68ff 100644
--- a/drivers/rtc/systohc.c
+++ b/drivers/rtc/systohc.c
@@ -31,7 +31,7 @@ int rtc_set_ntp_time(struct timespec64 now)
 	else
 		rtc_time64_to_tm(now.tv_sec + 1, &tm);
 
-	rtc = rtc_class_open(CONFIG_RTC_HCTOSYS_DEVICE);
+	rtc = rtc_class_open(CONFIG_RTC_SYSTOHC_DEVICE);
 	if (rtc) {
 		/* rtc_hctosys exclusively uses UTC, so we call set_time here,
 		 * not set_mmss. */
-- 
1.9.1


-- 
-- 
You received this message because you are subscribed to "rtc-linux".
Membership options at http://groups.google.com/group/rtc-linux .
Please read http://groups.google.com/group/rtc-linux/web/checklist
before submitting a driver.
--- 
You received this message because you are subscribed to the Google Groups "rtc-linux" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rtc-linux+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

^ permalink raw reply related	[flat|nested] 16+ messages in thread
* [rtc-linux] [PATCH v2 1/4] NTP: rtc: Add CONFIG_RTC_SYSTOHC_DEVICE for NTP synchronization
@ 2015-05-29 14:46 Xunlei Pang
  2015-06-01  8:27 ` [rtc-linux] " Paul Bolle
  0 siblings, 1 reply; 16+ messages in thread
From: Xunlei Pang @ 2015-05-29 14:46 UTC (permalink / raw)
  To: linux-kernel
  Cc: rtc-linux, Alessandro Zummo, John Stultz, Arnd Bergmann,
	David S. Miller, sparclinux, linux-cris-kernel, Mikael Starvik,
	Jesper Nilsson, Xunlei Pang

From: Xunlei Pang <pang.xunlei@linaro.org>

Currently, CONFIG_RTC_SYSTOHC uses CONFIG_RTC_HCTOSYS_DEVICE which
is originally used by CONFIG_RTC_HCTOSYS, but this rtc device has
some limiations, for example, it must be battery-backed, be able
to work with irq off and through system suspension, etc.

So add CONFIG_RTC_SYSTOHC_DEVICE used exclusively for CONFIG_RTC_SYSTOHC,
it is more lenient compared to CONFIG_RTC_HCTOSYS_DEVICE, and could
be assigned any available RTC in the system. Default value is "rtc0".

After this patch, NTP will sync up "rtc0" by default.

Signed-off-by: Xunlei Pang <pang.xunlei@linaro.org>
---
 drivers/rtc/Kconfig   | 28 +++++++++++++++++++---------
 drivers/rtc/systohc.c |  2 +-
 2 files changed, 20 insertions(+), 10 deletions(-)

diff --git a/drivers/rtc/Kconfig b/drivers/rtc/Kconfig
index 0fe4ad8..f429e9a 100644
--- a/drivers/rtc/Kconfig
+++ b/drivers/rtc/Kconfig
@@ -25,17 +25,9 @@ config RTC_HCTOSYS
 	  the value read from a specified RTC device. This is useful to avoid
 	  unnecessary fsck runs at boot time, and to network better.
 
-config RTC_SYSTOHC
-	bool "Set the RTC time based on NTP synchronization"
-	default y
-	help
-	  If you say yes here, the system time (wall clock) will be stored
-	  in the RTC specified by RTC_HCTOSYS_DEVICE approximately every 11
-	  minutes if userspace reports synchronized NTP status.
-
 config RTC_HCTOSYS_DEVICE
 	string "RTC used to set the system time"
-	depends on RTC_HCTOSYS = y || RTC_SYSTOHC = y
+	depends on RTC_HCTOSYS = y
 	default "rtc0"
 	help
 	  The RTC device that will be used to (re)initialize the system
@@ -56,6 +48,24 @@ config RTC_HCTOSYS_DEVICE
 	  sleep states. Do not specify an RTC here unless it stays powered
 	  during all this system's supported sleep states.
 
+config RTC_SYSTOHC
+	bool "Set the RTC time based on NTP synchronization"
+	default y
+	help
+	  If you say yes here, the system time (wall clock) will be stored
+	  in the RTC specified by RTC_HCTOSYS_DEVICE approximately every 11
+	  minutes if userspace reports synchronized NTP status.
+
+config RTC_SYSTOHC_DEVICE
+	string "RTC used to synchronize NTP adjustment"
+	depends on RTC_SYSTOHC = y
+	default "rtc0"
+	help
+	  The RTC device used for NTP synchronization. The main difference
+	  between RTC_HCTOSYS_DEVICE and RTC_SYSTOHC_DEVICE is that this
+	  one can sleep when setting time, because it runs in the workqueue
+	  context.
+
 config RTC_DEBUG
 	bool "RTC debug support"
 	help
diff --git a/drivers/rtc/systohc.c b/drivers/rtc/systohc.c
index 7728d5e..b4a68ff 100644
--- a/drivers/rtc/systohc.c
+++ b/drivers/rtc/systohc.c
@@ -31,7 +31,7 @@ int rtc_set_ntp_time(struct timespec64 now)
 	else
 		rtc_time64_to_tm(now.tv_sec + 1, &tm);
 
-	rtc = rtc_class_open(CONFIG_RTC_HCTOSYS_DEVICE);
+	rtc = rtc_class_open(CONFIG_RTC_SYSTOHC_DEVICE);
 	if (rtc) {
 		/* rtc_hctosys exclusively uses UTC, so we call set_time here,
 		 * not set_mmss. */
-- 
1.9.1


-- 
-- 
You received this message because you are subscribed to "rtc-linux".
Membership options at http://groups.google.com/group/rtc-linux .
Please read http://groups.google.com/group/rtc-linux/web/checklist
before submitting a driver.
--- 
You received this message because you are subscribed to the Google Groups "rtc-linux" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rtc-linux+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

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

end of thread, other threads:[~2015-06-11 19:19 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-06-02  9:14 [rtc-linux] [PATCH v2 1/4] NTP: rtc: Add CONFIG_RTC_SYSTOHC_DEVICE for NTP synchronization Xunlei Pang
2015-06-02  9:14 ` Xunlei Pang
2015-06-02  9:14 ` [rtc-linux] [PATCH v2 2/4] sparc: time: Replace update_persistent_clock() with CONFIG_RTC_SYSTOHC Xunlei Pang
2015-06-02  9:14   ` Xunlei Pang
2015-06-11 19:15   ` [rtc-linux] " Alexandre Belloni
2015-06-11 19:15     ` Alexandre Belloni
2015-06-02  9:14 ` [rtc-linux] [PATCH v2 3/4] drivers/rtc/interface.c: Remove rtc_set_mmss() Xunlei Pang
2015-06-02  9:14   ` Xunlei Pang
2015-06-02  9:14 ` [rtc-linux] [PATCH v2 4/4] cris: time: Cleanup of persistent clock stuff Xunlei Pang
2015-06-02  9:14   ` Xunlei Pang
2015-06-11 19:19   ` [rtc-linux] " Alexandre Belloni
2015-06-11 19:19     ` Alexandre Belloni
2015-06-11 19:08 ` [rtc-linux] Re: [PATCH v2 1/4] NTP: rtc: Add CONFIG_RTC_SYSTOHC_DEVICE for NTP synchronization Alexandre Belloni
2015-06-11 19:08   ` Alexandre Belloni
  -- strict thread matches above, loose matches on Subject: below --
2015-05-29 14:46 [rtc-linux] " Xunlei Pang
2015-06-01  8:27 ` [rtc-linux] " Paul Bolle
2015-06-02  3:18   ` pang.xunlei

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.