[0/3] iio: adc: palmas_gpadc: add iio events

Message ID 20230319223908.108540-1-risca@dalakolonin.se
Headers
Series iio: adc: palmas_gpadc: add iio events |

Message

Patrik Dahlström March 19, 2023, 10:39 p.m. UTC
  These changes are based on [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 todayi, 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.

Thresholds and events were tested on omap5-uevm board. It should still
be possible to wake up from sleep mode on events, but my board don't
like sleep. A userspace tool for monitoring events and adjusting
thresholds can be found at [3].

[1] https://patchwork.kernel.org/project/linux-iio/patch/20230318163039.56115-1-jic23@kernel.org/
[2] https://patchwork.kernel.org/project/linux-iio/patch/20230313205029.1881745-1-risca@dalakolonin.se/
[3] https://github.com/Risca/pyra_vol_mon


Patrik Dahlström (3):
  iio: adc: palmas_gpadc: add support for iio threshold events
  iio: adc: palmas_gpadc: remove adc_wakeupX_data
  iio: adc: palmas_gpadc: remove palmas_adc_wakeup_property

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


base-commit: 37fd83916da2e4cae03d350015c82a67b1b334c4
prerequisite-patch-id: 9b1f55610800b91b721d042bf7f33b58179237d1
prerequisite-patch-id: b0418c707db13f514400956596e9ebe91c25bba0
  

Comments

H. Nikolaus Schaller March 21, 2023, 8:40 p.m. UTC | #1
Hi Patrik,

> Am 19.03.2023 um 23:39 schrieb Patrik Dahlström <risca@dalakolonin.se>:
> 
> These changes are based on [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 todayi, 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.
> 
> Thresholds and events were tested on omap5-uevm board. It should still
> be possible to wake up from sleep mode on events, but my board don't
> like sleep. A userspace tool for monitoring events and adjusting
> thresholds can be found at [3].
> 
> [1] https://patchwork.kernel.org/project/linux-iio/patch/20230318163039.56115-1-jic23@kernel.org/
> [2] https://patchwork.kernel.org/project/linux-iio/patch/20230313205029.1881745-1-risca@dalakolonin.se/
> [3] https://github.com/Risca/pyra_vol_mon

nice to see the code here!

I haven't tested it yet and will just comment from code inspection.

Maybe it could be good to add linux-omap@vger.kernel.org because the Palmas is mostly used for OMAP devices.

BR,
Nikolaus

> 
> 
> Patrik Dahlström (3):
>  iio: adc: palmas_gpadc: add support for iio threshold events
>  iio: adc: palmas_gpadc: remove adc_wakeupX_data
>  iio: adc: palmas_gpadc: remove palmas_adc_wakeup_property
> 
> drivers/iio/adc/palmas_gpadc.c | 527 +++++++++++++++++++++++++++------
> include/linux/mfd/palmas.h     |   8 -
> 2 files changed, 434 insertions(+), 101 deletions(-)
> 
> 
> base-commit: 37fd83916da2e4cae03d350015c82a67b1b334c4
> prerequisite-patch-id: 9b1f55610800b91b721d042bf7f33b58179237d1
> prerequisite-patch-id: b0418c707db13f514400956596e9ebe91c25bba0
> -- 
> 2.25.1
>