All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v4 0/3] ECAP support on TI AM62x SoC
@ 2022-08-10 14:07 Julien Panis
  2022-08-10 14:07 ` [PATCH v4 1/3] dt-binding: counter: add ti,am62-ecap-capture.yaml Julien Panis
                   ` (3 more replies)
  0 siblings, 4 replies; 17+ messages in thread
From: Julien Panis @ 2022-08-10 14:07 UTC (permalink / raw)
  To: vilhelm.gray, robh+dt, krzysztof.kozlowski+dt
  Cc: linux-iio, linux-kernel, devicetree, mranostay, Julien Panis

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 (1->2->3->4->1->...), edge polarity (falling/rising
edge) can be selected.

This driver leverages counter subsystem to :
- select edge polarity for all 4 capture events (event mode)
- log timestamps for each capture event
Event polarity, and CAP1/2/3/4 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 v3:
	- Migrate driver from IIO to Counter subsystem
	- Minor modification in yaml ($id) to match Counter subsystem
	- Add ABI documentation

Userspace commands :
	### SIGNAL ###
	cd /sys/bus/counter/devices/counter0/signal0

	# Get available polarities for each capture event
	cat polarity1_available
	cat polarity2_available
	cat polarity3_available
	cat polarity4_available

	# Get polarity for each capture event
	cat polarity1
	cat polarity2
	cat polarity3
	cat polarity4

	# Set polarity for each capture event
	echo rising > polarity1
	echo falling > polarity2
	echo rising > polarity3
	echo falling > polarity4

	### COUNT ###
	cd /sys/bus/counter/devices/counter0/count0

	# Run ECAP
	echo 1 > enable

	# Get current timebase counter value
	cat count

	# Get captured timestamps
	cat capture1
	cat capture2
	cat capture3
	cat capture4

	# Note that counter watches can also be used to get
	# data from userspace application
	# -> see tools/counter/counter_example.c

	# Stop ECAP
	echo 0 > enable

Julien Panis (3):
  dt-binding: counter: add ti,am62-ecap-capture.yaml
  Documentation: ABI: add sysfs-bus-counter-ecap
  counter: capture-tiecap: capture driver support for ECAP

 .../ABI/testing/sysfs-bus-counter-ecap        |  64 ++
 .../counter/ti,am62-ecap-capture.yaml         |  61 ++
 drivers/counter/Kconfig                       |  14 +
 drivers/counter/Makefile                      |   1 +
 drivers/counter/capture-tiecap.c              | 634 ++++++++++++++++++
 include/uapi/linux/counter.h                  |   2 +
 6 files changed, 776 insertions(+)
 create mode 100644 Documentation/ABI/testing/sysfs-bus-counter-ecap
 create mode 100644 Documentation/devicetree/bindings/counter/ti,am62-ecap-capture.yaml
 create mode 100644 drivers/counter/capture-tiecap.c

-- 
2.25.1


^ permalink raw reply	[flat|nested] 17+ messages in thread

end of thread, other threads:[~2022-08-17 13:49 UTC | newest]

Thread overview: 17+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-08-10 14:07 [PATCH v4 0/3] ECAP support on TI AM62x SoC Julien Panis
2022-08-10 14:07 ` [PATCH v4 1/3] dt-binding: counter: add ti,am62-ecap-capture.yaml Julien Panis
2022-08-10 14:40   ` Krzysztof Kozlowski
2022-08-10 14:07 ` [PATCH v4 2/3] Documentation: ABI: add sysfs-bus-counter-ecap Julien Panis
2022-08-13 22:47   ` William Breathitt Gray
2022-08-10 14:07 ` [PATCH v4 3/3] counter: capture-tiecap: capture driver support for ECAP Julien Panis
2022-08-14 14:48   ` Jonathan Cameron
2022-08-14 17:03   ` William Breathitt Gray
2022-08-15 11:20     ` William Breathitt Gray
2022-08-16  8:11       ` Julien Panis
2022-08-16 15:22         ` William Breathitt Gray
2022-08-16  7:58     ` Julien Panis
2022-08-16 15:12       ` William Breathitt Gray
2022-08-16 15:28         ` Julien Panis
2022-08-14 18:00 ` [PATCH v4 0/3] ECAP support on TI AM62x SoC William Breathitt Gray
2022-08-16  8:26   ` Julien Panis
2022-08-17 13:48   ` Julien Panis

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.