static void vibratorOff(JNIEnv *env, jobject clazz) { #if defined(MTK_VIBSPK_OPTION_SUPPORT) if(IsJNISupportVibSpk()) VIBRATOR_SPKOFF(); else vibrator_off(); #else vibrator_off(); #endif }
static void vibrator_work(struct work_struct *work) { struct drv2605_data *data; data = container_of(work, struct drv2605_data, work); vibrator_off(data); }
static void vibrator_enable(struct timed_output_dev *dev, int value) { #if SUPPORT_TIMED_OUTPUT char mode; hrtimer_cancel(&vibdata.timer); cancel_work_sync(&vibdata.work); #if SUPPORT_WRITE_PAT cancel_work_sync(&vibdata.pat_work); #endif mutex_lock(&vibdata.lock); if (value) { wake_lock(&vibdata.wklock); drv2604_read_reg(STATUS_REG); /* Added by Ken on 20120531 */ if (!g_bAmpEnabled) { mode = drv2604_read_reg(MODE_REG) & DRV2604_MODE_MASK; /* Modified by Ken on 20120530 */ #if DRV2604_USE_RTP_MODE /* Only change the mode if not already in RTP mode; RTP input already set at init */ if (mode != MODE_REAL_TIME_PLAYBACK) { drv2604_change_mode(MODE_REAL_TIME_PLAYBACK); drv2604_set_rtp_val(vibe_strength); vibrator_is_playing = YES; g_bAmpEnabled = true; } #endif #if DRV2604_USE_PWM_MODE /* Only change the mode if not already in PWM mode */ if (mode != MODE_PWM_OR_ANALOG_INPUT) { pwm_duty_enable(vibdata.pwm_dev, 0); drv2604_change_mode(MODE_PWM_OR_ANALOG_INPUT); vibrator_is_playing = YES; g_bAmpEnabled = true; } #endif } if (value > 0) { if (value > MAX_TIMEOUT) value = MAX_TIMEOUT; hrtimer_start(&vibdata.timer, ns_to_ktime((u64)value * NSEC_PER_MSEC), HRTIMER_MODE_REL); } } else vibrator_off(); mutex_unlock(&vibdata.lock); #endif // SUPPORT_TIMED_OUTPUT }
static void vibrator_enable(struct timed_output_dev *dev, int value) { struct drv2605_data *data; data = container_of(dev, struct drv2605_data, dev); dev_info(&(data->client->dev), "drv2605 enable value: %d.\n", value); mutex_lock(&data->lock); hrtimer_cancel(&data->timer); cancel_work_sync(&data->work); if (value) { //wake_lock(&vibdata.wklock); gpio_direction_output(data->gpio_enable, GPIO_LEVEL_HIGH); udelay(30); /* Only change the mode if not already in RTP mode; RTP input already set at init */ if ((drv2605_read_reg(data->client, MODE_REG) & DRV260X_MODE_MASK) != MODE_REAL_TIME_PLAYBACK) { drv2605_set_rtp_val(data->client, REAL_TIME_PLAYBACK_STRENGTH); drv2605_change_mode(data->client, MODE_REAL_TIME_PLAYBACK); drv2605_set_go_bit(data->client, GO); vibrator_is_playing = YES; } if (value > 0) { if (value > data->max_timeout_ms) { value = data->max_timeout_ms; } hrtimer_start(&data->timer, ns_to_ktime((u64)value * NSEC_PER_MSEC), HRTIMER_MODE_REL); } } else { vibrator_off(data); } mutex_unlock(&data->lock); }
static void vibrator_enable(struct timed_output_dev *dev, int value) { struct i2c_client *client = this_client; struct drv2605_data *pDrv2605data = i2c_get_clientdata(client); //struct Haptics *pvibdata = container_of(dev, struct Haptics, to_dev); char mode; mutex_lock(&vibdata.lock); hrtimer_cancel(&vibdata.timer); cancel_work_sync(&vibdata.work); if (value) { wake_lock(&vibdata.wklock); mode = drv260x_read_reg(client, MODE_REG) & DRV260X_MODE_MASK; /* Only change the mode if not already in RTP mode; RTP input already set at init */ if (mode != MODE_REAL_TIME_PLAYBACK) { if (pDrv2605data->audio_haptics_enabled && mode == MODE_AUDIOHAPTIC) setAudioHapticsEnabled(client, NO); drv260x_set_rtp_val(client, REAL_TIME_PLAYBACK_STRENGTH); drv260x_change_mode(client, MODE_REAL_TIME_PLAYBACK); pDrv2605data->vibrator_is_playing = YES; switch_set_state(&pDrv2605data->sw_dev, SW_STATE_RTP_PLAYBACK); } if (value > 0) { if (value > MAX_TIMEOUT) value = MAX_TIMEOUT; hrtimer_start(&vibdata.timer, ns_to_ktime((u64)value * NSEC_PER_MSEC), HRTIMER_MODE_REL); } } else vibrator_off(client); mutex_unlock(&vibdata.lock); }
static void vibrator_work(struct work_struct *work) { mutex_lock(&vibdata.lock); vibrator_off(); mutex_unlock(&vibdata.lock); }
static void vibratorOff(JNIEnv *env, jobject clazz) { // ALOGI("vibratorOff\n"); vibrator_off(); }
void cmd_vibrator_off(int argc, char** argv) { bufferPrintf("Turning off vibrator.\r\n"); vibrator_off(); }
static void off(JNIEnv *env, jobject clazz) { // LOGI("off\n"); vibrator_off(); }
/* Internal Trigger (default) Mode */ static void vibrator_enable_internal_trigger(struct timed_output_dev *dev, int value) { struct i2c_client *client = this_client; struct drv2605_data *pDrv2605data = i2c_get_clientdata(client); //struct Haptics *pvibdata = container_of(dev, struct Haptics, to_dev); char mode; mutex_lock(&vibdata.lock); hrtimer_cancel(&vibdata.timer); cancel_work_sync(&vibdata.work); wake_lock(&vibdata.wklock); if (value) { switch(pDrv2605data->usermode){ case 1: drv260x_write_reg_val(client, nubia_wave_sequence1, sizeof(nubia_wave_sequence1)); break; case 2: drv260x_write_reg_val(client, nubia_wave_sequence2, sizeof(nubia_wave_sequence2)); break; case 3: drv260x_write_reg_val(client, nubia_wave_sequence3, sizeof(nubia_wave_sequence3)); break; case 4: drv260x_write_reg_val(client, nubia_wave_sequence4, sizeof(nubia_wave_sequence4)); break; case 5: drv260x_write_reg_val(client, nubia_wave_sequence5, sizeof(nubia_wave_sequence5)); break; case 6: drv260x_write_reg_val(client, nubia_wave_sequence6, sizeof(nubia_wave_sequence6)); break; case 7: drv260x_write_reg_val(client, nubia_wave_sequence7, sizeof(nubia_wave_sequence7)); break; case 8: drv260x_write_reg_val(client, nubia_wave_sequence8, sizeof(nubia_wave_sequence8)); break; case 9: drv260x_write_reg_val(client, nubia_wave_sequence9, sizeof(nubia_wave_sequence9)); break; case 10: drv260x_write_reg_val(client, nubia_wave_sequence10, sizeof(nubia_wave_sequence10)); break; default: printk(KERN_ERR "%s: Unknown usermode(%d).\n", __func__, pDrv2605data->usermode); break; } mode = drv260x_read_reg(client, MODE_REG) & DRV260X_MODE_MASK; if (pDrv2605data->audio_haptics_enabled && mode == MODE_AUDIOHAPTIC) setAudioHapticsEnabled(client, NO); drv260x_change_mode(client, MODE_INTERNAL_TRIGGER); pDrv2605data->vibrator_is_playing = YES; switch_set_state(&pDrv2605data->sw_dev, SW_STATE_SEQUENCE_PLAYBACK); drv260x_set_go_bit(client, GO); if (value > 0) { if (value > MAX_TIMEOUT) value = MAX_TIMEOUT; hrtimer_start(&vibdata.timer, ns_to_ktime((u64)value * NSEC_PER_MSEC), HRTIMER_MODE_REL); } } else { vibrator_off(client); } mutex_unlock(&vibdata.lock); }
static void vibratorOff(JNIEnv* /* env */, jobject /* clazz */) { // ALOGI("vibratorOff\n"); vibrator_off(); }