Received: by 2002:ac0:a5b6:0:0:0:0:0 with SMTP id m51-v6csp327726imm; Fri, 1 Jun 2018 01:25:01 -0700 (PDT) X-Google-Smtp-Source: ADUXVKLCQ5+b8PkKkR74b+XXNtgPpVWy1nZDMguHa+Y+dzIL+HP9ZGxzkFQFrmQSGH2iRuhax7Am X-Received: by 2002:a17:902:622:: with SMTP id 31-v6mr10211348plg.135.1527841501441; Fri, 01 Jun 2018 01:25:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1527841501; cv=none; d=google.com; s=arc-20160816; b=SozhTybXFy5deARw1MV61Eyw9WmVg5zal/QUZ3tMCRtGqCsDdFidcePFIGkrFBJDwr iEgT5EP8lrDkCNiRv+BqMl9tt2MRoEfYAbhoRWhoeiEwvVPEgwFO5cS5idTLegg2C1ox IMLBJgD3Cn25zbKtVUj0wlwRktAtcVkvcxmb9+MadhJD9+sptZ8dCqhnJ+9wHha556mj yzPxL6C87f8c7SdyQr/bFfZi+AgTcwgL8J+gIxTU3FRkdpitiLi49vtXsrBDlz2/tiJF AnhK1ICXmeziRKAYzdZUGmF2kECCTygqtBlX2Hg7z9Fuk+X5dwSlUr/WF2qJU8XOekd0 l5Sg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from :dkim-signature:arc-authentication-results; bh=XzLqQrnRxOpnvfTX2qACcqrjOFqqG0Sz3CsiNUs47F8=; b=QW36vTU9cGwrkgLDorgbt8Iu1kCvvahfv1Huepqke+nhRuDOKMkKfhUpvMe4D2wir3 u0JWKj1mIgN7vl4hIydZHQu4k9Fjth1GBNNihxi4eW+cJsVfHjf6+rtd5YlMbCg3PVWZ maH+F/pEW/4vU4KMog7pyZVIJnU9Oxe9xTvYq9KVK0hfVg39l18wKkTeCem1Bh4d3ukA BcRsANjRo6OtSdMka8VoxTxB0vyVGeYoiI5AWsiizzP0B9ZMU1dy3czl9DqsZo7Vi0II 4a3f68CJVMPFxQjNMZGvqxm8C0Z6BPsmhrUFk4S6FA6S+HniFSvTlUEG3Lfg0Xvd5boM EoaQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@gmail.com header.s=20161025 header.b=n9gFa5Xh; 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=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id a34-v6si40061692pld.281.2018.06.01.01.24.47; Fri, 01 Jun 2018 01:25:01 -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; dkim=fail header.i=@gmail.com header.s=20161025 header.b=n9gFa5Xh; 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=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751503AbeFAIX3 (ORCPT + 99 others); Fri, 1 Jun 2018 04:23:29 -0400 Received: from mail-lf0-f68.google.com ([209.85.215.68]:40882 "EHLO mail-lf0-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751092AbeFAIXZ (ORCPT ); Fri, 1 Jun 2018 04:23:25 -0400 Received: by mail-lf0-f68.google.com with SMTP id q11-v6so13602301lfc.7; Fri, 01 Jun 2018 01:23:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id; bh=XzLqQrnRxOpnvfTX2qACcqrjOFqqG0Sz3CsiNUs47F8=; b=n9gFa5XhiTP6O0FhEbiHMuyEzx9QMLdSNtVP+pHmnT+HAx/D9PNV4286NMkdiAodc5 1Ey2X0jWediKk/I5rNTb3MZhpAiELQm2Ji3zjEl4hrfBCoHvdvMf3TzPw1L1YPK1zB2C hczlK4toJ4lmoOsZ43cnQh2vvscCqZ5yC5pJocHilkeD2+RFWMaexEFeLH8/InvD+FLx oMliQYr/G7t0bcP3plnxpbteK5p67CdjN4YRekhGAmzTImlu0u1hpWTiqJ3P06H2qIIi pQtDKcVpG5ASM089sz6zoFV0pALIhw3IcfSPiqw0OrSb7X5rYQOAQr4YcZ66pl5+SsCm yB+w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id; bh=XzLqQrnRxOpnvfTX2qACcqrjOFqqG0Sz3CsiNUs47F8=; b=PvOe0/bUdzoo/I29tsxeYikEn/1JbrxOv/KML+6Tru7vrtpvsVPjAQuWDdRAAEv/5k tAPvw5JJ8hMOjLpc3qd05pEkAPMH9gnTS793Q+RmcKSqRcCOpL3T6Fk15gCBqPeZTFfJ v7CwZoPQ/ftb9xHEfs2HO+ml/YeO1vocy/BBnKEb+v2cOWvgxrps6m/IRygd7QnU5R8z h5E3gDFDfoYlpN66XgPBWjnsHjeIKRLt2PaEyuAWe4Tuvsd6h8jwOEcY+VtkACzAwdz1 D3S/IQLh4Skrym5Aw6pMj12WMvbYcyvVJpMIcrpiWFUHyLIclVdODLvWnoWuCkyOA2nn uqLA== X-Gm-Message-State: ALKqPwfqhICE36rxBrWy3Upd6RkzzhwvQ6Now9e307Hxtp0UcsBivNfK HjfLuCd6uCxnsyYdFbUANjs= X-Received: by 2002:a19:9101:: with SMTP id t1-v6mr6116291lfd.29.1527841403742; Fri, 01 Jun 2018 01:23:23 -0700 (PDT) Received: from xi.terra (c-8bb2e655.07-184-6d6c6d4.bbcust.telenor.se. [85.230.178.139]) by smtp.gmail.com with ESMTPSA id q18-v6sm8649674lfi.97.2018.06.01.01.23.22 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 01 Jun 2018 01:23:22 -0700 (PDT) Received: from johan by xi.terra with local (Exim 4.90_1) (envelope-from ) id 1fOfLB-0004a7-9x; Fri, 01 Jun 2018 10:23:17 +0200 From: Johan Hovold To: Greg Kroah-Hartman , Rob Herring , Mark Rutland Cc: Andreas Kemnade , Arnd Bergmann , "H . Nikolaus Schaller" , Pavel Machek , Marcel Holtmann , Sebastian Reichel , Tony Lindgren , linux-kernel@vger.kernel.org, devicetree@vger.kernel.org, Johan Hovold Subject: [PATCH v3 0/8] gnss: add new GNSS subsystem Date: Fri, 1 Jun 2018 10:22:51 +0200 Message-Id: <20180601082259.17563-1-johan@kernel.org> X-Mailer: git-send-email 2.17.1 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org This series adds a new subsystem for GNSS receivers (e.g. GPS receivers). 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). 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 identification of GNSS devices. 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. 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). Another possible extension is to add generic 1PPS support. 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. Also note that writes are always synchronous instead of requiring user space to call tcdrain() after every command. 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. I have implemented drivers for receivers based on two common GNSS chipsets; SiRFstar and u-blox. Due to lack of hardware, the sirf driver has been tested using a mockup device and a USB-serial-based SiRFstar IV GPS (using out-of-tree USB-serial code). [ Let me know if you've got any evaluation kits to spare. ] The ubx driver has been tested using a u-blox 8 GNSS evaluation kit (thanks u-blox!). 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. Johan Changes in v3 - dt-bindings - clarify that "u-blox,extint-gpios" is connected to a device input pin (Rob) - fix space-before-tab whitespace issues (Rob) - use "receiver" instead of "device" in the receiver type documentation for better consistency with the rest of the series Changes in v2 - add device type support (new patch 8/8) - fix one unprotected access to ops->write_raw - add support for optional v_bckp supply to ubx driver - drop unnecessary dev_dbgs (Greg) - simplify open() error path (Greg) - indent function parameters further - use gserial->drvdata to access variable length data - dt-bindings - document required reg property for I2C, SPI and USB bindings (Rob) - use "pin name:" prefix when referring to datasheet names (Rob) - add vendor prefix to sirf gpios (Rob) - add optional u-blox v-bckp supply (Rob) - add optional u-blox extint gpio - minor clean ups - add Rob's Reviewed-by tag (patches 2/8 and 6/8) Johan Hovold (8): gnss: add GNSS receiver subsystem dt-bindings: add generic gnss binding gnss: add generic serial driver dt-bindings: gnss: add u-blox binding gnss: add driver for u-blox receivers dt-bindings: gnss: add sirfstar binding gnss: add driver for sirfstar-based receivers gnss: add receiver type support Documentation/ABI/testing/sysfs-class-gnss | 15 + .../devicetree/bindings/gnss/gnss.txt | 36 ++ .../devicetree/bindings/gnss/sirfstar.txt | 45 ++ .../devicetree/bindings/gnss/u-blox.txt | 44 ++ .../devicetree/bindings/vendor-prefixes.txt | 4 + MAINTAINERS | 8 + drivers/Kconfig | 2 + drivers/Makefile | 1 + drivers/gnss/Kconfig | 43 ++ drivers/gnss/Makefile | 16 + drivers/gnss/core.c | 420 ++++++++++++++++++ drivers/gnss/serial.c | 275 ++++++++++++ drivers/gnss/serial.h | 47 ++ drivers/gnss/sirf.c | 408 +++++++++++++++++ drivers/gnss/ubx.c | 153 +++++++ include/linux/gnss.h | 75 ++++ 16 files changed, 1592 insertions(+) create mode 100644 Documentation/ABI/testing/sysfs-class-gnss create mode 100644 Documentation/devicetree/bindings/gnss/gnss.txt create mode 100644 Documentation/devicetree/bindings/gnss/sirfstar.txt create mode 100644 Documentation/devicetree/bindings/gnss/u-blox.txt create mode 100644 drivers/gnss/Kconfig create mode 100644 drivers/gnss/Makefile create mode 100644 drivers/gnss/core.c create mode 100644 drivers/gnss/serial.c create mode 100644 drivers/gnss/serial.h create mode 100644 drivers/gnss/sirf.c create mode 100644 drivers/gnss/ubx.c create mode 100644 include/linux/gnss.h -- 2.17.1