static int s5p_vibetonz_cpufreq_transition(struct notifier_block *nb, unsigned long val, void *data) { unsigned long new_clkrate; struct clk *clk; clk = clk_get(NULL, "timers"); if (IS_ERR(clk)) panic("failed to get clock for pwm timer"); clk_enable(clk); if((val == CPUFREQ_PRECHANGE) && (old_clkrate == 0)) { old_clkrate = clk_get_rate(clk); return 0; } new_clkrate = clk_get_rate(clk); if ((val == CPUFREQ_POSTCHANGE) && (new_clkrate!=old_clkrate) ) { set_vib_period(new_clkrate); /*If Vibration ON, continue vibration with the changed clk_rate value*/ if(g_bAmpEnabled && vib_state) set_vibetonz(vib_state); old_clkrate = new_clkrate; } return 0; }
/* ** Called to disable amp (disable output force) */ IMMVIBESPIAPI VibeStatus ImmVibeSPI_ForceOut_AmpDisable(VibeUInt8 nActuatorIndex) { #if 0 #error Please review the code between the #if and #endif if (g_bAmpEnabled) { DbgOut((KERN_DEBUG "ImmVibeSPI_ForceOut_AmpDisable.\n")); g_bAmpEnabled = false; #if 0 mhn_gpio_set_level(GPIO_EN, GPIO_LEVEL_LOW); mz_ops.bstat &= ~HN_BATTERY_MOTOR; #endif } #endif if (g_bAmpEnabled) { g_bAmpEnabled = false; vib_state = 0; set_vibetonz(vib_state); /*queue_work() not required as Touch Sense Player serialises(schedules) all the calls*/ } return VIBE_S_SUCCESS; }
static enum hrtimer_restart vibetonz_timer_func(struct hrtimer *timer) { gprintk("[VIBETONZ] %s : \n",__func__); set_vibetonz(0); return HRTIMER_NORESTART; }
static enum hrtimer_restart vibetonz_timer_func(struct hrtimer *timer) { unsigned long flags; //gprintk("[VIBETONZ] %s : \n",__func__); spin_lock_irqsave(&vib_lock, flags); set_vibetonz(0); spin_unlock_irqrestore(&vib_lock, flags); return HRTIMER_NORESTART; }
static void set_vib_pwm_duty(unsigned long duty) { unsigned long clk_rate; clk_rate = get_pclk_rate(); vib_pwm_duty = duty; set_vib_period(clk_rate); /*If Vibration ON, continue vibration with the changed PWM value*/ if(old_duty!=duty) { if(g_bAmpEnabled && vib_state) set_vibetonz(vib_state); } old_duty = duty; }
static ssize_t vibrator_store_test(struct device *dev,struct device_attribute *attr,const char *buf, size_t count) { int ret; unsigned long duty,clk_rate; ret=0; printk(" [VIBETONZ] %s \n",__func__); if((strict_strtoul(buf,10,&duty)<0) || (duty > 99)) return -EINVAL; clk_rate = get_pclk_rate(); vibrator_period = ((clk_rate)/(89600)) ; vibrator_on_period = (vibrator_period*duty)/100 +1; printk("vibrator_period = %lu, vibrator_on_period = %lu \n",vibrator_period,vibrator_on_period); vib_state = 1; set_vibetonz(vib_state); return count; }
static void enable_vibetonz_from_user(struct timed_output_dev *dev,int value) { // printk(KERN_DEBUG "[Vibtonz] %s : time = %d msec \n",__func__,value); hrtimer_cancel(&timer); set_vibetonz(value); vibrator_value = value; if (value > 0) { if (value > max_timeout) { value = max_timeout; } hrtimer_start(&timer, ktime_set(value / 1000, (value % 1000) * 1000000), HRTIMER_MODE_REL); vibrator_value = 0; } }
static void enable_vibetonz_from_user(struct timed_output_dev *dev,int value) { unsigned long flags; //printk("[VIBETONZ] %s : time = %d msec \n",__func__,value); hrtimer_cancel(&timer); spin_lock_irqsave(&vib_lock, flags); value = set_vibetonz(value); /* 2009.09.13(sunday) drkim - adjust vibratonz strength */ vibrator_value = value; spin_unlock_irqrestore(&vib_lock, flags); if (value > 0) { if (value > max_timeout) value = max_timeout; hrtimer_start(&timer, ktime_set(value / 1000, (value % 1000) * 1000000), HRTIMER_MODE_REL); vibrator_value = 0; } }
static void _set_vibetonz_work(struct work_struct *unused) { set_vibetonz(vibrator_work); return; }
void work_timer_func(struct work_struct *work) { set_vibetonz(0); }
static void vib_work_func(struct work_struct *work) { gprintk("[VIBETONZ] %s :",__func__); set_vibetonz(vib_state); }
static void vib_work_func(struct work_struct *work) { set_vibetonz(vib_state); }