Beispiel #1
0
int FL_uninit(void)
{
	PK_DBG("FL_uninit");

	FL_disable();
    return 0;
}
static int constant_flashlight_ioctl(MUINT32 cmd, MUINT32 arg)
{
	int i4RetValue = 0;
	int ior;
	int iow;
	int iowr;
	ior = _IOR(FLASHLIGHT_MAGIC,0, int);
	iow = _IOW(FLASHLIGHT_MAGIC,0, int);
	iowr = _IOWR(FLASHLIGHT_MAGIC,0, int);
	PK_DBG("constant_flashlight_ioctl() line=%d cmd=%d, ior=%d, iow=%d iowr=%d arg=%d\n",__LINE__, cmd, ior, iow, iowr, arg);
	PK_DBG("constant_flashlight_ioctl() line=%d cmd-ior=%d, cmd-iow=%d cmd-iowr=%d arg=%d\n",__LINE__, cmd-ior, cmd-iow, cmd-iowr, arg);
    switch(cmd)
    {

		case FLASH_IOC_SET_TIME_OUT_TIME_MS:
			PK_DBG("FLASH_IOC_SET_TIME_OUT_TIME_MS: %d\n",arg);
			g_timeOutTimeMs=arg;
		break;


    	case FLASH_IOC_SET_DUTY :
    		PK_DBG("FLASHLIGHT_DUTY: %d\n",arg);
    		g_duty=arg;
    		FL_dim_duty(arg);
    		break;


    	case FLASH_IOC_SET_STEP:
    		PK_DBG("FLASH_IOC_SET_STEP: %d\n",arg);
    		g_step=arg;
    		FL_step(arg);
    		break;

    	case FLASH_IOC_SET_ONOFF :
    		PK_DBG("FLASHLIGHT_ONOFF: %d\n",arg);
    		if(arg==1)
    		{
				if(g_timeOutTimeMs!=0)
	            {
	            	ktime_t ktime;
					ktime = ktime_set( 0, g_timeOutTimeMs*1000000 );
					hrtimer_start( &g_timeOutTimer, ktime, HRTIMER_MODE_REL );
	            }
    			FL_enable();
    			g_strobe_On=1;
    		}
    		else
    		{
    			FL_disable();
				hrtimer_cancel( &g_timeOutTimer );
				g_strobe_On=0;
    		}
    		break;
		default :
    		PK_DBG(" No such command \n");
    		i4RetValue = -EPERM;
    		break;
    }
    return i4RetValue;
}
int FL_init(void)
{
	upmu_set_flash_dim_duty(0);
	upmu_set_flash_sel(0);
	FL_disable();
	INIT_WORK(&workTimeOut, work_timeOutFunc);
    return 0;
}
int FL_init(void)
{
	if(mt_set_gpio_mode(FLASH_PIN,GPIO_MODE_00)){PK_DBG("[CAMERA flash] set gpio ENF mode failed!! \n");}		 		
	if(mt_set_gpio_dir(FLASH_PIN,GPIO_DIR_OUT)){PK_DBG("[CAMERA flash] set gpio ENF dir failed!! \n");}			
	if(mt_set_gpio_out(FLASH_PIN,GPIO_OUT_ZERO)){PK_DBG("[CAMERA flash] set gpio ENF failed!! \n");} 			
	if(mt_set_gpio_mode(TORCH_PIN,GPIO_MODE_00)){PK_DBG("[CAMERA flash] set gpio ENT mode failed!! \n");}		 		
	if(mt_set_gpio_dir(TORCH_PIN,GPIO_DIR_OUT)){PK_DBG("[CAMERA flash] set gpio ENT dir failed!! \n");}			
	if(mt_set_gpio_out(TORCH_PIN,GPIO_OUT_ZERO)){PK_DBG("[CAMERA flash] set gpio ENT failed!! \n");} 			

	FL_disable();
	INIT_WORK(&workTimeOut, work_timeOutFunc);
    return 0;
}
Beispiel #5
0
int FL_init(void)
{
//	upmu_set_flash_dim_duty(0);
//	upmu_set_flash_sel(0);
	PK_DBG("FL_init");

	mt_set_gpio_mode(GPIO_CAMERA_FLASH_EN_PIN, GPIO_CAMERA_FLASH_EN_PIN_M_GPIO);
	mt_set_gpio_mode(GPIO_CAMERA_FLASH_MODE_PIN, GPIO_CAMERA_FLASH_MODE_PIN_M_GPIO);

	FL_disable();
	INIT_WORK(&workTimeOut, work_timeOutFunc);
    return 0;
}
int FL_init(void)
{
	PK_DBG("FL_init\n");
	#if 0
	upmu_set_flash_dim_duty(0);
	upmu_set_flash_sel(0);
	FL_disable();

	#else
	if(adp1650_i2c_client == NULL)
    {
    	return 0;
    }
	adp1650_write_reg(adp1650_i2c_client, 0x04, 0xAC); //75ma torch output_en
	#endif

	INIT_WORK(&workTimeOut, work_timeOutFunc);

    return 0;
}
static void work_timeOutFunc(struct work_struct *data)
{
	FL_disable();
    PK_DBG("ledTimeOut_callback\n");
    //printk(KERN_ALERT "work handler function./n");
}
int FL_uninit(void)
{
	FL_disable();
    return 0;
}
static int constant_flashlight_ioctl(MUINT32 cmd, MUINT32 arg)
{
	int i4RetValue = 0;
	int iFlashType = (int)FLASHLIGHT_NONE;
	int ior;
	int iow;
	int iowr;
	ior = _IOR(FLASHLIGHT_MAGIC,0, int);
	iow = _IOW(FLASHLIGHT_MAGIC,0, int);
	iowr = _IOWR(FLASHLIGHT_MAGIC,0, int);
	PK_DBG("constant_flashlight_ioctl() line=%d cmd=%d, ior=%d, iow=%d iowr=%d arg=%d\n",__LINE__, cmd, ior, iow, iowr, arg);
	PK_DBG("constant_flashlight_ioctl() line=%d cmd-ior=%d, cmd-iow=%d cmd-iowr=%d arg=%d\n",__LINE__, cmd-ior, cmd-iow, cmd-iowr, arg);
    switch(cmd)
    {

        case FLASH_IOC_SET_TIME_OUT_TIME_MS:
                PK_DBG("FLASH_IOC_SET_TIME_OUT_TIME_MS: %d\n",arg);
                g_timeOutTimeMs=arg;
                break;

    	case FLASH_IOC_SET_DUTY :
    		PK_DBG("FLASHLIGHT_DUTY: %d\n",arg);
    		g_duty=arg;
    		FL_dim_duty(arg);
    		break;

    	case FLASH_IOC_SET_STEP:
    		PK_DBG("FLASH_IOC_SET_STEP: %d\n",arg);
    		g_step=arg;
    		FL_step(arg);
    		break;

    	case FLASH_IOC_SET_ONOFF :
    		PK_DBG("FLASHLIGHT_ONOFF: %d\n",arg);
    		if(arg==1)
    		{
	            if(g_timeOutTimeMs!=0)
	            {
	            	ktime_t ktime;
                        ktime = ktime_set( 0, g_timeOutTimeMs*1000000 );
                        hrtimer_start( &g_timeOutTimer, ktime, HRTIMER_MODE_REL );
	            }
	            FL_enable();
	            g_strobe_On=1;
    		}
    		else
    		{
	            FL_disable();
	            hrtimer_cancel( &g_timeOutTimer );
	            g_strobe_On=0;
    		}
    		break;
        case FLASHLIGHTIOC_G_FLASHTYPE:
            iFlashType = FLASHLIGHT_LED_CONSTANT;
            if(copy_to_user((void __user *) arg , (void*)&iFlashType , _IOC_SIZE(cmd)))
            {
                PK_DBG("[strobe_ioctl] ioctl copy to user failed\n");
                return -EFAULT;
            }
            break;
        default :
    		PK_DBG(" No such command \n");
    		i4RetValue = -EPERM;
    		break;
    }
    return i4RetValue;
}