lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [day] [month] [year] [list]
Message-ID: <20170131180232.GA12868@andreas>
Date:   Tue, 31 Jan 2017 19:02:32 +0100
From:   Andreas Klinger <ak@...klinger.de>
To:     jic23@...nel.org, knaack.h@....de, lars@...afoo.de,
        pmeerw@...erw.net, gregkh@...uxfoundation.org, dledford@...hat.com,
        akpm@...ux-foundation.org, shraddha.6596@...il.com, w@....eu,
        balbi@...nel.org, mtk.manpages@...il.com, sjenning@...hat.com,
        ksenija.stanojevic@...il.com, vilhelm.gray@...il.com,
        robh+dt@...nel.org, pawel.moll@....com, mark.rutland@....com,
        ijc+devicetree@...lion.org.uk, galak@...eaurora.org,
        devicetree@...r.kernel.org, linux-kernel@...r.kernel.org,
        linux-iio@...r.kernel.org
Cc:     ak@...klinger.de
Subject: [PATCH v3 0/2] iio: distance: devantech srf04 us ranger

This patch series adds support for the devantech srf04 ultrasonic ranger as
IIO device.

The device is able to recognize objects in a range of 1 cm and 3 meters.
The theoretical resolution is about 3 mm, practically more or less 1 cm.

Use cases for this device are level metering in tanks or distance measuring
in robotics.

This driver works by triggering the device and waiting for the echo, for
which a GPIO is set when send out and reset when the echo is received. 
The echo must be an interrupt and the time between rising and falling is
measured.

The returned distance is calculated with a ultrasonic speed of 343 m/s
which is the correct value at 20 degrees celsius.
For different temperatures one might want to compensate the temperature.
Look at the source code for a more detailed explanation of the calculation
and bounds.

The measurement cycle as timing diagram looks like: (taken from the source
code to illustrate here)

         +---+
GPIO     |   |
trig:  --+   +------------------------------------------------------
         ^   ^
         |<->|
        udelay(10)

ultra           +-+ +-+ +-+
sonic           | | | | | |
burst: ---------+ +-+ +-+ +-----------------------------------------
                          .
ultra                     .              +-+ +-+ +-+
sonic                     .              | | | | | |
echo:  ----------------------------------+ +-+ +-+ +----------------
                          .                        .
                          +------------------------+
GPIO                      |                        |
echo:  -------------------+                        +---------------
                          ^                        ^
                          interrupt                interrupt
                          (ts_rising)              (ts_falling)
                          |<---------------------->|
                             pulse time measured
                             --> one round trip of ultra sonic waves

Documenation can be found at:
http://www.robot-electronics.co.uk/htm/srf04tech.htm

Changes in v3:
Thanks to the review of Jonathan who pointed out two improvements.

* Patch 2: iio: distance: add devantech us ranger srf04
  - first get the time and then ask value of gpio pin to be more exactly in
    the interrupt_handler
  - use devm_iio_device_register() and remove srf04_remove()

Changes in v2:
Many thanks to the thorough reviews of Peter and Lars-Peter. Many
improvements have been identified and are now implemented in the driver.

* Patch 1: iio: distance: add dt binding for devantech-srf04
  - add more explanation about the GPIOs and there usage

* Patch 2: iio: distance: add devantech us ranger srf04
  - add documentation about how the driver is supposed to work together
    with a small timing diagram
  - improved locking: mutex is hold during the measurement cycle to ensure
    only one tasks set the output and waits for the response
  - documentation about maximum time accepted as valid ultrasonic response
  - removed dev_info(); it was there for debugging reasons and is no longer
    needed
  - usage of devm_request_irq() and iio_device_register()

Andreas Klinger (2):
  iio: distance: add dt binding for devantech-srf04
  iio: distance: add devantech us ranger srf04

 .../bindings/iio/proximity/devantech-srf04.txt     |  28 ++
 MAINTAINERS                                        |   6 +
 drivers/iio/proximity/Kconfig                      |  11 +
 drivers/iio/proximity/Makefile                     |   1 +
 drivers/iio/proximity/srf04.c                      | 304 +++++++++++++++++++++
 5 files changed, 350 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/iio/proximity/devantech-srf04.txt
 create mode 100644 drivers/iio/proximity/srf04.c

-- 
2.1.4

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