From: u.kleine-koenig@pengutronix.de (Uwe Kleine-König)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCHv0 3/3] rtc: rtc-isl12057: add alarm support to Intersil ISL12057 RTC driver
Date: Fri, 7 Nov 2014 08:58:43 +0100 [thread overview]
Message-ID: <20141107075843.GD10432@pengutronix.de> (raw)
In-Reply-To: <87ppcznbyv.fsf@natisbad.org>
Hi,
On Fri, Nov 07, 2014 at 12:30:48AM +0100, Arnaud Ebalard wrote:
> Mark Brown <broonie@kernel.org> writes:
> > On Wed, Nov 05, 2014 at 10:42:52PM +0100, Arnaud Ebalard wrote:
>
> >> + ret = rtc_tm_to_time(&rtc_tm, &rtc_secs);
> >> + if (ret)
> >> + goto err_unlock;
> >> +
> >> + ret = rtc_tm_to_time(alarm_tm, &alarm_secs);
> >> + if (ret)
> >> + goto err_unlock;
> >> +
> >> + /* If alarm time is before current time, disable the alarm */
> >> + if (!alarm->enabled || alarm_secs <= rtc_secs) {
> >> + enable = 0;
> >
> > Shouldn't there be some margin for time rolling forwards when checking
> > for alarm times in the past (or just refuse to set them, I've not
> > checked if this is following existing practice for RTC drivers)?
>
> No strong feeling on that point. ISL12008 on which this driver is based
> has a similar logic.
Some time ago I already had the feeling that there is much "rank growth"
in the rtc drivers. I guess this is because maintenance of the rtc
subsystem isn't optimal and there are no guidelines (at least I'm not
aware of any) about detail questions.
> >> + if (client->irq > 0) {
> >> + ret = devm_request_threaded_irq(&client->dev, client->irq, NULL,
> >> + isl12057_rtc_interrupt,
> >> + IRQF_SHARED|IRQF_ONESHOT,
> >> + DRV_NAME, client);
> >> + if (!ret) {
> >> + device_init_wakeup(&client->dev, true);
> >> + } else {
> >> + dev_err(dev, "irq %d unavailable, no alarm support\n",
> >> + client->irq);
> >> + client->irq = 0;
> >> + }
> >> + }
> >> +
> >
> > None of the alarm functionality checks to see if there's actually an IRQ
> > - is that OK? I'd at least expect the alarm interrupt enable call to
> > check if the interrupt is wired up.
>
> I can add those check BUT I would like some directions in order to
> support the following use case too.
>
> Current three in-tree users of ISL12057 are NAS devices (Netgear
> ReadyNAS 102, 104 and 2120). All of them *do not have* the interrupt pin
I assume you don't have schematics of the devices, right? If so, do you
think it might be worth to try to get them from Netgear? Just to make
sure that there really is no pin connected to the SoC.
> of the RTC chip connected to an interrupt line of the SoC. Nonetheless,
> the IRQ line of the chip being connected to a PMIC on the board (TI
> TPS65251 [1] on ReadyNAS 102 and 104, I do not know for ReadyNAS
Looking over the manual it seems there is no way to let the PMIC forward
the irq either.
> 2120). When the device is off and the alarm rings, the device gets
> powered on. AFAICT, the IRQ coming on the TPS65251 is not replicated on
> any line of the SoC.
>
> I think it's possible w/ some soldering to get somewhere where the RTC
> framework wants me to be and finish the alarm part to have it merged
> upstream but that's of limited interest if in-tree user cannot use it to
> fit their need, i.e. configure an alarm value and enable the associated
> interrupt which is routed externally, i.e. not visible by the SoC.
Do you need to enable the irq somewhere else (apart from in the RTC
device)? I guess not.
> FWIW, we had a similar discussion a while ago, during driver inclusion:
>
> http://marc.info/?l=devicetree&m=138109313118504&w=2
>
> Uwe, any idea?
What is the problem of a not-wired-up irq line? Does the rtc framework
need to change to allow setting an alarm without the irq line being
hooked up? Is it "only" that the alarm is missed? Irq polling probably
isn't sensible?
I assume it's not that unusual that an rtc irq doesn't trigger a system
irq, so having that supported nicely would be great.
Looking through the rtc's datasheet, the device is a tad more
complicated than the current driver handles. There are two irq lines and
three functions that can be routed through these (alarm1, alarm2 and
clkout; not all combinations are possible).
Best regards
Uwe
--
Pengutronix e.K. | Uwe Kleine-K?nig |
Industrial Linux Solutions | http://www.pengutronix.de/ |
next prev parent reply other threads:[~2014-11-07 7:58 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-11-05 21:42 [PATCHv0 0/3] rtc: rtc-isl12057: fixes and alarm support Arnaud Ebalard
2014-11-05 21:42 ` [PATCHv0 1/3] rtc: rtc-isl12057: fix masking of register values Arnaud Ebalard
2014-11-06 8:29 ` Uwe Kleine-König
2014-11-06 23:34 ` Arnaud Ebalard
2014-11-05 21:42 ` [PATCHv0 2/3] rtc: rtc-isl12057: fix isil vs isl naming for intersil Arnaud Ebalard
2014-11-06 5:32 ` Mark Brown
2014-11-06 22:46 ` Arnaud Ebalard
2014-11-07 6:39 ` Uwe Kleine-König
2014-11-05 21:42 ` [PATCHv0 3/3] rtc: rtc-isl12057: add alarm support to Intersil ISL12057 RTC driver Arnaud Ebalard
2014-11-06 5:50 ` Mark Brown
2014-11-06 5:59 ` Guenter Roeck
2014-11-06 6:07 ` Mark Brown
2014-11-06 23:30 ` Arnaud Ebalard
2014-11-07 7:58 ` Uwe Kleine-König [this message]
2014-11-07 9:37 ` Arnaud Ebalard
2014-11-07 9:53 ` Mark Brown
2014-11-07 9:47 ` Mark Brown
2014-11-06 8:49 ` Uwe Kleine-König
2014-11-06 22:47 ` Arnaud Ebalard
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=20141107075843.GD10432@pengutronix.de \
--to=u.kleine-koenig@pengutronix.de \
--cc=linux-arm-kernel@lists.infradead.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;
as well as URLs for NNTP newsgroup(s).