Esempio n. 1
0
int thread_regulate_fan(void *data)
{
	unsigned long temp;
	pr_info("Thread awake\n");
	while(!kthread_should_stop())
	{
		if(gMode == AUTO)
		{
			temp = exynos_thermal_get_value();
			if(temp < 57)
			{
				set_pwm(0);
				pwm_dis();
			}
			else if(temp >= 57 && temp < 63)
			{
				set_pwm(20);
				pwm_en();
			}
			else if(temp >= 63 && temp < 68)
			{
				set_pwm(50);
				pwm_en();
			}
			else if(temp >= 68)
			{
				set_pwm(100);
				pwm_en();
			}
			pr_info("Temperature of exynos is : %ld.\n", temp);
		}
		msleep(2000);
	}
    return 0;
}
Esempio n. 2
0
void KeyScan_PlayTone(UINT8 bType)
{
        PWM_struct PWMInfo;
        UINT32 uiKeyToneTimerID;
        UINT32 uiKeyPlayTime = 100; //ms


        if((ubIsPlaying)||(!bKeyToneEn))
            return;

        PWMInfo.uiDiv       = 180;
        PWMInfo.uiPrd       = 20;
        PWMInfo.uiOnCycle   = 0;
        PWMInfo.uiInv       = 0;
        PWMInfo.uiRise      = 0;
        PWMInfo.uiFall      = 10;
        pwm_open(PWMID_0);
        pwm_set(PWMID_0, &PWMInfo);

        if(timer_openAutoClose((UINT *)&uiKeyToneTimerID, (FP)KeyScan_PlayToneStop) == E_OK)
        {
            pwm_en(PWMID_0);
            timer_set(uiKeyToneTimerID, uiKeyPlayTime, _TIMER_CTRL_ONE_SHOT|_TIMER_CTRL_INT_ENABLE, _TIMER_PLAY);

        }
        ubIsPlaying = TRUE;
}
Esempio n. 3
0
static ssize_t skeleton_set_mode(struct device *dev, 
			struct device_attribute *attr,
			const char *buf, size_t count)
{
	if(count <= CMD_MAX_LEN)
	{
		memcpy(cmd, buf, count);
	}
	else
	{
		return 0;
	}
	if(strncmp(cmd, auto_str, count) == 0)
	{
		gMode = AUTO;
		pr_info("Fan Control : chanded mode to automatic\n");
		if(thread_is_running == 0)
			regulation_task = kthread_run(&thread_regulate_fan, 
										NULL, "regulation_task");
		thread_is_running = 1;
	}
	else if(strncmp(cmd, man_str, count) == 0)
	{
		gMode = MAN;
		pr_info("Fan Control : changed mode to manual\n");
		set_pwm(50);
		pwm_en();
		if(thread_is_running == 1)
			kthread_stop(regulation_task);
		thread_is_running = 0;
	}
	else gMode = AUTO;
	return count;
}
Esempio n. 4
0
/**
  Play sound (beep) by using PWM

  Play sound (beep) by using PWM.

  @param void
  @return void
*/
void GPIOMap_SoundPlayPWM(void)
{
    PWM_CFG PWMInfo;

    PWMInfo.uiDiv       = 99;   // 1500Hz (base-clock (3MHz) / (div + 1) / basic-period)
    PWMInfo.uiPrd       = 20;   // basic period
    PWMInfo.uiRise      = 0;    // +50
    PWMInfo.uiFall      = 10;   // -50
    PWMInfo.uiOnCycle   = 50;   // 33 ms
    PWMInfo.uiInv       = 0;    // not invert

    pwm_set(PWM_BEEP_SOUND, &PWMInfo);
    pwm_en(PWM_BEEP_SOUND);
}
Esempio n. 5
0
static ssize_t skeleton_set_duty(struct device *dev, 
			struct device_attribute *attr,
			const char *buf, size_t count)
{
	char * ret;
	int duty;
	duty = simple_strtoul(buf, &ret, 10);
	pr_info("Fan Control : duty of %d trying to be set\n", duty);	
	if(gMode == MAN)
	{
		pr_info("Fan Control : duty of %d was set\n", duty);
		set_pwm(duty);
		pwm_en();
	}
	return sizeof(buf);
}