예제 #1
0
/*
** Called to enable amp (enable output force)
*/
IMMVIBESPIAPI VibeStatus ImmVibeSPI_ForceOut_AmpEnable(VibeUInt8 nActuatorIndex)
{
    if (!g_bAmpEnabled)
    {
        DbgOut((KERN_DEBUG "ImmVibeSPI_ForceOut_AmpEnable.\n"));

        g_bAmpEnabled = true;
        gOldForce = 0;

        /* 
        ** Ensure the PWM frequency is at the expected value. These 2 lines of code
        ** can be removed if no other application alters the PWM frequency.
        */

        // PWM_CTRL  = 0;                  /* 13Mhz / (0 + 1) = 13MHz */
        // PWM_PERIOD = PWM_DUTY_MAX;      /* 13Mhz / (PWM_DUTY_MAX + 1) = 22.4kHz */

        ///* Set duty cycle to 50% */
        // PWM_DUTY = (PWM_DUTY_MAX+1)>>1; /* Duty cycle range = [0, PWM_DUTY_MAX] */
       
        tspdrv_pwm_set(1,0);


        /* Enable amp */
        tspdrv_power_set(1);
        tspdrv_ic_enable_set(1);


    }

    return VIBE_S_SUCCESS;
}
예제 #2
0
// chui101: turns on and off vibrator from user space. should only be called from work queue
static int tspdrv_set(int timeout)
{
	if(!timeout) {
		// printk(KERN_INFO "[ImmVibe] Off\n");
		// call LG functions to turn off vibe
        tspdrv_ic_enable_set(0);
        tspdrv_power_set(0);
        tspdrv_pwm_set(0,0);
	} else {
		// printk(KERN_INFO "[ImmVibe] Enabled for %d ms\n", timeout);
		// call functions to turn on vibe
        tspdrv_pwm_set(1,platform_vibe_data->amp_value);
        tspdrv_power_set(1);
        tspdrv_ic_enable_set(1);
	}
	
	vibrator_value = timeout;
	return 0;	
}
예제 #3
0
/*
** Called to disable amp (disable output force)
*/
IMMVIBESPIAPI VibeStatus ImmVibeSPI_ForceOut_AmpDisable(VibeUInt8 nActuatorIndex)
{
    if (g_bAmpEnabled)
    {       
        DbgOut((KERN_DEBUG "ImmVibeSPI_ForceOut_AmpDisable.\n"));
        
        g_bAmpEnabled = false;
               
        /* Dnable amp */
        tspdrv_power_set(0);
        tspdrv_ic_enable_set(0);

		/* PWM off */
        tspdrv_pwm_set(0,0);

    }
    return VIBE_S_SUCCESS;
}