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