[ltp] New PowerTOP utility for Linux 2.6.21+ from Intel

Martin Milata linux-thinkpad@linux-thinkpad.org
Sat, 19 May 2007 14:13:25 +0200


On Sat, May 19, 2007 at 07:29:38PM +1000, André Wyrwa wrote:
> On Mon, 2007-05-14 at 19:50 +0200, Martin Milata wrote:
> > On Mon, May 14, 2007 at 12:10:41PM -0400, Shem Multinymous wrote:
> > > On 5/14/07, Martin Milata <b42-ml@srck.net> wrote:
> > > >What about checking accelerometer status only if hdd is actually
> > > >spinning? Because when using laptop_mode, hdd is spun down most of the
> > > >time, but hdapsd is doing it's work all the time. Is something like that
> > > >possible?
> 
...
> 
> I think the problem here is for hdapsd to know when the drive is spun
> down. Because this would probably mean it probably needs to poll another
> file. The alternative would be to send it a message from whatever causes
> the drive to spin down, which could be a lot of things.

As others pointed out, this actually might not be a good idea.
 
> > Ok, another stupid idea;)
> > 
> > If I understand correctly there are two independent timers set: one for
> > hdaps driver to periodicaly poll data from accelerometer and other for
> > hdapsd to poll data from the driver.
> > 
> > Wouldn't be possible for the driver to provide a file (sys or char dev),
> > >from which hdapsd could read continuously and which would block until there
> > are new data available instead of openning the sys file periodically and
> > checking for values in it? This way only one timer would be needed ...
> 
> There are a couple of problems why it can't be done like this:
> 
> 1. The hdapsd source has a comment explaining why it has to reopen the
> sys file all the time, which is because you can't seek back to 0 in
> sysfs files. Hence hdapsd can't just keep it open, but needs to close
> and open it again to get the content.
> 
> 2. There is no such case where there is "no new data in the file".
> There's always new data in the file, because all the driver does is
> expose the acceleratometer data to that file in a sensible format. And
> this should not be changed because it would disable other uses of that
> data. Hence the data in the sysfs file changes all the time and it is
> hdapsd who applies a threshold to it on which to react.

What I meant was to export hdaps status as character device file, from
which hdapsd could read() fixed amount of data and which would block the
reader if there were no new hardware poll since last read. As Henrique
said, something similar will be achieved using the input layer. 

-MM