aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/rtc/rtc-meson-vrtc.c
AgeCommit message (Collapse)AuthorFilesLines
2023-03-21rtc: meson-vrtc: Use ktime_get_real_ts64() to get the current timeMartin Blumenstingl1-2/+2
The VRTC alarm register can be programmed with an amount of seconds after which the SoC will be woken up by the VRTC timer again. We are already converting the alarm time from meson_vrtc_set_alarm() to "seconds since 1970". This means we also need to use "seconds since 1970" for the current time. This fixes a problem where setting the alarm to one minute in the future results in the firmware (which handles wakeup) to output (on the serial console) that the system will be woken up in billions of seconds. ktime_get_raw_ts64() returns the time since boot, not since 1970. Switch to ktime_get_real_ts64() to fix the calculation of the alarm time and to make the SoC wake up at the specified date/time. Also the firmware (which manages suspend) now prints either 59 or 60 seconds until wakeup (depending on how long it takes for the system to enter suspend). Fixes: 6ef35398e827 ("rtc: Add Amlogic Virtual Wake RTC") Signed-off-by: Martin Blumenstingl <martin.blumenstingl@googlemail.com> Reviewed-by: Neil Armstrong <neil.armstrong@linaro.org> Reviewed-by: Kevin Hilman <khilman@baylibre.com> Link: https://lore.kernel.org/r/20230320212142.2355062-1-martin.blumenstingl@googlemail.com Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
2020-11-19rtc: rework rtc_register_device() resource managementBartosz Golaszewski1-1/+1
rtc_register_device() is a managed interface but it doesn't use devres by itself - instead it marks an rtc_device as "registered" and the devres callback for devm_rtc_allocate_device() takes care of resource release. This doesn't correspond with the design behind devres where managed structures should not be aware of being managed. The correct solution here is to register a separate devres callback for unregistering the device. While at it: rename rtc_register_device() to devm_rtc_register_device() and add it to the list of managed interfaces in devres.rst. This way we can avoid any potential confusion of driver developers who may expect there to exist a corresponding unregister function. Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com> Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com> Link: https://lore.kernel.org/r/20201109163409.24301-8-brgl@bgdev.pl
2020-09-29rtc: meson: simplify the return expression of meson_vrtc_probeLiu Shixin1-6/+1
Simplify the return expression. Signed-off-by: Liu Shixin <liushixin2@huawei.com> Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com> Acked-by: Kevin Hilman <khilman@baylibre.com> Link: https://lore.kernel.org/r/20200919100856.1639319-1-liushixin2@huawei.com
2019-09-10rtc: meson: mark PM functions as __maybe_unusedArnd Bergmann1-4/+3
The meson_vrtc_set_wakeup_time() function is only used by the PM functions and causes a warning when they are disabled: drivers/rtc/rtc-meson-vrtc.c:32:13: error: unused function 'meson_vrtc_set_wakeup_time' [-Werror,-Wunused-function] Remove the #ifdef around the callers and add a __maybe_unused annotation as a more reliable way to avoid these warnings. Signed-off-by: Arnd Bergmann <arnd@arndb.de> Reviewed-by: Kevin Hilman <khilman@baylibre.com> Link: https://lore.kernel.org/r/20190906152438.1533833-1-arnd@arndb.de Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
2019-08-22rtc: Add Amlogic Virtual Wake RTCNeil Armstrong1-0/+156
The Amlogic Meson GX SoCs uses a special register to store the time in seconds to wakeup after a system suspend. In order to be able to reuse the RTC wakealarm feature, this driver implements a fake RTC device which uses the system time to deduce a suspend delay. Signed-off-by: Neil Armstrong <narmstrong@baylibre.com> [khilman: rebase to v5.3-rc, rework and modernization] Signed-off-by: Kevin Hilman <khilman@baylibre.com> Link: https://lore.kernel.org/r/20190812232850.8016-3-khilman@kernel.org Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>