Re: Power button policy and mechanism

2007-10-20 Thread Kristoffer Ericson
On Fri, 19 Oct 2007 10:54:27 +0100
Richard Purdie <[EMAIL PROTECTED]> wrote:

> On Tue, 2007-10-16 at 10:34 -0400, Dmitry Torokhov wrote:
> > On 10/16/07, Kristoffer Ericson <[EMAIL PROTECTED]> wrote:
> > > This is mainly an embedded issue, but I feel it's quite important. 
> > > It should apply to other devices also like for example Zaurus
> > > branches (those with keyboard and designated power button).
> 
> There was a long discussion thread about this a while back. There were a
> lot of differing views but in the end no patch to fix up power.c to do
> anything was accepted. The Zaurus was the reason I raised the issue.
> 
> It seems power.c was recently removed as it was dead code.
> 
> > > So in short:
> > > 1. Does mainline policy allow static power button events inside kernel 
> > > (power button == suspend/resume)?
> > >Why/Why Not?
> > 
> > Could it be that you may want to prevent suspend from happening? Or
> > delay it until system completes some important operation? Do something
> > else, like cleanly disconnect your network connections? With actual
> > handling done in userspace it's all possible. With suspend done
> > directly in kernel it is much harder and couples input subsystem with
> > power management too tightly.
> > 
> > However if you are dead-set on doin it in kernel you coudl register an
> > input_handler in your platform PM code and it will attach to your
> > keyboard. Look for power.c module in older kernels for example.
> 
> The proposed changes to power.c were to hook it into things like APM as
> a "user" event so the power button triggered a suspend event but
> anything in userspace needing to know about (or veto) it could do so.
> 
> > > 2. Seeing as my knowledge about this area isn't the best I would 
> > > appreciate all opinions on the subject from the gurus.
> > 
> > Richard Purdie I think might have some pointers.
> 
> Currently I still patch this functionality into the Zaurus kernels
> (basically by resurrecting power.c with the patches I used to apply to
> it added in):
> 
Aha, good for reference code.

> http://www.rpsys.net/openzaurus/patches/input_power-r9.patch
> 
> This works for 2.6.23 but doesn't seem to work in 2.6.23-git9. I've not
> looked into why yet.
> 
> In the current climate, this will never make mainline kernels so I will
> be considering other options such as adding support into something like
> OHM. As yet, I've not found the time to do that and since the above
> patch works and is relatively easy to maintain...
I don't know exactly what OHM is but anything that would get this functionality 
(which is vital for handhelds)
would be great.

Big thanks for reply
> 
> Cheers,
> 
> Richard
> 
> 


-- 
Kristoffer Ericson <[EMAIL PROTECTED]>
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: Power button policy and mechanism

2007-10-20 Thread Kristoffer Ericson
On Fri, 19 Oct 2007 10:54:27 +0100
Richard Purdie [EMAIL PROTECTED] wrote:

 On Tue, 2007-10-16 at 10:34 -0400, Dmitry Torokhov wrote:
  On 10/16/07, Kristoffer Ericson [EMAIL PROTECTED] wrote:
   This is mainly an embedded issue, but I feel it's quite important. 
   It should apply to other devices also like for example Zaurus
   branches (those with keyboard and designated power button).
 
 There was a long discussion thread about this a while back. There were a
 lot of differing views but in the end no patch to fix up power.c to do
 anything was accepted. The Zaurus was the reason I raised the issue.
 
 It seems power.c was recently removed as it was dead code.
 
   So in short:
   1. Does mainline policy allow static power button events inside kernel 
   (power button == suspend/resume)?
  Why/Why Not?
  
  Could it be that you may want to prevent suspend from happening? Or
  delay it until system completes some important operation? Do something
  else, like cleanly disconnect your network connections? With actual
  handling done in userspace it's all possible. With suspend done
  directly in kernel it is much harder and couples input subsystem with
  power management too tightly.
  
  However if you are dead-set on doin it in kernel you coudl register an
  input_handler in your platform PM code and it will attach to your
  keyboard. Look for power.c module in older kernels for example.
 
 The proposed changes to power.c were to hook it into things like APM as
 a user event so the power button triggered a suspend event but
 anything in userspace needing to know about (or veto) it could do so.
 
   2. Seeing as my knowledge about this area isn't the best I would 
   appreciate all opinions on the subject from the gurus.
  
  Richard Purdie I think might have some pointers.
 
 Currently I still patch this functionality into the Zaurus kernels
 (basically by resurrecting power.c with the patches I used to apply to
 it added in):
 
Aha, good for reference code.

 http://www.rpsys.net/openzaurus/patches/input_power-r9.patch
 
 This works for 2.6.23 but doesn't seem to work in 2.6.23-git9. I've not
 looked into why yet.
 
 In the current climate, this will never make mainline kernels so I will
 be considering other options such as adding support into something like
 OHM. As yet, I've not found the time to do that and since the above
 patch works and is relatively easy to maintain...
I don't know exactly what OHM is but anything that would get this functionality 
(which is vital for handhelds)
would be great.

Big thanks for reply
 
 Cheers,
 
 Richard
 
 


-- 
Kristoffer Ericson [EMAIL PROTECTED]
-
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: Power button policy and mechanism

2007-10-19 Thread Dmitry Torokhov
Hi Richard,

On Friday 19 October 2007, Richard Purdie wrote:
> On Tue, 2007-10-16 at 10:34 -0400, Dmitry Torokhov wrote:
> > On 10/16/07, Kristoffer Ericson <[EMAIL PROTECTED]> wrote:
> > > This is mainly an embedded issue, but I feel it's quite important. 
> > > It should apply to other devices also like for example Zaurus
> > > branches (those with keyboard and designated power button).
> 
> There was a long discussion thread about this a while back. There were a
> lot of differing views but in the end no patch to fix up power.c to do
> anything was accepted. The Zaurus was the reason I raised the issue.
> 
> It seems power.c was recently removed as it was dead code.

That's because nothing in mainline was using it.

> 
> > > So in short:
> > > 1. Does mainline policy allow static power button events inside kernel 
> > > (power button == suspend/resume)?
> > >Why/Why Not?
> > 
> > Could it be that you may want to prevent suspend from happening? Or
> > delay it until system completes some important operation? Do something
> > else, like cleanly disconnect your network connections? With actual
> > handling done in userspace it's all possible. With suspend done
> > directly in kernel it is much harder and couples input subsystem with
> > power management too tightly.
> > 
> > However if you are dead-set on doin it in kernel you coudl register an
> > input_handler in your platform PM code and it will attach to your
> > keyboard. Look for power.c module in older kernels for example.
> 
> The proposed changes to power.c were to hook it into things like APM as
> a "user" event so the power button triggered a suspend event but
> anything in userspace needing to know about (or veto) it could do so.
> 
> > > 2. Seeing as my knowledge about this area isn't the best I would 
> > > appreciate all opinions on the subject from the gurus.
> > 
> > Richard Purdie I think might have some pointers.
> 
> Currently I still patch this functionality into the Zaurus kernels
> (basically by resurrecting power.c with the patches I used to apply to
> it added in):
> 
> http://www.rpsys.net/openzaurus/patches/input_power-r9.patch
> 
> This works for 2.6.23 but doesn't seem to work in 2.6.23-git9. I've not
> looked into why yet.
> 
> In the current climate, this will never make mainline kernels so I will
> be considering other options such as adding support into something like
> OHM. As yet, I've not found the time to do that and since the above
> patch works and is relatively easy to maintain...
> 

I think power.c as it was is not a good idea. Generic code does not know
the best way of shutting down/suspending a certain box. However having an
arch- (or even board-) specific version of power.c that pligs directl
and poperly into appropriate PM mechanism makes more sense. If certain
platforms need it I don't see a reason to prevent them from doing so.

-- 
Dmitry
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: Power button policy and mechanism

2007-10-19 Thread Richard Purdie
On Tue, 2007-10-16 at 10:34 -0400, Dmitry Torokhov wrote:
> On 10/16/07, Kristoffer Ericson <[EMAIL PROTECTED]> wrote:
> > This is mainly an embedded issue, but I feel it's quite important. 
> > It should apply to other devices also like for example Zaurus
> > branches (those with keyboard and designated power button).

There was a long discussion thread about this a while back. There were a
lot of differing views but in the end no patch to fix up power.c to do
anything was accepted. The Zaurus was the reason I raised the issue.

It seems power.c was recently removed as it was dead code.

