summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMathieu Mandret <mathieu.mandret@qorvo.com>2023-03-10 16:39:13 +0100
committerVictor Liu <victorliu@google.com>2023-06-28 18:23:31 +0000
commit905da76f2793187b702439117c78e009da99cc90 (patch)
tree95b5634cd16ad6b0e7716c3505bf45b8acfe5cec
parent2ef5d102433c4776aaa0e23c14d7aee00a6beadd (diff)
downloaduwb-905da76f2793187b702439117c78e009da99cc90.tar.gz
Instead of returning an error when CCC start delay is in the past, schedule the start as soon as possible. Bug: 285596493 Change-Id: I7838da8473adb26f2da9bfcf37f20c0a51fe2019 Signed-off-by: Mathieu Mandret <mathieu.mandret@qorvo.com>
-rw-r--r--kernel/drivers/net/ieee802154/dw3000_spi.c2
-rw-r--r--mac/nfcc_coex_region_call.c14
2 files changed, 10 insertions, 6 deletions
diff --git a/kernel/drivers/net/ieee802154/dw3000_spi.c b/kernel/drivers/net/ieee802154/dw3000_spi.c
index 76f1f3f..cadc9b1 100644
--- a/kernel/drivers/net/ieee802154/dw3000_spi.c
+++ b/kernel/drivers/net/ieee802154/dw3000_spi.c
@@ -116,7 +116,7 @@ static int dw3000_spi_probe(struct spi_device *spi)
hrtimer_init(&dw->idle_timer, CLOCK_MONOTONIC, HRTIMER_MODE_REL);
dw->idle_timer.function = dw3000_idle_timeout;
- dev_info(dw->dev, "Loading driver...050423");
+ dev_info(dw->dev, "Loading driver...06202023");
dw3000_sysfs_init(dw);
/* Setup SPI parameters */
diff --git a/mac/nfcc_coex_region_call.c b/mac/nfcc_coex_region_call.c
index a7e63cd..bf8fb9b 100644
--- a/mac/nfcc_coex_region_call.c
+++ b/mac/nfcc_coex_region_call.c
@@ -64,7 +64,7 @@ static int nfcc_coex_session_set_parameters(struct nfcc_coex_local *local,
struct nfcc_coex_session *session = &local->session;
struct nfcc_coex_session_params *p = &session->params;
/* Maximum dtu duration is INT32_MAX. */
- const u64 max_time0_ns =
+ const s64 max_time0_ns =
(S32_MAX * NS_PER_SECOND) / local->llhw->dtu_freq_hz;
int r;
@@ -98,7 +98,7 @@ static int nfcc_coex_session_set_parameters(struct nfcc_coex_local *local,
local->llhw->dtu_freq_hz + now_ns;
}
- if (p->time0_ns - now_ns > max_time0_ns)
+ if ((s64)(p->time0_ns - now_ns) > max_time0_ns)
return -ERANGE;
return 0;
}
@@ -129,9 +129,13 @@ static int nfcc_coex_session_start(struct nfcc_coex_local *local,
return r;
diff_ns = p->time0_ns - now_ns;
- diff_dtu = (diff_ns * local->llhw->dtu_freq_hz) / NS_PER_SECOND;
- if (diff_dtu < local->llhw->anticip_dtu)
- return -ETIMEDOUT;
+ diff_dtu = div64_s64(diff_ns * local->llhw->dtu_freq_hz, NS_PER_SECOND);
+ /* If the requested start date is in the past, start immediately */
+ if (diff_dtu < local->llhw->anticip_dtu) {
+ pr_warn("dw3000: Computed start date is in the past, scheduling"
+ " to anticip_dtu instead");
+ diff_dtu = local->llhw->anticip_dtu;
+ }
session->region_demand.timestamp_dtu = now_dtu + diff_dtu;
session->region_demand.max_duration_dtu = 0;