Hi, On 10/06/2020 15:24:03+0200, Martin Hundebøll wrote: > When running on hardware with no persistent clock, and no non-stop > clocksource, the timekeeping resume code relies on the rtc class to > inject the suspend time. > > Other drivers might call into the timekeeping code to sync time in their > devices. If such devices are resumed before the rtc class (and rtc is > the only time source running in suspend) they currently get the > pre-suspend time. > > Move the rtc class suspend/resume functions to be called late/early in > the cycle to make sure timekeeping is synchronised when other devices > are resumed. > > This works in our case on an i.MX6, where the rtc driver only has > _suspend_noirq()/_resume_noirq(). I imagine it fails with drivers that > has regular _suspend()/_resume() functions. Any hints are welcome. > Just to let you know that I've seen the previous thread and also this patch. I'm not sure about the patch, especially regarding RTCs on an i2c or SPI bus were wee need the bus to be suspended after the RTC and resumed before the RTC. The order is properly handled when using but I need to check whether it is correct when using _late. I remember having issues with that with regulators. I must admit my time is a bit scarce right now. Maybe you can get input from the PM guys? Regards, -- Alexandre Belloni, Bootlin Embedded Linux and Kernel engineering https://bootlin.com