linux-embedded.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* GPIO triggers kernel reboot
@ 2014-01-25 16:02 Heiko Schocher
  2014-01-25 19:11 ` Mehaffey, John
                   ` (2 more replies)
  0 siblings, 3 replies; 8+ messages in thread
From: Heiko Schocher @ 2014-01-25 16:02 UTC (permalink / raw)
  To: linux-embedded; +Cc: Wolfgang Denk, linux-arm-kernel@lists.infradead.org

Hello all,

is it possible to reboot current mainline kernel triggered from a
GPIO in kernel space?

If not, how can be done this, so that it has a chance to go into
mainline?

Thanks for any suggestions

bye,
Heiko
-- 
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany

^ permalink raw reply	[flat|nested] 8+ messages in thread

* RE: GPIO triggers kernel reboot
  2014-01-25 16:02 GPIO triggers kernel reboot Heiko Schocher
@ 2014-01-25 19:11 ` Mehaffey, John
  2014-01-25 20:24   ` Mehaffey, John
  2014-01-26  2:54 ` Florian Fainelli
       [not found] ` <CALLGbRKK_ZcOB6nAiV67njrphXMQXN7Y2s81n5k3PWoSVrsrUw@mail.gmail.com>
  2 siblings, 1 reply; 8+ messages in thread
From: Mehaffey, John @ 2014-01-25 19:11 UTC (permalink / raw)
  To: hs@denx.de, linux-embedded@vger.kernel.org
  Cc: Wolfgang Denk, linux-arm-kernel@lists.infradead.org

> -----Original Message-----
> From: linux-embedded-owner@vger.kernel.org [mailto:linux-embedded-owner@vger.kernel.org] On Behalf Of Heiko Schocher
> Sent: Saturday, January 25, 2014 8:03 AM
> To: linux-embedded@vger.kernel.org
> Cc: Wolfgang Denk; linux-arm-kernel@lists.infradead.org
> Subject: GPIO triggers kernel reboot
> 
> Hello all,
> 
> is it possible to reboot current mainline kernel triggered from a GPIO in kernel space?
> 
> If not, how can be done this, so that it has a chance to go into mainline?
> 
> Thanks for any suggestions
> 
> bye,
> Heiko

Hi Heiko,
Call kexec() from the GPIO driver.
It will take some effort to get it right :)

Sincerely,
John Mehaffey
Principal Engineer, Automotive
Mentor Graphics
> -- 
> DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
> HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
> --
> To unsubscribe from this list: send the line "unsubscribe linux-embedded" in the body of a message to majordomo@vger.kernel.org More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 8+ messages in thread

* RE: GPIO triggers kernel reboot
  2014-01-25 19:11 ` Mehaffey, John
@ 2014-01-25 20:24   ` Mehaffey, John
  2014-01-27  6:17     ` Heiko Schocher
  0 siblings, 1 reply; 8+ messages in thread
From: Mehaffey, John @ 2014-01-25 20:24 UTC (permalink / raw)
  To: hs@denx.de, linux-embedded@vger.kernel.org
  Cc: Wolfgang Denk, linux-arm-kernel@lists.infradead.org

> -----Original Message-----
> From: linux-embedded-owner@vger.kernel.org 
> [mailto:linux-embedded-owner@vger.kernel.org] On Behalf Of Heiko 
> Schocher
> Sent: Saturday, January 25, 2014 8:03 AM
> To: linux-embedded@vger.kernel.org
> Cc: Wolfgang Denk; linux-arm-kernel@lists.infradead.org
> Subject: GPIO triggers kernel reboot
> 
> Hello all,
> 
> is it possible to reboot current mainline kernel triggered from a GPIO in kernel space?
> 
> If not, how can be done this, so that it has a chance to go into mainline?
> 
> Thanks for any suggestions
> 
> bye,
> Heiko

Hi Heiko,
Call kexec() from the GPIO driver.
It will take some effort to get it right :)

Or if a simple reboot is all that you want, examine the several reboot APIs in kernel/reboot.c

Sincerely,
John Mehaffey
Principal Engineer, Automotive
Mentor Graphics
> -- 
> DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
> HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
> --
> To unsubscribe from this list: send the line "unsubscribe 
> linux-embedded" in the body of a message to majordomo@vger.kernel.org 
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
--
To unsubscribe from this list: send the line "unsubscribe linux-embedded" in the body of a message to majordomo@vger.kernel.org More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: GPIO triggers kernel reboot
  2014-01-25 16:02 GPIO triggers kernel reboot Heiko Schocher
  2014-01-25 19:11 ` Mehaffey, John
