• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C++ cpufreq_verify_within_limits函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中cpufreq_verify_within_limits函数的典型用法代码示例。如果您正苦于以下问题:C++ cpufreq_verify_within_limits函数的具体用法?C++ cpufreq_verify_within_limits怎么用?C++ cpufreq_verify_within_limits使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了cpufreq_verify_within_limits函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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;
}
开发者ID:03199618,项目名称:linux,代码行数:34,代码来源:freq_table.c


示例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;
}
开发者ID:jetonbacaj,项目名称:SomeKernel_920P_OL1,代码行数:35,代码来源:freq_table.c


示例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;
}
开发者ID:demonking,项目名称:Dhollmen_Kernel,代码行数:31,代码来源:freq_table.c


示例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;
}
开发者ID:itsmerajit,项目名称:kernel_otus,代码行数:44,代码来源:cpu-boost.c


示例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;
}
开发者ID:Clumsy-Kernel-Development,项目名称:M9_Kernel,代码行数:27,代码来源:battery_current_limit.c


示例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;
}
开发者ID:ivucica,项目名称:linux,代码行数:30,代码来源:processor_perflib.c


示例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;
}
开发者ID:007kumarraja,项目名称:rockchip-rk3188-mk908,代码行数:29,代码来源:cbe_cpufreq_pmi.c


示例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;
}
开发者ID:jfdsmabalot,项目名称:kernel_sony_msm8974,代码行数:33,代码来源:cpu-boost.c


示例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;
}
开发者ID:yangxjzwd1,项目名称:linux,代码行数:20,代码来源:generic.c


示例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
}
开发者ID:BuzzBumbleBee,项目名称:android_kernel_advent_vega,代码行数:10,代码来源:cpufreq.c


示例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;
}
开发者ID:zeroblade1984,项目名称:MotoG2k15,代码行数:19,代码来源:battery_current_limit.c


示例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;
}
开发者ID:JBTech,项目名称:ralink_rt5350,代码行数:23,代码来源:cpu.c


示例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;
}
开发者ID:choco81,项目名称:AIR-Kernel_ICS,代码行数:20,代码来源:sysconfig.c


示例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();
}
开发者ID:TeamRegular,项目名称:android_kernel_lge_msm8992,代码行数:53,代码来源:battery_current_limit.c


示例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;
}
开发者ID:dduval,项目名称:kernel-rhel3,代码行数:18,代码来源:longrun.c


示例16: thermal_notify

static int thermal_notify(struct notifier_block *block, unsigned long event,
	void *data)
{
	struct cpufreq_policy *policy = data;

	if (event != CPUFREQ_ADJUST)
		return 0;

	if (maximum_freq)
		cpufreq_verify_within_limits(policy, 0, maximum_freq);

	return 0;
}
开发者ID:lchao-bit,项目名称:linaro-kernel,代码行数:13,代码来源:thermal_freq.c


示例17: clamp_notifier_call

static int clamp_notifier_call(struct notifier_block *self,
                   unsigned long event, void *data)
{
    struct cpufreq_policy *p = data;
    unsigned long max_freq;

    if (event != CPUFREQ_ADJUST)
        return 0;

    max_freq = clamped ? (p->cpuinfo.min_freq) : (p->cpuinfo.max_freq);
    cpufreq_verify_within_limits(p, 0, max_freq);

    return 0;
}
开发者ID:274914765,项目名称:C,代码行数:14,代码来源:windfarm_cpufreq_clamp.c


示例18: powernow_cpufreq_verify

static int powernow_cpufreq_verify(struct cpufreq_policy *policy)
{
    struct acpi_cpufreq_data *data;
    struct processor_performance *perf;

    if (!policy || !(data = cpufreq_drv_data[policy->cpu]) ||
        !processor_pminfo[policy->cpu])
        return -EINVAL;

    perf = &processor_pminfo[policy->cpu]->perf;

    cpufreq_verify_within_limits(policy, 0, 
        perf->states[perf->platform_limit].core_frequency * 1000);

    return cpufreq_frequency_table_verify(policy, data->freq_table);
}
开发者ID:HackLinux,项目名称:xen,代码行数:16,代码来源:powernow.c


示例19: longrun_verify_policy

static int longrun_verify_policy(struct cpufreq_policy *policy)
{
	if (!policy)
		return -EINVAL;

	policy->cpu = 0;
	cpufreq_verify_within_limits(policy,
		policy->cpuinfo.min_freq,
		policy->cpuinfo.max_freq);

	if ((policy->policy != CPUFREQ_POLICY_POWERSAVE) &&
	    (policy->policy != CPUFREQ_POLICY_PERFORMANCE))
		return -EINVAL;

	return 0;
}
开发者ID:Medvedroid,项目名称:OT_903D-kernel-2.6.35.7,代码行数:16,代码来源:longrun.c


示例20: 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 min = s->boost_min;

	if (val != CPUFREQ_ADJUST)
		return NOTIFY_OK;

	if (min == 0)
		return NOTIFY_OK;

	cpufreq_verify_within_limits(policy, min, UINT_MAX);

	return NOTIFY_OK;
}
开发者ID:andi34,项目名称:Dhollmen_Kernel,代码行数:22,代码来源:cpu-boost.c



注:本文中的cpufreq_verify_within_limits函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ cpuid函数代码示例发布时间:2022-05-30
下一篇:
C++ cpufreq_unregister_notifier函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap