public inbox for linux-omap@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH v3 0/7] iio: adc: palmas_gpadc: add iio events
@ 2023-04-05 21:22 Patrik Dahlström
  2023-04-05 21:22 ` [PATCH v3 1/7] iio: adc: palmas: remove adc_wakeupX_data Patrik Dahlström
                   ` (7 more replies)
  0 siblings, 8 replies; 16+ messages in thread
From: Patrik Dahlström @ 2023-04-05 21:22 UTC (permalink / raw)
  To: linux-iio
  Cc: linux-kernel, letux-kernel, kernel, pgoudagunta, hns, jic23, lars,
	linux-omap, Patrik Dahlström

This series is based on linux-next/master [1] and [2].

The palmas gpadc block has support for monitoring up to 2 ADC channels
and issue an interrupt if they reach past a set threshold. This can be
configured statically with device tree today, but it only gets enabled
when reaching sleep mode. Also, it doesn't look like anyone is using it.

Instead of this one special case, change the code so userspace can
configure the ADC channels to their own needs through the iio events
subsystem. The high and low threshold values can be set for every
channel, but only 2 thresholds can be enabled at a time. Trying to
enable more than 2 thresholds will result in an error.

The configured thresholds will wake up the system from sleep mode if
wakeup is enabled in /sys/devices/.../power/wakeup.

The old platform data was removed.

Thresholds, events, and wakeup were tested on omap5-uevm board. It wakes
up from sleep mode when wakeup is enabled and a threshold is passed. A
userspace tool for monitoring events and adjusting thresholds can be
found at [3].

V2 -> V3:
* Rebased to linux-next.
* Avoid reconfiguring events on error and when old == new value.
V1 -> V2:
* Begin by removing adc_wakeupX_data instead of doing it last.
* Split changes in smaller patches

[1] git://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git
[2] https://lore.kernel.org/linux-iio/20230318163039.56115-1-jic23@kernel.org/
[3] https://github.com/Risca/pyra_vol_mon

Patrik Dahlström (7):
  iio: adc: palmas: remove adc_wakeupX_data
  iio: adc: palmas: replace "wakeup" with "event"
  iio: adc: palmas: use iio_event_direction for threshold polarity
  iio: adc: palmas: move eventX_enable into palmas_adc_event
  iio: adc: palmas: always reset events on unload
  iio: adc: palmas: add support for iio threshold events
  iio: adc: palmas: don't alter event config on suspend/resume

 drivers/iio/adc/palmas_gpadc.c | 559 +++++++++++++++++++++++++++------
 include/linux/mfd/palmas.h     |   8 -
 2 files changed, 464 insertions(+), 103 deletions(-)


base-commit: 8417c8f5007bf4567ccffda850a3157c7d905f67
prerequisite-patch-id: b0418c707db13f514400956596e9ebe91c25bba0
-- 
2.25.1


^ permalink raw reply	[flat|nested] 16+ messages in thread
* [PATCH v3 0/7] iio: adc: palmas_gpadc: add iio events
@ 2023-04-08 11:46 Patrik Dahlström
  2023-04-08 11:48 ` Patrik Dahlström
  0 siblings, 1 reply; 16+ messages in thread
From: Patrik Dahlström @ 2023-04-08 11:46 UTC (permalink / raw)
  To: linux-iio
  Cc: linux-kernel, letux-kernel, kernel, pgoudagunta, hns, jic23, lars,
	linux-omap, Patrik Dahlström

This series is based on linux-next/master [1] and [2].

The palmas gpadc block has support for monitoring up to 2 ADC channels
and issue an interrupt if they reach past a set threshold. This can be
configured statically with device tree today, but it only gets enabled
when reaching sleep mode. Also, it doesn't look like anyone is using it.

Instead of this one special case, change the code so userspace can
configure the ADC channels to their own needs through the iio events
subsystem. The high and low threshold values can be set for every
channel, but only 2 thresholds can be enabled at a time. Trying to
enable more than 2 thresholds will result in an error.

The configured thresholds will wake up the system from sleep mode if
wakeup is enabled in /sys/devices/.../power/wakeup.

The old platform data was removed.

Thresholds, events, and wakeup were tested on omap5-uevm board. It wakes
up from sleep mode when wakeup is enabled and a threshold is passed. A
userspace tool for monitoring events and adjusting thresholds can be
found at [3].

V2 -> V3:
* Rebased to linux-next.
* Avoid reconfiguring events on error and when old == new value.
V1 -> V2:
* Begin by removing adc_wakeupX_data instead of doing it last.
* Split changes in smaller patches

[1] git://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git
[2] https://lore.kernel.org/linux-iio/20230318163039.56115-1-jic23@kernel.org/
[3] https://github.com/Risca/pyra_vol_mon

Patrik Dahlström (7):
  iio: adc: palmas: remove adc_wakeupX_data
  iio: adc: palmas: replace "wakeup" with "event"
  iio: adc: palmas: use iio_event_direction for threshold polarity
  iio: adc: palmas: move eventX_enable into palmas_adc_event
  iio: adc: palmas: always reset events on unload
  iio: adc: palmas: add support for iio threshold events
  iio: adc: palmas: don't alter event config on suspend/resume

 drivers/iio/adc/palmas_gpadc.c | 559 +++++++++++++++++++++++++++------
 include/linux/mfd/palmas.h     |   8 -
 2 files changed, 464 insertions(+), 103 deletions(-)


base-commit: 8417c8f5007bf4567ccffda850a3157c7d905f67
prerequisite-patch-id: b0418c707db13f514400956596e9ebe91c25bba0
-- 
2.25.1


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

end of thread, other threads:[~2023-04-08 11:48 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-04-05 21:22 [PATCH v3 0/7] iio: adc: palmas_gpadc: add iio events Patrik Dahlström
2023-04-05 21:22 ` [PATCH v3 1/7] iio: adc: palmas: remove adc_wakeupX_data Patrik Dahlström
2023-04-05 21:22 ` [PATCH v3 2/7] iio: adc: palmas: replace "wakeup" with "event" Patrik Dahlström
2023-04-05 21:22 ` [PATCH v3 3/7] iio: adc: palmas: use iio_event_direction for threshold polarity Patrik Dahlström
2023-04-05 21:22 ` [PATCH v3 4/7] iio: adc: palmas: move eventX_enable into palmas_adc_event Patrik Dahlström
2023-04-05 21:22 ` [PATCH v3 5/7] iio: adc: palmas: always reset events on unload Patrik Dahlström
2023-04-05 21:22 ` [PATCH v3 6/7] iio: adc: palmas: add support for iio threshold events Patrik Dahlström
2023-04-07 17:19   ` Jonathan Cameron
2023-04-08 11:31     ` Patrik Dahlström
2023-04-05 21:22 ` [PATCH v3 7/7] iio: adc: palmas: don't alter event config on suspend/resume Patrik Dahlström
2023-04-07 17:22   ` Jonathan Cameron
2023-04-07 17:04 ` [PATCH v3 0/7] iio: adc: palmas_gpadc: add iio events Jonathan Cameron
2023-04-07 17:09   ` Jonathan Cameron
2023-04-08 10:51     ` Patrik Dahlström
  -- strict thread matches above, loose matches on Subject: below --
2023-04-08 11:46 Patrik Dahlström
2023-04-08 11:48 ` Patrik Dahlström

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox