All of lore.kernel.org
 help / color / mirror / Atom feed
From: Sebastian Reichel <sre@kernel.org>
To: Marcel Holtmann <marcel@holtmann.org>
Cc: One Thousand Gnomes <gnomes@lxorguk.ukuu.org.uk>,
	Arnd Bergmann <arnd@arndb.de>, Rob Herring <robh@kernel.org>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	Jiri Slaby <jslaby@suse.com>, Pavel Machek <pavel@ucw.cz>,
	Peter Hurley <peter@hurleysoftware.com>,
	NeilBrown <neil@brown.name>,
	"Dr . H . Nikolaus Schaller" <hns@goldelico.com>,
	Linus Walleij <linus.walleij@linaro.org>,
	"open list:BLUETOOTH DRIVERS" <linux-bluetooth@vger.kernel.org>,
	"linux-serial@vger.kernel.org" <linux-serial@vger.kernel.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: Re: [RFC PATCH 0/3] UART slave device bus
Date: Tue, 23 Aug 2016 00:03:17 +0200	[thread overview]
Message-ID: <20160822220313.wc47q7c4vub2cxmt@earth> (raw)
In-Reply-To: <FAD4CEF6-93F4-41D1-915E-823867F740F7@holtmann.org>

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

Hi,

On Mon, Aug 22, 2016 at 05:07:06PM -0400, Marcel Holtmann wrote:
> >> Would it make sense then to define a DT binding that can cover these
> >> four cases independent of the Linux usage:
> >> 
> >> a) an existing tty line discipline matched to a tty port
> >> b) a serio device using the N_MOUSE line discipline (which
> >>   happens to cover non-mouse devices these days)
> > 
> > These two are the same basic thing
> > 
> > 	port x expects ldisc y {with properties ...}
> > 
> >> c) a uart_port slave attached directly to the uart (like in your
> >>   current code)
> > 
> > c) needs to be a tty_port slave attached directly to a tty_port.
> > Important detail, but as uart_port is just a subset of tty_port it's a
> > trivial detail to the DT.
> > 
> >> d) the same slave drivers using a new tty line discipline
> > 
> > and this is also just a/b again.
> > 
> > 
> > What use cases and connectivity do you need to describe. Looking at the
> > ACPI platforms we have
> > 
> > - the expected serial port configuration
> > - the properties of the port (FIFO etc)
> > - the power management for the port
> > 
> > - the children of the port
> > - the power management of the children (at a very simplistic abstracted
> >  level)
> > 
> > So we want to be able to describe something like
> > 
> >  ttyS0 {
> > 	baud: 1152008N1
> > 	protocol: bluetooth hci
> > 	fixed: yes
> > 	powermanagement: { ... }
> >  }
> 
> we also need to know what Bluetooth vendor is there. Since we need
> to match the vendor to the firmware loading and configuration.
> 
> Additionally there might be PCM audio configurations that need to
> be considered. Since we have to configure direct PCM interconnect
> with the audio codec.

It's not enough to automatically set a ldisc. There is also need for
additional resouces. For example the Nokia bluetooth driver needs
some extra GPIOs. The same is true for the in-tree hci_bcm, which
misuses the platform_device exactly like Greg doesn't want it.

