[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#932845: TS-219 RTC issue with Debian Buster




On 26/07/2019 20.12, Trent Piepho wrote:
On Fri, 2019-07-26 at 12:53 +0200, Oliver Hartkopp wrote:
Just a thought:

There are some of these rtc drivers that set

rtc->rtc->uie_unsupported = 1;

in the case that they can't assign an irq line.

But others set

rtc->rtc->uie_unsupported = 1;

when they don't support an (alarm) trigger with 1 sec accuracy.

Wouldn't it make sense to put

+       select RTC_INTF_DEV
+       select RTC_INTF_DEV_UIE_EMUL

in the Kconfig entries of the latter devices?

The hwclock in busybox does not use UIE.  Is it the util-linux version
that uses it?  Or systemd timedate?

Yes, it is the util-linux version that invokes ioctl(rtc_fd, RTC_UIE_ON, 0), see:

https://git.kernel.org/pub/scm/utils/util-linux/util-linux.git/tree/sys-utils/hwclock-rtc.c#n244

I documented the effect here:
https://marc.info/?l=linux-arm-kernel&m=156390875629259&w=2

I know that chrony's linux RTC support requires UIE, or UIE emulation,
to work.  chrony does not detect lack of this very well and the RTC
support just "doesn't happen" with no errors.  I had to strace it to
figure out it was waiting for UIE interrupts that never came.

"or UIE emulation" - sounds like a plan :-)

Anyway, you don't really need UIE at all to use an rtc in a number of
ways.  The kernel "rtc to system clock on boot" feature doesn't need
it.

Right - for that reason the kernel sets the correct time when the rtc-s35390a driver is built-in.

When its loaded later as a module, the tool hwclock is used to retrieve the time which fails due to the missing UIE.

The kernel auto sync the rtc every 11 mins from NTP synced system
clock feature doesn't need it.  busybox hwclock doesn't need it.

So I suspect it's optional because it's not always needed.

hwclock works great in 'setting' the rtc (hwclock --systohc) but it fails to read it.

Regards,
Oliver


Reply to: