Received: by 2002:ac0:a5b6:0:0:0:0:0 with SMTP id m51-v6csp4325128imm; Wed, 30 May 2018 03:36:15 -0700 (PDT) X-Google-Smtp-Source: ADUXVKKOKLVWK/rMFLHjM03LyEbQaah3Dg/Vv8/qmOiaPb1oNLWoI1+8lx3xJaRsh+6I/qPCnJ9t X-Received: by 2002:a17:902:b216:: with SMTP id t22-v6mr2292967plr.199.1527676575187; Wed, 30 May 2018 03:36:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1527676575; cv=none; d=google.com; s=arc-20160816; b=dVsuZ7s8euDbaI080w2LDIRdYCTR3imXZHk9TKGgckqFLaBicbRUiFV7qQZ2GS72La 2wXayxNgrmRDIUMRZdHgidsllXOcW8LXcvfnHFRxYqiwh2CWqIEvLZvOOoQdLIk9mtrP 6od6cn8cThx9ieDJdiszDc9j5yYKe+31pqLdCzQklOgH8H9npC+NbyvnSbPCqnbi+573 SD+2AZ6in9xnauiw4ilZDnQyv3iwnavUs9R+23LF6NECNG0bGo4iGLVQHagN6Ai34P/k j5zSqjbqjG0l0ZW9whLDzmweCLBCeTeXxhXcwMz70/F5QVQGVejQ7r0aXHzFl7J7u0Bf 1FyA== 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=VeCfIZqr0uvNl4bqnTWUawCja52WxLv3sKu151SDAyY=; b=R/0GOnO+V+r1o838T311mIy4Nv8mKR+krFWIkxLxBW/S3QgNy5K81/ug88znQx1S4U KB2zDNR5wKkGcoYRN+6G/vh+ywDwRi3Wy6dqbozYdYxHPxwZI/jYEgdtk3NXGkUVe3GY EZjp3Ha4raDtKVNFM58Dko71COiO46M3DNbbR6lIFUn5KKt7QQtZyqDn2OE2tn4JpVrJ UcGJOKJ8v9Tp3XJXuoTxF0x9MOCgdftDLGwMi6a8o4h3zGWz3tWpKzbbXfYcnXTx13AL dZ8RUu3JYV2sdQEuk0dLIxaVhtMt5luTeHJxNtmMYc3mZu37caHo5Q8fy7hjCY4bSts9 Vhzg== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@gmail.com header.s=20161025 header.b=sLgUKHA0; 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 m79-v6si33992747pfi.236.2018.05.30.03.36.00; Wed, 30 May 2018 03:36:15 -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=sLgUKHA0; 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 S1752217AbeE3KfJ (ORCPT + 99 others); Wed, 30 May 2018 06:35:09 -0400 Received: from mail-lf0-f67.google.com ([209.85.215.67]:36650 "EHLO mail-lf0-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751724AbeE3KeO (ORCPT ); Wed, 30 May 2018 06:34:14 -0400 Received: by mail-lf0-f67.google.com with SMTP id u4-v6so3485524lff.3; Wed, 30 May 2018 03:34:13 -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=VeCfIZqr0uvNl4bqnTWUawCja52WxLv3sKu151SDAyY=; b=sLgUKHA0sx1aWJL84y2A6py8OUE3KNEvD80NnAlkkxmnYX+1TOXCyHzQ5YQRTawmCc sO0T/70LKfVmTOUKK0gBH70R5mglS8IhNRFPso6V7IipbcshvpRvyhAZ3srfZK3V0EhX Y0AFwGtuymB5edDaZGJceQwt5PAcTwSROnVT9WPHPcvRGiniQc5gZu9PUIfYHCMERfPl Q6QI++ICvzKCn4awsy9Xg3rzfNZsOivKNkCC0OK9mYLf73Gjn7N240L4oJyCy2rT5tDn +u1uYLaXiX4Ah/1bG8vVmwwW6ta8ik4LgEgiR8RSxgQtuHl/i+ppftojw+VeNylou42n RNLA== 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=VeCfIZqr0uvNl4bqnTWUawCja52WxLv3sKu151SDAyY=; b=ZJT2UdwN47yZNJFaRzviez2zy7bi3+FBBhH9+y+a9oezIkmhQeUPKtrsQA6fInVlWC nNQI/CTrVL/DO/AZnNbLhq7Sg88quwH6B5B1QE5u6LRW06ATCNyDUbym0m17a82nZ1Ge 3iqLnWy6bDU7vhZC0T54p1yFIF2Na58syO9l1rJNNQ2PutItiOsx8x30EoF6hVTvXLIT uttQXrzncpkKPJzYHcuzZnK87m3t0tsp9K24qYCgHwOvMX5O/6QBBQo2SN9Fd+1rrrpf orfpVdf1rUtiiJ/yRYtmCuEeKK6yCuIICu4cwCjpz2cO75Zqf5rfLGaJ4B+HMe3tN1I3 WbUw== X-Gm-Message-State: ALKqPwcxCakvbS13wOCdRPEy1u6x/CqnleuK5OS+g+s+xBNEXbZ9SXAF t90x0nxzUhFHjws1wBYt24M= X-Received: by 2002:a2e:2b51:: with SMTP id q78-v6mr1659040lje.119.1527676452528; Wed, 30 May 2018 03:34:12 -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 c12-v6sm7015648lji.59.2018.05.30.03.34.07 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 30 May 2018 03:34:09 -0700 (PDT) Received: from johan by xi.terra with local (Exim 4.90_1) (envelope-from ) id 1fNyQg-0005Q0-A1; Wed, 30 May 2018 12:34:06 +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 v2 0/8] gnss: add new GNSS subsystem Date: Wed, 30 May 2018 12:32:34 +0200 Message-Id: <20180530103242.20773-1-johan@kernel.org> X-Mailer: git-send-email 2.17.0 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 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 to 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 device 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.0