On Fri, 2010-08-27 at 20:53 +0200, ext Mark Brown wrote:
Mark, thanks for clarification. So is it ok to keep this in the driver
code.
I would like to get some advice about the following related to PM and
regulator control.
Small sensor with SYSFS only interface:
---------------------------------------
Driver doesn't know when someone opens (or keeps open) sysfs entry.
It only knows when someone reads or writes to it. Sensors may have quite
long wakeup time from total power off (regulators off) so it takes quite
long time to get first result. On the other hand, driver doesn't know
when it is ok to turn off the device.
At some level, this can be handled with a timer which is is kicked every
time when there is read / write operation. However, this is sounds
little bit a hack.
Would it make sense at all to enhange sysfs to have open / close
indication for PM related control? Of course this adds overhead to
every sysfs operation and most of the sysfs entries doesn't need
this kind of feature.
One solution is to have separate disable / enable control entry
for the sensor. This needs addional operations from the applications
and is little bit tricky in case of several users - should it be
on / off type or counting type control.
Misc-char-device + sysfs interface:
-----------------------------------
PM related issues can be nicely handled with char device.
It doesn't matter if there are one or several users. However
char device with binary data format is not that handy in scripts.
Same is true for input device.
Do you have any suggestions what could be the best way to handle this?
-Samu
--