コード例 #1
0
static int led_set_pwm(int pwm_num, enum led_brightness level)
{
	struct pwm_easy_config pwm_setting;
	pwm_setting.pwm_no = pwm_num;
	pwm_setting.clk_div = CLK_DIV1; 		
	pwm_setting.duration = 10;
    
    if(pwm_num != PWM3 && pwm_num != PWM4 && pwm_num != PWM5)
		pwm_setting.clk_src = PWM_CLK_OLD_MODE_32K;
	else
		pwm_setting.clk_src = PWM_CLK_NEW_MODE_BLOCK_DIV_BY_1625;
    
	if(level)
	{
		pwm_setting.duty = 30;
	}else
	{
		if(pwm_num == PWM1)
		{
			pwm_setting.duty = 100; //off the notify led
		}
		else
		{
			pwm_setting.duty = 0;
		}
	}
	printf("[LEDS]uboot: brightness_set_pwm: level=%d, clk=%d \n\r", level, pwm_setting.clk_src);
	pwm_set_easy_config(&pwm_setting);
	
	return 0;
	
}
コード例 #2
0
	ssize_t gpio_TORCH_Enable(void)
	{
		static struct pwm_easy_config pwm_setting;

		mt_set_gpio_mode(48, GPIO_MODE_00);
		mt_set_gpio_dir(48, GPIO_DIR_OUT);
		mt_set_gpio_out(48, GPIO_OUT_ZERO);

		mt_set_gpio_mode(66, GPIO_MODE_01);
		pwm_setting.pwm_no = fl_pwm_num;
		pwm_setting.clk_div = fl_div;
		pwm_setting.clk_src = PWM_CLK_OLD_MODE_32K;

		pwm_setting.duty = strobe_width;
		pwm_setting.duration = 0;
		pwm_set_easy_config(&pwm_setting);

		return 0;
	}
コード例 #3
0
DISP_STATUS DISP_Set3DPWM(BOOL enable, BOOL landscape)
{
#if 0
	unsigned int temp_reg;

	if (enable && (!ispwmenabled || ismodechanged))
	{
		// Set GPIO66, GPIO67, GPIO68 to PWM2, PWM1, PWM3
		mt_set_gpio_mode(GPIO187, GPIO_MODE_GPIO);	
		mt_set_gpio_out(GPIO187, GPIO_OUT_ONE);
		
		mt_set_gpio_mode(GPIO66, GPIO_MODE_07);	
		mt_set_gpio_mode(GPIO67, GPIO_MODE_07);	
		mt_set_gpio_mode(GPIO68, GPIO_MODE_07);	

		
		struct  pwm_easy_config pwm_setting;

		pwm_setting.clk_src = PWM_CLK_OLD_MODE_32K;
		pwm_setting.duty = 50;
		pwm_setting.clk_div = CLK_DIV1;
		pwm_setting.duration = 533;

		pwm_setting.pwm_no = PWM1;
		pwm_set_easy_config(&pwm_setting);
		pwm_setting.pwm_no = PWM2;
		pwm_set_easy_config(&pwm_setting);
		pwm_setting.pwm_no = PWM3;
		pwm_set_easy_config(&pwm_setting);

		temp_reg=INREG32(INFRA_SYS_CFG_BASE+0x700); 

		temp_reg&=~0xF000000;

		if(landscape)
			temp_reg|=0x9000000;
		else
			temp_reg|=0x3000000;

		OUTREG32((INFRA_SYS_CFG_BASE+0x700), temp_reg);

		ispwmenabled = TRUE;
		
		DISP_LOG("3D PWM is enabled. landscape:%d ! \n", landscape);
	}
	else if (!enable && ispwmenabled)
	{	
		mt_set_gpio_mode(GPIO187, GPIO_MODE_GPIO);	
		mt_set_gpio_out(GPIO187, GPIO_OUT_ZERO);

		mt_set_gpio_mode(GPIO66, GPIO_MODE_GPIO);	
		mt_set_gpio_mode(GPIO67, GPIO_MODE_GPIO);	
		mt_set_gpio_mode(GPIO68, GPIO_MODE_GPIO);	

		ispwmenabled = FALSE;

		DISP_LOG("3D PWM is disabled ! \n");
	}
#endif
	return DISP_STATUS_OK;
}