Re: [PATCH 2/3] TTY: add slave driver to power-on device via a regulator.

From: NeilBrown
Date: Fri Dec 12 2014 - 00:01:31 EST


On Thu, 11 Dec 2014 23:58:48 +0100 Sebastian Reichel <sre@xxxxxxxxxx> wrote:

> Hi,
>
> On Fri, Dec 12, 2014 at 08:59:44AM +1100, NeilBrown wrote:
> > The regulator is identified in devicetree as 'vdd-supply'
>
> long description is kind of useless...
>
> > Signed-off-by: NeilBrown <neilb@xxxxxxx>
> > ---
> > .../devicetree/bindings/serial/slave-reg.txt | 18 ++++
> > drivers/tty/Kconfig | 2
> > drivers/tty/Makefile | 1
> > drivers/tty/slaves/Kconfig | 12 ++
> > drivers/tty/slaves/Makefile | 2
> > drivers/tty/slaves/tty-reg.c | 102 ++++++++++++++++++++
> > 6 files changed, 137 insertions(+)
> > create mode 100644 Documentation/devicetree/bindings/serial/slave-reg.txt
> > create mode 100644 drivers/tty/slaves/Kconfig
> > create mode 100644 drivers/tty/slaves/Makefile
> > create mode 100644 drivers/tty/slaves/tty-reg.c
> >
> > diff --git a/Documentation/devicetree/bindings/serial/slave-reg.txt b/Documentation/devicetree/bindings/serial/slave-reg.txt
> > new file mode 100644
> > index 000000000000..7896bce8dfe4
> > --- /dev/null
> > +++ b/Documentation/devicetree/bindings/serial/slave-reg.txt
> > @@ -0,0 +1,18 @@
> > +Regulator powered UART-attached device
> > +
> > +Required properties:
> > +- compatible: "tty,regulator"
> > +- vdd-supply: regulator to power the device
> > +
> > +
> > +This is listed as a child node of a UART. When the
> > +UART is opened, the device is powered.
> > +
> > +Example:
> > +
> > +&uart1 {
> > + bluetooth {
> > + compatible = "tty,regulator";
> > + vdd-supply = <&vaux4>;
> > + };
> > +};
>
> NACK. The compatible value should describe the connected device. You
> did not connect a regulator, but a bluetooth chip! DT should look
> like this:
>
> &uart1 {
> bluetooth {
> compatible = "vendor,bluetooth-chip";
> vdd-supply = <&vaux4>;
> };
> };
>
> I think it would be ok to use your generic driver to handle the
> specific compatible value, though.
>
> Having the proper compatible value means, that there can be a more
> specific driver later, that other operating systems can expose the
> device as some kind of /dev/bluetooth instead of /dev/ttyXY, that
> userspace is able to know there is a bluetooth device connected to
> /dev/ttyXY by parsing the DT and results in easier-to-understand
> DTS.

So the tty_reg_dt_ids array could conceivably grow a long list of compatible
devices, starting with this one. I guess that makes sense.

Thanks,
NeilBrown

Attachment: pgp4P79bAk9_5.pgp
Description: OpenPGP digital signature