Переглянути джерело

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
Dustin Brown 6 роки тому
батько
коміт
4bbd546f61
1 змінених файлів з 36 додано та 1 видалено
  1. 36 1
      core/hdd/src/wlan_hdd_main.c

+ 36 - 1
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);
+