linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "H. Nikolaus Schaller" <hns@goldelico.com>
To: Rob Herring <robh+dt@kernel.org>
Cc: "Mark Rutland" <mark.rutland@arm.com>,
	"Benoît Cousson" <bcousson@baylibre.com>,
	"Tony Lindgren" <tony@atomide.com>,
	"Russell King" <linux@armlinux.org.uk>,
	"Thierry Reding" <treding@nvidia.com>,
	"Jonathan Cameron" <jic23@kernel.org>,
	"Maxime Ripard" <maxime.ripard@free-electrons.com>,
	"Jarkko Sakkinen" <jarkko.sakkinen@linux.intel.com>,
	"devicetree@vger.kernel.org" <devicetree@vger.kernel.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	linux-omap <linux-omap@vger.kernel.org>,
	"Discussions about the Letux Kernel"
	<letux-kernel@openphoenux.org>,
	kernel@pyra-handheld.com
Subject: Re: [RFC 0/3] misc: new serdev based drivers for w2sg00x4 GPS module and w2cbw003 wifi/bluetooth
Date: Tue, 23 May 2017 07:43:53 +0200	[thread overview]
Message-ID: <78B1501A-B9AD-4C6E-A481-26F647AA2BCE@goldelico.com> (raw)
In-Reply-To: <CAL_Jsq+fmi2QwE7J8xv47ece1b+jqnOo99NghfjtocnrRvBkPg@mail.gmail.com>

Hi Rob,

> Am 23.05.2017 um 04:26 schrieb Rob Herring <robh+dt@kernel.org>:
> 
> On Sun, May 21, 2017 at 5:44 AM, H. Nikolaus Schaller <hns@goldelico.com> wrote:
>> Since our proposed API was not acceptable and the new serdev API has arrived in 4.11 kernels,
>> we finally took the challenge to update the w2sg and w2cbw drivers to use the serdev API.
>> 
>> The approach is to write a "man in the middle" driver which is on one side a serdev client
>> which directly controls the UART where the device is connected to and on the other side
>> presents a new tty port so that user-space software can talk to the chips as if they would
>> directly talk to the UART of the SoC (e.g. ttyO1). This is similar to connecting to a remote
>> serial device e.g. through USB (ttyACM) or Bluetooth UART profiles.
>> 
>> For example gpsd or hciattach expect a /dev/tty they can control (flow control, baud rate
>> etc.).
> 
> I understand from the prior discussion why you want to pass the data
> thru for gps, but why do you need to do that for BT?

Because we otherwise can't turn on power when /dev/ttyBT0 is opened and turn off when it
is closed. I.e. it should not be powered unless someone does a hciattach /dev/ttyBT0. And it
should be turned off by a killall hciattach.

Basically we would like to have a power control automatic like it exists for many other devices.

Since the BT chip is described as a serdev by DT, we see no other means than to pass data
through the serdev driver.

We had looked into the line discipline approach but it makes a lot of problems. The first one
is that registering a new system-wide ldesc number is required. Next we do not see how to make
a serdev driver (as it seems to be required by the DT) to register a different ldesc.

> 
>> Here is the result of our first hack which is working as a demo on GTA04 devices (and the
>> w2cbw driver can also be used to control a GTA04 variant with WL1837).
>> 
>> Since it is just a demo hack, the code is not yet cleaned up, nor does it completely pass
>> check-patch, nor follows 100% the coding styles. And certainly has some bugs.
>> 
>> The most significant issue is that calling tty_port_register_device() inside of the
>> serdev probe() function makes the serdev probe() function to be entered a second
>> time. This does not lead to big problems since we currently have minor = 0
>> and this makes the second call assume the device is not available.
>> 
>> But we have no idea why this happens and how it can be prevented.
> 
> Johan's fixes may help there, but it is intended to be temporary to
> have a separate API for registering tty ports with or without serdev.

Ah, would that mean something like a tty_port_register_device_without_serdev()?

Do you have a reference to his fixes?

BR and thanks,
Nikolaus

  reply	other threads:[~2017-05-23  5:44 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-05-21 10:44 [RFC 0/3] misc: new serdev based drivers for w2sg00x4 GPS module and w2cbw003 wifi/bluetooth H. Nikolaus Schaller
2017-05-21 10:44 ` [RFC 1/3] DTS: gta04: add serdev nodes for w2sg00x4, w2cbw etc H. Nikolaus Schaller
2017-05-21 10:44 ` [RFC 2/3] misc: Add w2sg0004 (gps receiver) power control driver H. Nikolaus Schaller
2017-05-21 10:48   ` H. Nikolaus Schaller
2017-05-30 23:09   ` Rob Herring
2017-06-06 18:50     ` H. Nikolaus Schaller
2017-06-07  7:34   ` Ladislav Michl
2017-06-07 10:08     ` H. Nikolaus Schaller
2017-05-21 10:44 ` [RFC 3/3] misc: Add w2cbw003 (wifi/bluetooth) " H. Nikolaus Schaller
2017-05-23  2:26 ` [RFC 0/3] misc: new serdev based drivers for w2sg00x4 GPS module and w2cbw003 wifi/bluetooth Rob Herring
2017-05-23  5:43   ` H. Nikolaus Schaller [this message]
2017-05-23 12:28     ` Rob Herring
2017-05-23 12:48       ` H. Nikolaus Schaller
2017-05-23 13:10         ` Rob Herring
2017-05-23 13:49           ` H. Nikolaus Schaller
2017-05-25 12:48             ` Rob Herring
2017-06-06 18:50               ` H. Nikolaus Schaller
2017-05-25 17:05             ` Pavel Machek

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=78B1501A-B9AD-4C6E-A481-26F647AA2BCE@goldelico.com \
    --to=hns@goldelico.com \
    --cc=bcousson@baylibre.com \
    --cc=devicetree@vger.kernel.org \
    --cc=jarkko.sakkinen@linux.intel.com \
    --cc=jic23@kernel.org \
    --cc=kernel@pyra-handheld.com \
    --cc=letux-kernel@openphoenux.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-omap@vger.kernel.org \
    --cc=linux@armlinux.org.uk \
    --cc=mark.rutland@arm.com \
    --cc=maxime.ripard@free-electrons.com \
    --cc=robh+dt@kernel.org \
    --cc=tony@atomide.com \
    --cc=treding@nvidia.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).