@ 2014-01-26  2:54 ` Florian Fainelli
       [not found] ` <CALLGbRKK_ZcOB6nAiV67njrphXMQXN7Y2s81n5k3PWoSVrsrUw@mail.gmail.com>
  2 siblings, 0 replies; 8+ messages in thread
From: Florian Fainelli @ 2014-01-26  2:54 UTC (permalink / raw)
  To: hs, linux-embedded; +Cc: Wolfgang Denk, linux-arm-kernel@lists.infradead.org

Le 25/01/2014 08:02, Heiko Schocher a écrit :
> Hello all,
>
> is it possible to reboot current mainline kernel triggered from a
> GPIO in kernel space?
>
> If not, how can be done this, so that it has a chance to go into
> mainline?

Your GPIO could (should) be bound to a gpio-keys driver which will 
deliver key presses event; which you can ultimately bind to the action 
of triggering a system reboot.

Granted, this makes you cross a lot of layers, and requires user-space 
to implemnt the reboot policy, but what you are asking for is both a 
mechanism and policy mix, which is usually not accepted.

You are probably working with HW which won't change, but wiring a reset 
button to a system reset output is usually much simpler ;)

>
> Thanks for any suggestions
>
> bye,
> Heiko

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: GPIO triggers kernel reboot
  2014-01-25 20:24   ` Mehaffey, John
@ 2014-01-27  6:17     ` Heiko Schocher
  0 siblings, 0 replies; 8+ messages in thread
From: Heiko Schocher @ 2014-01-27  6:17 UTC (permalink / raw)
  To: Mehaffey, John
  Cc: linux-embedded@vger.kernel.org, Wolfgang Denk,
	linux-arm-kernel@lists.infradead.org

Hello John,

Am 25.01.2014 21:24, schrieb Mehaffey, John:
>> -----Original Message-----
>> From: linux-embedded-owner@vger.kernel.org
>> [mailto:linux-embedded-owner@vger.kernel.org] On Behalf Of Heiko
>> Schocher
>> Sent: Saturday, January 25, 2014 8:03 AM
>> To: linux-embedded@vger.kernel.org
>> Cc: Wolfgang Denk; linux-arm-kernel@lists.infradead.org
>> Subject: GPIO triggers kernel reboot
>>
>> Hello all,
>>
>> is it possible to reboot current mainline kernel triggered from a GPIO in kernel space?
>>
>> If not, how can be done this, so that it has a chance to go into mainline?
>>
>> Thanks for any suggestions
>>
>> bye,
>> Heiko
>
> Hi Heiko,
> Call kexec() from the GPIO driver.
> It will take some effort to get it right :)

Thanks for your answer!
Hmm.. but has this a chance to go into mainline?

> Or if a simple reboot is all that you want, examine the several reboot APIs in kernel/reboot.c

A current implementation from a customer is for an arm, am335x based board
to add in board setup code:

         ret = request_irq(OMAP_GPIO_IRQ(RESET_BUTTON_IRQ_GPIO)
                 , (irq_handler_t)arm_pm_restart, IRQF_TRIGGER_LOW, "reset button", NULL);

and as I want to bring this board to mainline, I think this is not
an acceptable/good way ... or?

