diff options
author | Viresh Kumar <viresh.kumar@linaro.org> | 2024-03-27 16:48:11 +0530 |
---|---|---|
committer | Viresh Kumar <viresh.kumar@linaro.org> | 2024-04-22 15:49:38 +0530 |
commit | 2fd3e398abfe907c9e59d6fc33458362b45c5536 (patch) | |
tree | d6e0e34e650da5e983ddfcacce3fb340f3d966c1 | |
parent | ba1a277028eb92c5d5548577184dedb520436585 (diff) |
debugrust/cpufreq-dt
Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
-rw-r--r-- | drivers/cpufreq/cpufreq.c | 3 | ||||
-rw-r--r-- | drivers/cpufreq/rcpufreq_dt.rs | 7 | ||||
-rw-r--r-- | drivers/opp/core.c | 25 | ||||
-rw-r--r-- | rust/kernel/cpufreq.rs | 1 |
4 files changed, 36 insertions, 0 deletions
diff --git a/drivers/cpufreq/cpufreq.c b/drivers/cpufreq/cpufreq.c index 66e10a19d76a..d8e1c250ccf4 100644 --- a/drivers/cpufreq/cpufreq.c +++ b/drivers/cpufreq/cpufreq.c @@ -1433,6 +1433,9 @@ static int cpufreq_online(unsigned int cpu) /* Let the per-policy boost flag mirror the cpufreq_driver boost during init */ policy->boost_enabled = cpufreq_boost_enabled() && policy_has_boost_freq(policy); + pr_info(" cpus: %*pbl\n clk: %p\n sf: %u\n ft: %p\n ftd: %u %u %u\n td: %u\n dvfs: %d\n boost: %d\n dd: %p\n", + cpumask_pr_args(policy->cpus), policy->clk, policy->suspend_freq, policy->freq_table, policy->freq_table->flags, policy->freq_table->driver_data, policy->freq_table->frequency, policy->transition_delay_us, policy->dvfs_possible_from_any_cpu, policy->boost_enabled, policy->driver_data); + /* * The initialization has succeeded and the policy is online. * If there is a problem with its frequency table, take it diff --git a/drivers/cpufreq/rcpufreq_dt.rs b/drivers/cpufreq/rcpufreq_dt.rs index 317167bb20e1..7cd479c212bf 100644 --- a/drivers/cpufreq/rcpufreq_dt.rs +++ b/drivers/cpufreq/rcpufreq_dt.rs @@ -84,6 +84,7 @@ impl cpufreq::DriverOps for CPUFreqDTDevice { type PData = Arc<Self>; fn init(policy: &mut cpufreq::Policy) -> Result<Self::PData> { + pr_info!("init\n"); let cpu = policy.cpu(); // SAFETY: It is safe to call `get_cpu_device()` for any CPU. @@ -170,17 +171,20 @@ impl cpufreq::DriverOps for CPUFreqDTDevice { } fn exit(_policy: &mut cpufreq::Policy, _data: Option<Self::PData>) -> Result<()> { + pr_info!("exit\n"); Ok(()) } fn online(_policy: &mut cpufreq::Policy) -> Result<()> { // We did light-weight tear down earlier, nothing to do here. + pr_info!("online\n"); Ok(()) } fn offline(_policy: &mut cpufreq::Policy) -> Result<()> { // Preserve policy->data and don't free resources on light-weight // tear down. + pr_info!("offline\n"); Ok(()) } @@ -197,6 +201,7 @@ impl cpufreq::DriverOps for CPUFreqDTDevice { } fn target_index(policy: &mut cpufreq::Policy, index: u32) -> Result<()> { + pr_info!("target_index\n"); let data = match policy.data::<Self::PData>() { Some(data) => data, None => return Err(ENOENT), @@ -207,11 +212,13 @@ impl cpufreq::DriverOps for CPUFreqDTDevice { } fn get(policy: &mut cpufreq::Policy) -> Result<u32> { + pr_info!("get\n"); // SAFETY: It is safe to call `cpufreq_generic_get()` for policy's CPU. Ok(unsafe { bindings::cpufreq_generic_get(policy.cpu()) }) } fn set_boost(_policy: &mut cpufreq::Policy, _state: i32) -> Result<()> { + pr_info!("set_boost\n"); Ok(()) } diff --git a/drivers/opp/core.c b/drivers/opp/core.c index 2c6a511cd735..c4d572184a02 100644 --- a/drivers/opp/core.c +++ b/drivers/opp/core.c @@ -370,6 +370,7 @@ EXPORT_SYMBOL_GPL(dev_pm_opp_get_max_volt_latency); */ unsigned long dev_pm_opp_get_max_transition_latency(struct device *dev) { + pr_info("%s: %d\n", __func__, __LINE__); return dev_pm_opp_get_max_volt_latency(dev) + dev_pm_opp_get_max_clock_latency(dev); } @@ -396,6 +397,7 @@ unsigned long dev_pm_opp_get_suspend_opp_freq(struct device *dev) dev_pm_opp_put_opp_table(opp_table); + pr_info("%s: %d: %lu\n", __func__, __LINE__, freq); return freq; } EXPORT_SYMBOL_GPL(dev_pm_opp_get_suspend_opp_freq); @@ -958,6 +960,7 @@ _opp_config_clk_single(struct device *dev, struct opp_table *opp_table, return -EINVAL; } + pr_info("%s: %d: %lu\n", __func__, __LINE__, freq); ret = clk_set_rate(opp_table->clk, freq); if (ret) { dev_err(dev, "%s: failed to set clock rate: %d\n", __func__, @@ -2174,9 +2177,12 @@ static int _opp_set_regulators(struct opp_table *opp_table, struct device *dev, int count = 0, ret, i; /* Count number of regulators */ + pr_info("%s: %d: %s\n", __func__, __LINE__, names[0]); while (*temp++) count++; + pr_info("%s: %d: %d\n", __func__, __LINE__, count); + pr_info("%s: %d: %s\n", __func__, __LINE__, names[0]); if (!count) return -EINVAL; @@ -2184,12 +2190,14 @@ static int _opp_set_regulators(struct opp_table *opp_table, struct device *dev, if (opp_table->regulators) return 0; + pr_info("%s: %d\n", __func__, __LINE__); opp_table->regulators = kmalloc_array(count, sizeof(*opp_table->regulators), GFP_KERNEL); if (!opp_table->regulators) return -ENOMEM; + pr_info("%s: %d\n", __func__, __LINE__); for (i = 0; i < count; i++) { reg = regulator_get_optional(dev, names[i]); if (IS_ERR(reg)) { @@ -2202,12 +2210,14 @@ static int _opp_set_regulators(struct opp_table *opp_table, struct device *dev, opp_table->regulators[i] = reg; } + pr_info("%s: %d\n", __func__, __LINE__); opp_table->regulator_count = count; /* Set generic config_regulators() for single regulators here */ if (count == 1) opp_table->config_regulators = _opp_config_regulator_single; + pr_info("%s: %d\n", __func__, __LINE__); return 0; free_regulators: @@ -2225,6 +2235,7 @@ static void _opp_put_regulators(struct opp_table *opp_table) { int i; + pr_info("%s: %d\n", __func__, __LINE__); if (!opp_table->regulators) return; @@ -2545,6 +2556,7 @@ int dev_pm_opp_set_config(struct device *dev, struct dev_pm_opp_config *config) unsigned int id; int ret; + pr_info("%s: %d\n", __func__, __LINE__); data = kmalloc(sizeof(*data), GFP_KERNEL); if (!data) return -ENOMEM; @@ -2558,14 +2570,17 @@ int dev_pm_opp_set_config(struct device *dev, struct dev_pm_opp_config *config) data->opp_table = opp_table; data->flags = 0; + pr_info("%s: %d\n", __func__, __LINE__); /* This should be called before OPPs are initialized */ if (WARN_ON(!list_empty(&opp_table->opp_list))) { ret = -EBUSY; goto err; } + pr_info("%s: %d\n", __func__, __LINE__); /* Configure clocks */ if (config->clk_names) { + pr_info("%s: %d\n", __func__, __LINE__); ret = _opp_set_clknames(opp_table, dev, config->clk_names, config->config_clks); if (ret) @@ -2573,6 +2588,7 @@ int dev_pm_opp_set_config(struct device *dev, struct dev_pm_opp_config *config) data->flags |= OPP_CONFIG_CLK; } else if (config->config_clks) { + pr_info("%s: %d\n", __func__, __LINE__); /* Don't allow config callback without clocks */ ret = -EINVAL; goto err; @@ -2580,6 +2596,7 @@ int dev_pm_opp_set_config(struct device *dev, struct dev_pm_opp_config *config) /* Configure property names */ if (config->prop_name) { + pr_info("%s: %d\n", __func__, __LINE__); ret = _opp_set_prop_name(opp_table, config->prop_name); if (ret) goto err; @@ -2589,6 +2606,7 @@ int dev_pm_opp_set_config(struct device *dev, struct dev_pm_opp_config *config) /* Configure config_regulators helper */ if (config->config_regulators) { + pr_info("%s: %d\n", __func__, __LINE__); ret = _opp_set_config_regulators_helper(opp_table, dev, config->config_regulators); if (ret) @@ -2599,6 +2617,7 @@ int dev_pm_opp_set_config(struct device *dev, struct dev_pm_opp_config *config) /* Configure supported hardware */ if (config->supported_hw) { + pr_info("%s: %d\n", __func__, __LINE__); ret = _opp_set_supported_hw(opp_table, config->supported_hw, config->supported_hw_count); if (ret) @@ -2609,6 +2628,7 @@ int dev_pm_opp_set_config(struct device *dev, struct dev_pm_opp_config *config) /* Configure supplies */ if (config->regulator_names) { + pr_info("%s: %d\n", __func__, __LINE__); ret = _opp_set_regulators(opp_table, dev, config->regulator_names); if (ret) @@ -2619,6 +2639,7 @@ int dev_pm_opp_set_config(struct device *dev, struct dev_pm_opp_config *config) /* Attach genpds */ if (config->genpd_names) { + pr_info("%s: %d\n", __func__, __LINE__); if (config->required_devs) goto err; @@ -2629,6 +2650,7 @@ int dev_pm_opp_set_config(struct device *dev, struct dev_pm_opp_config *config) data->flags |= OPP_CONFIG_GENPD; } else if (config->required_devs) { + pr_info("%s: %d\n", __func__, __LINE__); ret = _opp_set_required_devs(opp_table, dev, config->required_devs); if (ret) @@ -2637,11 +2659,13 @@ int dev_pm_opp_set_config(struct device *dev, struct dev_pm_opp_config *config) data->flags |= OPP_CONFIG_REQUIRED_DEVS; } + pr_info("%s: %d\n", __func__, __LINE__); ret = xa_alloc(&opp_configs, &id, data, XA_LIMIT(1, INT_MAX), GFP_KERNEL); if (ret) goto err; + pr_info("%s: %d\n", __func__, __LINE__); return id; err: @@ -2667,6 +2691,7 @@ void dev_pm_opp_clear_config(int token) { struct opp_config_data *data; + pr_info("%s: %d\n", __func__, __LINE__); /* * This lets the callers call this unconditionally and keep their code * simple. diff --git a/rust/kernel/cpufreq.rs b/rust/kernel/cpufreq.rs index 4c9a7534179c..c9d9da2c0ef1 100644 --- a/rust/kernel/cpufreq.rs +++ b/rust/kernel/cpufreq.rs @@ -273,6 +273,7 @@ impl Clk { impl Drop for Clk { fn drop(&mut self) { + pr_info!("Drop clk"); // SAFETY: By the type invariants, we know that `self` owns a reference, so it is safe to // relinquish it now. unsafe { bindings::clk_put(self.0) }; |