mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Julien Panis <jpanis@baylibre.com>
To: jic23@kernel.org, robh+dt@kernel.org, krzysztof.kozlowski+dt@linaro.org
Cc: lars@metafoo.de, linux-iio@vger.kernel.org,
	devicetree@vger.kernel.org, linux-kernel@vger.kernel.org,
	mranostay@ti.com, Julien Panis <jpanis@baylibre.com>
Subject: [PATCH v3 0/2] ECAP support on TI AM62x SoC
Date: Thu, 28 Jul 2022 19:51:22 +0200	[thread overview]
Message-ID: <20220728175124.468461-1-jpanis@baylibre.com> (raw)

The Enhanced Capture (ECAP) module can be used to timestamp events
detected on signal input pin. It can be used for time measurements
of pulse train signals.

ECAP module includes 4 timestamp capture registers. For all 4 sequenced
timestamp capture events (0->1->2->3->0->...), edge polarity (falling/rising
edge) can be selected. Moreover, input signal can be prescaled.

This driver leverages IIO subsystem to :
- select edge polarity for all 4 capture events (event mode)
- log both event index and timestamp for each capture event
Event polarity, event indexes, and timestamps give all the information
about the input pulse train. Further information can easily be computed :
period and/or duty cycle if frequency is constant, elapsed time between
pulses, etc...

Modifications since v2:
	- Fix yaml file name
	- Remove unnecessary node in yaml 'examples' section
	- Remove unnecessary error messages in probe function

Userspace commands :
	cd /sys/devices/platform/bus@f0000/23120000.capture/iio\:device2/

	# Configure/Enable data buffers
	echo 1 > scan_elements/in_index_en
	echo 1 > scan_elements/in_timestamp_en
	echo 100 > buffer/length
	echo 1 > buffer/enable

	# Set event mode in range [0 ; 15]
	# One bit for each CAPx register : 1 = falling edge / 0 = rising edge
	# e.g. mode = 13 = 0xd = 0b1101
	# -> falling edge for CAP1-3-4 / rising edge for CAP2
	echo 13 > events/change_falling_value

	# Run ECAP
	echo 1 > en

	# Get the number of available data
	cat buffer/data_available

	# Read data
	hexdump -v /dev/iio\:device2

	# Stop ECAP
	echo 0 > en

Julien Panis (2):
  dt-binding: iio: time: add ti,am62-ecap-capture.yaml
  iio: time: capture-tiecap: capture driver support for ECAP

 .../iio/time/ti,am62-ecap-capture.yaml        |  61 +++
 drivers/iio/Kconfig                           |   1 +
 drivers/iio/Makefile                          |   1 +
 drivers/iio/time/Kconfig                      |  22 +
 drivers/iio/time/Makefile                     |   6 +
 drivers/iio/time/capture-tiecap.c             | 517 ++++++++++++++++++
 6 files changed, 608 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/iio/time/ti,am62-ecap-capture.yaml
 create mode 100644 drivers/iio/time/Kconfig
 create mode 100644 drivers/iio/time/Makefile
 create mode 100644 drivers/iio/time/capture-tiecap.c

-- 
2.25.1


             reply	other threads:[~2022-07-28 17:51 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-07-28 17:51 Julien Panis [this message]
2022-07-28 17:51 ` [PATCH v3 1/2] dt-binding: iio: time: add ti,am62-ecap-capture.yaml Julien Panis
2022-07-28 17:55   ` Krzysztof Kozlowski
2022-07-28 17:51 ` [PATCH v3 2/2] iio: time: capture-tiecap: capture driver support for ECAP Julien Panis
2022-07-28 20:02   ` Christophe JAILLET
2022-07-29  7:50     ` Julien Panis
2022-07-31 15:41   ` Jonathan Cameron
2022-08-01 14:08     ` Julien Panis
2022-08-02 13:28       ` Julien Panis
2022-08-06 17:01         ` Jonathan Cameron
2022-08-08  0:30         ` William Breathitt Gray
2022-08-08  8:58           ` Julien Panis
2022-08-08 16:19             ` William Breathitt Gray
2022-08-09  6:19               ` Julien Panis
2022-08-09  6:23                 ` Julien Panis
2022-08-06 16:45       ` Jonathan Cameron

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220728175124.468461-1-jpanis@baylibre.com \
    --to=jpanis@baylibre.com \
    --cc=devicetree@vger.kernel.org \
    --cc=jic23@kernel.org \
    --cc=krzysztof.kozlowski+dt@linaro.org \
    --cc=lars@metafoo.de \
    --cc=linux-iio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mranostay@ti.com \
    --cc=robh+dt@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®