Message ID | 20200715160209.652-1-linux.amoon@gmail.com (mailing list archive) |
---|---|
Headers | show |
Series | Enable RTC on Odroid N2 | expand |
Hi Anand, Only the vrtc is able to wakeup the device from suspend, the external RTC is not capable. Neil On 15/07/2020 18:02, Anand Moon wrote: > Inoder for test suspend resume feature on Odroid N2 > we need to enable RTC module on this device. > > Following patches enable rtc on Odroid N2 > but sill rtcwakeup is not working se bellow. > Any inputs are welcome. > > # sudo hwclock -r && date > 2020-07-15 15:53:27.706883+00:00 > Wed Jul 15 15:53:27 UTC 2020 > > # echo 1 > /sys/power/pm_debug_messages > bash: /sys/power/pm_debug_messages: Permission denied > # time rtcwake -s 30 -m mem > rtcwake: /dev/rtc0 not enabled for wakeup events > > real 0m0.003s > user 0m0.003s > sys 0m0.000s > # > > -Anand > > Anand Moon (3): > arm64: dts: meson-g12b-odroid-n2: Enable RTC controller node > arm64: dts: meson-g12b-odroid-n2: Disable virtual wake RTC > arm64: defconfig: Enable RTC devices for Amlogic boards > > .../boot/dts/amlogic/meson-g12b-odroid-n2.dts | 18 ++++++++++++++++++ > arch/arm64/configs/defconfig | 1 + > 2 files changed, 19 insertions(+) >
Hi Neil, Thanks for your review comments. On Thu, 16 Jul 2020 at 12:35, Neil Armstrong <narmstrong@baylibre.com> wrote: > > Hi Anand, > > Only the vrtc is able to wakeup the device from suspend, > the external RTC is not capable. > > Neil Now I have two RTC driver registered $ dmesg | grep rtc [ 4.737315] rtc-pcf8563 0-0051: registered as rtc0 [ 4.738763] rtc-pcf8563 0-0051: setting system clock to 2020-07-16T08:00:46 UTC (1594886446) [ 4.790206] meson-vrtc ff8000a8.rtc: registered as rtc1 And there are two nodes # ls /dev/rtc* /dev/rtc /dev/rtc0 /dev/rtc1 So it seames an issue that /dev/rtc0 is not able to handle wakeup events. How can we resolve this issue? # time rtcwake -s 30 -m mem rtcwake: /dev/rtc0 not enabled for wakeup events real 0m0.002s user 0m0.001s sys 0m0.002s -Anand
Hi, On 16/07/2020 10:14, Anand Moon wrote: > Hi Neil, > > Thanks for your review comments. > > On Thu, 16 Jul 2020 at 12:35, Neil Armstrong <narmstrong@baylibre.com> wrote: >> >> Hi Anand, >> >> Only the vrtc is able to wakeup the device from suspend, >> the external RTC is not capable. >> >> Neil > > Now I have two RTC driver registered > > $ dmesg | grep rtc > [ 4.737315] rtc-pcf8563 0-0051: registered as rtc0 > [ 4.738763] rtc-pcf8563 0-0051: setting system clock to > 2020-07-16T08:00:46 UTC (1594886446) > [ 4.790206] meson-vrtc ff8000a8.rtc: registered as rtc1 > > And there are two nodes > # ls /dev/rtc* > /dev/rtc /dev/rtc0 /dev/rtc1 > > So it seames an issue that /dev/rtc0 is not able to handle wakeup events. > How can we resolve this issue? > > # time rtcwake -s 30 -m mem > rtcwake: /dev/rtc0 not enabled for wakeup events rtcwake -d /dev/rtc1 -s 30 -m mem As Christian reported off-list, it may be necessary to keep the vrtc as rtc0, so you should add aliases in the odroid-n2 DT to have vrtc as rtc0 and the on-board rtc as rtc1, but it may break the hwclock tools, so the reverse may be better but you'll need to specify rtc1 to rtcwake. Neil > > real 0m0.002s > user 0m0.001s > sys 0m0.002s > > -Anand >
Hi, On 16/07/2020 10:20, Neil Armstrong wrote: > Hi, > > On 16/07/2020 10:14, Anand Moon wrote: >> Hi Neil, >> >> Thanks for your review comments. >> >> On Thu, 16 Jul 2020 at 12:35, Neil Armstrong <narmstrong@baylibre.com> wrote: >>> >>> Hi Anand, >>> >>> Only the vrtc is able to wakeup the device from suspend, >>> the external RTC is not capable. >>> >>> Neil >> >> Now I have two RTC driver registered >> >> $ dmesg | grep rtc >> [ 4.737315] rtc-pcf8563 0-0051: registered as rtc0 >> [ 4.738763] rtc-pcf8563 0-0051: setting system clock to >> 2020-07-16T08:00:46 UTC (1594886446) >> [ 4.790206] meson-vrtc ff8000a8.rtc: registered as rtc1 >> >> And there are two nodes >> # ls /dev/rtc* >> /dev/rtc /dev/rtc0 /dev/rtc1 >> >> So it seames an issue that /dev/rtc0 is not able to handle wakeup events. >> How can we resolve this issue? >> >> # time rtcwake -s 30 -m mem >> rtcwake: /dev/rtc0 not enabled for wakeup events > > rtcwake -d /dev/rtc1 -s 30 -m mem > > As Christian reported off-list, it may be necessary to keep the vrtc as rtc0, > so you should add aliases in the odroid-n2 DT to have vrtc as rtc0 and the on-board > rtc as rtc1, but it may break the hwclock tools, so the reverse may be better > but you'll need to specify rtc1 to rtcwake. While looking closer to the Odroid-N2 schematics and U-Boot/SCP Firmware, the external on-board RTC can wake the device with the GPIO_AO 7, and wakeup is enabled in: https://github.com/hardkernel/u-boot/blob/odroidn2-v2015.01/board/hardkernel/odroidn2/firmware/scp_task/pwr_ctrl.c#L143 So, something must be missing. Neil > > Neil > >> >> real 0m0.002s >> user 0m0.001s >> sys 0m0.002s >> >> -Anand >> >
hi Neil, On Thu, 16 Jul 2020 at 14:05, Neil Armstrong <narmstrong@baylibre.com> wrote: > > Hi, > > On 16/07/2020 10:20, Neil Armstrong wrote: > > Hi, > > > > On 16/07/2020 10:14, Anand Moon wrote: > >> Hi Neil, > >> > >> Thanks for your review comments. > >> > >> On Thu, 16 Jul 2020 at 12:35, Neil Armstrong <narmstrong@baylibre.com> wrote: > >>> > >>> Hi Anand, > >>> > >>> Only the vrtc is able to wakeup the device from suspend, > >>> the external RTC is not capable. > >>> > >>> Neil > >> > >> Now I have two RTC driver registered > >> > >> $ dmesg | grep rtc > >> [ 4.737315] rtc-pcf8563 0-0051: registered as rtc0 > >> [ 4.738763] rtc-pcf8563 0-0051: setting system clock to > >> 2020-07-16T08:00:46 UTC (1594886446) > >> [ 4.790206] meson-vrtc ff8000a8.rtc: registered as rtc1 > >> > >> And there are two nodes > >> # ls /dev/rtc* > >> /dev/rtc /dev/rtc0 /dev/rtc1 > >> > >> So it seames an issue that /dev/rtc0 is not able to handle wakeup events. > >> How can we resolve this issue? > >> > >> # time rtcwake -s 30 -m mem > >> rtcwake: /dev/rtc0 not enabled for wakeup events > > > > rtcwake -d /dev/rtc1 -s 30 -m mem > > > > As Christian reported off-list, it may be necessary to keep the vrtc as rtc0, > > so you should add aliases in the odroid-n2 DT to have vrtc as rtc0 and the on-board > > rtc as rtc1, but it may break the hwclock tools, so the reverse may be better > > but you'll need to specify rtc1 to rtcwake. > > While looking closer to the Odroid-N2 schematics and U-Boot/SCP Firmware, the external on-board > RTC can wake the device with the GPIO_AO 7, and wakeup is enabled in: > https://github.com/hardkernel/u-boot/blob/odroidn2-v2015.01/board/hardkernel/odroidn2/firmware/scp_task/pwr_ctrl.c#L143 > > So, something must be missing. > Ok I have missed this setting. But I could not find any more information on this configuration in S922X_Public_Datasheet_V0.2-Hardkernel, But HK uses the same set up as we do. https://github.com/hardkernel/linux/blob/odroidn2-4.9.y/arch/arm64/boot/dts/amlogic/mesong12_odroid_common.dtsi#L322-L333 I could not gather much input from this configration. Does VIM3 support VRTC or do they prefer rtc wakeup via RTC ? -Anand
Neil Armstrong <narmstrong@baylibre.com> writes: > Hi, > > On 16/07/2020 10:20, Neil Armstrong wrote: >> Hi, >> >> On 16/07/2020 10:14, Anand Moon wrote: >>> Hi Neil, >>> >>> Thanks for your review comments. >>> >>> On Thu, 16 Jul 2020 at 12:35, Neil Armstrong <narmstrong@baylibre.com> wrote: >>>> >>>> Hi Anand, >>>> >>>> Only the vrtc is able to wakeup the device from suspend, >>>> the external RTC is not capable. >>>> >>>> Neil >>> >>> Now I have two RTC driver registered >>> >>> $ dmesg | grep rtc >>> [ 4.737315] rtc-pcf8563 0-0051: registered as rtc0 >>> [ 4.738763] rtc-pcf8563 0-0051: setting system clock to >>> 2020-07-16T08:00:46 UTC (1594886446) >>> [ 4.790206] meson-vrtc ff8000a8.rtc: registered as rtc1 >>> >>> And there are two nodes >>> # ls /dev/rtc* >>> /dev/rtc /dev/rtc0 /dev/rtc1 >>> >>> So it seames an issue that /dev/rtc0 is not able to handle wakeup events. >>> How can we resolve this issue? >>> >>> # time rtcwake -s 30 -m mem >>> rtcwake: /dev/rtc0 not enabled for wakeup events >> >> rtcwake -d /dev/rtc1 -s 30 -m mem >> >> As Christian reported off-list, it may be necessary to keep the vrtc as rtc0, >> so you should add aliases in the odroid-n2 DT to have vrtc as rtc0 and the on-board >> rtc as rtc1, but it may break the hwclock tools, so the reverse may be better >> but you'll need to specify rtc1 to rtcwake. > > While looking closer to the Odroid-N2 schematics and U-Boot/SCP Firmware, the external on-board > RTC can wake the device with the GPIO_AO 7, and wakeup is enabled in: > https://github.com/hardkernel/u-boot/blob/odroidn2-v2015.01/board/hardkernel/odroidn2/firmware/scp_task/pwr_ctrl.c#L143 > > So, something must be missing. A couple possibilities come to mind (without looking at the specific RTC driver): 1) pinctrl for that GPIO needs proper settings 2) DT node for the RTC needs "wakeup-source" property Kevin