> > and if I look at the usermode crapfest on a lot of Android systems it
> > looks similar but with the notion of things like being able to describe
> > 
> > -	Use GPIO mode sleeping and assume first char is X to save power
> > 
> > -	Power up, wait n ms, write, read, wait n ms, power down (which
> > 	has to be driven at the ldisc/user level as only the ldisc
> > 	understands transactions, or via ioctls (right now Android user
> > 	space tends to do hardcoded writes to /sys.. gpio to drive power
> > 
> > -	And a few variants thereof (power up on write, off on a timer
> >  	etc)
> 
> Actually the sad part about the Android mess is that we can fix it
> for Bluetooth. We have HCI User Channel that allows to grab a HCI
> device and assign it to Bluedroid stack on Android. So it would
> work with whatever bus or whatever vendor is underneath. All this
> hacking would go away. And we have used this successfully for
> Intel based Android platforms. We know this works.
> 
> > So I can imagine wanting to describe something like
> > 
> > -	The bluetooth HCI hardware is managed by gpio 11 (or UART DTR,
> > 	or PMIC n etc)
> > 	The uart can switch into GPIO mode and is gpio 15
> > 
> > or
> > 
> > -	Raise gpio 4 when writing, drop it after 50mS with no read/write
> > 
> > Then the ldisc needs to make port->ops. calls for enabling/disabling low
> > power mode and expected char, and the uarts that can do it need to
> > implement the gpio/uart switching and any timers.
> 
> I now wonder if we can not just turn the ldisc into a bus. So we
> have a ldisc bus that exposes devices that have no business of
> having a userspace /dev/ttyX exposed. And our Bluetooth UART
> support just turns into a ldisc driver on the ldisc bus.
> 
> One of the problems is that attaching the ldisc from userspace you
> still need to figure out what /dev/ttyX you get assigned in the
> end. And figure out which one is the Bluetooth UART. If we want
> single images where things just work out of the box, we need to
> get extra information for doing auto-detection. So some sort of
> bus enumeration is key to make this work smoothly.

I don't understand your propsoal. First you write, that no ttyX
needs to be exported at all, then you need to figure out what ttyX
got assigned in the end.

I think the problem with line disciplines is, that they do
not follow the Linux device model. UART slaves may have extra
resources like gpios or regulators. The current workaround from
the drivers is an additional platform device, which only is
used as resource storage and accessed by the line discipline.

I think having a proper slave devices would be better in the long
run than adding more hacks to work around the problem of line
discplines not being devices. It probably makes sense to make the
API similar to the line discipline API, though. That way old code
can be reused.

-- Sebastian

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

  parent reply	other threads:[~2016-08-22 22:03 UTC|newest]

Thread overview: 139+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-08-18  1:14 [RFC PATCH 0/3] UART slave device bus Rob Herring
2016-08-18  1:14 ` [RFC PATCH 1/3] uart bus: Introduce new bus for UART slave devices Rob Herring
2016-08-18  1:14 ` [RFC PATCH 2/3] tty: serial_core: make tty_struct optional Rob Herring
2016-08-18 10:50   ` Pavel Machek
2016-08-18  1:14 ` [RFC PATCH 3/3] tty: serial_core: add uart controller registration Rob Herring
2016-08-18 10:22 ` [RFC PATCH 0/3] UART slave device bus Greg Kroah-Hartman
2016-08-18 10:22   ` Greg Kroah-Hartman
2016-08-18 10:30   ` Marcel Holtmann
2016-08-18 10:53     ` Greg Kroah-Hartman
2016-08-18 13:53       ` Rob Herring
2016-08-18 13:15   ` Rob Herring
2016-08-18 15:04     ` One Thousand Gnomes
2016-08-18 18:33       ` Rob Herring
2016-08-19 11:03         ` One Thousand Gnomes
2016-08-25 16:40       ` Rob Herring
2016-08-25 16:40         ` Rob Herring
2016-08-26 13:12         ` One Thousand Gnomes
2016-08-18 10:39 ` H. Nikolaus Schaller
2016-08-18 10:39   ` H. Nikolaus Schaller
2016-08-18 10:47   ` Pavel Machek
2016-08-18 10:54     ` H. Nikolaus Schaller
2016-08-18 10:54       ` H. Nikolaus Schaller
2016-08-18 10:57       ` Greg Kroah-Hartman
2016-08-18 11:14         ` H. Nikolaus Schaller
2016-08-18 11:14           ` H. Nikolaus Schaller
2016-08-18 11:14           ` H. Nikolaus Schaller
2016-08-18 14:40         ` One Thousand Gnomes
2016-08-18 14:40           ` One Thousand Gnomes
2016-08-18 14:58           ` Greg Kroah-Hartman
2016-08-18 11:27     ` H. Nikolaus Schaller
2016-08-18 10:49   ` Marcel Holtmann
2016-08-18 10:55     ` Greg Kroah-Hartman
2016-08-18 11:01       ` Marcel Holtmann
2016-08-18 11:24         ` Greg Kroah-Hartman
2016-08-18 11:42           ` Pavel Machek
2016-08-18 11:42             ` Pavel Machek
2016-08-18 11:51           ` Marcel Holtmann
2016-08-18 11:51             ` Marcel Holtmann
2016-08-18 15:14             ` One Thousand Gnomes
2016-08-18 15:13           ` One Thousand Gnomes
2016-08-18 11:10       ` Pavel Machek
2016-08-18 11:18         ` H. Nikolaus Schaller
2016-08-18 11:49           ` Marcel Holtmann
2016-08-18 12:16             ` H. Nikolaus Schaller
2016-08-18 12:16               ` H. Nikolaus Schaller
2016-08-18 15:15             ` One Thousand Gnomes
2016-08-18 11:47         ` Marcel Holtmann
2016-08-18 13:01           ` Pavel Machek
2016-08-18 15:16           ` One Thousand Gnomes
2016-08-18 11:02     ` H. Nikolaus Schaller
2016-08-18 11:02       ` H. Nikolaus Schaller
2016-08-18 11:41       ` Marcel Holtmann
2016-08-18 12:07         ` H. Nikolaus Schaller
2016-08-18 12:07           ` H. Nikolaus Schaller
2016-08-18 12:07           ` H. Nikolaus Schaller
2016-08-18 11:02 ` Pavel Machek
2016-08-18 13:07 ` Linus Walleij
2016-08-18 17:31   ` Marcel Holtmann
2016-08-18 14:25 ` One Thousand Gnomes
2016-08-18 15:14   ` H. Nikolaus Schaller
2016-08-18 15:14     ` H. Nikolaus Schaller
2016-08-18 15:38     ` One Thousand Gnomes
2016-08-18 18:31       ` H. Nikolaus Schaller
2016-08-18 18:31         ` H. Nikolaus Schaller
2016-08-18 22:25   ` Rob Herring
2016-08-19 11:38     ` One Thousand Gnomes
2016-08-19 15:36       ` Sebastian Reichel
2016-08-18 20:29 ` Sebastian Reichel
2016-08-18 23:08   ` Rob Herring
2016-08-19  5:21     ` Sebastian Reichel
2016-08-19  7:29       ` H. Nikolaus Schaller
2016-08-19  7:49         ` Oleksij Rempel
2016-08-19  7:49           ` Oleksij Rempel
2016-08-19 17:50           ` H. Nikolaus Schaller
2016-08-19 20:19             ` Oleksij Rempel
2016-08-19 20:19               ` Oleksij Rempel
2016-08-20 13:34             ` One Thousand Gnomes
2016-08-21  7:50               ` H. Nikolaus Schaller
2016-08-21  7:50                 ` H. Nikolaus Schaller
2016-08-22 20:39                 ` Sebastian Reichel
2016-08-22 21:23                   ` H. Nikolaus Schaller
2016-08-22 21:43                     ` Arnd Bergmann
2016-08-22 22:42                     ` Sebastian Reichel
2016-08-22 22:52                       ` One Thousand Gnomes
2016-08-22 23:10                         ` Sebastian Reichel
2016-08-23  7:28                       ` H. Nikolaus Schaller
2016-08-27 12:01                     ` Michal Suchanek
2016-08-19 11:06         ` One Thousand Gnomes
2016-08-19 17:42           ` H. Nikolaus Schaller
2016-08-19 17:42             ` H. Nikolaus Schaller
2016-08-20 13:22             ` One Thousand Gnomes
2016-08-20 13:22               ` One Thousand Gnomes
2016-08-21  7:50               ` H. Nikolaus Schaller
2016-08-21  7:50                 ` H. Nikolaus Schaller
2016-08-21  7:50                 ` H. Nikolaus Schaller
2016-08-21 17:09                 ` One Thousand Gnomes
2016-08-21 18:23                   ` H. Nikolaus Schaller
2016-08-21 18:23                     ` H. Nikolaus Schaller
2016-08-22  9:09                     ` One Thousand Gnomes
2016-08-22  9:33                       ` Marcel Holtmann
2016-08-22  9:33                         ` Marcel Holtmann
2016-08-19 11:03       ` One Thousand Gnomes
2016-08-19 11:03         ` One Thousand Gnomes
2016-08-19 14:44         ` Sebastian Reichel
2016-08-22 12:37 ` Arnd Bergmann
2016-08-22 13:38   ` Rob Herring
2016-08-22 15:24     ` Arnd Bergmann
2016-08-22 15:28       ` Marcel Holtmann
2016-08-22 15:46         ` Arnd Bergmann
2016-08-22 15:45       ` One Thousand Gnomes
2016-08-22 21:07         ` Marcel Holtmann
2016-08-22 21:35           ` One Thousand Gnomes
2016-08-22 22:03           ` Sebastian Reichel [this message]
2016-08-22 22:46             ` One Thousand Gnomes
2016-08-22 23:41               ` Sebastian Reichel
2016-08-24 12:14         ` Linus Walleij
2016-08-22 16:44       ` Rob Herring
2016-08-22 17:02         ` One Thousand Gnomes
2016-08-22 17:30           ` Rob Herring
2016-08-22 17:30             ` Rob Herring
2016-08-22 17:38             ` One Thousand Gnomes
2016-08-22 21:16               ` Marcel Holtmann
2016-08-22 21:32                 ` One Thousand Gnomes
2016-08-22 22:00                   ` Pavel Machek
2016-08-22 22:54                     ` One Thousand Gnomes
2016-08-22 23:57                       ` Sebastian Reichel
2016-08-23  0:15                         ` One Thousand Gnomes
2016-08-23  0:57                           ` Sebastian Reichel
2016-08-24 13:57                             ` One Thousand Gnomes
2016-08-24 13:57                               ` One Thousand Gnomes
2016-08-24 14:29                               ` Marcel Holtmann
2016-08-24 14:29                                 ` Marcel Holtmann
2016-08-23 11:42                           ` Marcel Holtmann
2016-08-22 23:02                     ` Sebastian Reichel
2016-08-22 20:00             ` Sebastian Reichel
2016-08-22 22:00               ` Rob Herring
2016-08-22 22:00                 ` Rob Herring
2016-08-22 22:18                 ` Sebastian Reichel
2016-08-23 21:04       ` Rob Herring

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=20160822220313.wc47q7c4vub2cxmt@earth \
    --to=sre@kernel.org \
    --cc=arnd@arndb.de \
    --cc=gnomes@lxorguk.ukuu.org.uk \
    --cc=gregkh@linuxfoundation.org \
    --cc=hns@goldelico.com \
    --cc=jslaby@suse.com \
    --cc=linus.walleij@linaro.org \
    --cc=linux-bluetooth@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-serial@vger.kernel.org \
    --cc=marcel@holtmann.org \
    --cc=neil@brown.name \
    --cc=pavel@ucw.cz \
    --cc=peter@hurleysoftware.com \
    --cc=robh@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.