コード例 #1
0
int32_t msm_camera_flash_set_led_state(
	struct msm_camera_sensor_flash_data *fdata, unsigned led_state)
	{
	int32_t rc=0;
	pr_err("led_state=%d\n",led_state);
	switch (led_state) {
	case MSM_CAMERA_LED_RELEASE:
	case MSM_CAMERA_LED_OFF:
#if defined  CONFIG_FLSH_ADP1650		
	rc = ADP1650_disable();
#elif defined FLASH_GPIO_CONTROL	
	rc = msm_camera_flash_led_disable();
#endif

	break;

	case MSM_CAMERA_LED_LOW:	

#if defined  CONFIG_FLSH_ADP1650		
	rc = ADP1650_assistmode_enable();
#elif defined FLASH_GPIO_CONTROL
	msm_camera_set_flash_torch_mode(13);
#endif

	break;

	case MSM_CAMERA_LED_HIGH:
#if defined  CONFIG_FLSH_ADP1650		
rc = ADP1650_flashmode_enable();
#elif defined FLASH_GPIO_CONTROL	
	if(current_flash_led_mode ==2){
	rc = msm_camera_flash_led_enable();
	}else if((current_flash_led_mode ==1)&&(ov5640_autoflashflag== 1)){
			rc = msm_camera_flash_led_enable();
	}
#endif

	break;
	default:
	rc = 0;
	break;
	}

	return rc;
	}
コード例 #2
0
/*
 * Refer to MSM_CAM_IOCTL_FLASH_LED_CFG used by mm-camera in user space
 * flash_led_enable is set in apps's menu item selected by user
 * 0: disable Flash LED
 * 1: enable Flash LED
 */
int32_t msm_camera_flash_set_led_state(struct msm_camera_sensor_flash_data *fdata,
		unsigned led_state)
{
    int32_t rc = 0;

	pr_err("%s: led_state: %d,fdata->flash_type=%d\n", __func__, led_state,fdata->flash_type);

    if (fdata->flash_type != MSM_CAMERA_FLASH_LED)
    {
		return -ENODEV;
    }

    switch(led_state)
    {
        case MSM_CAMERA_LED_OFF:
			if( __gpio_get_value(MSM_CAMERA_FLASH_LED_GPIO))
			msm_camera_flash_set_led_gpio(0);
            break;

        case MSM_CAMERA_LED_LOW:
			if (flash_led_enable==1)
            {//MSM_LED_MODE_ON
              msm_camera_set_flash_torch_mode(5);
            }
		    else if(flash_led_enable==2)
		    {
		      //MSM_LED_MODE_AUTO
		       if(zte_get_flash_auto_flag_value()== 1)
			   {
		          msm_camera_set_flash_torch_mode(5);
		       }  
			}
			
			break;
			
        case MSM_CAMERA_LED_HIGH:
            msm_camera_flash_led_enable();
            break;

        case MSM_CAMERA_LED_RELEASE:
			if( __gpio_get_value(MSM_CAMERA_FLASH_LED_GPIO))
			 msm_camera_flash_set_led_gpio(0);
            break;

        default:
            rc = -EFAULT;
			pr_err("%s: rc=%d\n", __func__, rc);

            return rc;
    }

    return rc;
}