From: NeilBrown <neilb@suse.de>
To: linux-serial@vger.kernel.org, linux-pm@vger.kernel.org
Cc: lkml <linux-kernel@vger.kernel.org>
Subject: Question: How to power-manage UART-attached devices.
Date: Tue, 1 May 2012 08:22:09 +1000 [thread overview]
Message-ID: <20120501082209.0b560708@notabene.brown> (raw)
[-- Attachment #1: Type: text/plain, Size: 2029 bytes --]
Greetings.
I have a conundrum that I am hoping someone could help me with.
I have a mobile device (Openmoko successor: GTA04) which has two devices
that are attached by UARTs - bluetooth and GPS.
Each of these can usefully be power-managed: The bluetooth shares a
regulator with WIFI and if both are inactive the regulator can be turned off.
GPS has a powered antenna which and be powered down when inactive, and also
has an 'on/off' pin which, when pulsed, toggles the GPS between 'on' and
'off.
The question is how can user-space tell the kernel that these devices are
'inactive'?
I would like to integrate this into Linux in the most "natural" way that I
can but am having trouble. My current approach involves using "rfkill" but
that doesn't work very well for reasons that are probably not very relevant
here. It probably does make sense for powering the GPS antenna, but not
much else.
What I would really like is to integrate it closely with the state of the
UART. i.e. if the /dev/ttyO1 device is open, then the GPS is "on". If not
then it is "off". Similarly if /dev/tty/O0 is open, bluetooth is "on", else
"off".
However I cannot find any way to "plug in" to the tty or serial drivers to
perform an arbitrary action on first-open or last-close. Is something like
that possible?
If not, is it a reasonable thing to ask?
Any suggests about where to put such a hook?
It would be particularly useful if the hooked-in code could also find out
about received characters when the device is thought to be "off". This is
because the only way to find out if the GPS is "on" is to see if it is
sending data, so to turn it off you check if it is sending data and if it
does, toggle the 'on/off' line. I could manage this a different way by
reprogramming the RX pin on the OMAP3 to be a GPIO and then taking a falling
interrupt as an indication that the device is 'on', but I would rather
something more integrated.
Thanks,
NeilBrown
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 828 bytes --]
next reply other threads:[~2012-04-30 22:22 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-04-30 22:22 NeilBrown [this message]
2012-04-30 22:33 ` Question: How to power-manage UART-attached devices Mark Brown
2012-04-30 23:35 ` NeilBrown
2012-05-01 16:33 ` Mark Brown
2012-05-01 23:15 ` NeilBrown
2012-05-02 9:02 ` Mark Brown
2012-04-30 22:51 ` H. Peter Anvin
2012-04-30 23:34 ` Alan Cox
2012-05-01 0:12 ` NeilBrown
2012-04-30 23:47 ` NeilBrown
2012-04-30 23:50 ` H. Peter Anvin
2012-05-01 0:27 ` NeilBrown
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=20120501082209.0b560708@notabene.brown \
--to=neilb@suse.de \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pm@vger.kernel.org \
--cc=linux-serial@vger.kernel.org \
/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;
as well as URLs for NNTP newsgroup(s).