> > So in short:
> > 1. Does mainline policy allow static power button events inside kernel 
> > (power button == suspend/resume)?
> >Why/Why Not?
> 
> Could it be that you may want to prevent suspend from happening? Or
> delay it until system completes some important operation? Do something
> else, like cleanly disconnect your network connections? With actual
> handling done in userspace it's all possible. With suspend done
> directly in kernel it is much harder and couples input subsystem with
> power management too tightly.
> 
> However if you are dead-set on doin it in kernel you coudl register an
> input_handler in your platform PM code and it will attach to your
> keyboard. Look for power.c module in older kernels for example.

The proposed changes to power.c were to hook it into things like APM as
a "user" event so the power button triggered a suspend event but
anything in userspace needing to know about (or veto) it could do so.

> > 2. Seeing as my knowledge about this area isn't the best I would 
> > appreciate all opinions on the subject from the gurus.
> 
> Richard Purdie I think might have some pointers.

Currently I still patch this functionality into the Zaurus kernels
(basically by resurrecting power.c with the patches I used to apply to
it added in):

http://www.rpsys.net/openzaurus/patches/input_power-r9.patch

This works for 2.6.23 but doesn't seem to work in 2.6.23-git9. I've not
looked into why yet.

In the current climate, this will never make mainline kernels so I will
be considering other options such as adding support into something like
OHM. As yet, I've not found the time to do that and since the above
patch works and is relatively easy to maintain...

Cheers,

Richard


-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: Power button policy and mechanism

2007-10-19 Thread Dmitry Torokhov
Hi Richard,

On Friday 19 October 2007, Richard Purdie wrote:
 On Tue, 2007-10-16 at 10:34 -0400, Dmitry Torokhov wrote:
  On 10/16/07, Kristoffer Ericson [EMAIL PROTECTED] wrote:
   This is mainly an embedded issue, but I feel it's quite important. 
   It should apply to other devices also like for example Zaurus
   branches (those with keyboard and designated power button).
 
 There was a long discussion thread about this a while back. There were a
 lot of differing views but in the end no patch to fix up power.c to do
 anything was accepted. The Zaurus was the reason I raised the issue.
 
 It seems power.c was recently removed as it was dead code.

That's because nothing in mainline was using it.

 
   So in short:
   1. Does mainline policy allow static power button events inside kernel 
   (power button == suspend/resume)?
  Why/Why Not?
  
  Could it be that you may want to prevent suspend from happening? Or
  delay it until system completes some important operation? Do something
  else, like cleanly disconnect your network connections? With actual
  handling done in userspace it's all possible. With suspend done
  directly in kernel it is much harder and couples input subsystem with
  power management too tightly.
  
  However if you are dead-set on doin it in kernel you coudl register an
  input_handler in your platform PM code and it will attach to your
  keyboard. Look for power.c module in older kernels for example.
 
 The proposed changes to power.c were to hook it into things like APM as
 a user event so the power button triggered a suspend event but
 anything in userspace needing to know about (or veto) it could do so.
 
   2. Seeing as my knowledge about this area isn't the best I would 
   appreciate all opinions on the subject from the gurus.
  
  Richard Purdie I think might have some pointers.
 
 Currently I still patch this functionality into the Zaurus kernels
 (basically by resurrecting power.c with the patches I used to apply to
 it added in):
 
 http://www.rpsys.net/openzaurus/patches/input_power-r9.patch
 
 This works for 2.6.23 but doesn't seem to work in 2.6.23-git9. I've not
 looked into why yet.
 
 In the current climate, this will never make mainline kernels so I will
 be considering other options such as adding support into something like
 OHM. As yet, I've not found the time to do that and since the above
 patch works and is relatively easy to maintain...
 

I think power.c as it was is not a good idea. Generic code does not know
the best way of shutting down/suspending a certain box. However having an
arch- (or even board-) specific version of power.c that pligs directl
and poperly into appropriate PM mechanism makes more sense. If certain
platforms need it I don't see a reason to prevent them from doing so.

-- 
Dmitry
-
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: Power button policy and mechanism

2007-10-19 Thread Richard Purdie
On Tue, 2007-10-16 at 10:34 -0400, Dmitry Torokhov wrote:
 On 10/16/07, Kristoffer Ericson [EMAIL PROTECTED] wrote:
  This is mainly an embedded issue, but I feel it's quite important. 
  It should apply to other devices also like for example Zaurus
  branches (those with keyboard and designated power button).