bye,
Heiko
-- 
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: GPIO triggers kernel reboot
       [not found] ` <CALLGbRKK_ZcOB6nAiV67njrphXMQXN7Y2s81n5k3PWoSVrsrUw@mail.gmail.com>
@ 2014-01-27  6:22   ` Heiko Schocher
  2014-01-27  8:08     ` Arnaud Patard
  0 siblings, 1 reply; 8+ messages in thread
From: Heiko Schocher @ 2014-01-27  6:22 UTC (permalink / raw)
  To: Steve deRosier
  Cc: linux-embedded, Wolfgang Denk,
	linux-arm-kernel@lists.infradead.org

Hello Steve,

Thanks for your answer!

Am 25.01.2014 20:39, schrieb Steve deRosier:
> Hi Heiko,
>
> It's certainly possible, and it's also easily done from user-space.
>   Something like this is more policy than function.  It's also a potential
> security issue.  As such I'd expect it highly unlikely that the kernel
> maintainers would allow it to go upstream. Give it a try though.

Ok, thats what I also think ...

> I'd approach this from user-space.  Add in the gpio-keys driver and use the
> input-event-daemon to trigger a reboot.  Super easy.

Yes, that was also my suggestion, but is there a way to do this without
user space usage in a generic way?

bye,
Heiko
-- 
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: GPIO triggers kernel reboot
  2014-01-27  6:22   ` Heiko Schocher
@ 2014-01-27  8:08     ` Arnaud Patard
  2014-01-27  8:25       ` Geert Uytterhoeven
  0 siblings, 1 reply; 8+ messages in thread
From: Arnaud Patard @ 2014-01-27  8:08 UTC (permalink / raw)
  To: hs
  Cc: Steve deRosier, linux-embedded, Wolfgang Denk,
	linux-arm-kernel@lists.infradead.org

Heiko Schocher <hs@denx.de> writes:

> Hello Steve,
>
> Thanks for your answer!
>
> Am 25.01.2014 20:39, schrieb Steve deRosier:
>> Hi Heiko,
>>
>> It's certainly possible, and it's also easily done from user-space.
>>   Something like this is more policy than function.  It's also a potential
>> security issue.  As such I'd expect it highly unlikely that the kernel
>> maintainers would allow it to go upstream. Give it a try though.
>
> Ok, thats what I also think ...
>
>> I'd approach this from user-space.  Add in the gpio-keys driver and use the
>> input-event-daemon to trigger a reboot.  Super easy.
>
> Yes, that was also my suggestion, but is there a way to do this without
> user space usage in a generic way?

I think that you can register an input handler for that. iirc, there was
a driver doing something similar for apm.

Arnaud

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: GPIO triggers kernel reboot
  2014-01-27  8:08     ` Arnaud Patard
@ 2014-01-27  8:25       ` Geert Uytterhoeven
  0 siblings, 0 replies; 8+ messages in thread
From: Geert Uytterhoeven @ 2014-01-27  8:25 UTC (permalink / raw)
  To: Arnaud Patard
  Cc: hs, Steve deRosier, Linux Embedded, Wolfgang Denk,
	linux-arm-kernel@lists.infradead.org

On Mon, Jan 27, 2014 at 9:08 AM, Arnaud Patard
<arnaud.patard@rtp-net.org> wrote:
>>> It's certainly possible, and it's also easily done from user-space.
>>>   Something like this is more policy than function.  It's also a potential
>>> security issue.  As such I'd expect it highly unlikely that the kernel
>>> maintainers would allow it to go upstream. Give it a try though.
>>
>> Ok, thats what I also think ...
>>
>>> I'd approach this from user-space.  Add in the gpio-keys driver and use the
>>> input-event-daemon to trigger a reboot.  Super easy.
>>
>> Yes, that was also my suggestion, but is there a way to do this without
>> user space usage in a generic way?
>
> I think that you can register an input handler for that. iirc, there was
> a driver doing something similar for apm.

According to Documentation/sysctl/kernel.txt, the default for the
"ctrl-alt-del" input is to just reboot.

Gr{oetje,eeting}s,

                        Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2014-01-27  8:25 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-01-25 16:02 GPIO triggers kernel reboot Heiko Schocher
2014-01-25 19:11 ` Mehaffey, John
2014-01-25 20:24   ` Mehaffey, John
2014-01-27  6:17     ` Heiko Schocher
2014-01-26  2:54 ` Florian Fainelli
     [not found] ` <CALLGbRKK_ZcOB6nAiV67njrphXMQXN7Y2s81n5k3PWoSVrsrUw@mail.gmail.com>
2014-01-27  6:22   ` Heiko Schocher
2014-01-27  8:08     ` Arnaud Patard
2014-01-27  8:25       ` Geert Uytterhoeven

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).