Exemplo n.º 1
0
static long hw_camera_led_ioctl(struct file *filep ,unsigned int cmd, unsigned long arg)
{
	int ret = 0;
	unsigned int camera_led_state;
	extern int tps61310_set_flash(unsigned led_state);
	
	CDBG("function %s enterence\n",__func__);
	switch(cmd)
	{
		case CAMERA_LED_GET :
			
			camera_led_state = atomic_read(&camera_led_flag);
			if(copy_to_user((void __user *)arg,&camera_led_state,sizeof(camera_led_state))) 
			{
				pr_err("function copy_to_user fail");
				ret = -EFAULT;
			}
			break;
		case CAMERA_LED_SET :
			if(copy_from_user(&camera_led_state,(void __user *)arg,sizeof(camera_led_state)))
			{
				pr_err("function copy_from_user fail");
				ret = -EFAULT;
			}
			else
			{
				/*these handset use tps61310 as flash*/
				if(/* machine_is_msm8x25_U8825()
				|| machine_is_msm8x25_U8825D()
                || machine_is_msm8x25_U8833D()
                || machine_is_msm8x25_U8833()                
				|| machine_is_msm8x25_C8825D()
				|| machine_is_msm8x25_C8950D()
				|| machine_is_msm8x25_U8950D()
				|| machine_is_msm8x25_U8951()
                || machine_is_msm8x25_C8951()
                || machine_is_msm8x25_H881C()
				||machine_is_msm8x25_U8950()*/ 1)
				{
				call_led_set_state(camera_led_state);
				}
				else
				{
					ret = msm_camera_flash_set_led_state(&hw_camera_led_data, camera_led_state);
				}
				
				if(!ret)
				{
					atomic_set(&camera_led_flag,camera_led_state);
				}
			}
			break;
		default:
			pr_err("hw_camera_led_ioctl:error ioctl cmd");
			ret = -EINVAL;
		
	}
	
	return ret;
}
Exemplo n.º 2
0
static long hw_camera_led_ioctl(struct file *filep ,unsigned int cmd, unsigned long arg)
{
    int ret = 0;
    unsigned int camera_led_state;
    hw_product_sub_type product_sub_type = get_hw_sub_board_id();

    CDBG("function %s enterence\n",__func__);
    switch(cmd)
    {
    case CAMERA_LED_GET :

        camera_led_state = atomic_read(&camera_led_flag);
        if(copy_to_user((void __user *)arg,&camera_led_state,sizeof(camera_led_state)))
        {
            pr_err("function copy_to_user fail");
            ret = -EFAULT;
        }
        break;
    case CAMERA_LED_SET :
        if(copy_from_user(&camera_led_state,(void __user *)arg,sizeof(camera_led_state)))
        {
            pr_err("function copy_from_user fail");
            ret = -EFAULT;
        }
        else
        {
            /*C8813Q support torch */
            if( machine_is_msm8x25_C8950D()
                    || machine_is_msm8x25_C8813()
                    || machine_is_msm8x25_C8813Q()
                    || machine_is_msm8x25_G610C()
                    || ( ( machine_is_msm8x25_U8951()
                           || machine_is_msm8x25_G520U())
                         && ( !IS_UMTS_DOUBLE_SIM(product_sub_type) ) ) )
            {
                ret = call_led_set_state(camera_led_state);
            }
            else
            {
                ret = msm_camera_flash_set_led_state(&hw_camera_led_data, camera_led_state);
            }

            if(!ret)
            {
                atomic_set(&camera_led_flag,camera_led_state);
            }
        }
        break;
    default:
        pr_err("hw_camera_led_ioctl:error ioctl cmd");
        ret = -EINVAL;

    }

    return ret;
}