There was a long discussion thread about this a while back. There were a
lot of differing views but in the end no patch to fix up power.c to do
anything was accepted. The Zaurus was the reason I raised the issue.

It seems power.c was recently removed as it was dead code.

  So in short:
  1. Does mainline policy allow static power button events inside kernel 
  (power button == suspend/resume)?
 Why/Why Not?
 
 Could it be that you may want to prevent suspend from happening? Or
 delay it until system completes some important operation? Do something
 else, like cleanly disconnect your network connections? With actual
 handling done in userspace it's all possible. With suspend done
 directly in kernel it is much harder and couples input subsystem with
 power management too tightly.
 
 However if you are dead-set on doin it in kernel you coudl register an
 input_handler in your platform PM code and it will attach to your
 keyboard. Look for power.c module in older kernels for example.

The proposed changes to power.c were to hook it into things like APM as
a user event so the power button triggered a suspend event but
anything in userspace needing to know about (or veto) it could do so.

  2. Seeing as my knowledge about this area isn't the best I would 
  appreciate all opinions on the subject from the gurus.
 
 Richard Purdie I think might have some pointers.

Currently I still patch this functionality into the Zaurus kernels
(basically by resurrecting power.c with the patches I used to apply to
it added in):

http://www.rpsys.net/openzaurus/patches/input_power-r9.patch

This works for 2.6.23 but doesn't seem to work in 2.6.23-git9. I've not
looked into why yet.

In the current climate, this will never make mainline kernels so I will
be considering other options such as adding support into something like
OHM. As yet, I've not found the time to do that and since the above
patch works and is relatively easy to maintain...

Cheers,

Richard


-
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: Power button policy and mechanism

2007-10-16 Thread Bodo Eggert
Dmitry Torokhov <[EMAIL PROTECTED]> wrote:
> On 10/16/07, Kristoffer Ericson <[EMAIL PROTECTED]> wrote:

>> Is the suggested approach on handling powerbutton (in keyboard driver) to
>> simply push out the event and let userland handle it?
> 
> Yes.
> 
>> The reason Im asking this is because as you might know Im maintainer for two
>> mini-laptop style pda's (HP7xx & HP6xx) and it would simplify my life alot if
>> I didn't need to depend on userland applications to be able to
>> suspend/resume.
>>
>> For instance HP6XX receives an interrupt call whenever the powerbutton is
>> pressed. Now I could just push out the event and let another program handle
>> it but considering it would take a minimum amount of lines to let it simply
>> suspend/resume I feel its a waste.
>>
>> Previously the hp6xx has been allowed to do this "policy" way but that was
>> when LinuxSH stod as a side branch to main tree. Now when everything gets
>> merged into mainline I need to decide how to do this.
>>
>> This is mainly an embedded issue, but I feel it's quite important. It should
>> apply to other devices also like for example Zaurus branches (those with
>> keyboard and designated power button).
>>
>> So in short:
>> 1. Does mainline policy allow static power button events inside kernel (power
>> button == suspend/resume)?
>>Why/Why Not?
> 
> Could it be that you may want to prevent suspend from happening? Or
> delay it until system completes some important operation?

If I want to prevent the suspend/shutdown from happening, I don't press
the button. If my system insists on not shutting down in order to instead
run out to power while doing something important - I'm not happy, too.

OTOH, maybe you could allocate the storage for the suspend image here instead
of creating HUGE swap space and letting the kernel prevent suspend by using
it or watching the kernel thrash for hours before each OOM.

> Do something
> else, like cleanly disconnect your network connections?

Not needed, possibly not desired.

> With actual
> handling done in userspace it's all possible. With suspend done
> directly in kernel it is much harder and couples input subsystem with
> power management too tightly.

You can do something like control_alt_delete() - in fact I'm dedicating
400 KB of RAM for "kill -INT 1" on my desktop, not using suspend. Having
an ACPI userspace event is not bad if you intend to use it, but for people
who just want shutdown or suspend to happen, it's overkill.
-- 
Top 100 things you don't want the sysadmin to say:
79. What's this "any" key I'm supposed to press?

Friß, Spammer: [EMAIL PROTECTED] [EMAIL PROTECTED]
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: Power button policy and mechanism

2007-10-16 Thread Dmitry Torokhov
Hi Kristoffer,

