All of lore.kernel.org
 help / color / mirror / Atom feed
From: Patrick Doyle <wpdster@gmail.com>
To: buildroot@busybox.net
Subject: [Buildroot] Lightweight method for handling external power-down request
Date: Tue, 19 Apr 2016 14:15:10 -0400	[thread overview]
Message-ID: <CAF_dkJCO5r0Se08Pr6pAv=u-esPSFMR68V01=DHLSeHn0q2oTw@mail.gmail.com> (raw)

Hello all,
I found this discussion:

http://lists.infradead.org/pipermail/linux-arm-kernel/2015-April/339919.html

on the Linux Arm Kernel mailing list archive.  It is from April of
2015.  Sannon Zhao started a discussion regarding how to implement
external power down for ARM.  The consensus seemed to be to use ACPI.
I am wondering if there is a lighter weight (smaller code and
mindshare footprint) method for handling this.

I would like to initiate an orderly shutdown of my buildroot based
system when a GPIO signal is toggled high.  I think could add
something like the following to my device tree:

    gpio-keys {
        compatible = "gpio-keys";
        pinctrl-names = "default";
        pinctrl-0 = <&pinctrl_gpio_poweroff>;
        power {
                label = "Power-Key";
            gpios = <&pioA 103 GPIO_ACTIVE_HIGH>;
            linux,code = <KEY_POWER>;
            debounce-interval = <10>;
        };
    };

and I believe that would result in a KEY_POWER event(?)/input key(?)
getting delivered to user-land.  But I am not sure how to handle that
in user-land.  So it seems that I could install acpid to handle that
somehow, but I feel this is getting more complicated than it should
be.

Alternatively, I could code up a shell script that polls my GPIO pin
and shuts down the processor when that signal goes high, but I hate
the idea of polling; I'm not thrilled about the lack of debounce
support; and I would much rather respond to the event immediately,
than have to wait the 500 to 1000ms I might have to wait for my
polling process to notice the signal.

So, how do ARM folks in Buildroot-land handle this?

--wpd

             reply	other threads:[~2016-04-19 18:15 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-04-19 18:15 Patrick Doyle [this message]
2016-04-19 19:04 ` [Buildroot] Lightweight method for handling external power-down request Thomas Petazzoni
2016-04-19 19:22   ` Patrick Doyle

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAF_dkJCO5r0Se08Pr6pAv=u-esPSFMR68V01=DHLSeHn0q2oTw@mail.gmail.com' \
    --to=wpdster@gmail.com \
    --cc=buildroot@busybox.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.