static void max77660_haptic_enable(struct max77660_haptic *chip, bool enable) { // printk("Ivan max77660_haptic_enable = %d \n", enable); if (chip->enabled == enable) return; // mutex_lock(&chip->enable_lock); chip->enabled = enable; if (enable) { // printk("Ivan max77660_haptic_enable ENABLE! \n"); regulator_enable(chip->regulator); max77660_haptic_configure(chip); if (chip->mode == MAX77660_EXTERNAL_MODE) pwm_enable(chip->pwm); // haptic_enable_processing = 0; //Ivan } else { // printk("Ivan max77660_haptic_enable DISABLE! \n"); max77660_haptic_configure(chip); max77660_reg_write(chip->dev->parent, MAX77660_HAPTIC_SLAVE, MAX77660_HAPTIC_REG_CONF2, 2); if (chip->mode == MAX77660_EXTERNAL_MODE) pwm_disable(chip->pwm); regulator_disable(chip->regulator); } // mutex_unlock(&chip->enable_lock); }
static void max77660_haptic_enable(struct max77660_haptic *chip, bool enable) { if (chip->enabled == enable) return; chip->enabled = enable; if (enable) { regulator_enable(chip->regulator); max77660_haptic_configure(chip); if (chip->mode == MAX77660_EXTERNAL_MODE) pwm_enable(chip->pwm); } else { max77660_haptic_configure(chip); if (chip->mode == MAX77660_EXTERNAL_MODE) pwm_disable(chip->pwm); regulator_disable(chip->regulator); } }