gnss: add new GNSS subsystem
Subsystems (2)
Johan Hovold
maintainerv2 cover gnss: add new GNSS subsystem
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
Signature · 1 line
2.17.0
Johan Hovold
maintainerPATCH v2 1/8 gnss: add GNSS receiver subsystem
Add a new subsystem for GNSS (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.
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).
--- MAINTAINERS | 6 + drivers/Kconfig | 2 + drivers/Makefile | 1 + drivers/gnss/Kconfig | 11 ++ drivers/gnss/Makefile | 7 + drivers/gnss/core.c | 371 ++++++++++++++++++++++++++++++++++++++++++ include/linux/gnss.h | 66 ++++++++ 7 files changed, 464 insertions(+) create mode 100644 drivers/gnss/Kconfig create mode 100644 drivers/gnss/Makefile create mode 100644 drivers/gnss/core.c create mode 100644 include/linux/gnss.h
MAINTAINERS +6 -0
@@ -5962,6 +5962,12 @@ F: Documentation/isdn/README.gigaset F: drivers/isdn/gigaset/ F: include/uapi/linux/gigaset_dev.h +GNSS SUBSYSTEM +M: Johan Hovold <[email protected]> +S: Maintained +F: drivers/gnss/ +F: include/linux/gnss.h + GO7007 MPEG CODEC M: Hans Verkuil <[email protected]> L: [email protected]
drivers/Kconfig +2 -0
@@ -9,6 +9,8 @@ source "drivers/bus/Kconfig" source "drivers/connector/Kconfig" +source "drivers/gnss/Kconfig" + source "drivers/mtd/Kconfig" source "drivers/of/Kconfig"
drivers/Makefile +1 -0
@@ -185,3 +185,4 @@ obj-$(CONFIG_TEE) += tee/ obj-$(CONFIG_MULTIPLEXER) += mux/ obj-$(CONFIG_UNISYS_VISORBUS) += visorbus/ obj-$(CONFIG_SIOX) += siox/ +obj-$(CONFIG_GNSS) += gnss/
drivers/gnss/Kconfig new file +11 -0
@@ -0,0 +1,11 @@ +# +# GNSS receiver configuration +# + +menuconfig GNSS + tristate "GNSS receiver support" + ---help--- + Say Y here if you have a GNSS receiver (e.g. a GPS receiver). + + To compile this driver as a module, choose M here: the module will + be called gnss.
drivers/gnss/Makefile new file +7 -0
@@ -0,0 +1,7 @@ +# SPDX-License-Identifier: GPL-2.0 +# +# Makefile for the GNSS subsystem. +# + +obj-$(CONFIG_GNSS) += gnss.o +gnss-y := core.o
drivers/gnss/core.c new file +371 -0
371 lines not on this page · raw message
include/linux/gnss.h new file +66 -0
66 lines not on this page · raw message
Signature · 1 line
2.17.0
Johan Hovold
maintainerPATCH v2 2/8 dt-bindings: add generic gnss binding
In reply to Johan HovoldDescribe generic properties for GNSS receivers.
--- .../devicetree/bindings/gnss/gnss.txt | 36 +++++++++++++++++++ MAINTAINERS | 1 + 2 files changed, 37 insertions(+) create mode 100644 Documentation/devicetree/bindings/gnss/gnss.txt
Documentation/devicetree/bindings/gnss/gnss.txt new file +36 -0
@@ -0,0 +1,36 @@ +GNSS Receiver DT binding + +This documents the binding structure and common properties for GNSS receiver +devices. + +A GNSS receiver node is a node named "gnss" and typically resides on a serial +bus (e.g. UART, I2C or SPI). + +Please refer to the following documents for generic properties: + + Documentation/devicetree/bindings/serial/slave-device.txt + Documentation/devicetree/bindings/spi/spi-bus.txt + +Required properties: + +- compatible : A string reflecting the vendor and specific device the node + represents + +Optional properties: +- enable-gpios : GPIO used to enable the device +- timepulse-gpios : Time pulse GPIO + +Example: + +serial@1234 { + compatible = "ns16550a"; + + gnss { + compatible = "u-blox,neo-8"; + + vcc-supply = <&gnss_reg>; + timepulse-gpios = <&gpio0 16 GPIO_ACTIVE_HIGH>; + + current-speed = <4800>; + }; +};
MAINTAINERS +1 -0
@@ -5965,6 +5965,7 @@ F: include/uapi/linux/gigaset_dev.h GNSS SUBSYSTEM M: Johan Hovold <[email protected]> S: Maintained +F: Documentation/devicetree/bindings/gnss/ F: drivers/gnss/ F: include/linux/gnss.h
Signature · 1 line
2.17.0
Johan Hovold
maintainerPATCH v2 3/8 gnss: add generic serial driver
In reply to Johan HovoldAdd a generic serial GNSS driver (library) which provides a common implementation for the gnss interface and power management (runtime and system suspend). This allows GNSS drivers for specific chip to be implemented by simply providing a set_power() callback to handle three
states: ACTIVE, STANDBY and OFF.
--- drivers/gnss/Kconfig | 7 ++ drivers/gnss/Makefile | 3 + drivers/gnss/serial.c | 275 ++++++++++++++++++++++++++++++++++++++++++ drivers/gnss/serial.h | 47 ++++++++ 4 files changed, 332 insertions(+) create mode 100644 drivers/gnss/serial.c create mode 100644 drivers/gnss/serial.h
drivers/gnss/Kconfig +7 -0
@@ -9,3 +9,10 @@ menuconfig GNSS To compile this driver as a module, choose M here: the module will be called gnss. + +if GNSS + +config GNSS_SERIAL + tristate + +endif # GNSS
drivers/gnss/Makefile +3 -0
@@ -5,3 +5,6 @@ obj-$(CONFIG_GNSS) += gnss.o gnss-y := core.o + +obj-$(CONFIG_GNSS_SERIAL) += gnss-serial.o +gnss-serial-y := serial.o
drivers/gnss/serial.c new file +275 -0
275 lines not on this page · raw message
drivers/gnss/serial.h new file +47 -0
47 lines not on this page · raw message
Signature · 1 line
2.17.0
Johan Hovold
maintainerPATCH v2 4/8 dt-bindings: gnss: add u-blox binding
In reply to Johan HovoldAdd binding for u-blox GNSS receivers.
Note that the u-blox product names encodes form factor (e.g. "neo"), chipset (e.g. "8") and variant (e.g. "q"), but that only formfactor and chipset is used for the compatible strings (for now).
--- .../devicetree/bindings/gnss/u-blox.txt | 44 +++++++++++++++++++ .../devicetree/bindings/vendor-prefixes.txt | 1 + 2 files changed, 45 insertions(+) create mode 100644 Documentation/devicetree/bindings/gnss/u-blox.txt
Documentation/devicetree/bindings/gnss/u-blox.txt new file +44 -0
@@ -0,0 +1,44 @@ +u-blox GNSS Receiver DT binding + +The u-blox GNSS receivers can use UART, DDC (I2C), SPI and USB interfaces. + +Please see Documentation/devicetree/bindings/gnss/gnss.txt for generic +properties. + +Required properties: + +- compatible : Must be one of + + "u-blox,neo-8" + "u-blox,neo-m8" + +- vcc-supply : Main voltage regulator + +Required properties (DDC): +- reg : DDC (I2C) slave address + +Required properties (SPI): +- reg : SPI chip select address + +Required properties (USB): +- reg : Number of the USB hub port or the USB host-controller port + to which this device is attached + +Optional properties: + +- timepulse-gpios : Time pulse GPIO +- u-blox,extint-gpios : External interrupt GPIO +- v-bckp-supply : Backup voltage regulator + +Example: + +serial@1234 { + compatible = "ns16550a"; + + gnss { + compatible = "u-blox,neo-8"; + + v-bckp-supply = <&gnss_v_bckp_reg>; + vcc-supply = <&gnss_vcc_reg>; + }; +};
Documentation/devicetree/bindings/vendor-prefixes.txt +1 -0
@@ -374,6 +374,7 @@ tronsmart Tronsmart truly Truly Semiconductors Limited tsd Theobroma Systems Design und Consulting GmbH tyan Tyan Computer Corporation +u-blox u-blox ucrobotics uCRobotics ubnt Ubiquiti Networks udoo Udoo
Signature · 1 line
2.17.0
Rob Herring
maintainerRe: [PATCH v2 4/8] dt-bindings: gnss: add u-blox binding
Quoted 19 lines · Johan Hovold
Add binding for u-blox GNSS receivers.
Note that the u-blox product names encodes form factor (e.g. "neo"), chipset (e.g. "8") and variant (e.g. "q"), but that only formfactor and chipset is used for the compatible strings (for now).
Signed-off-by Johan Hovold <[email protected]>--- .../devicetree/bindings/gnss/u-blox.txt | 44 +++++++++++++++++++ .../devicetree/bindings/vendor-prefixes.txt | 1 + 2 files changed, 45 insertions(+) create mode 100644 Documentation/devicetree/bindings/gnss/u-blox.txtDocumentation/devicetree/bindings/gnss/u-blox.txt new file +0
-0
Documentation/devicetree/bindings/gnss/u-blox.txt line 10
Quoted 10 lines
Documentation/devicetree/bindings/gnss/u-blox.txt new file +10
-0@@ -0,0 +1,44 @@ +u-blox GNSS Receiver DT binding + +The u-blox GNSS receivers can use UART, DDC (I2C), SPI and USB interfaces. + +Please see Documentation/devicetree/bindings/gnss/gnss.txt for generic +properties. + +Required properties: + +- compatible : Must be one of
mixture of space and tab here.
Quoted 10 lines
Documentation/devicetree/bindings/gnss/u-blox.txt new file +10
-0+ + "u-blox,neo-8" + "u-blox,neo-m8" + +- vcc-supply : Main voltage regulator + +Required properties (DDC): +- reg : DDC (I2C) slave address + +Required properties (SPI):
Documentation/devicetree/bindings/gnss/u-blox.txt line 30
Quoted 10 lines
Documentation/devicetree/bindings/gnss/u-blox.txt new file +10
-0+- reg : SPI chip select address + +Required properties (USB): +- reg : Number of the USB hub port or the USB host-controller port + to which this device is attached + +Optional properties: + +- timepulse-gpios : Time pulse GPIO +- u-blox,extint-gpios : External interrupt GPIO
This should be interrupts property instead of a gpio.
Quoted 29 lines
Documentation/devicetree/bindings/gnss/u-blox.txt new file +14
-0+- v-bckp-supply : Backup voltage regulator + +Example: + +serial@1234 { + compatible = "ns16550a"; + + gnss { + compatible = "u-blox,neo-8"; + + v-bckp-supply = <&gnss_v_bckp_reg>; + vcc-supply = <&gnss_vcc_reg>; + }; +};Documentation/devicetree/bindings/vendor-prefixes.txt +1
-0@@ -374,6 +374,7 @@ tronsmart Tronsmart truly Truly Semiconductors Limited tsd Theobroma Systems Design und Consulting GmbH tyan Tyan Computer Corporation +u-blox u-blox ucrobotics uCRobotics ubnt Ubiquiti Networks udoo UdooSignature · 1 line
2.17.0
Johan Hovold
maintainerRe: [PATCH v2 4/8] dt-bindings: gnss: add u-blox binding
Quoted 24 lines · Rob Herring
Quoted 23 lines · Johan Hovold
Add binding for u-blox GNSS receivers.
Note that the u-blox product names encodes form factor (e.g. "neo"), chipset (e.g. "8") and variant (e.g. "q"), but that only formfactor and chipset is used for the compatible strings (for now).
Signed-off-by Johan Hovold <[email protected]>--- .../devicetree/bindings/gnss/u-blox.txt | 44 +++++++++++++++++++ .../devicetree/bindings/vendor-prefixes.txt | 1 + 2 files changed, 45 insertions(+) create mode 100644 Documentation/devicetree/bindings/gnss/u-blox.txtDocumentation/devicetree/bindings/gnss/u-blox.txt new file +4
-0@@ -0,0 +1,44 @@ +u-blox GNSS Receiver DT binding + +The u-blox GNSS receivers can use UART, DDC (I2C), SPI and USB interfaces. +
Quoted 8 lines
Documentation/devicetree/bindings/gnss/u-blox.txt line 10
Quoted 6 lines
Documentation/devicetree/bindings/gnss/u-blox.txt new file +6
-0+Please see Documentation/devicetree/bindings/gnss/gnss.txt for generic +properties. + +Required properties: + +- compatible : Must be one ofmixture of space and tab here.
Oops. Same single space character before the tab here in all three binding docs (and in the in-tree slave_devices.txt which I think I used as a template).
Do you want me to fix this even if this turns out to be the only thing that needs to be addressed in a v3?
Quoted 14 lines
Quoted 14 lines
Documentation/devicetree/bindings/gnss/u-blox.txt new file +14
-0+ + "u-blox,neo-8" + "u-blox,neo-m8" + +- vcc-supply : Main voltage regulator + +Required properties (DDC): +- reg : DDC (I2C) slave address + +Required properties (SPI): +- reg : SPI chip select address + +Required properties (USB): +- reg : Number of the USB hub port or the USB host-controller port
Quoted 8 lines
Documentation/devicetree/bindings/gnss/u-blox.txt line 30
Quoted 6 lines
Documentation/devicetree/bindings/gnss/u-blox.txt new file +6
-0+ to which this device is attached + +Optional properties: + +- timepulse-gpios : Time pulse GPIO +- u-blox,extint-gpios : External interrupt GPIOThis should be interrupts property instead of a gpio.
Contrary to what the name may suggest, this pin is actually an input which can be used to control active power or to provide time or frequency aiding data to the receiver (see section 1.13 in [1]).
I only added it for completeness as the driver does not use it currently. Remove, leave as is, or add "input" to the description as in:
- u-blox,extint-gpios : External interrupt input GPIO
perhaps?
Thanks,
Johan
[1] https://www.u-blox.com/sites/default/files/NEO-8Q_DataSheet_%28UBX-15031913%29.pdf
Rob Herring
maintainerRe: [PATCH v2 4/8] dt-bindings: gnss: add u-blox binding
Quoted 34 lines · Johan Hovold
Quoted 24 lines · Rob Herring
Quoted 23 lines · Johan Hovold
Add binding for u-blox GNSS receivers.
Note that the u-blox product names encodes form factor (e.g. "neo"), chipset (e.g. "8") and variant (e.g. "q"), but that only formfactor and chipset is used for the compatible strings (for now).
Signed-off-by Johan Hovold <[email protected]>--- .../devicetree/bindings/gnss/u-blox.txt | 44 +++++++++++++++++++ .../devicetree/bindings/vendor-prefixes.txt | 1 + 2 files changed, 45 insertions(+) create mode 100644 Documentation/devicetree/bindings/gnss/u-blox.txtDocumentation/devicetree/bindings/gnss/u-blox.txt new file +4
-0@@ -0,0 +1,44 @@ +u-blox GNSS Receiver DT binding + +The u-blox GNSS receivers can use UART, DDC (I2C), SPI and USB interfaces. +Quoted 8 lines
Documentation/devicetree/bindings/gnss/u-blox.txt line 10
Quoted 6 lines
Documentation/devicetree/bindings/gnss/u-blox.txt new file +6
-0+Please see Documentation/devicetree/bindings/gnss/gnss.txt for generic +properties. + +Required properties: + +- compatible : Must be one ofmixture of space and tab here.
Quoted 3 lines
Oops. Same single space character before the tab here in all three binding docs (and in the in-tree slave_devices.txt which I think I used as a template).
Who wrote that crap? ;)
Quoted 2 lines
Do you want me to fix this even if this turns out to be the only thing that needs to be addressed in a v3?
No
Quoted 24 lines
Quoted 15 lines
Quoted 15 lines
Documentation/devicetree/bindings/gnss/u-blox.txt new file +14
-0+ + "u-blox,neo-8" + "u-blox,neo-m8" + +- vcc-supply : Main voltage regulator + +Required properties (DDC): +- reg : DDC (I2C) slave address + +Required properties (SPI): +- reg : SPI chip select address + +Required properties (USB): +- reg : Number of the USB hub port or the USB host-controller portQuoted 8 lines
Documentation/devicetree/bindings/gnss/u-blox.txt line 30
Quoted 6 lines
Documentation/devicetree/bindings/gnss/u-blox.txt new file +6
-0+ to which this device is attached + +Optional properties: + +- timepulse-gpios : Time pulse GPIO +- u-blox,extint-gpios : External interrupt GPIOThis should be interrupts property instead of a gpio.
Quoted 8 lines
Contrary to what the name may suggest, this pin is actually an input which can be used to control active power or to provide time or frequency aiding data to the receiver (see section 1.13 in [1]).
I only added it for completeness as the driver does not use it currently. Remove, leave as is, or add "input" to the description as in:
- u-blox,extint-gpios : External interrupt input GPIO
Yes. You should also define the active level.
Rob
Johan Hovold
maintainerRe: [PATCH v2 4/8] dt-bindings: gnss: add u-blox binding
Quoted 35 lines · Rob Herring
Quoted 34 lines · Johan Hovold
Quoted 32 lines · Rob Herring
Quoted 19 lines · Johan Hovold
Add binding for u-blox GNSS receivers.
Note that the u-blox product names encodes form factor (e.g. "neo"), chipset (e.g. "8") and variant (e.g. "q"), but that only formfactor and chipset is used for the compatible strings (for now).
Signed-off-by Johan Hovold <[email protected]>--- .../devicetree/bindings/gnss/u-blox.txt | 44 +++++++++++++++++++ .../devicetree/bindings/vendor-prefixes.txt | 1 + 2 files changed, 45 insertions(+) create mode 100644 Documentation/devicetree/bindings/gnss/u-blox.txtDocumentation/devicetree/bindings/gnss/u-blox.txt new file +0
-0Documentation/devicetree/bindings/gnss/u-blox.txt line 10
Quoted 10 lines
Documentation/devicetree/bindings/gnss/u-blox.txt new file +10
-0@@ -0,0 +1,44 @@ +u-blox GNSS Receiver DT binding + +The u-blox GNSS receivers can use UART, DDC (I2C), SPI and USB interfaces. + +Please see Documentation/devicetree/bindings/gnss/gnss.txt for generic +properties. + +Required properties: + +- compatible : Must be one ofmixture of space and tab here.
Quoted 5 lines
Quoted 3 lines
Oops. Same single space character before the tab here in all three binding docs (and in the in-tree slave_devices.txt which I think I used as a template).
Who wrote that crap? ;)
Heh.
Quoted 28 lines
Quoted 28 lines
Quoted 15 lines
Quoted 15 lines
Documentation/devicetree/bindings/gnss/u-blox.txt new file +14
-0+ + "u-blox,neo-8" + "u-blox,neo-m8" + +- vcc-supply : Main voltage regulator + +Required properties (DDC): +- reg : DDC (I2C) slave address + +Required properties (SPI): +- reg : SPI chip select address + +Required properties (USB): +- reg : Number of the USB hub port or the USB host-controller portQuoted 8 lines
Documentation/devicetree/bindings/gnss/u-blox.txt line 30
Quoted 6 lines
Documentation/devicetree/bindings/gnss/u-blox.txt new file +6
-0+ to which this device is attached + +Optional properties: + +- timepulse-gpios : Time pulse GPIO +- u-blox,extint-gpios : External interrupt GPIOThis should be interrupts property instead of a gpio.
Contrary to what the name may suggest, this pin is actually an input which can be used to control active power or to provide time or frequency aiding data to the receiver (see section 1.13 in [1]).
Quoted 6 lines
Quoted 4 lines
I only added it for completeness as the driver does not use it currently. Remove, leave as is, or add "input" to the description as in:
- u-blox,extint-gpios : External interrupt input GPIO
Yes. You should also define the active level.
The active level appears to be runtime configurable and dependent on the selected function. For power control it can be used to control force-on (active high), force-off (active low) or both; and for time aiding sampling on falling or rising edge is also configurable. And who knows what else this pin is used for next time they update the firmware. ;)
Shall I remove the property, or just add "input" as suggested above?
Thanks,
Johan
Rob Herring
maintainerRe: [PATCH v2 4/8] dt-bindings: gnss: add u-blox binding
Quoted 77 lines · Johan Hovold
Quoted 35 lines · Rob Herring
Quoted 34 lines · Johan Hovold
Quoted 32 lines · Rob Herring
Quoted 19 lines · Johan Hovold
Add binding for u-blox GNSS receivers.
Note that the u-blox product names encodes form factor (e.g. "neo"), chipset (e.g. "8") and variant (e.g. "q"), but that only formfactor and chipset is used for the compatible strings (for now).
Signed-off-by Johan Hovold <[email protected]>--- .../devicetree/bindings/gnss/u-blox.txt | 44 +++++++++++++++++++ .../devicetree/bindings/vendor-prefixes.txt | 1 + 2 files changed, 45 insertions(+) create mode 100644 Documentation/devicetree/bindings/gnss/u-blox.txtDocumentation/devicetree/bindings/gnss/u-blox.txt new file +0
-0Documentation/devicetree/bindings/gnss/u-blox.txt line 10
Quoted 10 lines
Documentation/devicetree/bindings/gnss/u-blox.txt new file +10
-0@@ -0,0 +1,44 @@ +u-blox GNSS Receiver DT binding + +The u-blox GNSS receivers can use UART, DDC (I2C), SPI and USB interfaces. + +Please see Documentation/devicetree/bindings/gnss/gnss.txt for generic +properties. + +Required properties: + +- compatible : Must be one ofmixture of space and tab here.
Quoted 5 lines
Quoted 3 lines
Oops. Same single space character before the tab here in all three binding docs (and in the in-tree slave_devices.txt which I think I used as a template).
Who wrote that crap? ;)
Heh.
Quoted 33 lines
Quoted 32 lines
Quoted 15 lines
Quoted 15 lines
Documentation/devicetree/bindings/gnss/u-blox.txt new file +14
-0+ + "u-blox,neo-8" + "u-blox,neo-m8" + +- vcc-supply : Main voltage regulator + +Required properties (DDC): +- reg : DDC (I2C) slave address + +Required properties (SPI): +- reg : SPI chip select address + +Required properties (USB): +- reg : Number of the USB hub port or the USB host-controller portQuoted 8 lines
Documentation/devicetree/bindings/gnss/u-blox.txt line 30
Quoted 6 lines
Documentation/devicetree/bindings/gnss/u-blox.txt new file +6
-0+ to which this device is attached + +Optional properties: + +- timepulse-gpios : Time pulse GPIO +- u-blox,extint-gpios : External interrupt GPIOThis should be interrupts property instead of a gpio.
Contrary to what the name may suggest, this pin is actually an input which can be used to control active power or to provide time or frequency aiding data to the receiver (see section 1.13 in [1]).
I only added it for completeness as the driver does not use it currently. Remove, leave as is, or add "input" to the description as in:
- u-blox,extint-gpios : External interrupt input GPIO
Quoted 7 lines
Quoted 1 line
Yes. You should also define the active level.
The active level appears to be runtime configurable and dependent on the selected function. For power control it can be used to control force-on (active high), force-off (active low) or both; and for time aiding sampling on falling or rising edge is also configurable. And who knows what else this pin is used for next time they update the firmware. ;)
Okay.
Quoted 1 line
Shall I remove the property, or just add "input" as suggested above?
Just add "input".
Rob
Johan Hovold
maintainerRe: [PATCH v2 4/8] dt-bindings: gnss: add u-blox binding
Quoted 31 lines · Rob Herring
Quoted 22 lines · Johan Hovold
Quoted 21 lines · Rob Herring
Quoted 19 lines · Johan Hovold
Quoted 9 lines · Rob Herring
Documentation/devicetree/bindings/gnss/u-blox.txt line 30
Quoted 6 lines · Johan Hovold
Add binding for u-blox GNSS receivers.
Documentation/devicetree/bindings/gnss/u-blox.txt new file +4
-0+Optional properties: + +- timepulse-gpios : Time pulse GPIO +- u-blox,extint-gpios : External interrupt GPIOThis should be interrupts property instead of a gpio.
Contrary to what the name may suggest, this pin is actually an input which can be used to control active power or to provide time or frequency aiding data to the receiver (see section 1.13 in [1]).
I only added it for completeness as the driver does not use it currently. Remove, leave as is, or add "input" to the description as in:
- u-blox,extint-gpios : External interrupt input GPIO
Quoted 7 lines
Quoted 1 line
Yes. You should also define the active level.
The active level appears to be runtime configurable and dependent on the selected function. For power control it can be used to control force-on (active high), force-off (active low) or both; and for time aiding sampling on falling or rising edge is also configurable. And who knows what else this pin is used for next time they update the firmware. ;)
Quoted 5 lines
Okay.
Quoted 1 line
Shall I remove the property, or just add "input" as suggested above?
Just add "input".
I ended up rewording this as
u-blox,extint-gpios : GPIO connected to the "external
interrupt" input pin
to avoid any confusion about the direction of the GPIO.
Thanks,
Johan
Johan Hovold
maintainerPATCH v2 5/8 gnss: add driver for u-blox receivers
In reply to Johan HovoldAdd driver for serial-connected u-blox GNSS receivers.
Note that the driver uses the generic GNSS serial implementation and therefore essentially only manages power abstracted into three power
states: ACTIVE, STANDBY, and OFF.
For u-blox receivers with a main supply and no enable-gpios, this simply means that the main supply is disabled in STANDBY and OFF (the optional backup supply is kept enabled while the driver is bound).
Note that timepulse-support is not yet implemented.
--- drivers/gnss/Kconfig | 13 ++++ drivers/gnss/Makefile | 3 + drivers/gnss/ubx.c | 151 ++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 167 insertions(+) create mode 100644 drivers/gnss/ubx.c
drivers/gnss/Kconfig +13 -0
@@ -15,4 +15,17 @@ if GNSS config GNSS_SERIAL tristate +config GNSS_UBX_SERIAL + tristate "u-blox GNSS receiver support" + depends on SERIAL_DEV_BUS + select GNSS_SERIAL + ---help--- + Say Y here if you have a u-blox GNSS receiver which uses a serial + interface. + + To compile this driver as a module, choose M here: the module will + be called gnss-ubx. + + If unsure, say N. + endif # GNSS
drivers/gnss/Makefile +3 -0
@@ -8,3 +8,6 @@ gnss-y := core.o obj-$(CONFIG_GNSS_SERIAL) += gnss-serial.o gnss-serial-y := serial.o + +obj-$(CONFIG_GNSS_UBX_SERIAL) += gnss-ubx.o +gnss-ubx-y := ubx.o
drivers/gnss/ubx.c new file +151 -0
151 lines not on this page · raw message
Signature · 1 line
2.17.0
kbuild test robot
build botRe: [PATCH v2 5/8] gnss: add driver for u-blox receivers
I love your patch! Perhaps something to improve:
Hi Johan,
I love your patch! Perhaps something to improve:
[auto build test WARNING on linus/master]
[also build test WARNING on v4.17-rc7 next-20180601]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]
url: https://github.com/0day-ci/linux/commits/Johan-Hovold/gnss-add-new-GNSS-subsystem/20180602-020421
reproduce:
# apt-get install sparse
make ARCH=x86_64 allmodconfig
make C=1 CF=-D__CHECK_ENDIAN__sparse warnings: (new ones prefixed by >>)
>> drivers/gnss/ubx.c:62:30: sparse: symbol 'ubx_gserial_ops' was not declared. Should it be static?
Please review and possibly fold the followup patch.
---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation
kbuild test robot
build bot[RFC PATCH] gnss: ubx_gserial_ops can be static
In reply to Johan HovoldFixes: 45cad4b6d339 ("gnss: add driver for u-blox receivers")
--- ubx.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gnss/ubx.c +1 -1
@@ -59,7 +59,7 @@ static int ubx_set_power(struct gnss_serial *gserial,return -EINVAL ; } -const struct gnss_serial_ops ubx_gserial_ops = { +static const struct gnss_serial_ops ubx_gserial_ops = { .set_power = ubx_set_power, };
Johan Hovold
maintainerPATCH v2 6/8 dt-bindings: gnss: add sirfstar binding
In reply to Johan HovoldAdd binding for SiRFstar-based GNSS receivers.
Note that while four compatible-strings are initially added representing devices which differ in which I/O interfaces they support, they otherwise essentially share the same feature set.
Pin and supply names vary slightly, as do some recommended timings.
Note that the wakeup gpio is not intended to be used as a wakeup source, but rather to detect the current power state of the device (active or hibernate).
--- .../devicetree/bindings/gnss/sirfstar.txt | 45 +++++++++++++++++++ .../devicetree/bindings/vendor-prefixes.txt | 3 ++ 2 files changed, 48 insertions(+) create mode 100644 Documentation/devicetree/bindings/gnss/sirfstar.txt
Documentation/devicetree/bindings/gnss/sirfstar.txt new file +45 -0
@@ -0,0 +1,45 @@ +SiRFstar-based GNSS Receiver DT binding + +SiRFstar chipsets are used in GNSS-receiver modules produced by several +vendors and can use UART, SPI or I2C interfaces. + +Please see Documentation/devicetree/bindings/gnss/gnss.txt for generic +properties. + +Required properties: + +- compatible : Must be one of + + "fastrax,uc430" + "linx,r4" + "wi2wi,w2sg0008i" + "wi2wi,w2sg0084i" + +- vcc-supply : Main voltage regulator (pin name: 3V3_IN, VCC, VDD) + +Required properties (I2C): +- reg : I2C slave address + +Required properties (SPI): +- reg : SPI chip select address + +Optional properties: + +- sirf,onoff-gpios : GPIO used to power on and off device (pin name: ON_OFF) +- sirf,wakeup-gpios : GPIO used to determine device power state + (pin name: RFPWRUP, WAKEUP) +- timepulse-gpios : Time pulse GPIO (pin name: 1PPS, TM) + +Example: + +serial@1234 { + compatible = "ns16550a"; + + gnss { + compatible = "wi2wi,w2sg0084i"; + + vcc-supply = <&gnss_reg>; + sirf,onoff-gpios = <&gpio0 16 GPIO_ACTIVE_HIGH>; + sirf,wakeup-gpios = <&gpio0 17 GPIO_ACTIVE_HIGH>; + }; +};
Documentation/devicetree/bindings/vendor-prefixes.txt +3 -0
@@ -120,6 +120,7 @@ excito Excito ezchip EZchip Semiconductor fairphone Fairphone B.V. faraday Faraday Technology Corporation +fastrax Fastrax Oy fcs Fairchild Semiconductor firefly Firefly focaltech FocalTech Systems Co.,Ltd
@@ -197,6 +198,7 @@ licheepi Lichee Pi linaro Linaro Limited linksys Belkin International, Inc. (Linksys) linux Linux-specific binding +linx Linx Technologies lltc Linear Technology Corporation lsi LSI Corp. (LSI Logic) lwn Liebherr-Werk Nenzing GmbH
@@ -393,6 +395,7 @@ vot Vision Optical Technology Co., Ltd. wd Western Digital Corp. wetek WeTek Electronics, limited. wexler Wexler +wi2wi Wi2Wi, Inc. winbond Winbond Electronics corp. winstar Winstar Display Corp. wlf Wolfson Microelectronics
Signature · 1 line
2.17.0
Johan Hovold
maintainerPATCH v2 7/8 gnss: add driver for sirfstar-based receivers
In reply to Johan HovoldAdd driver for serial-connected SiRFstar-based GNSS receivers.
These devices typically boot into hibernate mode from which they can be woken using a pulse on the ON_OFF input pin. Once active, a pulse on the same ON_OFF pin is used to put the device back into hibernate mode. The current state can be determined by sampling the WAKEUP output.
Hardware configurations where WAKEUP has been connected to ON_OFF (and where an initial WAKEUP pulse during boot is sufficient to have the device boot into active mode) are also supported. In this case, device power is managed using the main-supply regulator only.
Note that configurations where WAKEUP is left not connected, so that the device power state can only indirectly be determined using the I/O interface, is currently not supported. It should be fairly straight-forward to extend the current implementation with such support however (and this this is the main reason for not using the generic serial implementation for this driver).
Note that timepulse-support is left unimplemented.
--- drivers/gnss/Kconfig | 12 ++ drivers/gnss/Makefile | 3 + drivers/gnss/sirf.c | 407 ++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 422 insertions(+) create mode 100644 drivers/gnss/sirf.c
drivers/gnss/Kconfig +12 -0
@@ -15,6 +15,18 @@ if GNSS config GNSS_SERIAL tristate +config GNSS_SIRF_SERIAL + tristate "SiRFstar GNSS receiver support" + depends on SERIAL_DEV_BUS + ---help--- + Say Y here if you have a SiRFstar-based GNSS receiver which uses a + serial interface. + + To compile this driver as a module, choose M here: the module will + be called gnss-sirf. + + If unsure, say N. + config GNSS_UBX_SERIAL tristate "u-blox GNSS receiver support" depends on SERIAL_DEV_BUS
drivers/gnss/Makefile +3 -0
@@ -9,5 +9,8 @@ gnss-y := core.o obj-$(CONFIG_GNSS_SERIAL) += gnss-serial.o gnss-serial-y := serial.o +obj-$(CONFIG_GNSS_SIRF_SERIAL) += gnss-sirf.o +gnss-sirf-y := sirf.o + obj-$(CONFIG_GNSS_UBX_SERIAL) += gnss-ubx.o gnss-ubx-y := ubx.o
drivers/gnss/sirf.c new file +407 -0
407 lines not on this page · raw message
Signature · 1 line
2.17.0
Johan Hovold
maintainerPATCH v2 8/8 gnss: add device type support
In reply to Johan HovoldAdd a "type" device attribute and a "GNSS_TYPE" uevent variable which can be used to determine the type of a GNSS device. The currently identified types reflect the protocol(s) supported by a device:
"NMEA" NMEA 0183 "SiRF" SiRF Binary "UBX" UBX
Note that both SiRF and UBX type devices typically support a subset of NMEA 0183 with vendor extensions (e.g. to allow switching to the vendor protocol).
--- Documentation/ABI/testing/sysfs-class-gnss | 15 +++++++ MAINTAINERS | 1 + drivers/gnss/core.c | 49 ++++++++++++++++++++++ drivers/gnss/sirf.c | 1 + drivers/gnss/ubx.c | 2 + include/linux/gnss.h | 9 ++++ 6 files changed, 77 insertions(+) create mode 100644 Documentation/ABI/testing/sysfs-class-gnss
Documentation/ABI/testing/sysfs-class-gnss new file +15 -0
@@ -0,0 +1,15 @@ +What: /sys/class/gnss/gnssN/type +Date: May 2018 +KernelVersion: 4.18 +Contact: Johan Hovold <[email protected]> +Description: + The GNSS device type. The currently identified types reflect + the protocol(s) supported by the device: + + "NMEA" NMEA 0183 + "SiRF" SiRF Binary + "UBX" UBX + + Note that also non-"NMEA" type devices typically support a + subset of NMEA 0183 with vendor extensions (e.g. to allow + switching to a vendor protocol).
MAINTAINERS +1 -0
@@ -5965,6 +5965,7 @@ F: include/uapi/linux/gigaset_dev.h GNSS SUBSYSTEM M: Johan Hovold <[email protected]> S: Maintained +F: Documentation/ABI/testing/sysfs-class-gnss F: Documentation/devicetree/bindings/gnss/ F: drivers/gnss/ F: include/linux/gnss.h
drivers/gnss/core.c +49 -0
61 lines not on this page · raw message
drivers/gnss/sirf.c +1 -0
@@ -267,6 +267,7 @@ static int sirf_probe(struct serdev_device *serdev)if (!gdev)return -ENOMEM ; + gdev->type =GNSS_TYPE_SIRF ; gdev->ops = &sirf_gnss_ops;gnss_set_drvdata (gdev, data);
drivers/gnss/ubx.c +2 -0
@@ -77,6 +77,8 @@ static int ubx_probe(struct serdev_device *serdev) gserial->ops = &ubx_gserial_ops; + gserial->gdev->type =GNSS_TYPE_UBX ; + data =gnss_serial_get_drvdata (gserial); data->vcc =devm_regulator_get (&serdev->dev,"vcc" );
include/linux/gnss.h +9 -0
@@ -18,6 +18,14 @@struct gnss_device ; +enum gnss_type { +GNSS_TYPE_NMEA =0 , +GNSS_TYPE_SIRF , +GNSS_TYPE_UBX , + +GNSS_TYPE_COUNT +}; +struct gnss_operations {int (*open)(struct gnss_device *gdev);void (*close)(struct gnss_device *gdev);
@@ -30,6 +38,7 @@ struct gnss_device {struct cdev cdev;int id; +enum gnss_type type;unsigned long flags;struct rw_semaphore rwsem;
Signature · 1 line
2.17.0
Quoted 1 line · Johan Hovold
Another possible extension is to add generic 1PPS support.
There are two possibilities to consider.
1. If the PPS causes an interrupt, then it should hook into the PPS subsystem.
2. If the PPS is a HW signal routed for example to the input pin of a MAC based PTP Hardware Clock (PHC), then it would make sense to model the GNSS device as a PHC as well. This PHC would be readable but not writable, and more importantly it would offer an output signal. Then user space could use the existing interfaces to dial the PPS signal from one device the another.
(Come to think of it, modeling the GNSS as PHC would also give you the interface for #1 as well.)
Thanks,
Richard
Johan Hovold
maintainerQuoted 7 lines · Richard Cochran
Quoted 1 line · Johan Hovold
Another possible extension is to add generic 1PPS support.
There are two possibilities to consider.
1. If the PPS causes an interrupt, then it should hook into the PPS subsystem.
Registering a PPS child device is what I had in mind for this.
Quoted 6 lines
2. If the PPS is a HW signal routed for example to the input pin of a MAC based PTP Hardware Clock (PHC), then it would make sense to model the GNSS device as a PHC as well. This PHC would be readable but not writable, and more importantly it would offer an output signal. Then user space could use the existing interfaces to dial the PPS signal from one device the another.
Ok.
Quoted 2 lines
(Come to think of it, modeling the GNSS as PHC would also give you the interface for #1 as well.)
Thanks
Johan
Quoted 5 lines
Am 31.05.2018 um 10:52 schrieb Johan Hovold <[email protected]>:
Quoted 1 line · Richard Cochran
On Wed, May 30, 2018 at 12:32:34PM +0200, Johan Hovold wrote:
Quoted 8 lines
Quoted 6 lines
Quoted 1 line
Another possible extension is to add generic 1PPS support.
There are two possibilities to consider.
1. If the PPS causes an interrupt, then it should hook into the PPS subsystem.
Registering a PPS child device is what I had in mind for this.
This seems to be duplicating functionality that is already solved by
https://elixir.bootlin.com/linux/v4.17-rc7/source/Documentation/devicetree/bindings/pps/pps-gpio.txt
and
https://elixir.bootlin.com/linux/v4.17-rc7/source/drivers/pps/clients/pps-gpio.c
Or what is bad with just using that?
BR,
Nikolaus
Johan Hovold
maintainerQuoted 16 lines · H. Nikolaus Schaller
Quoted 5 lines
Am 31.05.2018 um 10:52 schrieb Johan Hovold <[email protected]>:
Quoted 1 line · Richard Cochran
On Wed, May 30, 2018 at 12:32:34PM +0200, Johan Hovold wrote:
Quoted 8 lines
Quoted 6 lines
Quoted 1 line
Another possible extension is to add generic 1PPS support.
There are two possibilities to consider.
1. If the PPS causes an interrupt, then it should hook into the PPS subsystem.
Registering a PPS child device is what I had in mind for this.
This seems to be duplicating functionality that is already solved by
Quoted 7 lines
https://elixir.bootlin.com/linux/v4.17-rc7/source/Documentation/devicetree/bindings/pps/pps-gpio.txt
and
https://elixir.bootlin.com/linux/v4.17-rc7/source/drivers/pps/clients/pps-gpio.c
Or what is bad with just using that?
Using pps-gpio would not allow you to describe the hardware properly, something which, for example, may be needed for power management (e.g. to power on the GNSS receiver when the pps device is being accessed).
Johan
Quoted 24 lines
Am 31.05.2018 um 13:47 schrieb Johan Hovold <[email protected]>:
Quoted 20 lines · H. Nikolaus Schaller
Quoted 5 lines
Am 31.05.2018 um 10:52 schrieb Johan Hovold <[email protected]>:
Quoted 1 line · Richard Cochran
On Wed, May 30, 2018 at 12:32:34PM +0200, Johan Hovold wrote:
Quoted 8 lines
Quoted 6 lines
Quoted 1 line
Another possible extension is to add generic 1PPS support.
There are two possibilities to consider.
1. If the PPS causes an interrupt, then it should hook into the PPS subsystem.
Registering a PPS child device is what I had in mind for this.
This seems to be duplicating functionality that is already solved by
https://elixir.bootlin.com/linux/v4.17-rc7/source/Documentation/devicetree/bindings/pps/pps-gpio.txt
and
Quoted 7 lines
Quoted 3 lines
https://elixir.bootlin.com/linux/v4.17-rc7/source/drivers/pps/clients/pps-gpio.c
Or what is bad with just using that?
Using pps-gpio would not allow you to describe the hardware properly, something which, for example, may be needed for power management (e.g. to power on the GNSS receiver when the pps device is being accessed).
Yes, that is indeed a very valid reason to do it that way as the pps-gpio seems to assume an always-on impulse source.
On the other hand it looks as if the pps framework can't tell the source when to power on/off because it does not notify when it is being accessed or not:
https://elixir.bootlin.com/linux/v4.17-rc7/source/drivers/pps/pps.c#L305
BR,
Nikolaus
Johan Hovold
maintainerQuoted 6 lines · H. Nikolaus Schaller
Quoted 5 lines
Am 31.05.2018 um 13:47 schrieb Johan Hovold <[email protected]>:
Using pps-gpio would not allow you to describe the hardware properly, something which, for example, may be needed for power management (e.g. to power on the GNSS receiver when the pps device is being accessed).
Quoted 8 lines
Yes, that is indeed a very valid reason to do it that way as the pps-gpio seems to assume an always-on impulse source.
On the other hand it looks as if the pps framework can't tell the source when to power on/off because it does not notify when it is being accessed or not:
https://elixir.bootlin.com/linux/v4.17-rc7/source/drivers/pps/pps.c#L305
Yeah, we may need to address that when/if we get there.
Thanks,
Johan