drivers: counter: nrfx_timer: Use shutdown task if available

Add a workaround for NRF52 anomaly 78: "High current consumption when
using timer STOP task only". Use the SHUTDOWN task instead.

For consistency, CLEAR the timer timer after STOPPING on devices that
lack the SHUTDOWN task. This also aligns the behavior with
nrfx_timer_disable().

For devices with the SHUTDOWN task, this restores the behavior previous
to e92323f.

Fixes #87224

Signed-off-by: Marco Widmer <marco.widmer@bytesatwork.ch>
This commit is contained in:
Marco Widmer 2025-03-17 15:38:32 +01:00 committed by Benjamin Cabé
parent 6061deba55
commit 491e297418

View File

@ -110,7 +110,13 @@ static int stop(const struct device *dev)
{
const struct counter_nrfx_config *config = dev->config;
#if NRF_TIMER_HAS_SHUTDOWN
nrf_timer_task_trigger(config->timer, NRF_TIMER_TASK_SHUTDOWN);
#else
nrf_timer_task_trigger(config->timer, NRF_TIMER_TASK_STOP);
nrf_timer_task_trigger(config->timer, NRF_TIMER_TASK_CLEAR);
#endif
#ifdef COUNTER_ANY_FAST
struct counter_nrfx_data *data = dev->data;