BPI-R2 already has an on-board RTC

(Wolfgang) #1

… unfortunately without a battery. This means the RTC will run as long is power is applied to the board. It survives a software power-off or software reset, but when you pull the power plug it will stop. Not ideal, but better than nothing…

It’s part of the MT6323 PMIC (the voltage regulator). A few days ago Sean Wang from Mediatek posted a patchset which seems to work just fine even though it’s not yet part of the kernel. You can find his first version (all-in-on for kernel 4.14) as part of my Yocto repo here:

along with his patch to add poweroff support - which also works for me:

It requires an addition to the PMIC wrapper (‘pwrap’) section of the devicetree:

&pwrap {
	mt6323 {
		mt6323led: led {
			compatible = "mediatek,mt6323-led";
			#address-cells = <1>;
			#size-cells = <0>;

		led@0 {
			reg = <0>;
			label = "bpi-r2:isink:green";
			default-state = "off";


	        mt6323rtc: rtc {
    			compatible = "mediatek,mt6323-rtc";

			power-off {
				compatible = "mediatek,mt6323-rtc-poweroff";

(Frank W.) #2

should this patch also poweroff the board? power seems to be the same (4.7w -> 4.4w on poweroff-command)

(Wolfgang) #3

I didn’t measure power consumption, I just noticed all LEDs going off. Given that the code is for the PMIC, it’s probably fair to assume that stuff that’s not powered by the PMIC will remain powered on.

(dorabmon) #4

Moreover, the whole series for PMIC RTC and Power off https://patchwork.kernel.org/patch/10303005/ should depend on the series for PMIC KEY https://patchwork.kernel.org/patch/10026727/

once the two series are included, you can see rtc and pmic key (only for power key found on bpi r2 board) are both supported


Hi Frank,

I noticed that the poweroff in 4.14-main does not work.

I have therefore revert commit 5a350ae40cbd6d8994157584ab8e040bb4c2900a and following 2 patch series recorded and adapted to 4.14-main.



this allows ‘shutown -P now’ as well as power-key to put the r2 in the initial state.

just to test my patch

revert 5a350ae40cbd6d8994157584ab8e040bb4c2900a

revert.patch (17,5 KB)

pmic-key.patch (17 KB)

rtc-poweroff.patch (19,3 KB)

in the order they should be able to be imported without hunk

(Frank W.) #6

thank you, i will try your patches

i have tested original ones and got problems with network-device detection (all interfaces disappear), no idea why

works well…5w running and 0.2w if shutdown, all net-interfaces still present

(Frank W.) #7

@jofri with this patches, power-button now acts as real power-button, which triggers power-off on running system at the moment of pressung it. can this be changed (time to press,disable) without affecting the poweroff?

some people have soldered power-pins (to bootup on powersupply available) which now causes a boot-loop


There are more options.

Remove all acpi packages especially ‘acpi-support-base’,

or the easiest one will be to insert the module

echo “blacklist mtk_pmic_keys” >/etc/modprobe.d/blacklist.conf