public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: David Brownell <david-b@pacbell.net>
To: Rodolfo Giometti <giometti@enneenne.com>
Cc: linux-kernel@vger.kernel.org
Subject: Re: [RFC] disabling RTC irq during release
Date: Tue, 10 Jul 2007 11:29:45 -0700	[thread overview]
Message-ID: <200707101129.45456.david-b@pacbell.net> (raw)
In-Reply-To: <20070704170753.GO10397@enneenne.com>

On Wednesday 04 July 2007, Rodolfo Giometti wrote:
> Hello,
> 
> Looking at other rtc drivers I noticed that during the release()
> method we should disable IRQs as follow:
> 
> static void ds1307_release(struct device *dev)
> {
>         struct ds1307   *ds1307 = dev_get_drvdata(dev);
> 
>         if (ds1307->irq >= 0) {
>                 ds1307->irqen = 0;
>                 ds1307_update_alarm(ds1307);
>         }
> }

On the RTC list, the outcome of that discussion was that
the release() method -- not generally implemented at this
time, and only supporting the /dev/rtcN access mode -- should
only disable the IRQs enabled through that /dev/rtcN file.

Now, it turns out that of the three kinds of RTC IRQ (alarm,
once-per-second, and 2^N-per-second), two of those modes can
be accessed through in-kernel APIs outside /dev/rtcN calls:

 - 2^N-per-second "periodic" irqs, using rtc_irq_set_freq()
   and rtc_irq_set_state()

 - alarm irqs, using rtc_set_alarm()

So it would be incorrect to disable those IRQs, when some
other kernel activity had enabled them.  But for now it
would be correct to always disable once-per-second "update"
IRQs in a release() method.

There's a separate issue -- longstanding, not new to the
RTC framework -- of how several consumers of RTC IRQs ought
to share the different kinds of IRQ.


> But if I wish using RTC IRQ line to turn also the board ON, not just
> to put to sleep it, I should leave the IRQ line on!

That can be done with /sys/class/rtcN/device/power/wakealarm,
writing it to the time (in seconds) the RTC alarm should kick
the board's power-on circuitry.

- Dave

      reply	other threads:[~2007-07-10 18:29 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-07-04 17:07 [RFC] disabling RTC irq during release Rodolfo Giometti
2007-07-10 18:29 ` David Brownell [this message]

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=200707101129.45456.david-b@pacbell.net \
    --to=david-b@pacbell.net \
    --cc=giometti@enneenne.com \
    --cc=linux-kernel@vger.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