From 4bbd546f616b8b9f75ae400c6ce5641b49890b22 Mon Sep 17 00:00:00 2001 From: Dustin Brown Date: Fri, 22 Mar 2019 11:18:13 -0700 Subject: [PATCH] qcacld-3.0: Expose timer multiplier via module param The timer multiplier is currently controlled via ini configuration. However, there are several timers which are started before the configuration can be applied during SoC probe. Add a module parameter that allows controlling the timer multiplier both at load time and at run time. Change-Id: I34a8511c1900a722030374b881a73adc9c5fee19 CRs-Fixed: 2421716 --- core/hdd/src/wlan_hdd_main.c | 37 +++++++++++++++++++++++++++++++++++- 1 file changed, 36 insertions(+), 1 deletion(-) diff --git a/core/hdd/src/wlan_hdd_main.c b/core/hdd/src/wlan_hdd_main.c index 97d80270dcca..c5a73b1a09aa 100644 --- a/core/hdd/src/wlan_hdd_main.c +++ b/core/hdd/src/wlan_hdd_main.c @@ -9533,7 +9533,10 @@ struct hdd_context *hdd_context_create(struct device *dev) hdd_cfg_params_init(hdd_ctx); - qdf_timer_set_multiplier(cfg_get(hdd_ctx->psoc, CFG_TIMER_MULTIPLIER)); + /* apply multiplier config, if not already set via module parameter */ + if (qdf_timer_get_multiplier() == 1) + qdf_timer_set_multiplier(cfg_get(hdd_ctx->psoc, + CFG_TIMER_MULTIPLIER)); hdd_debug("set timer multiplier: %u", qdf_timer_get_multiplier()); cds_set_fatal_event(cfg_get(hdd_ctx->psoc, @@ -15067,3 +15070,35 @@ module_param(enable_dfs_chan_scan, int, S_IRUSR | S_IRGRP | S_IROTH); module_param(enable_11d, int, S_IRUSR | S_IRGRP | S_IROTH); module_param(country_code, charp, S_IRUSR | S_IRGRP | S_IROTH); + +static int timer_multiplier_get_handler(char *buffer, + const struct kernel_param *kp) +{ + return scnprintf(buffer, PAGE_SIZE, "%u", qdf_timer_get_multiplier()); +} + +static int timer_multiplier_set_handler(const char *kmessage, + const struct kernel_param *kp) +{ + QDF_STATUS status; + uint32_t scalar; + + status = qdf_uint32_parse(kmessage, &scalar); + if (QDF_IS_STATUS_ERROR(status)) + return qdf_status_to_os_return(status); + + if (!cfg_in_range(CFG_TIMER_MULTIPLIER, scalar)) + return -ERANGE; + + qdf_timer_set_multiplier(scalar); + + return 0; +} + +static const struct kernel_param_ops timer_multiplier_ops = { + .get = timer_multiplier_get_handler, + .set = timer_multiplier_set_handler, +}; + +module_param_cb(timer_multiplier, &timer_multiplier_ops, NULL, 0644); +