Can't set RTC time on Dragon board


I am working on Dragon board 410 and I am using Android 5.1.1 OS.

I want to use RTC of PMIC 8916. I am able to read time from the RTC but whenever try to set RTC time to system time, it is showing Invalid argument.

Log :

root@msm8916_64:/ # busybox hwclock -r
Thu Jan 1 02:03:57 1970 0.000000 seconds
root@msm8916_64:/ # busybox hwclock -w
hwclock: RTC_SET_TIME: Invalid argument

If I make qcom,qpnp-rtc-write = <1>; for RTC node in DTSI file, then the board is getting reboot while writing the RTC registers.

So, how to set RTC time of PMIC8916 ?

The way this is implemented in the codeaurora AOSP builds is that the RTC is kept read-only and a service in userspace keeps track of the delta between the RTC and the wall clock between boots.

The read-only aspect is, I believe, implemented by applying security settings on those registers. I am not aware of any way around it and the configuration is outside of our direct control.