Kwamecorp / Fairphone

Source code for the Fairphone OS. A seriously cool smartphone. Putting social values first.
Other
77 stars 13 forks source link

RTC is read-only #36

Closed labre closed 7 years ago

labre commented 7 years ago

The Real Time Clock is read-only. /dev/rtc0 is present. It seems RTC_DRV_QPNP is responsible for that. Unfortunately system time will reset on each reboot, until Internet is reachable for NTP synchronization. The hardware clock starts counting at Unix epoch start (1970) and will restore as usual. Alarm Timers are therefore useless and users are forced to drain the battery for that use case.

Steps to reproduce:

  1. Set system time.
  2. Reboot.

Alternative in Terminal:

  1. su
  2. hwclock -uw

Actual results: Systohc fails. RTC counts up from Unix epoch start. RTC_SET_TIME: invalid argument

alarm_set_rtc: Failed to set RTC, time will be lost on reboot Expected results: RTC is updated to system time. Additional information: I looked into the sources and found, that the RTC driver (qpnp) has its .rtc_write_enable booleans set to “false”. Toggling them with `sed -rie '/rtc_write_enable/{s/false/true/}' $(grep -Rle 'rtc_write_enable' * | xargs -d '\n')` did not fix it unfortunately. I also toggled the .rtc_alarm_powerup booleans and yes I checked for unintended replacements i.e. in conditions. I continued with checking the kernel config, but could not find significant mistakes. Possibly CONFIG_ANDROID_INTF_ALARM_DEV in contrary to AOSP defconfig not being set might pose a problem. I will have to recompile to check that, but it’s late in my timezone, so I’ll do that tomorrow. Forum thread: https://forum.fairphone.com/t/fp-open-os-clock-resets-after-reboot/17635 Suggestion to set .rtc_write_enable to “true” for a Xperia device: [2] http://forum.xda-developers.com/showthread.php?t=2480713 [dmesg.txt](https://github.com/Kwamecorp/Fairphone/files/491397/dmesg.txt)
labre commented 7 years ago

Seems to be an FP1 repository. Sorry for interrupting.