All of lore.kernel.org
 help / color / mirror / Atom feed
* sysfs and power management
@ 2010-10-27 10:59 Onkalo Samu
  2010-10-27 11:48 ` Alan Cox
  0 siblings, 1 reply; 15+ messages in thread
From: Onkalo Samu @ 2010-10-27 10:59 UTC (permalink / raw)
  To: gregkh, Alan Cox, Andrew Morton; +Cc: linux-kernel

Hi

I have recently sent couple of sensor drivers to kernel.
Interface is purely sysfs based. The hard part is to get
power management to work reasonable way.

With /dev/* interface power management is quite easy to do since
driver gets clear open and release calls. With sysfs, there is only
read / write methods available.
My solution has been separate sysfs entry which controls operating
state. However, there are some problems with that.
In case of boolean type enable / disable control, there must be
only one userspace component which decides sensor state.
In case of counting type of control, there is a change that
sensor is permanently left on if the userspace component crashes.
This would lead to unbalanced enable / disable count.

If the sensor functionality is based on interrupts (like threshold
interrupt), it may take long time before there is any activity.
In this kind of case timeout from the previous sysfs access doesn't make
much sense. 
I started to wonder if it makes sense to enhance sysfs so that it
optionally prodives open / close call backs. Internally sysfs has some 
bookkeeping about the refcount but this is not visible to the driver.
Of course majority of the sysfs users doesn't need that at all
and for them this is just overhead. 

Is it out of the question to provide call back to driver when 
some sysfs entry is opened (first time) and when refcnt goes back
to 0?

Regards,
Samu



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

end of thread, other threads:[~2010-11-03 15:01 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-10-27 10:59 sysfs and power management Onkalo Samu
2010-10-27 11:48 ` Alan Cox
2010-10-27 13:43   ` samu.p.onkalo
2010-10-27 14:28     ` Alan Cox
2010-10-29 19:50       ` Greg KH
2010-10-30 14:00         ` Henrique de Moraes Holschuh
2010-10-31 11:57           ` Onkalo Samu
2010-10-31 14:25             ` Greg KH
2010-11-01 10:41               ` Onkalo Samu
2010-11-01 16:57                 ` Alan Cox
2010-11-01 18:07                   ` Greg KH
2010-11-03  9:44                     ` Alan Cox
2010-11-03 10:48                       ` samu.p.onkalo
2010-11-03 13:09                       ` Greg KH
2010-11-03 15:00                         ` samu.p.onkalo

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.