Skip to contentSkip to conversation

iio: Add IIO_DISTANCE type

PATCH New Matt Ranostay 1 participant 3 messages Feb 1, 2014 1 message not in the archive

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH v3 1/3 iio: Add IIO_DISTANCE type

Allow drivers to report distance values, but however it is up to drivers to set scaling for meters, kilometers, etc.

---
 drivers/iio/industrialio-core.c | 1 +
 include/linux/iio/types.h       | 1 +
 2 files changed, 2 insertions(+)
drivers/iio/industrialio-core.c +1 -0
index acc911a..ac999ab 100644
@@ -70,6 +70,7 @@ static const char * const iio_chan_type_name_spec[] = {
 	[IIO_CCT] = "cct",
 	[IIO_PRESSURE] = "pressure",
 	[IIO_HUMIDITYRELATIVE] = "humidityrelative",
+	[IIO_DISTANCE] = "distance",
 };
 
 static const char * const iio_modifier_names[] = {
include/linux/iio/types.h +1 -0
index 084d882..675c2d8 100644
@@ -30,6 +30,7 @@ enum iio_chan_type {
 	IIO_CCT,
 	IIO_PRESSURE,
 	IIO_HUMIDITYRELATIVE,
+	IIO_DISTANCE,
 };
 
 enum iio_modifier {
Signature · 6 lines
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

A message that is not in the archive (sent off-list or not yet received): 1391235760-32652-1-git-send-email-mranostay-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org

#2 lore raw

PATCH v3 2/3 iio: Add AS3935 lightning sensor support

AS3935 chipset can detect lightning strikes and reports those back as events and the estimated distance to the storm.

---
 .../ABI/testing/sysfs-bus-iio-distance-as3935      |  19 +
 drivers/iio/Kconfig                                |   1 +
 drivers/iio/Makefile                               |   1 +
 drivers/iio/distance/Kconfig                       |  19 +
 drivers/iio/distance/Makefile                      |   6 +
 drivers/iio/distance/as3935.c                      | 438 +++++++++++++++++++++
 6 files changed, 484 insertions(+)
 create mode 100644 Documentation/ABI/testing/sysfs-bus-iio-distance-as3935
 create mode 100644 drivers/iio/distance/Kconfig
 create mode 100644 drivers/iio/distance/Makefile
 create mode 100644 drivers/iio/distance/as3935.c
Documentation/ABI/testing/sysfs-bus-iio-distance-as3935 new file +19 -0
new file mode 100644
index 0000000..cf9a67c
@@ -0,0 +1,19 @@
+What		/sys/bus/iio/devices/iio:deviceX/in_distance_raw
+Date:		January 2014
+KernelVersion:	3.15
+Contact:	Matt Ranostay <[email protected]>
+Description:
+		Get the current distance in kilometers of storm
+		0    = no storm activity
+		1    = storm overhead
+		1-40 = distance in kilometers
+		63   = out of range
+
+What		/sys/bus/iio/devices/iio:deviceX/gain_boost
+Date:		January 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
index 5dd0e12..5164a68 100644
@@ -63,6 +63,7 @@ source "drivers/iio/adc/Kconfig"
 source "drivers/iio/amplifiers/Kconfig"
 source "drivers/iio/common/Kconfig"
 source "drivers/iio/dac/Kconfig"
+source "drivers/iio/distance/Kconfig"
 source "drivers/iio/frequency/Kconfig"
 source "drivers/iio/gyro/Kconfig"
 source "drivers/iio/humidity/Kconfig"
drivers/iio/Makefile +1 -0
index 887d390..1574731 100644
@@ -16,6 +16,7 @@ obj-y += adc/
 obj-y += amplifiers/
 obj-y += common/
 obj-y += dac/
+obj-y += distance/
 obj-y += gyro/
 obj-y += frequency/
 obj-y += humidity/
drivers/iio/distance/Kconfig new file +19 -0
new file mode 100644
index 0000000..8a2404c
@@ -0,0 +1,19 @@
+#
+# Distance sensors
+#
+
+menu "Lightning sensors"
+
+config AS3935
+	tristate "AS3935 Franklin lightning sensor"
+	select IIO_BUFFER
+	select IIO_TRIGGERED_BUFFER
+	depends on SPI
+	help
+	 If you say yes here you get support for the Austrian Microsystems
+	 AS3935 lightning detection sensor.
+
+	 This driver can also be built as a module. If so, the module
+	 will be called as3935.
+
+endmenu
drivers/iio/distance/Makefile new file +6 -0
new file mode 100644
index 0000000..f63b70d
@@ -0,0 +1,6 @@
+#
+# Makefile for IIO distance sensors
+#
+
+# When adding new entries keep the list in alphabetical order
+obj-$(CONFIG_AS3935)		+= as3935.o
drivers/iio/distance/as3935.c new file +438 -0

438 lines not on this page · raw message

Signature · 6 lines
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
#3 lore raw

PATCH v3 3/3 iio:as3935: Add DT binding docs for AS3935 driver

In reply to a message not in the archive

Document compatible string, required and optional DT properties for AS3935 chipset driver.

---
 .../devicetree/bindings/iio/distance/as3935.txt    | 25 ++++++++++++++++++++++
 1 file changed, 25 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/iio/distance/as3935.txt
Documentation/devicetree/bindings/iio/distance/as3935.txt new file +25 -0
new file mode 100644
index 0000000..409b48b
@@ -0,0 +1,25 @@
+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
+  	- interrupt-parent : should be the phandle for the interrupt controller
+	- interrupts : interrupt mapping for GPIO IRQ
+
+Optional properties:
+	- ams,tune-cap: Calibration tuning capacitor stepping value 0 - 15.
+	  Range of 0 to 120 pF, 8pF steps. 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,tune-cap = /bits/ 8 <10>;
+};
Signature · 6 lines
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