static int isa1200_vibrator_suspend(struct i2c_client *client,pm_message_t mesg)
{

	int ret = 0;

	if (g_bIsPlaying){
        ret = -EBUSY;
	}
	else{
		DbgOut((KERN_INFO "tspdrv: suspend.\n"));
		if(isa1200_enabled){
			vibrator_write_register(0x30, 0x08);
			gpio_set_value(vibrator_drvdata.motor_en, VIBRATION_OFF);
			isa1200_enabled = 0;
		}
	DbgOut((KERN_ERR "[VIBTONZ] isa1200_early_suspend \n"));
	}
	return ret;

}
static int resume(struct platform_device *pdev) 
{	
    DbgOut((KERN_INFO "tspdrv: resume.\n"));
	
#if defined (CONFIG_KOR_MODEL_SHV_E110S)
		if (get_hw_rev() > 0x00){	
			if(!isa1200_enabled){
				gpio_set_value(VIB_EN, VIBRATION_ON);		
				vibrator_write_register(0x30, 0x09);
				vibrator_write_register(0x31, 0x40);
				vibrator_write_register(0x34, 0x19);
				vibrator_write_register(0x35, 0x00);	
				vibrator_write_register(0x36, 0x00);
	
				isa1200_enabled = 1;				
			}
	
			printk(KERN_ERR "[VIBTONZ] isa1200_late_resume \n");
		}
#elif defined (CONFIG_KOR_SHV_E120L_HD720) || defined(CONFIG_KOR_MODEL_SHV_E120S) || defined(CONFIG_KOR_MODEL_SHV_E120K) ||  defined (CONFIG_KOR_MODEL_SHV_E120L)
		if(!isa1200_enabled){
			gpio_set_value(VIB_EN, VIBRATION_ON);		
			vibrator_write_register(0x30, 0x09);
			vibrator_write_register(0x31, 0x40);
			vibrator_write_register(0x32, 0x00);
			vibrator_write_register(0x33, 0x13);
			vibrator_write_register(0x34, 0x05);
			vibrator_write_register(0x35, 0x00);
			vibrator_write_register(0x36, 0x00);
			isa1200_enabled = 1;				
		}

		printk(KERN_ERR "[VIBTONZ] isa1200_late_resume \n");
#elif defined  (CONFIG_KOR_MODEL_SHV_E160L)
		if(!isa1200_enabled){
			gpio_set_value(VIB_EN, VIBRATION_ON);		
			vibrator_write_register(0x30, 0x09);
			vibrator_write_register(0x31, 0x40);
			vibrator_write_register(0x32, 0x00);
			vibrator_write_register(0x33, 0x13);
			vibrator_write_register(0x34, 0x02);
			vibrator_write_register(0x35, 0x00);
			vibrator_write_register(0x36, 0x00);
			isa1200_enabled = 1;				
		}

		printk(KERN_ERR "[VIBTONZ] isa1200_late_resume \n");
#elif defined(CONFIG_KOR_MODEL_SHV_E160S) || defined(CONFIG_KOR_MODEL_SHV_E160K)
		if(!isa1200_enabled){
			gpio_set_value(VIB_EN, VIBRATION_ON);		
			vibrator_write_register(0x30, 0x09);
			vibrator_write_register(0x31, 0x40);
			vibrator_write_register(0x32, 0x00);
			vibrator_write_register(0x33, 0x13);
			vibrator_write_register(0x34, 0x03);
			vibrator_write_register(0x35, 0x00);
			vibrator_write_register(0x36, 0x00);
			isa1200_enabled = 1;				
		}

		printk(KERN_ERR "[VIBTONZ] isa1200_late_resume \n");
#elif defined(CONFIG_USA_MODEL_SGH_I577) || defined(CONFIG_CAN_MODEL_SGH_I577R)
		if(!isa1200_enabled){
            gpio_set_value(VIB_EN, VIBRATION_ON);
            vibrator_write_register(0x30, 0x09);
            vibrator_write_register(0x31, 0x40);
            vibrator_write_register(0x34, 0x02);
            vibrator_write_register(0x35, 0x00);    
            vibrator_write_register(0x36, 0x00);
			isa1200_enabled = 1;				
		}

        printk(KERN_ERR "[VIBTONZ] isa1200_late_resume \n");        
        
#elif defined (CONFIG_USA_MODEL_SGH_T989)|| defined (CONFIG_USA_MODEL_SGH_I727) || defined (CONFIG_USA_MODEL_SGH_T769)
		if (get_hw_rev() > 0x04){	
			if(!isa1200_enabled){
				gpio_set_value(VIB_EN, VIBRATION_ON);		
				vibrator_write_register(0x30, 0x09);
				vibrator_write_register(0x31, 0x40);
				#if defined (CONFIG_USA_MODEL_SGH_T989)
				if (get_hw_rev() >= 0x0d)
					vibrator_write_register(0x34, 0x01);
				else				
					vibrator_write_register(0x34, 0x16);
				#elif defined (CONFIG_USA_MODEL_SGH_T769)
				    vibrator_write_register(0x34, 0x17);
				#else
				vibrator_write_register(0x34, 0x19);
				#endif
				vibrator_write_register(0x35, 0x00);	
				vibrator_write_register(0x36, 0x00);
	
				isa1200_enabled = 1;				
			}
	
			printk(KERN_ERR "[VIBTONZ] isa1200_late_resume \n");
		}

#elif defined (CONFIG_USA_MODEL_SGH_I717) || defined(CONFIG_USA_MODEL_SGH_I757)

		if(!isa1200_enabled){
            gpio_set_value(VIB_EN, VIBRATION_ON);       
            vibrator_write_register(0x30, 0x09);
            vibrator_write_register(0x31, 0x40);
            vibrator_write_register(0x34, 0x02);
            vibrator_write_register(0x35, 0x00);    
            vibrator_write_register(0x36, 0x00);
			isa1200_enabled = 1;				
		}

        printk(KERN_ERR "[VIBTONZ] isa1200_late_resume \n");

        
#elif defined (CONFIG_JPN_MODEL_SC_03D)
		if (get_hw_rev() > 0x00){	
			if(!isa1200_enabled){
				gpio_set_value(VIB_EN, VIBRATION_ON);		
				vibrator_write_register(0x30, 0x09);
				vibrator_write_register(0x31, 0x40);
				vibrator_write_register(0x34, 0x19);
				vibrator_write_register(0x35, 0x00);	
				vibrator_write_register(0x36, 0x00);

				isa1200_enabled = 1;				
			}

			printk(KERN_ERR "[VIBTONZ] isa1200_late_resume \n");
		}
#endif
	return 0;   /* can resume */
}
static int suspend(struct platform_device *pdev, pm_message_t state) 
{
	int ret;

    if (g_bIsPlaying)
    {
	ret = -EBUSY;
    }
    else
    {
        DbgOut((KERN_INFO "tspdrv: suspend.\n"));
#if defined (CONFIG_KOR_MODEL_SHV_E110S)
		if (get_hw_rev() > 0x00){
			if(isa1200_enabled){
				vibrator_write_register(0x30, 0x09);
				gpio_set_value(VIB_EN, VIBRATION_OFF);				
				isa1200_enabled = 0;	
			}
	
			printk(KERN_ERR "[VIBTONZ] isa1200_early_suspend \n");
		}
#elif defined (CONFIG_KOR_SHV_E120L_HD720) || defined(CONFIG_KOR_MODEL_SHV_E120K) || defined(CONFIG_KOR_MODEL_SHV_E120S) || defined(CONFIG_KOR_MODEL_SHV_E160S) || defined(CONFIG_KOR_MODEL_SHV_E160K) || defined(CONFIG_KOR_MODEL_SHV_E160L) ||  defined (CONFIG_KOR_MODEL_SHV_E120L)
		if(isa1200_enabled){
			vibrator_write_register(0x30, 0x09);
			gpio_set_value(VIB_EN, VIBRATION_OFF);				
			isa1200_enabled = 0;	
		}
		printk(KERN_ERR "[VIBTONZ] isa1200_early_suspend \n");
#elif defined (CONFIG_USA_MODEL_SGH_T989)|| defined (CONFIG_USA_MODEL_SGH_I727) || defined (CONFIG_USA_MODEL_SGH_T769)
		if (get_hw_rev() > 0x04){
			if(isa1200_enabled){
				vibrator_write_register(0x30, 0x09);
				gpio_set_value(VIB_EN, VIBRATION_OFF);				
				isa1200_enabled = 0;	
			}
	
			printk(KERN_ERR "[VIBTONZ] isa1200_early_suspend \n");
		}
#elif defined (CONFIG_USA_MODEL_SGH_I717) || defined(CONFIG_USA_MODEL_SGH_I757) || defined(CONFIG_USA_MODEL_SGH_I577)

        if(isa1200_enabled){
            vibrator_write_register(0x30, 0x09);
            gpio_set_value(VIB_EN, VIBRATION_OFF);              
            isa1200_enabled = 0;    
        }
        
        printk(KERN_ERR "[VIBTONZ] isa1200_early_suspend \n");

        
#elif defined (CONFIG_JPN_MODEL_SC_03D)
		if (get_hw_rev() > 0x00){
			if(isa1200_enabled){
				vibrator_write_register(0x30, 0x09);
				gpio_set_value(VIB_EN, VIBRATION_OFF);				
				isa1200_enabled = 0;	
			}

			printk(KERN_ERR "[VIBTONZ] isa1200_early_suspend \n");
		}
#endif			

    }

    return 0;
}
Example #4
0
static int ioctl(struct inode *inode, struct file *file, unsigned int cmd, unsigned long arg)
{
#ifdef QA_TEST
    int i;
#endif

//    printk("[tspdrv] ioctl cmd (%x) \n", cmd);

    switch (cmd)
    {

        case TSPDRV_SET_VIBE_TUNING:
            vibrator_write_register(0x30, 0x09);
            vibrator_write_register(0x31, 0x40);
            vibrator_write_register(0x34, arg);
            vibrator_write_register(0x35, 0x00);    
            vibrator_write_register(0x36, 0x00);

            break;
#ifdef VIBE_TUNING1
		case 185:
			g_PWM_duty_max = arg; /* set value of g_PWM_duty_max in ImmVibeSPI */
			break;
		case 186:
			g_PWM_ctrl = arg; /* set value of g_PWM_ctrl in ImmVibeSPI */
			break;
		case 187:
			g_PWM_multiplier = arg; /* set value of g_PWM_multiplier in ImmVibeSPI */
			break;
#endif /* VIBE_TUNING */
        case TSPDRV_STOP_KERNEL_TIMER:
            /* 
            ** As we send one sample ahead of time, we need to finish playing the last sample
            ** before stopping the timer. So we just set a flag here.
            */
            if (true == g_bIsPlaying) g_bStopRequested = true;

#ifdef QA_TEST
            if (g_nForceLogIndex)
            {
                for (i=0; i<g_nForceLogIndex; i++)
                {
                    printk("<6>%d\t%d\n", g_nTime, g_nForceLog[i]);
                    g_nTime += TIME_INCREMENT;
                }
            }
            g_nTime = 0;
            g_nForceLogIndex = 0;
#endif
            break;

        case TSPDRV_IDENTIFY_CALLER:
            if (TSPDRV_MAGIC_NUMBER == arg) file->private_data = (void*)TSPDRV_MAGIC_NUMBER;
            break;

        case TSPDRV_ENABLE_AMP:
            //wake_lock(&vib_wake_lock);
            ImmVibeSPI_ForceOut_AmpEnable(arg);
            break;

        case TSPDRV_DISABLE_AMP:
            ImmVibeSPI_ForceOut_AmpDisable(arg);
            //wake_unlock(&vib_wake_lock);
            break;

	case TSPDRV_SET_VIBE_ALARM:
            return Set_vibe_for_alarm();
            break;

        case TSPDRV_GET_NUM_ACTUATORS:
            return NUM_ACTUATORS;
    }

    return 0;
}