From 203864e4f32b983178b80534dc53b50c3325e352 Mon Sep 17 00:00:00 2001 From: Mykyta Dorokhin Date: Wed, 22 Jun 2022 15:57:36 +0300 Subject: mtcap3: respect backoff timers on radio reset --- io-module/machine/mtcap3.c | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) (limited to 'io-module') diff --git a/io-module/machine/mtcap3.c b/io-module/machine/mtcap3.c index 9a81e1c..3c99077 100644 --- a/io-module/machine/mtcap3.c +++ b/io-module/machine/mtcap3.c @@ -325,6 +325,27 @@ static ssize_t mts_attr_store_radio_reset_mtcap3(struct device *dev, return -EINVAL; } + /* check reset timings is enabled */ + if (value != -1 && NULL != timings_data) { + /* check reset timer is started */ + if (radio_reset_timer_is_start == 1) { + log_info("radio reset timer is running."); + return count; + } + + /* check reset timer available is started */ + if (radio_reset_available_timer_is_start == 1) { + del_timer(&radio_reset_available_timer); + radio_reset_available_timer_is_start = 0; + } + + /* reset timer not started, start it */ + mod_timer(&radio_reset_timer, jiffies + msecs_to_jiffies((timings_data[timings_data_index]) * 1000)); + /* save timings_data_stop_seconds */ + timings_data_stop_seconds = timings_data[timings_data_index] + time_now_secs(); + radio_reset_timer_is_start = 1; + } + reset_radio_udev_discovery(); mutex_lock(&mts_io_mutex); -- cgit v1.2.3