devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: NeilBrown <neilb@suse.de>
To: balbi@ti.com
Cc: Nishanth Menon <nm@ti.com>, Greg KH <gregkh@linuxfoundation.org>,
	marcel@holtmann.org, gustavo@padovan.org,
	johan.hedberg@gmail.com, jslaby@suse.cz, grant.likely@linaro.org,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
	linux-bluetooth@vger.kernel.org, linux-serial@vger.kernel.org,
	devicetree@vger.kernel.org,
	Linux OMAP Mailing List <linux-omap@vger.kernel.org>,
	Tony Lindgren <tony@atomide.com>
Subject: Re: [PATCH 10/13] tty: serial: omap: remove some dead code
Date: Thu, 24 Apr 2014 10:13:29 +1000	[thread overview]
Message-ID: <20140424101329.02e6a62f@notabene.brown> (raw)
In-Reply-To: <20140423230121.GC10924@saruman.home>

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

On Wed, 23 Apr 2014 18:01:21 -0500 Felipe Balbi <balbi@ti.com> wrote:

> Hi,
> 
> On Thu, Apr 24, 2014 at 08:43:05AM +1000, NeilBrown wrote:
> > On Wed, 23 Apr 2014 10:35:04 -0500 Nishanth Menon <nm@ti.com> wrote:
> > 
> > > On 04/23/2014 09:58 AM, Felipe Balbi wrote:
> > > > nobody passes a DTR_gpio to this driver, so
> > > > this code is not necessary.
> > > > 
> > > > Signed-off-by: Felipe Balbi <balbi@ti.com>
> > > > ---
> > > 
> > > Niel,
> > > this seems to revert the functionality introduced in
> > > commit 9574f36fb801035f6ab0fbb1b53ce2c12c17d100
> > > (OMAP/serial: Add support for driving a GPIO as DTR.)
> > > 
> > > would you like to Ack this change?
> > 
> > I have a couple of out-of-tree drivers that use this support.
> > 
> > I hope to get back to working on that code one day and even get those drivers
> > upstream.  So I would really prefer this code to remain if it isn't causing
> > any actual problems.
> 
> it causes problem with DT (not really). That suport is only available on
> legacy platform_data-based boot, it's not available on DT. I hear Tony
> is pretty close to turning OMAP3 DT-only.
> 
> > Of course, I can always re-submit it when I need it again, but that it just
> > extra work all around.
> 
> I wonder how you will pass those attributes through DT considering they
> are *really* SW configuration. Why can't you use the real DTR pin, btw ?
> 

This myth that DT is only about hardware is probably one of the reasons that I
haven't got these out-of-tree drivers upstream yet.

There is no "real" DTR pin.

When I open /dev/ttyWHATEVER, I need the driver for the device that is
permanently connected to that serial port to be told that the serial-device
has been opened so that it can "power on" or "wake up" the device.

I don't much care how that happens, or how I tell DT that it has to happen.
I just need it to happen.

In discrete hardware devices, the DTR line is what you would use.  The RS232
port would raise (or lower or whatever) DTR when /dev/ttyWHATEVER was open,
and  the device that was plugged in would detect the level change and do
stuff.

But I don't have discrete hardware.  I have a bunch of stuff soldered onto a
board with ad-hoc connections chosen to make the life of the hardware builder
easy rather than chosen to make the life of the software developer easy
(which I think is the correct choice).

So I need to tell DT "This device is plugged into this UART, and there is no
DTR line, but when the UARTs DTR line would be asserted (if it had one), then
I need that regulator of there turned on". or maybe "I need to toggle this
GPIO  with exactly this pattern, while watching that GPIO to see if it is
working".

So I thought:

 1/ give the UART a "virtual" DTR so it could drive any GPIO
 2/ create a "gpio-to-regulator" driver which presented as a (virtual) gpio
    and responded to state changes on that GPIO by turning on or off the
    regulator
 3/ create a dedicated driver which knows how to toggle the magic GPIO while
    watching the other GPIO to convince the silly device to wakeup, or go to
    sleep, as required, and have this appear as a (virtual) GPIO.

Then I can just tell DT that these (virtual) GPIOs are connected together,
and it will all just work.  And it does.

But given the whole "no no, DT is for describing hardware, and you are
describing software" attitude,  it seems that I lost motivation for a while
(that wasn't the only reason, but it didn't help).

I have a patch which converts the OMAP serial driver to use DT to configure
these virtual DTR lines.  I'm very happy to submit that if there is some
chance it might be accepted and will keep the current DTR code in place.

On the other hand, if you can point out to me what I'm missing, and how I can
solve my problem with any virtual GPIOs, I'm all ears.

