linux-serial.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: NeilBrown <neilb@suse.de>
To: "H. Peter Anvin" <hpa@zytor.com>
Cc: Alan Cox <alan@lxorguk.ukuu.org.uk>,
	linux-serial@vger.kernel.org, linux-pm@vger.kernel.org,
	lkml <linux-kernel@vger.kernel.org>
Subject: Re: Question:  How to power-manage UART-attached devices.
Date: Tue, 1 May 2012 10:27:58 +1000	[thread overview]
Message-ID: <20120501102758.03aa9cb2@notabene.brown> (raw)
In-Reply-To: <4F9F2538.4080407@zytor.com>

[-- Attachment #1: Type: text/plain, Size: 1752 bytes --]

On Mon, 30 Apr 2012 16:50:16 -0700 "H. Peter Anvin" <hpa@zytor.com> wrote:

> On 04/30/2012 04:47 PM, NeilBrown wrote:
> > 
> > I imagine this proposal as being like a virtual DTR line.  It may
> > not always be appropriate to connect DTR to the power switch, but
> > sometimes it is.
> > 
> 
> Yeah, that's pretty much what I'm suggesting.
> 
> 	-hpa

Yes, so you are :-)

I was distracted by the TIOCPOWER suggestion, and I really didn't want any
new action by user-space, I would much prefer it all "just works".
But you also mentioned "termios flags" but by that I suspect you are
referring to HUPCL which is documented as:

       HUPCL  Lower modem control lines after last process closes  the  device
              (hang up).

without really saying which modem control lines.  Looking at the code it
seems to be talking about DTR and RTS.  It only says "lower on last close"
but doesn't say "raise on first open" but maybe that is assumed.
So as long as HUPCL is the default, defining a virtual DTR line might be just
what I want, and HUPCL could be disabled of someone want to keep the device
powered on while it is closed.

So I think I want to:
 1/ teach omap-serial to drive a given GPIO as a DTR line
 2/ write a 'gpio-regulator' driver which provides a single GPIO and
    turns a given regulator 'on' or 'off' depending on the state of the GPIO
 3/ write a special-purpose GPIO driver which provides a single GPIO
    and toggles another GPIO whenever the state of the first changes, and also
    monitors the serial RX pin when the device should be 'off', and toggles
    again if it sees RX activity.
 4/ Keeping using rfkill to power the GPS antenna.

Sounds like a plan.

Thanks,
NeilBrown

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 828 bytes --]

      reply	other threads:[~2012-05-01  0:28 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-04-30 22:22 Question: How to power-manage UART-attached devices NeilBrown
2012-04-30 22:33 ` 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 [this message]

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=20120501102758.03aa9cb2@notabene.brown \
    --to=neilb@suse.de \
    --cc=alan@lxorguk.ukuu.org.uk \
    --cc=hpa@zytor.com \
    --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).