static void max77660_haptic_play_effect_work(struct work_struct *work)
{
	struct max77660_haptic *chip =
		container_of(work, struct max77660_haptic, work);
	unsigned int approved;
	int ret;

	if (chip->level) {
		/* Request E-state before operating */
		if (chip->haptic_edp_client) {
			ret = edp_update_client_request(chip->haptic_edp_client,
					MAX77660_HAPTIC_EDP_HIGH, &approved);
			if (ret || approved != MAX77660_HAPTIC_EDP_HIGH) {
				dev_err(chip->dev,
					"E state high transition failed, error=%d, approved=%d\n",
					ret, approved);
//				haptic_enable_processing = 0;		//Ivan
				mutex_unlock(&chip->enable_lock);
				return;
			}
		}
		ret = max77660_haptic_set_duty_cycle(chip);
		if (ret) {
			dev_err(chip->dev, "set_pwm_cycle failed\n");
//			haptic_enable_processing = 0;			//Ivan
			mutex_unlock(&chip->enable_lock);
			return;
		}

		max77660_haptic_enable(chip, true);
		mutex_unlock(&chip->enable_lock);		
	} else {
		/* Disable device before releasing E-state request */
		max77660_haptic_enable(chip, false);
		if (chip->haptic_edp_client) {
			ret = edp_update_client_request(chip->haptic_edp_client,
					MAX77660_HAPTIC_EDP_LOW, NULL);
			if (ret) {
				dev_err(chip->dev,
					"E state low transition failed, error=%d\n",
					ret);
				mutex_unlock(&chip->enable_lock);				
				return;
			}
		}
		mutex_unlock(&chip->enable_lock);
	}
}
Esempio n. 2
0
static void max77660_haptic_play_effect_work(struct work_struct *work)
{
	struct max77660_haptic *chip =
		container_of(work, struct max77660_haptic, work);
	int ret;

	if (chip->level) {
		ret = max77660_haptic_set_duty_cycle(chip);
		if (ret) {
			dev_err(chip->dev, "set_pwm_cycle failed\n");
			return;
		}

		max77660_haptic_enable(chip, true);
	} else {
		max77660_haptic_enable(chip, false);
	}
}