how can we tell system to shutdown on a power fail, using systemd and apcid

35 views
Skip to first unread message

evilwulfie

unread,
Feb 25, 2018, 3:29:19 PM2/25/18
to BeagleBoard
We use a battery and acpid to shutdown the board on power fail.
When power is removed  the battery holds up the board for an orderly
shutdown then after
a predetermined time we remove battery power and wait for power to be
reapplied.

on the old kernels everything works great
root@beaglebone:~# uname -r
4.4.12-ti-r31

on boot we have this in syslog related to acpid
Feb 25 19:19:29 beaglebone acpid: starting up with netlink and the input
layer
blah blah blah more infos not related to acpid
Feb 25 19:19:29 beaglebone acpid: 1 rule loaded
Feb 25 19:19:29 beaglebone acpid: waiting for events: event logging is off


in var/log/messages the last line during power fail is
Feb 25 19:19:26 beaglebone rsyslogd: [origin software="rsyslogd"
swVersion="8.4.2" x-pid="359" x-info="http://www.rsyslog.com"] exiting
on signal 15.
same line in syslog

then the board shuts down we wait our time and remove battery power.

On the new kernel using systemd, acpid does not generate the shutdown
event  and we just sit there till battery is removed
4.14.20-ti-r36

i noticed this on 4.9 too

root@beaglebone:/home/debian# systemctl list-unit-files | grep enabled
acpid.path                             enabled
further down the list
acpid.socket                           enabled

root@beaglebone:/home/debian# systemctl list-units --type=service
--state=running
acpid.service               loaded active running ACPI event daemon

Power button powers down the board as expected.
remove acpid, power button still powers down board
reinstalling acpid  power button works as expected but power fail still
does not shutdown system
It seems on newer systems with systemd acpid does nothing

how can we tell system to shutdown on a power fail ?













evilwulfie

unread,
Feb 25, 2018, 10:09:17 PM2/25/18
to BeagleBoard

I think i see something interesting
they did some changes to the dt for the pmic
https://patchwork.kernel.org/patch/9771235/
some of the comments deal with interrupts
seems the one that is missing or not handled is "AC"
or something needs to be written to handle "AC" now
I read something about breaking out the power button interrupt
in some other verbage today
as with the old kernel PB and AC fail did the same thing
but to get AC fail to trigger a power off you needed apcid
or at least it did not shut down till you installed acpid

This is deeply buried in kernel land. might need to monitor
a PG signal from the power supply and act on it with APCID
till this is resolved

At least if you do that you can set an interrupt with a powerfail gpio
and write an APCID handler












evilwulfie

unread,
Feb 25, 2018, 10:46:03 PM2/25/18
to BeagleBoard
uname -r
4.4.12-ti-r31

ls /sys/firmware/devicetree/base/ocp/i2c@44e0b000/tps@24/

compatible interrupt-parent interrupts linux,phandle name phandle
reg regulators ti,pmic-shutdown-controller



uname -r
4.14.20-ti-r36
ls /sys/firmware/devicetree/base/ocp/i2c@44e0b000/tps@24/

charger compatible #interrupt-cells interrupt-controller
interrupt-parent interrupts name phandle pwrbutton reg regulators
ti,pmic-shutdown-controller

seems they added "charger" and "pwrbutton" directorys


more
/sys/firmware/devicetree/base/ocp/i2c@44e0b000/tps@24/charger/interrupt-names
USB


No "AC" ?
It seems that "AC" has been left out so we cannot get a power fail response?

Will do more testing tomorrow powering off USB using battery backup to
see if the BBG shuts down.

Sure be nice to know







evilwulfie

unread,
Feb 26, 2018, 9:47:46 PM2/26/18
to BeagleBoard
seems they omitted the "AC" interrupt in the patch

https://patchwork.kernel.org/patch/9782813/

therefore the system will not power down on power fail like it used to













Reply all
Reply to author
Forward
0 new messages