public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Greg KH <gregkh@suse.de>
To: Onkalo Samu <samu.p.onkalo@nokia.com>
Cc: ext Henrique de Moraes Holschuh <hmh@hmh.eng.br>,
	Alan Cox <alan@lxorguk.ukuu.org.uk>,
	"alan@linux.intel.com" <alan@linux.intel.com>,
	"akpm@linux-foundation.org" <akpm@linux-foundation.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: Re: sysfs and power management
Date: Sun, 31 Oct 2010 07:25:39 -0700	[thread overview]
Message-ID: <20101031142539.GA25480@suse.de> (raw)
In-Reply-To: <1288526275.2313.14.camel@noppispoppis.nmp.nokia.com>

On Sun, Oct 31, 2010 at 01:57:55PM +0200, Onkalo Samu wrote:
> On Sat, 2010-10-30 at 16:00 +0200, ext Henrique de Moraes Holschuh
> wrote:
> > On Fri, 29 Oct 2010, Greg KH wrote:
> > > back to sleep.  That's probably the best way to do this, as userspace
> > > isn't going to open the sysfs file and not close it instantly anyway
> > > after it has read the data (seeking on a sysfs file isn't really
> > > recommended, even if it sometimes seems to work.)
> > 
> > Well, it is documented that seek(start of file) on sysfs works, and it
> > is ABI already (some userspace uses it on poll/select-capable
> > attributes).  So, maybe seek(somewhere that is not the start of the
> > file) doesn't work -- and it should return an error in that case if it
> > doesn't already...  but it is a lot more deterministic than "sometimes"
> > ;-)
> > 
> > So yes, userspace will open() and not close() a sysfs attribute immediately
> > afterwards.  It is not only shell crap that interfaces to the kernel over
> > sysfs :-)
> > 
> 
> What I would like to do is:
> 
> Control sensors operating mode and regulators based on the userspace
> activity. If no-one is interested about the sensor, it can be turned
> totally off including its operating power via regulator framework.
> 
> So far the only accepted interface for the small sensor seems to be
> sysfs. I tried use misc device but it was not accepted.

Look at the drivers/staging/iio/ subsystem.  It is working on a
framework that you can use through a character device (I think) to
properly manage your drivers in this manner.

Try working with those developers as I think it is what you are looking
for here.

thanks,

greg k-h

  reply	other threads:[~2010-10-31 14:32 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 [this message]
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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20101031142539.GA25480@suse.de \
    --to=gregkh@suse.de \
    --cc=akpm@linux-foundation.org \
    --cc=alan@linux.intel.com \
    --cc=alan@lxorguk.ukuu.org.uk \
    --cc=hmh@hmh.eng.br \
    --cc=linux-kernel@vger.kernel.org \
    --cc=samu.p.onkalo@nokia.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox