lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20240624102354.894871-2-ghidoliemanuele@gmail.com>
Date: Mon, 24 Jun 2024 12:23:53 +0200
From: Emanuele Ghidoli <ghidoliemanuele@...il.com>
To: alexandre.belloni@...tlin.com,
	linux-kernel@...r.kernel.org,
	linux-rtc@...r.kernel.org,
	linux-kselftest@...r.kernel.org,
	shuah@...nel.org
Cc: Emanuele Ghidoli <emanuele.ghidoli@...adex.com>,
	jjang@...dia.com,
	kobak@...dia.com,
	mochs@...dia.com
Subject: [PATCH v1 1/2] rtc: ds1307: set one-minute alarm resolution for rx_8130

From: Emanuele Ghidoli <emanuele.ghidoli@...adex.com>

Set one-minute alarm resolution for the rx_8130 by setting the
RTC_FEATURE_ALARM_RES_MINUTE flag according to the hw capabilities.

Additionally, set the no_upd_irq flag to disable update interrupts,
as it is not possible to generate update IRQs.
hwclock fails reading the date and time if the no update irq flag
is not set and IRQs is defined in DT.

Signed-off-by: Emanuele Ghidoli <emanuele.ghidoli@...adex.com>
---
 drivers/rtc/rtc-ds1307.c | 14 ++++++++++++--
 1 file changed, 12 insertions(+), 2 deletions(-)

diff --git a/drivers/rtc/rtc-ds1307.c b/drivers/rtc/rtc-ds1307.c
index 506b7d1c2397..96e4d82ad915 100644
--- a/drivers/rtc/rtc-ds1307.c
+++ b/drivers/rtc/rtc-ds1307.c
@@ -181,6 +181,8 @@ struct ds1307 {
 
 struct chip_desc {
 	unsigned		alarm:1;
+	unsigned		alarm_res_min:1;
+	unsigned		no_upd_irq:1;
 	u16			nvram_offset;
 	u16			nvram_size;
 	u8			offset; /* register's offset */
@@ -1015,6 +1017,8 @@ static const struct chip_desc chips[last_ds_type] = {
 	},
 	[rx_8130] = {
 		.alarm		= 1,
+		.alarm_res_min  = 1,
+		.no_upd_irq     = 1,
 		/* this is battery backed SRAM */
 		.nvram_offset	= 0x20,
 		.nvram_size	= 4,	/* 32bit (4 word x 8 bit) */
@@ -1946,10 +1950,16 @@ static int ds1307_probe(struct i2c_client *client)
 	if (IS_ERR(ds1307->rtc))
 		return PTR_ERR(ds1307->rtc);
 
-	if (want_irq || ds1307_can_wakeup_device)
+	if (want_irq || ds1307_can_wakeup_device) {
 		device_set_wakeup_capable(ds1307->dev, true);
-	else
+		if (chip->alarm_res_min)
+			set_bit(RTC_FEATURE_ALARM_RES_MINUTE, ds1307->rtc->features);
+	} else {
 		clear_bit(RTC_FEATURE_ALARM, ds1307->rtc->features);
+	}
+
+	if (chip->no_upd_irq)
+		clear_bit(RTC_FEATURE_UPDATE_INTERRUPT, ds1307->rtc->features);
 
 	if (ds1307_can_wakeup_device && !want_irq) {
 		dev_info(ds1307->dev,
-- 
2.34.1


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