On 10/16/07, Kristoffer Ericson <[EMAIL PROTECTED]> wrote:
> Greetings Dmitry,
>
> Is the suggested approach on handling powerbutton (in keyboard driver) to 
> simply push out the event and let userland handle it?

Yes.

> The reason Im asking this is because as you might know Im maintainer for two 
> mini-laptop style pda's (HP7xx & HP6xx)
> and it would simplify my life alot if I didn't need to depend on userland 
> applications to be able to suspend/resume.
>
> For instance HP6XX receives an interrupt call whenever the powerbutton is 
> pressed. Now I could just push out the event and let another program handle 
> it but considering it would take a minimum amount of lines to let it simply 
> suspend/resume I feel its a waste.
>
> Previously the hp6xx has been allowed to do this "policy" way but that was 
> when LinuxSH stod as a side branch to main tree. Now
> when everything gets merged into mainline I need to decide how to do this.
>
> This is mainly an embedded issue, but I feel it's quite important. It should 
> apply to other devices also like for example Zaurus branches (those with 
> keyboard and designated power button).
>
> So in short:
> 1. Does mainline policy allow static power button events inside kernel (power 
> button == suspend/resume)?
>Why/Why Not?

Could it be that you may want to prevent suspend from happening? Or
delay it until system completes some important operation? Do something
else, like cleanly disconnect your network connections? With actual
handling done in userspace it's all possible. With suspend done
directly in kernel it is much harder and couples input subsystem with
power management too tightly.

However if you are dead-set on doin it in kernel you coudl register an
input_handler in your platform PM code and it will attach to your
keyboard. Look for power.c module in older kernels for example.

> 2. Seeing as my knowledge about this area isn't the best I would appreciate 
> all opinions on the subject from the gurus.
>

Richard Purdie I think might have some pointers.

-- 
Dmitry
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Power button policy and mechanism

2007-10-16 Thread Kristoffer Ericson
Greetings Dmitry,

Is the suggested approach on handling powerbutton (in keyboard driver) to 
simply push out the event and let userland handle it? 
The reason Im asking this is because as you might know Im maintainer for two 
mini-laptop style pda's (HP7xx & HP6xx)
and it would simplify my life alot if I didn't need to depend on userland 
applications to be able to suspend/resume.

For instance HP6XX receives an interrupt call whenever the powerbutton is 
pressed. Now I could just push out the event and let another program handle it 
but considering it would take a minimum amount of lines to let it simply 
suspend/resume I feel its a waste.

Previously the hp6xx has been allowed to do this "policy" way but that was when 
LinuxSH stod as a side branch to main tree. Now
when everything gets merged into mainline I need to decide how to do this.

This is mainly an embedded issue, but I feel it's quite important. It should 
apply to other devices also like for example Zaurus branches (those with 
keyboard and designated power button).

So in short:
1. Does mainline policy allow static power button events inside kernel (power 
button == suspend/resume)?
Why/Why Not?
2. Seeing as my knowledge about this area isn't the best I would appreciate all 
opinions on the subject from the gurus.

Best wishes
Kristoffer Ericson

-- 
Kristoffer Ericson <[EMAIL PROTECTED]>
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Power button policy and mechanism

2007-10-16 Thread Kristoffer Ericson
Greetings Dmitry,

Is the suggested approach on handling powerbutton (in keyboard driver) to 
simply push out the event and let userland handle it? 
The reason Im asking this is because as you might know Im maintainer for two 
mini-laptop style pda's (HP7xx  HP6xx)
and it would simplify my life alot if I didn't need to depend on userland 
applications to be able to suspend/resume.

For instance HP6XX receives an interrupt call whenever the powerbutton is 
pressed. Now I could just push out the event and let another program handle it 
but considering it would take a minimum amount of lines to let it simply 
suspend/resume I feel its a waste.

Previously the hp6xx has been allowed to do this policy way but that was when 
LinuxSH stod as a side branch to main tree. Now
when everything gets merged into mainline I need to decide how to do this.

This is mainly an embedded issue, but I feel it's quite important. It should 
apply to other devices also like for example Zaurus branches (those with 
keyboard and designated power button).

So in short:
1. Does mainline policy allow static power button events inside kernel (power 
button == suspend/resume)?
Why/Why Not?
2. Seeing as my knowledge about this area isn't the best I would appreciate all 
opinions on the subject from the gurus.

Best wishes
Kristoffer Ericson

