Page 1 of 1

PMIC low voltage detect

Posted: Wed Nov 06, 2019 8:19 pm
by dchristiancp
I want to be able to protect the filesystems and do a semi-graceful shutdown if the voltage is dropping.

I have a custom sama5d2 board with an ACT8865. Linux has a driver for this in drivers/regulator/act8865-regulator.c. The PMIC can trigger a line if the voltage drops below a threshold SYSLEV.

However, I can't see a way to either program SYSLEV for the right threshold or configure/handle the interrupt in. I also looked at the act8945a driver (which is used on the sama5d2_xplained board) and it doesn't have it either. It looks like Wenyou Yang at Atmel wrote both drivers.

Has anyone implemented low voltage detect in Linux? Via a ACT88xx would be ideal, but any example code would be useful.

Thanks,
Dan

Re: PMIC low voltage detect

Posted: Wed Nov 06, 2019 11:30 pm
by blue_z
dchristiancp wrote: However, I can't see a way to either program SYSLEV for the right threshold or configure/handle the interrupt in.
Did you study the ACT8865 datasheet and the Microchip App Note?

As this voltage does down, how much time do you expect to have compared to Linux interrupt latency?
See "Detecting Loss of Power" and
"I2C broken in demo images?".
If your ACT8865 shares the I2C bus with other devices, then you probably cannot reliably use it with Linux.

The use of a journaled filesystem is the primary method of "protect(ing) the filesystem".

Regards

Re: PMIC low voltage detect

Posted: Thu Nov 07, 2019 9:58 pm
by dchristiancp
I hadn't seen the app note, but it does match our implementation. Section 3.1.4 talks about the hardware side of low voltage detect, but there is no mention of the software side.

As for the other issues you brought up: yes, it's on it's own I2C bus. A journalling file system is, of course, more resistant to loss; but I still want to know if the power is dropping.

As far as the holdup time, that is a critical question for our application. I would think the act8945a would support this for battery applications, but I don't see any support in the driver.

Dan