AS3935 lightning sensor support
Subsystems (2)
v8 cover AS3935 lightning sensor support
This series adds support for the AMS AS3935 lightning sensor that allows reporting back estimated storm distance and strike events.
Changes from v7
* Added IIO_CHAN_INFO_PROCESSED to report back meter converted
* Storm out-of-range is reported as -EINVAL instead of mystery value 63000
* Fixed error unwinding order in as3935_probe()
* Renamed value gain_boot attribute to sensor_sensitivity
Changes from v6
* Revised binding documents to not use the term "interrupts mapping"
* Renamed tune-cap property to a more clear tuning-capacitor-pf
Changes from v5
* SPI write cache-aligned issues fixed
* Fixed mutex_unlock's being missed
* Reports distance in meters instead of kilometers (1km steps)
* tune_cap is now in picofarads and not a register value
Matt Ranostay (2):
iio:as3935: Add DT binding docs for AS3935 driver
iio: Add AS3935 lightning sensor support
.../ABI/testing/sysfs-bus-iio-proximity-as3935 | 16 + .../devicetree/bindings/iio/proximity/as3935.txt | 28 ++ .../devicetree/bindings/vendor-prefixes.txt | 1 + drivers/iio/Kconfig | 1 + drivers/iio/Makefile | 1 + drivers/iio/proximity/Kconfig | 19 + drivers/iio/proximity/Makefile | 6 + drivers/iio/proximity/as3935.c | 456 +++++++++++++++++++++ 8 files changed, 528 insertions(+) create mode 100644 Documentation/ABI/testing/sysfs-bus-iio-proximity-as3935 create mode 100644 Documentation/devicetree/bindings/iio/proximity/as3935.txt create mode 100644 drivers/iio/proximity/Kconfig create mode 100644 drivers/iio/proximity/Makefile create mode 100644 drivers/iio/proximity/as3935.c
Signature · 1 line
1.8.3.2
PATCH v8 1/2 iio:as3935: Add DT binding docs for AS3935 driver
Document compatible string, required and optional DT properties for AS3935 chipset driver.
--- .../devicetree/bindings/iio/proximity/as3935.txt | 28 ++++++++++++++++++++++ .../devicetree/bindings/vendor-prefixes.txt | 1 + 2 files changed, 29 insertions(+) create mode 100644 Documentation/devicetree/bindings/iio/proximity/as3935.txt
Documentation/devicetree/bindings/iio/proximity/as3935.txt new file +28 -0
@@ -0,0 +1,28 @@ +Austrian Microsystems AS3935 Franklin lightning sensor device driver + +Required properties: + - compatible: must be "ams,as3935" + - reg: SPI chip select number for the device + - spi-cpha: SPI Mode 1. Refer to spi/spi-bus.txt for generic SPI + slave node bindings. + - interrupt-parent : should be the phandle for the interrupt controller + - interrupts : the sole interrupt generated by the device + + Refer to interrupt-controller/interrupts.txt for generic + interrupt client node bindings. + +Optional properties: + - ams,tuning-capacitor-pf: Calibration tuning capacitor stepping + value 0 - 120pF. This will require using the calibration data from + the manufacturer. + +Example: + +as3935@0 { + compatible = "ams,as3935"; + reg = <0>; + spi-cpha; + interrupt-parent = <&gpio1>; + interrupts = <16 1>; + ams,tuning-capacitor-pf = <80>; +};
Documentation/devicetree/bindings/vendor-prefixes.txt +1 -0
@@ -11,6 +11,7 @@ ak Asahi Kasei Corp. allwinner Allwinner Technology Co., Ltd. altr Altera Corp. amcc Applied Micro Circuits Corporation (APM, formally AMCC) +ams AMS AG amstaos AMS-Taos Inc. apm Applied Micro Circuits Corporation (APM) arm ARM Ltd.
Signature · 1 line
1.8.3.2
Re: [PATCH v8 1/2] iio:as3935: Add DT binding docs for AS3935 driver
Quoted 4 lines · Matt Ranostay
Document compatible string, required and optional DT properties for AS3935 chipset driver.
Signed-off-by Matt Ranostay <[email protected]>
Quoted 59 lines
--- .../devicetree/bindings/iio/proximity/as3935.txt | 28 ++++++++++++++++++++++ .../devicetree/bindings/vendor-prefixes.txt | 1 + 2 files changed, 29 insertions(+) create mode 100644 Documentation/devicetree/bindings/iio/proximity/as3935.txtDocumentation/devicetree/bindings/iio/proximity/as3935.txt new file +28
-0@@ -0,0 +1,28 @@ +Austrian Microsystems AS3935 Franklin lightning sensor device driver + +Required properties: + - compatible: must be "ams,as3935" + - reg: SPI chip select number for the device + - spi-cpha: SPI Mode 1. Refer to spi/spi-bus.txt for generic SPI + slave node bindings. + - interrupt-parent : should be the phandle for the interrupt controller + - interrupts : the sole interrupt generated by the device + + Refer to interrupt-controller/interrupts.txt for generic + interrupt client node bindings. + +Optional properties: + - ams,tuning-capacitor-pf: Calibration tuning capacitor stepping + value 0 - 120pF. This will require using the calibration data from + the manufacturer. + +Example: + +as3935@0 { + compatible = "ams,as3935"; + reg = <0>; + spi-cpha; + interrupt-parent = <&gpio1>; + interrupts = <16 1>; + ams,tuning-capacitor-pf = <80>; +};Documentation/devicetree/bindings/vendor-prefixes.txt +1
-1@@ -11,6 +11,7 @@ ak Asahi Kasei Corp. allwinner Allwinner Technology Co., Ltd. altr Altera Corp. amcc Applied Micro Circuits Corporation (APM, formally AMCC) +ams AMS AG amstaos AMS-Taos Inc. apm Applied Micro Circuits Corporation (APM) arm ARM Ltd. --1.8.3.2
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
Jonathan Cameron
maintainerRe: [PATCH v8 1/2] iio:as3935: Add DT binding docs for AS3935 driver
Quoted 7 lines · Rob Herring
Quoted 4 lines · Matt Ranostay
Document compatible string, required and optional DT properties for AS3935 chipset driver.
Signed-off-by Matt Ranostay <[email protected]>Acked-by Rob Herring <[email protected]>
Applied to the togreg branch of iio.git (probably pushed out as testing first to allow the autobuilders to play.
Thanks
Jonathan
Quoted 65 lines
Quoted 56 lines
--- .../devicetree/bindings/iio/proximity/as3935.txt | 28 ++++++++++++++++++++++ .../devicetree/bindings/vendor-prefixes.txt | 1 + 2 files changed, 29 insertions(+)create mode 100644
Documentation/devicetree/bindings/iio/proximity/as3935.txtDocumentation/devicetree/bindings/iio/proximity/as3935.txt new file +28
-0@@ -0,0 +1,28 @@ +Austrian Microsystems AS3935 Franklin lightning sensor device driver + +Required properties: + - compatible: must be "ams,as3935" + - reg: SPI chip select number for the device + - spi-cpha: SPI Mode 1. Refer to spi/spi-bus.txt for generic SPI + slave node bindings. + - interrupt-parent : should be the phandle for the interrupt controller + - interrupts : the sole interrupt generated by the device + + Refer to interrupt-controller/interrupts.txt for generic + interrupt client node bindings. + +Optional properties: + - ams,tuning-capacitor-pf: Calibration tuning capacitor stepping + value 0 - 120pF. This will require using the calibration data from + the manufacturer. + +Example: + +as3935@0 { + compatible = "ams,as3935"; + reg = <0>; + spi-cpha; + interrupt-parent = <&gpio1>; + interrupts = <16 1>; + ams,tuning-capacitor-pf = <80>; +};Documentation/devicetree/bindings/vendor-prefixes.txt +1
-1@@ -11,6 +11,7 @@ ak Asahi Kasei Corp. allwinner Allwinner Technology Co., Ltd. altr Altera Corp. amcc Applied Micro Circuits Corporation (APM, formally AMCC) +ams AMS AG amstaos AMS-Taos Inc. apm Applied Micro Circuits Corporation (APM) arm ARM Ltd. --1.8.3.2
Quoted 4 lines
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html--
To unsubscribe from this list: send the line "unsubscribe linux-iio" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
PATCH v8 2/2 iio: Add AS3935 lightning sensor support
In reply to Matt RanostayAS3935 chipset can detect lightning strikes and reports those back as events and the estimated distance to the storm.
--- .../ABI/testing/sysfs-bus-iio-proximity-as3935 | 16 + drivers/iio/Kconfig | 1 + drivers/iio/Makefile | 1 + drivers/iio/proximity/Kconfig | 19 + drivers/iio/proximity/Makefile | 6 + drivers/iio/proximity/as3935.c | 456 +++++++++++++++++++++ 6 files changed, 499 insertions(+) create mode 100644 Documentation/ABI/testing/sysfs-bus-iio-proximity-as3935 create mode 100644 drivers/iio/proximity/Kconfig create mode 100644 drivers/iio/proximity/Makefile create mode 100644 drivers/iio/proximity/as3935.c
Documentation/ABI/testing/sysfs-bus-iio-proximity-as3935 new file +16 -0
@@ -0,0 +1,16 @@ +What /sys/bus/iio/devices/iio:deviceX/in_proximity_raw +Date: March 2014 +KernelVersion: 3.15 +Contact: Matt Ranostay <[email protected]> +Description: + Get the current distance in meters of storm (1km steps) + 1000-40000 = distance in meters + +What /sys/bus/iio/devices/iio:deviceX/sensor_sensitivity +Date: March 2014 +KernelVersion: 3.15 +Contact: Matt Ranostay <[email protected]> +Description: + Show or set the gain boost of the amp, from 0-31 range. + 18 = indoors (default) + 14 = outdoors
drivers/iio/Kconfig +1 -0
@@ -74,6 +74,7 @@ if IIO_TRIGGER source "drivers/iio/trigger/Kconfig" endif #IIO_TRIGGER source "drivers/iio/pressure/Kconfig" +source "drivers/iio/proximity/Kconfig" source "drivers/iio/temperature/Kconfig" endif # IIO
drivers/iio/Makefile +1 -0
@@ -24,5 +24,6 @@ obj-y += light/ obj-y += magnetometer/ obj-y += orientation/ obj-y += pressure/ +obj-y += proximity/ obj-y += temperature/ obj-y += trigger/
drivers/iio/proximity/Kconfig new file +19 -0
@@ -0,0 +1,19 @@ +# +# Proximity sensors +# + +menu "Lightning sensors" + +config AS3935 + tristate "AS3935 Franklin lightning sensor" + select IIO_BUFFER + select IIO_TRIGGERED_BUFFER + depends on SPI + help + Say Y here to build SPI interface support for the Austrian + Microsystems AS3935 lightning detection sensor. + + To compile this driver as a module, choose M here: the + module will be called as3935 + +endmenu
drivers/iio/proximity/Makefile new file +6 -0
@@ -0,0 +1,6 @@ +# +# Makefile for IIO proximity sensors +# + +# When adding new entries keep the list in alphabetical order +obj-$(CONFIG_AS3935) += as3935.o
drivers/iio/proximity/as3935.c new file +456 -0
456 lines not on this page · raw message
Signature · 1 line
1.8.3.2
Re: [PATCH v8 2/2] iio: Add AS3935 lightning sensor support
Quoted 4 lines · Matt Ranostay
AS3935 chipset can detect lightning strikes and reports those back as events and the estimated distance to the storm.
Signed-off-by Matt Ranostay <[email protected]>
Best regards,
Marek Vasut
Jonathan Cameron
maintainerRe: [PATCH v8 2/2] iio: Add AS3935 lightning sensor support
Quoted 7 lines · Marek Vasut
Quoted 4 lines · Matt Ranostay
AS3935 chipset can detect lightning strikes and reports those back as events and the estimated distance to the storm.
Signed-off-by Matt Ranostay <[email protected]>Reviewed-by Marek Vasut <[email protected]>
I'm not 100% happy with sensor_sensitivity but don't have a better idea.
As it is device specific lets leave it be for now. Should we come
up with a better idea later it isn't much extra code to keep supporting this interface going forwards.
Applied to the togreg branch of iio.git (pushed out initially as testing)
Thanks,
Jonathan