To make my problem simple and explicit:  I have a device attached to a UART
which has a separate regulator.  The regulator should be powered on if and
only if the /dev/ttyXX interface to the UART is open.  The device is a
bluetooth transceiver.
(I have another device which is a GPS receiver which has similar
but more complicated requirements)

Thanks,
NeilBrown


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

  reply	other threads:[~2014-04-24  0:13 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-04-23 14:58 [PATCH 01/13] tty_ldisc: add more limits to the @write_wakeup Felipe Balbi
2014-04-23 14:58 ` [PATCH 02/13] bluetooth: hci_ldisc: fix deadlock condition Felipe Balbi
2014-04-24  9:01   ` Andreas Bießmann
2014-04-23 14:58 ` [PATCH 03/13] Revert "serial: omap: unlock the port lock" Felipe Balbi
2014-04-23 14:58 ` [PATCH 04/13] serial: fix UART_IIR_ID Felipe Balbi
2014-04-23 14:58 ` [PATCH 05/13] tty: serial: add missing braces Felipe Balbi
2014-04-23 14:58 ` [PATCH 06/13] tty: serial: omap: switch over to devm_request_gpio Felipe Balbi
2014-04-23 14:58 ` [PATCH 07/13] tty: serial: omap: cleanup variable declarations Felipe Balbi
2014-04-23 14:58 ` [PATCH 08/13] tty: serial: omap: switch over to platform_get_resource Felipe Balbi
     [not found]   ` <1398265117-11793-8-git-send-email-balbi-l0cyMroinI0@public.gmane.org>
2014-04-23 15:27     ` Fabio Estevam
2014-04-23 15:49       ` Felipe Balbi
2014-04-23 14:58 ` [PATCH 09/13] tty: serial: omap: switch over to devm_ioremap_resource Felipe Balbi
2014-04-23 14:58 ` [PATCH 10/13] tty: serial: omap: remove some dead code Felipe Balbi
     [not found]   ` <1398265117-11793-10-git-send-email-balbi-l0cyMroinI0@public.gmane.org>
2014-04-23 15:26     ` Felipe Balbi
2014-04-23 15:35     ` Nishanth Menon
     [not found]       ` <5357DDA8.4040206-l0cyMroinI0@public.gmane.org>
2014-04-23 22:43         ` NeilBrown
     [not found]           ` <20140424084305.20c7f301-wvvUuzkyo1EYVZTmpyfIwg@public.gmane.org>
2014-04-23 23:01             ` Felipe Balbi
2014-04-24  0:13               ` NeilBrown [this message]
     [not found]                 ` <20140424101329.02e6a62f-wvvUuzkyo1EYVZTmpyfIwg@public.gmane.org>
2014-04-24  1:21                   ` Felipe Balbi
     [not found]                     ` <20140424012100.GB13374-HgARHv6XitL9zxVx7UNMDg@public.gmane.org>
2014-04-24  1:41                       ` NeilBrown
2014-04-24  1:43                         ` Felipe Balbi
2014-04-24  2:24                           ` NeilBrown
2014-04-24 14:19                       ` One Thousand Gnomes
2014-04-25  9:34                         ` NeilBrown
     [not found]                           ` <20140425193412.7d32e429-wvvUuzkyo1EYVZTmpyfIwg@public.gmane.org>
2014-04-25  9:53                             ` Yegor Yefremov
2014-04-25 11:40                               ` One Thousand Gnomes
2014-04-25 11:47                           ` One Thousand Gnomes
2014-04-23 14:58 ` [PATCH 11/13] tty: serial: omap: remove unneeded singlethread workqueue Felipe Balbi
2014-04-23 14:58 ` [PATCH 12/13] tty: serial: omap: fix Sparse warnings Felipe Balbi
     [not found] ` <1398265117-11793-1-git-send-email-balbi-l0cyMroinI0@public.gmane.org>
2014-04-23 14:58   ` [PATCH 13/13] serial: 8250: add OMAP glue Felipe Balbi

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=20140424101329.02e6a62f@notabene.brown \
    --to=neilb@suse.de \
    --cc=balbi@ti.com \
    --cc=devicetree@vger.kernel.org \
    --cc=grant.likely@linaro.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=gustavo@padovan.org \
    --cc=johan.hedberg@gmail.com \
    --cc=jslaby@suse.cz \
    --cc=linux-bluetooth@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-omap@vger.kernel.org \
    --cc=linux-serial@vger.kernel.org \
    --cc=marcel@holtmann.org \
    --cc=nm@ti.com \
    --cc=tony@atomide.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;
as well as URLs for NNTP newsgroup(s).