From: Emanuele Ghidoli <ghidoliemanuele@gmail.com>
To: alexandre.belloni@bootlin.com, linux-kernel@vger.kernel.org,
linux-rtc@vger.kernel.org, linux-kselftest@vger.kernel.org,
shuah@kernel.org
Cc: Emanuele Ghidoli <emanuele.ghidoli@toradex.com>,
jjang@nvidia.com, kobak@nvidia.com, mochs@nvidia.com
Subject: [PATCH v1 1/2] rtc: ds1307: set one-minute alarm resolution for rx_8130
Date: Mon, 24 Jun 2024 12:23:53 +0200 [thread overview]
Message-ID: <20240624102354.894871-2-ghidoliemanuele@gmail.com> (raw)
In-Reply-To: <20240624102354.894871-1-ghidoliemanuele@gmail.com>
From: Emanuele Ghidoli <emanuele.ghidoli@toradex.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@toradex.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
next prev parent reply other threads:[~2024-06-24 10:24 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-06-24 10:23 [PATCH v1 0/2] Fixes for RX8310 RTC Configuration and rtctest Alarm Emanuele Ghidoli
2024-06-24 10:23 ` Emanuele Ghidoli [this message]
2024-06-24 10:23 ` [PATCH v1 2/2] selftests: rtc: rtctest: skip alarm test if alarm resolution is one minute Emanuele Ghidoli
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20240624102354.894871-2-ghidoliemanuele@gmail.com \
--to=ghidoliemanuele@gmail.com \
--cc=alexandre.belloni@bootlin.com \
--cc=emanuele.ghidoli@toradex.com \
--cc=jjang@nvidia.com \
--cc=kobak@nvidia.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-kselftest@vger.kernel.org \
--cc=linux-rtc@vger.kernel.org \
--cc=mochs@nvidia.com \
--cc=shuah@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox