[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <1288177143.12206.22.camel@4fid08082>
Date: Wed, 27 Oct 2010 13:59:03 +0300
From: Onkalo Samu <samu.p.onkalo@...ia.com>
To: gregkh@...e.de, Alan Cox <alan@...ux.intel.com>,
Andrew Morton <akpm@...ux-foundation.org>
Cc: "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
Subject: sysfs and power management
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
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists