Exemple #1
0
static ssize_t __ref store_online(struct sys_device *dev, struct sysdev_attribute *attr,
				 const char *buf, size_t count)
{
	struct cpu *cpu = container_of(dev, struct cpu, sysdev);
	ssize_t ret;

	cpu_hotplug_driver_lock();
	switch (buf[0]) {
	case '0':
		ret = cpu_down(cpu->sysdev.id);
		if (!ret)
			kobject_uevent(&dev->kobj, KOBJ_OFFLINE);
		break;
	case '1':
		ret = cpu_up(cpu->sysdev.id);
		if (!ret)
			kobject_uevent(&dev->kobj, KOBJ_ONLINE);
		break;
	default:
		ret = -EINVAL;
	}
	cpu_hotplug_driver_unlock();

#if defined (CONFIG_KOR_MODEL_SHV_E120S) || defined (CONFIG_KOR_MODEL_SHV_E120K) || defined (CONFIG_KOR_MODEL_SHV_E120L) \
|| defined (CONFIG_KOR_MODEL_SHV_E160S) || defined (CONFIG_KOR_MODEL_SHV_E160K) || defined(CONFIG_KOR_MODEL_SHV_E160L)  \
|| defined (CONFIG_USA_MODEL_SGH_I757) || defined (CONFIG_USA_MODEL_SGH_I577) || defined (CONFIG_USA_MODEL_SGH_T769) || defined(CONFIG_CAN_MODEL_SGH_I577R) || defined (CONFIG_CAN_MODEL_SGH_I757M)
		if (!ret && cpu->sysdev.id == NON_BOOT_CPU)
		{
			if (buf[0] == '0') // cpu1 offline
			{
				cpufreq_set_limit(UNI_PRO_START);
			}
			else if (buf[0] == '1') // cpu1 online
			{
				cpufreq_set_limit(UNI_PRO_STOP);
			}
		}
#endif

	if (ret >= 0)
		ret = count;
	return ret;
}
Exemple #2
0
static ssize_t store_run_queue_avg(struct kobject *kobj,
		struct kobj_attribute *attr, char *buf, size_t count)
{
	if (buf[0] == '1')
	{	
		if (is_dual_locked != 0)
			return count;

		cpufreq_set_limit(DVFS_START);
#if 1
		cpu_hotplug_driver_lock();
		if (cpu_is_offline(NON_BOOT_CPU))
		{	
			cpu_up(NON_BOOT_CPU); // it takes 60ms
		}
		cpu_hotplug_driver_unlock();
#else	
		if (cpu_is_offline(NON_BOOT_CPU))
			schedule_work_on(0, &dvfs_hotplug_work);
#endif
		stall_mpdecision = 1;	
		is_dual_locked = 1;
	}
	else
	{
		if (is_dual_locked == 0)
		{
			stall_mpdecision = 0;
			return count;
		}

		cpufreq_set_limit(DVFS_STOP);

		stall_mpdecision = 0;
		is_dual_locked = 0;
	}

	return count;
}