Exemple #1
0
static void ast_vibrator_enable(struct timed_output_dev *dev, int value)
{
    haptic_vibrator->timeout = value;

	if (IS_ERR(haptic_vibrator->pwm)) {
		printk("haptic_vibrator->pwm error\n");
		return ;
	}

	if(pwm_duty_val != 1)
	{
		haptic_vibrator->duty_cycle=pwm_duty_val;
	}

    if (haptic_vibrator->on_dock == false) {
       	pwm_config(haptic_vibrator->pwm, haptic_vibrator->duty_cycle, 
                   haptic_vibrator->pwm_period);
		pwm_enable(haptic_vibrator->pwm);
        vibrator_enable();
		msleep(value);
    }

    vibrator_disable();
    vibrator_disable_pwm();

    return;
}
Exemple #2
0
/* Called to enable amp (enable output force) */
IMMVIBESPIAPI VibeStatus ImmVibeSPI_ForceOut_AmpEnable( VibeUInt8 nActuatorIndex )
{
    if (haptic_vibrator->on_dock == true) {
        vibrator_disable();
        vibrator_disable_pwm();
		return VIBE_S_SUCCESS;
	}
	
    if (haptic_vibrator->amp_enabled == false) {
		DbgOut((DBL_VERBOSE, "[ImmVibeSPI] : ImmVibeSPI_ForceOut_AmpEnable\n"));
        vibrator_enable_pwm();
        vibrator_enable();
	}

	return VIBE_S_SUCCESS;
}
void msm_timed_vibrate(int value) {
        vibrator_enable(0,value);
}
// at_param shall be ONLY  INTERGER, do not  (float / pointer / string...)
static int  dsatHandleAT_ARM11(uint32_t at_cmd, uint32_t at_act, uint32_t at_param,struct msm_rpc_server *server)
{
	int result = HANDLE_OK;
#ifdef USE_REPLY_RETSTRING
	int loop = 0;
#endif
	char ret_string[MAX_STRING_RET];
	uint32_t ret_value1 =0;
	uint32_t ret_value2 = 0;
	memset (ret_string, 0, sizeof(ret_string));


	switch (at_cmd)
	{
		// example code
		case ATCMD_FRST:
		{
			if(at_act != ATCMD_ACTION)
				result = HANLDE_FAIL;

			sprintf(ret_string, "edcb");
			ret_value1 = 10;
			ret_value2 = 20;
		}
		break;

		case ATCMD_SWV:
		{


		}
		break;

                case ATCMD_AVR: /* 45 */
                {
                        //printk("#### ATCMD_AVR ###### Act: 0x%x, Param: 0x%x\n", at_act, at_param);
			 printk("\n[kschoi] ***** ATCMD_AVR key = %d : rpc_server_misc.c",at_param);	
	         lge_atcmd_report_key(1, at_param);			 
                }
                break;
		case ATCMD_EMT:	//46
		{
			ret_value1 = external_memory_test();
		}
		break;
		
		case ATCMD_NOT_ATMCD_EARSENSE:
		{
		  printk(" ****************** ATCMD_NOT_ATMCD_EARSENSE ****************** \n");
		  printk(" ****************** headset_inserted [%d] ****************** \n",headset_inserted);
			ret_value1 = headset_inserted;
			break;
		}
		case ATCMD_FRSTSTATUS:
			if ( at_act == ATCMD_ACTION )
				ret_value1 = set_kernel_factory_reset_status(at_param);
			else
				ret_value1 = get_kernel_factory_reset_status();
			break;
			
       case ATCMD_MOT:	// 71
       {
       	
#if 1 // def CONFIG_ANDROID_VIBRATOR

       	if (at_act == ATCMD_ACTION){
       		ret_value1 = is_vib_state(); // Check vibrator state
          }
          else if (at_act == ATCMD_ASSIGN) {
				if (at_param== 1) 	{
//					vibrator_set(100);
					vibrator_enable();  // Enable vibrator
					ret_value1 = 1; 	// "MOTOR ON"
				}
				else	{
					vibrator_disable();  // Disabe vibrator
					printk("#### ATCMD_MOT 0###### Act: 0x%x, Param: 0x%x\n", at_act, at_param);
					ret_value1 = 0; 	// "MOTOR OFF"
				}
			}
			else	
#endif

			{
				result = HANLDE_FAIL;
			}
		}
		break;			
		case ATCMD_FKPD:	// 33       	
		{
          if (at_act == ATCMD_ASSIGN) {
				ret_value1 = 1; 
				at_fkpd_cfg(1/*ENABLE FKPD KEY INPUT*/, at_param/*AT INPUT KEY VALUE*/); 

			}
			else if (at_act == ATCMD_QUERY){		//JUST RETURN OK
				ret_value1 = 1;
			}
			else	{
				result = HANLDE_FAIL;
			}
		}
		break;			
			
		case ATCMD_GKPD:	// 34
		{
       	if (at_act == ATCMD_ACTION) {
 				
       		ret_value1 = at_gkpd_cfg(0/* 0 = READ GKPD*/,0/* READ GKPD STATE*/); //READ GKPD STATE
          }
          else if (at_act == ATCMD_ASSIGN) {
				if (at_param== 1) 	
					{
					at_gkpd_cfg(1/*WRITE GKPD*/,1/*WRITE TO SET GKPD BUFF*/); //SET GKPD STATE
					ret_value1 = 1; 	// "GKPD ON"
				}
				else	{
					at_gkpd_cfg(1/*WRITE GKPD*/,0/*DISABLE GKPD BUFF*/);  //DISABLE GKPD STATE
					ret_value1 = 0; 	// "GKPD OFF"
				}
			}
			else if (at_act == ATCMD_QUERY) {	
				ret_value1 = at_gkpd_cfg(0/*READ GKPD*/,1/*READ GKPD BUUFERED VALUE*/); //READ A GKPD BUUFER VALUE
			}
			else	{
				result = HANLDE_FAIL;
			}
		}
			break;

		case ATCMD_BOFF: // 58
		{			
			// To use AT%LCD, uncomment this.

#if defined(CONFIG_MACH_MSM7X27_SWIFT)
			int fd;
			char buf = '0';
			mm_segment_t oldfs;

			oldfs = get_fs();
			set_fs(get_ds());

			fd = sys_open((const char __user *) "/sys/devices/virtual/backlight/rt9393/brightness", O_WRONLY | O_CREAT | O_TRUNC, 0777);
			if (fd < 0) {
				break;
			}

			sys_write(fd, &buf, sizeof(char));
			sys_close(fd);
			set_fs(oldfs);
#endif

#ifdef CONFIG_BACKLIGHT_EVE
			lge_atcmd_boff();
#endif
			ret_value1 = 1;
		}
			break;

		case ATCMD_FC:	// 59
			if(at_act != ATCMD_ACTION)
				result = HANLDE_FAIL;

#ifdef CONFIG_ANDROID_HALL_IC
			if (is_slide_open()== 0) 
			{
				set_slide_open(1);  // close slide
				ret_value1 = 1; 	// "FOLDER CLOSE OK"
			}
			else
			{
				ret_value1 = 0; 	// "FOLDER IS ALREADY CLOSED"
			}
#endif
			break;

		case ATCMD_FO:	// 60
			if(at_act != ATCMD_ACTION)
				result = HANLDE_FAIL;

#ifdef CONFIG_ANDROID_HALL_IC
			if (is_slide_open() == 0)
			{
				ret_value1 = 1; 	// "FOLDER IS ALREADY OPEN"
			}
			else
			{
				set_slide_open(0);  // open slide
				ret_value1 = 0; 	// "FOLDER OPEN OK"
			}
#endif
			break;
#if 1 // defined (CONFIG_MACH_EVE)-comment
		case ATCMD_VLC:	//36
			if(at_act != ATCMD_ACTION)
				result = HANLDE_FAIL;
			if (atpdev != NULL){
	 			update_atcmd_state(atpdev, "vlc", at_param); //state is up? down?
			}
			else 
			{
				printk("\n[%s] error vlc", __func__ );
			}
			break;
		case ATCMD_SPM:	//40
			if(at_act != ATCMD_ACTION)
				result = HANLDE_FAIL;
			if (atpdev != NULL){
	 			update_atcmd_state(atpdev, "spm", at_param); //state is up? down?
			}
			else 
			{
				printk("\n[%s] error spm", __func__ );
			}
			break;
			
		case ATCMD_ACS:
			if ( at_param != 0 )
				mdelay(1000);
			break;
		case ATCMD_MPT:	//43
			if(at_act != ATCMD_ACTION)
				result = HANLDE_FAIL;
			if (atpdev != NULL){
	 			update_atcmd_state(atpdev, "mpt", at_param); //state is up? down?
	 			mdelay (1000);
			}
			else 
			{
				printk("\n[%s] error mpt", __func__ );
			}
			break;
		case ATCMD_FMR: //42
		       printk("\n[rpc_server_misc] ATCMD_FMR");
			if(at_act != ATCMD_ACTION)
				result = HANLDE_FAIL;
			if (atpdev != NULL){
	 			update_atcmd_state(atpdev, "fmr", at_param); //state is up? down?
			}
			else 
			{
				printk("\n[%s] error fmr", __func__ );
			}
			break;
#endif
        case ATCMD_LCD: /* 69 */
			{	           
	            // To use AT%LCD, uncomment this.
	            lge_atcmd_report_key(ATCMD_LCD_REPORTKEY, at_param);				

				ret_value1 = 1;
        	}
            break;
        case ATCMD_CAM: /* 70 */
	        {
	                //printk("#### ATCMD_CAM ###### Act: 0x%x, Param: 0x%x\n", at_act, at_param);
					printk("\n[kschoi] ***** ATCMD_CAM key = %d: rpc_server_misc.c",at_param);
	                lge_atcmd_report_key(0, at_param);					
	        }
        	break;

		default :
			result = HANDLE_ERROR;
			break;


	}

	// give to RPC server result
	/////////////////////////////////////////////////////////////////
#ifdef USE_REPLY_RETSTRING
	for(loop = 0; loop < MAX_STRING_RET ; loop++)
	{
		server->retvalue.ret_string[loop]= (AT_STR_t)(ret_string[loop]);
	}
	server->retvalue.ret_string[MAX_STRING_RET-1] = 0;
	server->retvalue.ret_value1 = ret_value1;
	server->retvalue.ret_value2 = ret_value2;
#endif
/////////////////////////////////////////////////////////////////
	return result;
}
void custom_vibration_enable(int value)
{
    vibrator_enable(&mtk_vibrator,value);
}
Exemple #6
0
int plat_vibrator_enable(int enable)
{
	return vibrator_enable(&(vib_data), enable);
}
static int vibrator_probe(struct platform_device *pdev)
{
    struct pwm_vib_platform_data *pdata = pdev->dev.platform_data;
    struct pwm_vib_data *data;
    int ret = 0;

    if (!pdata) {
        ret	=	-EBUSY;
        goto	err0;
    }

    data	=	kzalloc(sizeof(struct pwm_vib_data), GFP_KERNEL);
    if (!data) {
        ret	=	-ENOMEM;
        goto	err0;
    }

    data->pdata	=	pdata;

    INIT_WORK(&data->vibrator_work, update_vibrator);

    vibe_timer_state = 0;
    hrtimer_init(&data->vibe_timer, CLOCK_MONOTONIC, HRTIMER_MODE_REL);
    data->vibe_timer.function = vibrator_timer_func;
    spin_lock_init(&data->vibe_lock);
    spin_lock_init(&vibe__timer_lock);

    data->dev.name		=	"vibrator";
    data->dev.get_time	=	vibrator_get_time;
    data->dev.enable	=	vibrator_enable;

    pwm_timer	=	omap_dm_timer_request_specific(MOTOR_RESONANCE_TIMER_ID);
    if (pwm_timer == NULL) {
        pr_err(KERN_ERR "failed to request vibrator pwm timer\n");
        goto	err1;
    }

    /* omap_dm_timer_request_specific enables the timer */
//	dm timer failed to be disabled.
//	omap_dm_timer_disable(pwm_timer);
    omap_dm_timer_set_source(pwm_timer, MOTOR_RESONANCE_SRC_CLK);
//	dm timer should be disabled here.
    omap_dm_timer_disable(pwm_timer);

    ret	=	timed_output_dev_register(&data->dev);
    if (ret < 0)
        goto	err1;

    if (data->pdata->init) {
        ret = data->pdata->init();
        if (ret < 0)
            goto err2;
    }

    gpio_request(GPIO_VIB_EN, "vib_en_gpio");
    gpio_direction_output(GPIO_VIB_EN, 1);
    gpio_set_value(GPIO_VIB_EN, 0);

    misc_data= data;
    platform_set_drvdata(pdev, data);

    vibrator_enable(&data->dev, data->pdata->initial_vibrate);

    pr_info("COSMO vibrator is initialized\n");

    return	0;

err2:
    timed_output_dev_unregister(&data->dev);

err1:
    kfree(data->pdata);
    kfree(data);

err0:
    return	ret;
}