Re: [Gta04-owner] [PATCH 2/3] TTY: add support for tty_slave devices.

From: NeilBrown
Date: Mon Mar 30 2015 - 20:34:08 EST


On Fri, 27 Mar 2015 07:09:56 -0400 Peter Hurley <peter@xxxxxxxxxxxxxxxxxx>
wrote:

> On 03/25/2015 05:17 PM, NeilBrown wrote:
> > On Wed, 25 Mar 2015 12:30:00 -0400 Peter Hurley <peter@xxxxxxxxxxxxxxxxxx>
> > wrote:
> >
> >> On 03/18/2015 01:58 AM, NeilBrown wrote:
> >>
> >>> + * A "tty-slave" is a device permanently attached to a particularly
> >>> + * tty, typically wired to a UART.
> >>
> >> Why "permanently"?
> >> Is that a limitation of the implementation or design?
> >>
> >
> > The slave is described in devicetree - that only happens for permanently
> > attached devices, doesn't it?
> >
> > I guess that with device-tree overlays and 'capes' for boards you could have
> > a device attached to the uart "for this power session" rather than
> > "permanently", but I think it is a rather subtle distinction.
> >
> > Did you have something else in mind?
>
> My primary concern is that the abstraction match the scope.
>
> If the abstraction is at the tty layer, then the scope of the design
> should support tty devices, not just hard-wired, devicetree-defined uarts.

I think I see your point, and I tend to agree. However there is a limit to
how closely we can reach the ideal...

I see a lot of conceptual overlap between line discipline and tty_slaves.
They both provide extra driver support for the thing which the tty talks to.

Line disciplines can be configured at runtime depending on what is found to
be attached. tty_slaves are configure at boot time depending what is
declared to be attached in device-tree.

line disciplines are a lot like device drivers, but aren't implemented that
way for sound historical reasons. I think it would be nice if they were, but
they aren't.
tty_slaves really need to be devices with device drivers so that they can
utilise information from devicetree.

line disciplines do not and cannot know about any hardware other than the
standard UART. tty_slaves exist so that they can know about regulators and
GPIOs and anything else that might combine with the UART to control a
particular device.

So tty_slaves are really specifically for devices which present a tty, but
have more hardware controls than just a UART. Anything that doesn't have
more hardware controls is probably best handled from user-space or in a line
discipline.

And if there are more hardware controls, then it is sure to be permanently
attached.

Does that make sense? Does it allay your concerns?

Thanks,
NeilBrown

Attachment: pgp4bnaBKNyga.pgp
Description: OpenPGP digital signature