Received: by 10.192.165.148 with SMTP id m20csp44901imm; Fri, 4 May 2018 06:29:08 -0700 (PDT) X-Google-Smtp-Source: AB8JxZpZPFxe9CtIY4Inxs7/9FaH9fWFgywzSDQ/b1bizUeoH29fMhCEt64T83PDTBPnkikRNxLC X-Received: by 2002:a17:902:5a46:: with SMTP id f6-v6mr27735100plm.85.1525440548718; Fri, 04 May 2018 06:29:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1525440548; cv=none; d=google.com; s=arc-20160816; b=e9A6RNolN5iPBEaOOysbm2niy/SB+rzDw01D43qOQ6s9lrRtrbTptfG6FRfEe+Za46 AG1MoVSvBFrEowof2Vq9oYS6K7/tRV8Tj66Bt39tbLkTxgU0V80UUr6dJzaViIH8QhF6 0dYifn6cdVrnXz0QroahiDdwQ1Gv0LGcChL/+BrmIqJRUJpRc5VOYTza3+0kjvUM4KXW V1N1yRT1OqMEPE1vqQ2eiaviDvKmEf0LkfgQlkVWz/65bZIpFlZEtYoVZoZPhgILYPWi 8lCzA+SAWQU71O5CfUXiETLv/2d+13ND2UBRXNxpk6Es0sxI/ZtvZeeIcckVzdoax14J ar5Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:arc-authentication-results; bh=mrM/xJIN2da9c9jDkvzoG02hPI4giPjQjDYJ0pDtHH8=; b=PsTE2CaRs9BapaEF9mZsvJMsz1WeSDTa5/c8adZhXyLcZgQTSdy/RYMDQT7lIFZG89 BSgyeh6hg+qlxPHD81oUjOtdJ9qkMbVWvWrY3FeSVzReOzKq/A8WvZeHMPvp+FeWfOU4 eEVT+KgFkT0lZQuFoGw4HJ40f3+Uwz1+K69V2W0JwfxyioMBJVHMr+ZFg7HC3v/jga4i T6MMA+3L5IROuflOQtQavlmTyxse2XuhIaM3LC5hfh7lEsh79ol4Bc8nxs02av+2t0Lq Y0FW1caJE3zxJ2bMnMgZoVKYdV/UB/55TJHFIteqbB/sjERQm0wq71M3IoHc2MvAZMgy RvOg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=collabora.co.uk Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id o33-v6si15159227plb.432.2018.05.04.06.28.54; Fri, 04 May 2018 06:29:08 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=collabora.co.uk Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751411AbeEDN1u (ORCPT + 99 others); Fri, 4 May 2018 09:27:50 -0400 Received: from bhuna.collabora.co.uk ([46.235.227.227]:51872 "EHLO bhuna.collabora.co.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751262AbeEDN1q (ORCPT ); Fri, 4 May 2018 09:27:46 -0400 Received: from [127.0.0.1] (localhost [127.0.0.1]) (Authenticated sender: sre) with ESMTPSA id 39B1026842E Date: Fri, 4 May 2018 15:27:41 +0200 From: Sebastian Reichel To: Johan Hovold Cc: Greg Kroah-Hartman , Rob Herring , Mark Rutland , Andreas Kemnade , Arnd Bergmann , "H . Nikolaus Schaller" , Pavel Machek , linux-kernel@vger.kernel.org, devicetree@vger.kernel.org Subject: Re: [PATCH 0/7] gnss: add new GNSS subsystem Message-ID: <20180504132741.brn5jqv5ufjhp7ky@earth.universe> References: <20180424163458.11947-1-johan@kernel.org> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="smpsuold57ovmvb7" Content-Disposition: inline In-Reply-To: <20180424163458.11947-1-johan@kernel.org> User-Agent: NeoMutt/20180323 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org --smpsuold57ovmvb7 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Hi Johan, On Tue, Apr 24, 2018 at 06:34:51PM +0200, Johan Hovold wrote: > This series adds a new subsystem for GNSS receivers (e.g. GPS > receivers). >=20 > While GNSS receivers are typically accessed using a UART interface they > often also support other I/O interfaces such as I2C, SPI and USB, while > yet other devices use iomem or even some form of remote-processor > messaging (rpmsg). > =20 > The new GNSS subsystem abstracts the underlying interface and provides a > new "gnss" class type, which exposes a character-device interface (e.g. > /dev/gnss0) to user space. This allows GNSS receivers to have a > representation in the Linux device model, something which is important > not least for power management purposes and which also allows for easy > detection and (eventually) identification of GNSS devices. >=20 > Note that the character-device interface provides raw access to whatever > protocol the receiver is (currently) using, such as NMEA 0183, UBX or > SiRF Binary. These protocols are expected to be continued to be handled > by user space for the time being, even if some hybrid solutions are also > conceivable (e.g. to have kernel drivers issue management commands). > > This will still allow for better platform integration by allowing GNSS > devices and their resources (e.g. regulators and enable-gpios) to be > described by firmware and managed by kernel drivers rather than > platform-specific scripts and services. > =20 > While the current interface is kept minimal, it could be extended using > IOCTLs, sysfs or uevents as needs and proper abstraction levels are > identified and determined (e.g. for device and feature identification). >=20 > Another possible extension is to add generic 1PPS support. >=20 > I decided to go with a custom character-device interface rather than > pretend that these abstract GNSS devices are still TTY devices (e.g. > /dev/ttyGNSS0). Obviously, modifying line settings or reading modem > control signals does not make any sense for a device using, say, a > USB (not USB-serial) or iomem interface. This also means, however, that > user space would no longer be able to set the line speed to match a new > port configuration that can be set using the various GNSS protocols when > the underlying interface is indeed a UART; instead this would need to be > taken care of by the driver. >=20 > Also note that writes are always synchronous instead of requiring user > space to call tcdrain() after every command. >=20 > This all seems to work well-enough (e.g. with gpsd), but please let me > know if I've overlooked something which would indeed require a TTY > interface instead. >=20 > As proof-of-concept I have implemented drivers for receivers based on > two common GNSS chipsets (SiRFstar and u-blox), but due to lack of > hardware these have so far only been tested using mockup devices and a > USB-serial-based GPS device (using out-of-tree code). [ Let me know if > you've got any evalutation kits to spare. ] >=20 > Finally, note that documentation (including kerneldoc) remains to be > written, but hopefully this will not hinder review given that the > current interfaces are fairly self-describing. Great work. I like your design decisions. I have quite a few devices with have non-serial based GPS peripherals using binary protocols (*). As far as I can see it should be possible to add support for those. I have one concern, though. While providing raw data by default is fine generally, it is a problem with device auto-discovery. I think there should be some IOCTL from the start, that can be used to inform userspace about the raw protocol being used (i.e. "NMEA"). I fear, that userspace may start to just assume raw =3D NMEA without having this (especially since all initial drivers provide NMEA). (*) I have those in mind: Nokia N900: The phone has GPS integrated into the modem and uses ISI encapsulated data. The protocol has been reverse engineered and it should be possible to write a kernel driver for handling the GPS packets and dumping the raw data to /dev/gnss0. I don't think this is particularly useful without a non-raw interface, though. It would still require a custom userspace implementation. Nokia N950/N9: Those phones have an I2C connected BCM4751, which uses (proprietary, non-reverse-engineered) MEIF binary protocol. Nokia's kernel had a driver, which provides a similar userspace interface (char device with raw data from chip). Droid 4: GPS is similar to N900, but different protocol and QMI encapsulated. This one also has known protocol with userspace implementation. I did not yet have a detailed look, if its possible to (un)wrap this in the kernel. -- Sebastian --smpsuold57ovmvb7 Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAEBCgAdFiEE72YNB0Y/i3JqeVQT2O7X88g7+poFAlrsX8oACgkQ2O7X88g7 +prCNw//YWja9CZJXLW6bo7ByVpordi+pb9a0N0aftm11G2BqL9jQBSgzjeFktqb 1k8b6qlT4Qb+ScYd/Nqv3l4Z1nEbqN3O26LeLeiTPQtQbApdFS/E7JEuzktRNTTg Nl/QaBHB5TIVZ8VxeaxcjazhzmknsrRl8xQK1WfXZNDry7w7M00V7/F347IVAFl1 l28ryF4HkdVZyeerfmzYX1Oa741ybc+kmI1F75vvqJNtgptCeIsC9VMDvTJv8zqH jM+tEBINsEFiB1ZmYXAtgDc0Idbirqq6fPbr+qKNCky3HqXGxMoRQw27B9e/aju+ uzMC2vToFp6CanDtsJbKFKXZ56GI9g18SuOF9yi/OJzt+O77DzmumFvuUEnBP/U7 5aWZ7GEd/4p83Jgx4IcpgQA9kObvafjdHx7qGwrKm+Dua7mPx/GA20QkRYRnkl+W H2KltC1FmNrVDUAOKa5MhiT1nedk2JtbpM3s1GNR408iPdDCmsnmb3wsVE8FnYqm cJBwSu26zuoCD6CAzSOcH42ds1tF8SRGrROqA8z9e7gIagtBgcFsC2IM/jkNr1Jb xex4+A5h+ACct2oCRAuZjo7hQ1dQqRvoPV+V+lq+FRJ/yFyH4LlGYdw2dJeZaQFN lN8CzgP6SszwEIeoJu3lgHOJLSjhN8DCnXmP6JWE3l98T/t4nIo= =Pd53 -----END PGP SIGNATURE----- --smpsuold57ovmvb7--