本文整理汇总了C++中cpufreq_verify_within_limits函数的典型用法代码示例。如果您正苦于以下问题:C++ cpufreq_verify_within_limits函数的具体用法?C++ cpufreq_verify_within_limits怎么用?C++ cpufreq_verify_within_limits使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了cpufreq_verify_within_limits函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: cpufreq_frequency_table_verify
int cpufreq_frequency_table_verify(struct cpufreq_policy *policy,
struct cpufreq_frequency_table *table)
{
unsigned int next_larger = ~0;
unsigned int i;
unsigned int count = 0;
pr_debug("request for verification of policy (%u - %u kHz) for cpu %u\n",
policy->min, policy->max, policy->cpu);
cpufreq_verify_within_limits(policy, policy->cpuinfo.min_freq,
policy->cpuinfo.max_freq);
for (i = 0; (table[i].frequency != CPUFREQ_TABLE_END); i++) {
unsigned int freq = table[i].frequency;
if (freq == CPUFREQ_ENTRY_INVALID)
continue;
if ((freq >= policy->min) && (freq <= policy->max))
count++;
else if ((next_larger > freq) && (freq > policy->max))
next_larger = freq;
}
if (!count)
policy->max = next_larger;
cpufreq_verify_within_limits(policy, policy->cpuinfo.min_freq,
policy->cpuinfo.max_freq);
pr_debug("verification lead to (%u - %u kHz) for cpu %u\n",
policy->min, policy->max, policy->cpu);
return 0;
}
示例2: cpufreq_frequency_table_verify
int cpufreq_frequency_table_verify(struct cpufreq_policy *policy,
struct cpufreq_frequency_table *table)
{
unsigned int next_larger = ~0, freq, i = 0;
bool found = false;
pr_debug("request for verification of policy (%u - %u kHz) for cpu %u\n",
policy->min, policy->max, policy->cpu);
cpufreq_verify_within_limits(policy, policy->cpuinfo.min_freq,
policy->cpuinfo.max_freq);
for (; freq = table[i].frequency, freq != CPUFREQ_TABLE_END; i++) {
if (freq == CPUFREQ_ENTRY_INVALID)
continue;
if ((freq >= policy->min) && (freq <= policy->max)) {
found = true;
break;
}
if ((next_larger > freq) && (freq > policy->max))
next_larger = freq;
}
if (!found) {
policy->max = next_larger;
cpufreq_verify_within_limits(policy, policy->cpuinfo.min_freq,
policy->cpuinfo.max_freq);
}
pr_debug("verification lead to (%u - %u kHz) for cpu %u\n",
policy->min, policy->max, policy->cpu);
return 0;
}
示例3: cpufreq_frequency_table_verify
int cpufreq_frequency_table_verify(struct cpufreq_policy *policy,
struct cpufreq_frequency_table *table)
{
unsigned int next_larger = ~0;
unsigned int i;
unsigned int count = 0;
if (!cpu_online(policy->cpu))
return -EINVAL;
cpufreq_verify_within_limits(policy, policy->cpuinfo.min_freq,
policy->cpuinfo.max_freq);
for (i = 0; (table[i].frequency != CPUFREQ_TABLE_END); i++) {
unsigned int freq = table[i].frequency;
if (freq == CPUFREQ_ENTRY_INVALID)
continue;
if ((freq >= policy->min) && (freq <= policy->max))
count++;
else if ((next_larger > freq) && (freq > policy->max))
next_larger = freq;
}
if (!count)
policy->max = next_larger;
cpufreq_verify_within_limits(policy, policy->cpuinfo.min_freq,
policy->cpuinfo.max_freq);
return 0;
}
示例4: boost_adjust_notify
/*
* The CPUFREQ_ADJUST notifier is used to override the current policy min to
* make sure policy min >= boost_min. The cpufreq framework then does the job
* of enforcing the new policy.
*
* The sync kthread needs to run on the CPU in question to avoid deadlocks in
* the wake up code. Achieve this by binding the thread to the respective
* CPU. But a CPU going offline unbinds threads from that CPU. So, set it up
* again each time the CPU comes back up. We can use CPUFREQ_START to figure
* out a CPU is coming online instead of registering for hotplug notifiers.
*/
static int boost_adjust_notify(struct notifier_block *nb, unsigned long val, void *data)
{
struct cpufreq_policy *policy = data;
unsigned int cpu = policy->cpu;
struct cpu_sync *s = &per_cpu(sync_info, cpu);
unsigned int b_min = s->boost_min;
unsigned int ib_min = s->input_boost_min;
unsigned int min;
switch (val) {
case CPUFREQ_ADJUST:
if (!b_min && !ib_min)
break;
min = max(b_min, ib_min);
pr_debug("CPU%u policy min before boost: %u kHz\n",
cpu, policy->min);
pr_debug("CPU%u boost min: %u kHz\n", cpu, min);
cpufreq_verify_within_limits(policy, min, UINT_MAX);
pr_debug("CPU%u policy min after boost: %u kHz\n",
cpu, policy->min);
break;
case CPUFREQ_START:
set_cpus_allowed(s->thread, *cpumask_of(cpu));
break;
}
return NOTIFY_OK;
}
示例5: bcl_cpufreq_callback
static int bcl_cpufreq_callback(struct notifier_block *nfb,
unsigned long event, void *data)
{
struct cpufreq_policy *policy = data;
uint32_t max_freq = UINT_MAX;
if (!(bcl_frequency_mask & BIT(policy->cpu)))
return NOTIFY_OK;
switch (event) {
case CPUFREQ_INCOMPATIBLE:
if (bcl_vph_state == BCL_LOW_THRESHOLD
|| bcl_ibat_state == BCL_HIGH_THRESHOLD
|| bcl_soc_state == BCL_LOW_THRESHOLD) {
max_freq = (gbcl->bcl_monitor_type
== BCL_IBAT_MONITOR_TYPE) ? gbcl->btm_freq_max
: gbcl->bcl_p_freq_max;
}
pr_debug("Requesting Max freq:%u for CPU%d\n",
max_freq, policy->cpu);
cpufreq_verify_within_limits(policy, 0,
max_freq);
break;
}
return NOTIFY_OK;
}
示例6: acpi_processor_ppc_notifier
static int acpi_processor_ppc_notifier(struct notifier_block *nb,
unsigned long event, void *data)
{
struct cpufreq_policy *policy = data;
struct acpi_processor *pr;
unsigned int ppc = 0;
mutex_lock(&performance_mutex);
if (event != CPUFREQ_INCOMPATIBLE)
goto out;
pr = processors[policy->cpu];
if (!pr || !pr->performance)
goto out;
ppc = (unsigned int)pr->performance_platform_limit;
if (ppc >= pr->performance->state_count)
goto out;
cpufreq_verify_within_limits(policy, 0,
pr->performance->states[ppc].
core_frequency * 1000);
out:
mutex_unlock(&performance_mutex);
return 0;
}
示例7: pmi_notifier
static int pmi_notifier(struct notifier_block *nb,
unsigned long event, void *data)
{
struct cpufreq_policy *policy = data;
struct cpufreq_frequency_table *cbe_freqs;
u8 node;
/* Should this really be called for CPUFREQ_ADJUST, CPUFREQ_INCOMPATIBLE
* and CPUFREQ_NOTIFY policy events?)
*/
if (event == CPUFREQ_START)
return 0;
cbe_freqs = cpufreq_frequency_get_table(policy->cpu);
node = cbe_cpu_to_node(policy->cpu);
pr_debug("got notified, event=%lu, node=%u\n", event, node);
if (pmi_slow_mode_limit[node] != 0) {
pr_debug("limiting node %d to slow mode %d\n",
node, pmi_slow_mode_limit[node]);
cpufreq_verify_within_limits(policy, 0,
cbe_freqs[pmi_slow_mode_limit[node]].frequency);
}
return 0;
}
示例8: boost_adjust_notify
/*
* The CPUFREQ_ADJUST notifier is used to override the current policy min to
* make sure policy min >= boost_min. The cpufreq framework then does the job
* of enforcing the new policy.
*/
static int boost_adjust_notify(struct notifier_block *nb, unsigned long val, void *data)
{
struct cpufreq_policy *policy = data;
unsigned int cpu = policy->cpu;
struct cpu_sync *s = &per_cpu(sync_info, cpu);
unsigned int b_min = s->boost_min;
unsigned int ib_min = s->input_boost_min;
unsigned int min;
if (val != CPUFREQ_ADJUST)
return NOTIFY_OK;
if (!b_min && !ib_min)
return NOTIFY_OK;
min = max(b_min, ib_min);
pr_debug("CPU%u policy min before boost: %u kHz\n",
cpu, policy->min);
pr_debug("CPU%u boost min: %u kHz\n", cpu, min);
cpufreq_verify_within_limits(policy, min, UINT_MAX);
pr_debug("CPU%u policy min after boost: %u kHz\n",
cpu, policy->min);
return NOTIFY_OK;
}
示例9: sa11x0_verify_speed
/* make sure that only the "userspace" governor is run -- anything else wouldn't make sense on
* this platform, anyway.
*/
int sa11x0_verify_speed(struct cpufreq_policy *policy)
{
unsigned int tmp;
if (policy->cpu)
return -EINVAL;
cpufreq_verify_within_limits(policy, policy->cpuinfo.min_freq, policy->cpuinfo.max_freq);
/* make sure that at least one frequency is within the policy */
tmp = cclk_frequency_100khz[sa11x0_freq_to_ppcr(policy->min)] * 100;
if (tmp > policy->max)
policy->max = tmp;
cpufreq_verify_within_limits(policy, policy->cpuinfo.min_freq, policy->cpuinfo.max_freq);
return 0;
}
示例10: tegra_verify_speed
static int tegra_verify_speed(struct cpufreq_policy *policy)
{
#if defined(CONFIG_USE_FAKE_SHMOO)
return cpufreq_frequency_table_verify(policy, freq_table);
#else
cpufreq_verify_within_limits(policy, policy->cpuinfo.min_freq,
policy->cpuinfo.max_freq);
return 0;
#endif
}
示例11: bcl_cpufreq_callback
static int bcl_cpufreq_callback(struct notifier_block *nfb,
unsigned long event, void *data)
{
struct cpufreq_policy *policy = data;
switch (event) {
case CPUFREQ_INCOMPATIBLE:
if (bcl_vph_state == BCL_LOW_THRESHOLD) {
cpufreq_verify_within_limits(policy, 0,
gbcl->btm_freq_max);
} else if (bcl_vph_state == BCL_HIGH_THRESHOLD) {
cpufreq_verify_within_limits(policy, 0,
UINT_MAX);
}
break;
}
return NOTIFY_OK;
}
示例12: integrator_verify_policy
/*
* Validate the speed policy.
*/
static int integrator_verify_policy(struct cpufreq_policy *policy)
{
struct icst525_vco vco;
cpufreq_verify_within_limits(policy,
policy->cpuinfo.min_freq,
policy->cpuinfo.max_freq);
vco = icst525_khz_to_vco(&cclk_params, policy->max);
policy->max = icst525_khz(&cclk_params, vco);
vco = icst525_khz_to_vco(&cclk_params, policy->min);
policy->min = icst525_khz(&cclk_params, vco);
cpufreq_verify_within_limits(policy,
policy->cpuinfo.min_freq,
policy->cpuinfo.max_freq);
return 0;
}
示例13: limit_adjust_cpufreq_notifier
static int limit_adjust_cpufreq_notifier(struct notifier_block *nb,
unsigned long event, void *data)
{
struct cpufreq_policy *policy = data;
if (event != CPUFREQ_ADJUST)
return 0;
/* This is our indicator of GPU activity */
if (regulator_is_enabled(g3d_pd_regulator))
#ifdef CONFIG_LIVE_OC
cpufreq_verify_within_limits(policy, get_gpuminfreq(),
policy->cpuinfo.max_freq);
#else
cpufreq_verify_within_limits(policy, MIN_CPU_KHZ_FREQ,
policy->cpuinfo.max_freq);
#endif
return 0;
}
示例14: bcl_cpufreq_callback
static int bcl_cpufreq_callback(struct notifier_block *nfb,
unsigned long event, void *data)
{
struct cpufreq_policy *policy = data;
uint32_t max_freq = UINT_MAX;
if (!(bcl_frequency_mask & BIT(policy->cpu)))
return NOTIFY_OK;
switch (event) {
case CPUFREQ_INCOMPATIBLE:
#ifndef CONFIG_LGE_PM
if (bcl_vph_state == BCL_LOW_THRESHOLD
|| bcl_ibat_state == BCL_HIGH_THRESHOLD
|| bcl_soc_state == BCL_LOW_THRESHOLD) {
#else
if (bcl_vph_state == BCL_LOW_THRESHOLD
|| bcl_ibat_state == BCL_HIGH_THRESHOLD) {
#endif
max_freq = (gbcl->bcl_monitor_type
== BCL_IBAT_MONITOR_TYPE) ? gbcl->btm_freq_max
: gbcl->bcl_p_freq_max;
}
pr_debug("Requesting Max freq:%u for CPU%d\n",
max_freq, policy->cpu);
cpufreq_verify_within_limits(policy, 0,
max_freq);
break;
}
return NOTIFY_OK;
}
static struct notifier_block bcl_cpufreq_notifier = {
.notifier_call = bcl_cpufreq_callback,
};
static void update_cpu_freq(void)
{
int cpu, ret = 0;
get_online_cpus();
for_each_online_cpu(cpu) {
if (bcl_frequency_mask & BIT(cpu)) {
ret = cpufreq_update_policy(cpu);
if (ret)
pr_err(
"Error updating policy for CPU%d. ret:%d\n",
cpu, ret);
}
}
put_online_cpus();
}
示例15: longrun_verify_policy
/**
* longrun_verify_poliy - verifies a new CPUFreq policy
*
* Validates a new CPUFreq policy. This function has to be called with
* cpufreq_driver locked.
*/
static int longrun_verify_policy(struct cpufreq_policy *policy)
{
if (!policy || !longrun_driver)
return -EINVAL;
policy->cpu = 0;
cpufreq_verify_within_limits(policy,
longrun_driver->policy[0].cpuinfo.min_freq,
longrun_driver->policy[0].cpuinfo.max_freq);
return 0;
}