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); } }
static int max77660_haptic_suspend(struct device *dev) { struct max77660_haptic *chip = platform_get_drvdata(pdev); max77660_haptic_enable(chip, false); return 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); } }
static void max77660_haptic_throttle(unsigned int new_state, void *priv_data) { struct max77660_haptic *chip = priv_data; if (!chip) return; max77660_haptic_enable(chip, false); }
static int max77660_haptic_suspend(struct device *dev) { struct platform_device *pdev = to_platform_device(dev); struct max77660_haptic *chip = platform_get_drvdata(pdev); int ret; /* Disable device before releasing E-state request */ //Ivan added // cancel_delayed_work(&chip->work); 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 in suspend\n"); return ret; } } return 0; }