-- 
Kristoffer Ericson [EMAIL PROTECTED]
-
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: Power button policy and mechanism

2007-10-16 Thread Dmitry Torokhov
Hi Kristoffer,

On 10/16/07, Kristoffer Ericson [EMAIL PROTECTED] wrote:
 Greetings Dmitry,

 Is the suggested approach on handling powerbutton (in keyboard driver) to 
 simply push out the event and let userland handle it?

Yes.

 The reason Im asking this is because as you might know Im maintainer for two 
 mini-laptop style pda's (HP7xx  HP6xx)
 and it would simplify my life alot if I didn't need to depend on userland 
 applications to be able to suspend/resume.

 For instance HP6XX receives an interrupt call whenever the powerbutton is 
 pressed. Now I could just push out the event and let another program handle 
 it but considering it would take a minimum amount of lines to let it simply 
 suspend/resume I feel its a waste.

 Previously the hp6xx has been allowed to do this policy way but that was 
 when LinuxSH stod as a side branch to main tree. Now
 when everything gets merged into mainline I need to decide how to do this.

 This is mainly an embedded issue, but I feel it's quite important. It should 
 apply to other devices also like for example Zaurus branches (those with 
 keyboard and designated power button).

 So in short:
 1. Does mainline policy allow static power button events inside kernel (power 
 button == suspend/resume)?
Why/Why Not?

Could it be that you may want to prevent suspend from happening? Or
delay it until system completes some important operation? Do something
else, like cleanly disconnect your network connections? With actual
handling done in userspace it's all possible. With suspend done
directly in kernel it is much harder and couples input subsystem with
power management too tightly.

However if you are dead-set on doin it in kernel you coudl register an
input_handler in your platform PM code and it will attach to your
keyboard. Look for power.c module in older kernels for example.

 2. Seeing as my knowledge about this area isn't the best I would appreciate 
 all opinions on the subject from the gurus.


Richard Purdie I think might have some pointers.

-- 
Dmitry
-
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: Power button policy and mechanism

2007-10-16 Thread Bodo Eggert
Dmitry Torokhov [EMAIL PROTECTED] wrote:
 On 10/16/07, Kristoffer Ericson [EMAIL PROTECTED] wrote:

 Is the suggested approach on handling powerbutton (in keyboard driver) to
 simply push out the event and let userland handle it?
 
 Yes.
 
 The reason Im asking this is because as you might know Im maintainer for two
 mini-laptop style pda's (HP7xx  HP6xx) and it would simplify my life alot if
 I didn't need to depend on userland applications to be able to
 suspend/resume.

 For instance HP6XX receives an interrupt call whenever the powerbutton is
 pressed. Now I could just push out the event and let another program handle
 it but considering it would take a minimum amount of lines to let it simply
 suspend/resume I feel its a waste.

 Previously the hp6xx has been allowed to do this policy way but that was
 when LinuxSH stod as a side branch to main tree. Now when everything gets
 merged into mainline I need to decide how to do this.

 This is mainly an embedded issue, but I feel it's quite important. It should
 apply to other devices also like for example Zaurus branches (those with
 keyboard and designated power button).

 So in short:
 1. Does mainline policy allow static power button events inside kernel (power
 button == suspend/resume)?
Why/Why Not?
 
 Could it be that you may want to prevent suspend from happening? Or
 delay it until system completes some important operation?

If I want to prevent the suspend/shutdown from happening, I don't press
the button. If my system insists on not shutting down in order to instead
run out to power while doing something important - I'm not happy, too.

OTOH, maybe you could allocate the storage for the suspend image here instead
of creating HUGE swap space and letting the kernel prevent suspend by using
it or watching the kernel thrash for hours before each OOM.

 Do something
 else, like cleanly disconnect your network connections?

Not needed, possibly not desired.

 With actual
 handling done in userspace it's all possible. With suspend done
 directly in kernel it is much harder and couples input subsystem with
 power management too tightly.

You can do something like control_alt_delete() - in fact I'm dedicating
400 KB of RAM for kill -INT 1 on my desktop, not using suspend. Having
an ACPI userspace event is not bad if you intend to use it, but for people
who just want shutdown or suspend to happen, it's overkill.
-- 
Top 100 things you don't want the sysadmin to say:
79. What's this any key I'm supposed to press?

Friß, Spammer: [EMAIL PROTECTED] [EMAIL PROTECTED]
-
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/