All of lore.kernel.org
 help / color / mirror / Atom feed
From: Richard Weinberger <richard@nod.at>
To: John Stultz <john.stultz@linaro.org>
Cc: Thomas Gleixner <tglx@linutronix.de>,
	a.zummo@towertech.it, rtc-linux@googlegroups.com,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: Re: RTC regression
Date: Thu, 08 Mar 2012 19:53:51 +0100	[thread overview]
Message-ID: <4F59003F.4050709@nod.at> (raw)
In-Reply-To: <1331076961.2191.165.camel@work-vm>

On 07.03.2012 00:36, John Stultz wrote:
> On Wed, 2012-02-29 at 22:41 +0100, Richard Weinberger wrote:
>> Hi!
>>
>> hwclock calls the RTC_UIE_ON ioctl to wait for a timer tick.
>> If RTC_UIE_ON was successful it opens /dev/rtcX and waits up to 5 seconds using select()
>> for a tick.
>> Some RTC drivers have no support for RTC_UIE_ON and ioctl just returns -EINVAL.
>> Drivers indicated this by setting rtc_class_ops->update_irq_enable to NULL.
>> In this case hwclock waits in a busy loop for the next timer tick.
>>
>> These two commits changed this behavior:
>> 6610e08 (RTC: Rework RTC code to use timerqueue for events)
>> 51ba60c (RTC: Cleanup rtc_class_ops->update_irq_enable())
>>
>> rtc_class_ops->update_irq_enable was removed and rtc_update_irq_enable()
>> is now using rtc_class_ops->set_alarm instead of rtc_class_ops->update_irq_enable.
>>
>> Some RTC devices (like mpc515x) don't support intervals smaller than one
>> minute.
>> rtc-mpc5121.c deals with this by rounding up to one minute.
>> But now after commit 6610e08 RTC_UIE_ON will no longer return -EINVAL and
>> the next tick comes somewhen within the next 60 seconds, because the driver rounded up...
>> hwclock's select() is not happy about this and timeouts in most cases.
>
> Thanks for diagnosing and pointing out this issue! I hadn't been aware
> of such hardware.
>
> Would something like the following be a better generic interface?
> Basically allow the RTC drivers to flag that UIE is unsupported (much as
> setting the update_irq_enable to null did prior).
>
> Let me know if this works for you, and I'll look to see what other
> drivers might be affected here.
>
> thanks
> -john
>
> Add generic infrastructure to handle rtc devices that don't support UIE
> mode.
>
> Signed-off-by: John Stultz<john.stultz@linaro.org>

Tested-by: Richard Weinberger <richard@nod.at>

> diff --git a/drivers/rtc/rtc-mpc5121.c b/drivers/rtc/rtc-mpc5121.c
> index 9d3cacc..be6d4f4 100644
> --- a/drivers/rtc/rtc-mpc5121.c
> +++ b/drivers/rtc/rtc-mpc5121.c
> @@ -360,6 +360,8 @@ static int __devinit mpc5121_rtc_probe(struct platform_device *op)
>   						&mpc5200_rtc_ops, THIS_MODULE);
>   	}
>
> +	rtc->rtc.uie_unsupported = 1;
> +

Please replace this line by:
rtc->rtc->uie_unsupported = 1;

Thanks,
//richard

      reply	other threads:[~2012-03-08 18:54 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-02-29 21:41 RTC regression Richard Weinberger
2012-03-06 23:36 ` John Stultz
2012-03-08 18:53   ` Richard Weinberger [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=4F59003F.4050709@nod.at \
    --to=richard@nod.at \
    --cc=a.zummo@towertech.it \
    --cc=john.stultz@linaro.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=rtc-linux@googlegroups.com \
    --cc=tglx@linutronix.de \
    /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 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.