Lines Matching +full:pwm +full:- +full:active +full:- +full:state

1 // SPDX-License-Identifier: GPL-2.0+
16 #include <linux/pwm.h>
181 /* Maximum gain is 0x7fff for PWM mode */
259 bool active; member
290 error = regmap_read(haptics->regmap, DA7280_IRQ_STATUS1, &val); in da7280_haptic_mem_update()
294 dev_warn(haptics->dev, in da7280_haptic_mem_update()
296 return -EBUSY; in da7280_haptic_mem_update()
301 error = regmap_read(haptics->regmap, DA7280_MEM_CTL2, &val); in da7280_haptic_mem_update()
305 dev_warn(haptics->dev, "Please unlock the bit first\n"); in da7280_haptic_mem_update()
306 return -EACCES; in da7280_haptic_mem_update()
310 error = regmap_update_bits(haptics->regmap, in da7280_haptic_mem_update()
317 error = regmap_read(haptics->regmap, DA7280_MEM_CTL1, &val); in da7280_haptic_mem_update()
321 return regmap_bulk_write(haptics->regmap, val, haptics->snp_mem, in da7280_haptic_mem_update()
322 DA7280_SNP_MEM_MAX - val + 1); in da7280_haptic_mem_update()
327 struct pwm_state state; in da7280_haptic_set_pwm() local
331 if (!haptics->gain && enabled) { in da7280_haptic_set_pwm()
332 dev_err(haptics->dev, "Unable to enable pwm with 0 gain\n"); in da7280_haptic_set_pwm()
333 return -EINVAL; in da7280_haptic_set_pwm()
336 pwm_get_state(haptics->pwm_dev, &state); in da7280_haptic_set_pwm()
337 state.enabled = enabled; in da7280_haptic_set_pwm()
339 period_mag_multi = (u64)state.period * haptics->gain; in da7280_haptic_set_pwm()
345 * See datasheet 'PWM mode' section. in da7280_haptic_set_pwm()
347 if (!haptics->acc_en) { in da7280_haptic_set_pwm()
348 period_mag_multi += state.period; in da7280_haptic_set_pwm()
352 state.duty_cycle = period_mag_multi; in da7280_haptic_set_pwm()
355 error = pwm_apply_might_sleep(haptics->pwm_dev, &state); in da7280_haptic_set_pwm()
357 dev_err(haptics->dev, "Failed to apply pwm state: %d\n", error); in da7280_haptic_set_pwm()
366 if (haptics->active) in da7280_haptic_activate()
369 switch (haptics->op_mode) { in da7280_haptic_activate()
372 if (haptics->acc_en && haptics->level > 0x7F) in da7280_haptic_activate()
373 haptics->level = 0x7F; in da7280_haptic_activate()
374 else if (haptics->level > 0xFF) in da7280_haptic_activate()
375 haptics->level = 0xFF; in da7280_haptic_activate()
378 error = regmap_write(haptics->regmap, DA7280_TOP_CTL2, in da7280_haptic_activate()
379 haptics->level); in da7280_haptic_activate()
381 dev_err(haptics->dev, in da7280_haptic_activate()
383 haptics->level, error); in da7280_haptic_activate()
402 * The pattern will be played by the GPI[N] state, in da7280_haptic_activate()
409 dev_err(haptics->dev, "Invalid op mode %d\n", haptics->op_mode); in da7280_haptic_activate()
413 error = regmap_update_bits(haptics->regmap, in da7280_haptic_activate()
416 haptics->op_mode); in da7280_haptic_activate()
418 dev_err(haptics->dev, in da7280_haptic_activate()
423 if (haptics->op_mode == DA7280_PWM_MODE || in da7280_haptic_activate()
424 haptics->op_mode == DA7280_RTWM_MODE) { in da7280_haptic_activate()
425 error = regmap_update_bits(haptics->regmap, in da7280_haptic_activate()
430 dev_err(haptics->dev, in da7280_haptic_activate()
436 haptics->active = true; in da7280_haptic_activate()
443 if (!haptics->active) in da7280_haptic_deactivate()
447 error = regmap_update_bits(haptics->regmap, in da7280_haptic_deactivate()
451 dev_err(haptics->dev, in da7280_haptic_deactivate()
456 switch (haptics->op_mode) { in da7280_haptic_deactivate()
458 error = regmap_write(haptics->regmap, in da7280_haptic_deactivate()
461 dev_err(haptics->dev, in da7280_haptic_deactivate()
474 error = regmap_update_bits(haptics->regmap, in da7280_haptic_deactivate()
478 dev_err(haptics->dev, in da7280_haptic_deactivate()
486 dev_err(haptics->dev, "Invalid op mode %d\n", haptics->op_mode); in da7280_haptic_deactivate()
490 haptics->active = false; in da7280_haptic_deactivate()
497 int val = haptics->val; in da7280_haptic_work()
516 if (haptics->active) in da7280_haptics_upload_effect()
517 return -EBUSY; in da7280_haptics_upload_effect()
519 switch (effect->type) { in da7280_haptics_upload_effect()
520 /* DRO/PWM modes support this type */ in da7280_haptics_upload_effect()
522 haptics->op_mode = haptics->const_op_mode; in da7280_haptics_upload_effect()
523 if (haptics->op_mode == DA7280_DRO_MODE) { in da7280_haptics_upload_effect()
524 tmp = effect->u.constant.level * 254; in da7280_haptics_upload_effect()
525 haptics->level = tmp / 0x7FFF; in da7280_haptics_upload_effect()
529 haptics->gain = effect->u.constant.level <= 0 ? in da7280_haptics_upload_effect()
530 0 : effect->u.constant.level; in da7280_haptics_upload_effect()
535 if (effect->u.periodic.waveform != FF_CUSTOM) { in da7280_haptics_upload_effect()
536 dev_err(haptics->dev, in da7280_haptics_upload_effect()
538 return -EINVAL; in da7280_haptics_upload_effect()
548 if (effect->u.periodic.custom_len == DA7280_CUSTOM_DATA_LEN) in da7280_haptics_upload_effect()
551 if (effect->u.periodic.custom_len == DA7280_CUSTOM_GP_DATA_LEN) in da7280_haptics_upload_effect()
554 if (effect->u.periodic.custom_len < DA7280_CUSTOM_DATA_LEN || in da7280_haptics_upload_effect()
555 effect->u.periodic.custom_len > DA7280_SNP_MEM_SIZE) { in da7280_haptics_upload_effect()
556 dev_err(haptics->dev, "Invalid waveform data size\n"); in da7280_haptics_upload_effect()
557 return -EINVAL; in da7280_haptics_upload_effect()
560 if (copy_from_user(data, effect->u.periodic.custom_data, in da7280_haptics_upload_effect()
562 effect->u.periodic.custom_len)) in da7280_haptics_upload_effect()
563 return -EFAULT; in da7280_haptics_upload_effect()
565 memset(haptics->snp_mem, 0, DA7280_SNP_MEM_SIZE); in da7280_haptics_upload_effect()
567 for (i = 0; i < effect->u.periodic.custom_len; i++) { in da7280_haptics_upload_effect()
569 dev_err(haptics->dev, in da7280_haptics_upload_effect()
572 return -EINVAL; in da7280_haptics_upload_effect()
574 haptics->snp_mem[i] = (u8)data[i]; in da7280_haptics_upload_effect()
579 dev_err(haptics->dev, in da7280_haptics_upload_effect()
586 if (copy_from_user(data, effect->u.periodic.custom_data, in da7280_haptics_upload_effect()
588 return -EFAULT; in da7280_haptics_upload_effect()
594 dev_err(haptics->dev, in da7280_haptics_upload_effect()
598 return -EINVAL; in da7280_haptics_upload_effect()
601 haptics->ps_seq_id = data[DA7280_CUSTOM_SEQ_ID_IDX] & 0x0f; in da7280_haptics_upload_effect()
602 haptics->ps_seq_loop = data[DA7280_CUSTOM_SEQ_LOOP_IDX] & 0x0f; in da7280_haptics_upload_effect()
603 haptics->op_mode = haptics->periodic_op_mode; in da7280_haptics_upload_effect()
605 val = FIELD_PREP(DA7280_PS_SEQ_ID_MASK, haptics->ps_seq_id) | in da7280_haptics_upload_effect()
607 haptics->ps_seq_loop); in da7280_haptics_upload_effect()
608 error = regmap_write(haptics->regmap, DA7280_SEQ_CTL2, val); in da7280_haptics_upload_effect()
610 dev_err(haptics->dev, in da7280_haptics_upload_effect()
617 if (copy_from_user(data, effect->u.periodic.custom_data, in da7280_haptics_upload_effect()
619 return -EFAULT; in da7280_haptics_upload_effect()
625 dev_err(haptics->dev, in da7280_haptics_upload_effect()
629 return -EINVAL; in da7280_haptics_upload_effect()
633 haptics->gpi_ctl[num].seq_id = in da7280_haptics_upload_effect()
635 haptics->op_mode = haptics->periodic_op_mode; in da7280_haptics_upload_effect()
638 haptics->gpi_ctl[num].seq_id); in da7280_haptics_upload_effect()
639 error = regmap_update_bits(haptics->regmap, in da7280_haptics_upload_effect()
644 dev_err(haptics->dev, in da7280_haptics_upload_effect()
651 dev_err(haptics->dev, "Unsupported effect type: %d\n", in da7280_haptics_upload_effect()
652 effect->type); in da7280_haptics_upload_effect()
653 return -EINVAL; in da7280_haptics_upload_effect()
664 if (!haptics->op_mode) { in da7280_haptics_playback()
665 dev_warn(haptics->dev, "No effects have been uploaded\n"); in da7280_haptics_playback()
666 return -EINVAL; in da7280_haptics_playback()
669 if (likely(!haptics->suspended)) { in da7280_haptics_playback()
670 haptics->val = val; in da7280_haptics_playback()
671 schedule_work(&haptics->work); in da7280_haptics_playback()
681 error = regmap_update_bits(haptics->regmap, in da7280_haptic_start()
686 dev_err(haptics->dev, "Unable to enable device: %d\n", error); in da7280_haptic_start()
697 cancel_work_sync(&haptics->work); in da7280_haptic_stop()
702 error = regmap_update_bits(haptics->regmap, DA7280_TOP_CTL1, in da7280_haptic_stop()
705 dev_err(haptics->dev, "Failed to disable device: %d\n", error); in da7280_haptic_stop()
727 } else if (!strcmp(str, "ERM-bar")) { in da7280_haptic_of_mode_str()
729 } else if (!strcmp(str, "ERM-coin")) { in da7280_haptic_of_mode_str()
732 dev_warn(dev, "Invalid string - set to LRA\n"); in da7280_haptic_of_mode_str()
740 if (!strcmp(str, "Single-pattern")) { in da7280_haptic_of_gpi_mode_str()
742 } else if (!strcmp(str, "Multi-pattern")) { in da7280_haptic_of_gpi_mode_str()
745 dev_warn(dev, "Invalid string - set to Single-pattern\n"); in da7280_haptic_of_gpi_mode_str()
753 if (!strcmp(str, "Rising-edge")) { in da7280_haptic_of_gpi_pol_str()
755 } else if (!strcmp(str, "Falling-edge")) { in da7280_haptic_of_gpi_pol_str()
757 } else if (!strcmp(str, "Both-edge")) { in da7280_haptic_of_gpi_pol_str()
760 dev_warn(dev, "Invalid string - set to Rising-edge\n"); in da7280_haptic_of_gpi_pol_str()
776 char gpi_str1[] = "dlg,gpi0-seq-id"; in da7280_parse_properties()
777 char gpi_str2[] = "dlg,gpi0-mode"; in da7280_parse_properties()
778 char gpi_str3[] = "dlg,gpi0-polarity"; in da7280_parse_properties()
786 haptics->dev_type = DA7280_DEV_MAX; in da7280_parse_properties()
787 error = device_property_read_string(dev, "dlg,actuator-type", &str); in da7280_parse_properties()
789 haptics->dev_type = da7280_haptic_of_mode_str(dev, str); in da7280_parse_properties()
791 haptics->const_op_mode = DA7280_DRO_MODE; in da7280_parse_properties()
792 error = device_property_read_u32(dev, "dlg,const-op-mode", &val); in da7280_parse_properties()
794 haptics->const_op_mode = DA7280_PWM_MODE; in da7280_parse_properties()
796 haptics->periodic_op_mode = DA7280_RTWM_MODE; in da7280_parse_properties()
797 error = device_property_read_u32(dev, "dlg,periodic-op-mode", &val); in da7280_parse_properties()
799 haptics->periodic_op_mode = DA7280_ETWM_MODE; in da7280_parse_properties()
801 haptics->nommax = DA7280_SKIP_INIT; in da7280_parse_properties()
802 error = device_property_read_u32(dev, "dlg,nom-microvolt", &val); in da7280_parse_properties()
804 haptics->nommax = da7280_haptic_of_volt_rating_set(val); in da7280_parse_properties()
806 haptics->absmax = DA7280_SKIP_INIT; in da7280_parse_properties()
807 error = device_property_read_u32(dev, "dlg,abs-max-microvolt", &val); in da7280_parse_properties()
809 haptics->absmax = da7280_haptic_of_volt_rating_set(val); in da7280_parse_properties()
811 haptics->imax = DA7280_IMAX_DEFAULT; in da7280_parse_properties()
812 error = device_property_read_u32(dev, "dlg,imax-microamp", &val); in da7280_parse_properties()
814 haptics->imax = (val - 28600) / DA7280_IMAX_STEP + 1; in da7280_parse_properties()
816 haptics->impd = DA7280_IMPD_DEFAULT; in da7280_parse_properties()
817 error = device_property_read_u32(dev, "dlg,impd-micro-ohms", &val); in da7280_parse_properties()
819 haptics->impd = val; in da7280_parse_properties()
821 haptics->resonant_freq_h = DA7280_SKIP_INIT; in da7280_parse_properties()
822 haptics->resonant_freq_l = DA7280_SKIP_INIT; in da7280_parse_properties()
823 error = device_property_read_u32(dev, "dlg,resonant-freq-hz", &val); in da7280_parse_properties()
827 haptics->resonant_freq_h = in da7280_parse_properties()
829 haptics->resonant_freq_l = in da7280_parse_properties()
832 haptics->resonant_freq_h = DA7280_RESONT_FREQH_DFT; in da7280_parse_properties()
833 haptics->resonant_freq_l = DA7280_RESONT_FREQL_DFT; in da7280_parse_properties()
838 haptics->ps_seq_id = 0; in da7280_parse_properties()
839 error = device_property_read_u32(dev, "dlg,ps-seq-id", &val); in da7280_parse_properties()
841 haptics->ps_seq_id = val; in da7280_parse_properties()
843 haptics->ps_seq_loop = 0; in da7280_parse_properties()
844 error = device_property_read_u32(dev, "dlg,ps-seq-loop", &val); in da7280_parse_properties()
846 haptics->ps_seq_loop = val; in da7280_parse_properties()
851 haptics->gpi_ctl[i].seq_id = DA7280_GPI_SEQ_ID_DFT + i; in da7280_parse_properties()
854 haptics->gpi_ctl[i].seq_id = val; in da7280_parse_properties()
857 haptics->gpi_ctl[i].mode = 0; in da7280_parse_properties()
860 haptics->gpi_ctl[i].mode = in da7280_parse_properties()
864 haptics->gpi_ctl[i].polarity = 0; in da7280_parse_properties()
867 haptics->gpi_ctl[i].polarity = in da7280_parse_properties()
871 haptics->bemf_sense_en = in da7280_parse_properties()
872 device_property_read_bool(dev, "dlg,bemf-sens-enable"); in da7280_parse_properties()
873 haptics->freq_track_en = in da7280_parse_properties()
874 device_property_read_bool(dev, "dlg,freq-track-enable"); in da7280_parse_properties()
875 haptics->acc_en = in da7280_parse_properties()
876 device_property_read_bool(dev, "dlg,acc-enable"); in da7280_parse_properties()
877 haptics->rapid_stop_en = in da7280_parse_properties()
878 device_property_read_bool(dev, "dlg,rapid-stop-enable"); in da7280_parse_properties()
879 haptics->amp_pid_en = in da7280_parse_properties()
880 device_property_read_bool(dev, "dlg,amp-pid-enable"); in da7280_parse_properties()
882 haptics->mem_update = false; in da7280_parse_properties()
883 error = device_property_read_u32_array(dev, "dlg,mem-array", in da7280_parse_properties()
886 haptics->mem_update = true; in da7280_parse_properties()
887 memset(haptics->snp_mem, 0, DA7280_SNP_MEM_SIZE); in da7280_parse_properties()
890 haptics->snp_mem[i] = (u8)mem[i]; in da7280_parse_properties()
892 dev_err(haptics->dev, in da7280_parse_properties()
893 "Invalid data in mem-array at %d: %x\n", in da7280_parse_properties()
895 haptics->mem_update = false; in da7280_parse_properties()
905 struct device *dev = haptics->dev; in da7280_irq_handler()
910 error = regmap_bulk_read(haptics->regmap, DA7280_IRQ_EVENT1, in da7280_irq_handler()
918 error = regmap_write(haptics->regmap, DA7280_IRQ_EVENT1, events[0]); in da7280_irq_handler()
926 * Stop first if haptic is active, otherwise, the fault may in da7280_irq_handler()
929 error = regmap_update_bits(haptics->regmap, DA7280_TOP_CTL1, in da7280_irq_handler()
937 haptics->active = false; in da7280_irq_handler()
946 dev_warn(dev, "Over-temperature warning\n"); in da7280_irq_handler()
955 dev_info(dev, "Please restart PWM interface\n"); in da7280_irq_handler()
973 if (haptics->dev_type == DA7280_DEV_MAX) { in da7280_init()
974 error = regmap_read(haptics->regmap, DA7280_TOP_CFG1, &val); in da7280_init()
978 haptics->dev_type = val & DA7280_ACTUATOR_TYPE_MASK ? in da7280_init()
983 if (haptics->dev_type == DA7280_LRA && in da7280_init()
984 haptics->resonant_freq_l != DA7280_SKIP_INIT) { in da7280_init()
985 error = regmap_write(haptics->regmap, DA7280_FRQ_LRA_PER_H, in da7280_init()
986 haptics->resonant_freq_h); in da7280_init()
989 error = regmap_write(haptics->regmap, DA7280_FRQ_LRA_PER_L, in da7280_init()
990 haptics->resonant_freq_l); in da7280_init()
993 } else if (haptics->dev_type == DA7280_ERM_COIN) { in da7280_init()
994 error = regmap_update_bits(haptics->regmap, DA7280_TOP_INT_CFG1, in da7280_init()
1003 error = regmap_update_bits(haptics->regmap, DA7280_TOP_CFG4, in da7280_init()
1008 haptics->acc_en = false; in da7280_init()
1009 haptics->rapid_stop_en = false; in da7280_init()
1010 haptics->amp_pid_en = false; in da7280_init()
1020 (haptics->dev_type ? 1 : 0)) | in da7280_init()
1022 (haptics->bemf_sense_en ? 1 : 0)) | in da7280_init()
1024 (haptics->freq_track_en ? 1 : 0)) | in da7280_init()
1026 (haptics->acc_en ? 1 : 0)) | in da7280_init()
1028 (haptics->rapid_stop_en ? 1 : 0)) | in da7280_init()
1030 (haptics->amp_pid_en ? 1 : 0)); in da7280_init()
1032 error = regmap_update_bits(haptics->regmap, DA7280_TOP_CFG1, mask, val); in da7280_init()
1036 error = regmap_update_bits(haptics->regmap, DA7280_TOP_CFG5, in da7280_init()
1038 haptics->acc_en ? in da7280_init()
1043 error = regmap_update_bits(haptics->regmap, in da7280_init()
1046 haptics->acc_en ? in da7280_init()
1051 if (haptics->nommax != DA7280_SKIP_INIT) { in da7280_init()
1052 error = regmap_write(haptics->regmap, DA7280_ACTUATOR1, in da7280_init()
1053 haptics->nommax); in da7280_init()
1058 if (haptics->absmax != DA7280_SKIP_INIT) { in da7280_init()
1059 error = regmap_write(haptics->regmap, DA7280_ACTUATOR2, in da7280_init()
1060 haptics->absmax); in da7280_init()
1065 error = regmap_update_bits(haptics->regmap, DA7280_ACTUATOR3, in da7280_init()
1066 DA7280_IMAX_MASK, haptics->imax); in da7280_init()
1070 v2i_factor = haptics->impd * (haptics->imax + 4) / 1610400; in da7280_init()
1071 error = regmap_write(haptics->regmap, DA7280_CALIB_V2I_L, in da7280_init()
1075 error = regmap_write(haptics->regmap, DA7280_CALIB_V2I_H, in da7280_init()
1080 error = regmap_update_bits(haptics->regmap, in da7280_init()
1087 if (haptics->mem_update) { in da7280_init()
1094 val = FIELD_PREP(DA7280_PS_SEQ_ID_MASK, haptics->ps_seq_id) | in da7280_init()
1095 FIELD_PREP(DA7280_PS_SEQ_LOOP_MASK, haptics->ps_seq_loop); in da7280_init()
1096 error = regmap_write(haptics->regmap, DA7280_SEQ_CTL2, val); in da7280_init()
1103 haptics->gpi_ctl[i].seq_id) | in da7280_init()
1105 haptics->gpi_ctl[i].mode) | in da7280_init()
1107 haptics->gpi_ctl[i].polarity); in da7280_init()
1108 error = regmap_write(haptics->regmap, in da7280_init()
1115 error = regmap_update_bits(haptics->regmap, in da7280_init()
1123 error = regmap_write(haptics->regmap, DA7280_IRQ_EVENT1, 0xff); in da7280_init()
1127 error = regmap_update_bits(haptics->regmap, in da7280_init()
1135 haptics->active = false; in da7280_init()
1139 dev_err(haptics->dev, "chip initialization error: %d\n", error); in da7280_init()
1145 struct device *dev = &client->dev; in da7280_probe()
1148 struct pwm_state state; in da7280_probe() local
1152 if (!client->irq) { in da7280_probe()
1154 return -EINVAL; in da7280_probe()
1159 return -ENOMEM; in da7280_probe()
1161 haptics->dev = dev; in da7280_probe()
1165 if (haptics->const_op_mode == DA7280_PWM_MODE) { in da7280_probe()
1166 haptics->pwm_dev = devm_pwm_get(dev, NULL); in da7280_probe()
1167 error = PTR_ERR_OR_ZERO(haptics->pwm_dev); in da7280_probe()
1169 if (error != -EPROBE_DEFER) in da7280_probe()
1170 dev_err(dev, "Unable to request PWM: %d\n", in da7280_probe()
1175 /* Sync up PWM state and ensure it is off. */ in da7280_probe()
1176 pwm_init_state(haptics->pwm_dev, &state); in da7280_probe()
1177 state.enabled = false; in da7280_probe()
1178 error = pwm_apply_might_sleep(haptics->pwm_dev, &state); in da7280_probe()
1180 dev_err(dev, "Failed to apply PWM state: %d\n", error); in da7280_probe()
1185 * Check PWM period, PWM freq = 1000000 / state.period. in da7280_probe()
1186 * The valid PWM freq range: 10k ~ 250kHz. in da7280_probe()
1188 if (state.period > 100000 || state.period < 4000) { in da7280_probe()
1189 dev_err(dev, "Unsupported PWM period: %lld\n", in da7280_probe()
1190 state.period); in da7280_probe()
1191 return -EINVAL; in da7280_probe()
1195 INIT_WORK(&haptics->work, da7280_haptic_work); in da7280_probe()
1197 haptics->client = client; in da7280_probe()
1200 haptics->regmap = devm_regmap_init_i2c(client, in da7280_probe()
1202 error = PTR_ERR_OR_ZERO(haptics->regmap); in da7280_probe()
1218 return -ENOMEM; in da7280_probe()
1221 input_dev->name = "da7280-haptic"; in da7280_probe()
1222 input_dev->dev.parent = client->dev.parent; in da7280_probe()
1223 input_dev->open = da7280_haptic_open; in da7280_probe()
1224 input_dev->close = da7280_haptic_close; in da7280_probe()
1226 haptics->input_dev = input_dev; in da7280_probe()
1228 input_set_capability(haptics->input_dev, EV_FF, FF_PERIODIC); in da7280_probe()
1229 input_set_capability(haptics->input_dev, EV_FF, FF_CUSTOM); in da7280_probe()
1230 input_set_capability(haptics->input_dev, EV_FF, FF_CONSTANT); in da7280_probe()
1231 input_set_capability(haptics->input_dev, EV_FF, FF_GAIN); in da7280_probe()
1233 error = input_ff_create(haptics->input_dev, in da7280_probe()
1240 ff = input_dev->ff; in da7280_probe()
1241 ff->upload = da7280_haptics_upload_effect; in da7280_probe()
1242 ff->playback = da7280_haptics_playback; in da7280_probe()
1250 error = devm_request_threaded_irq(dev, client->irq, in da7280_probe()
1253 "da7280-haptics", haptics); in da7280_probe()
1256 client->irq, error); in da7280_probe()
1267 mutex_lock(&haptics->input_dev->mutex); in da7280_suspend()
1273 spin_lock_irq(&haptics->input_dev->event_lock); in da7280_suspend()
1274 haptics->suspended = true; in da7280_suspend()
1275 spin_unlock_irq(&haptics->input_dev->event_lock); in da7280_suspend()
1279 mutex_unlock(&haptics->input_dev->mutex); in da7280_suspend()
1289 mutex_lock(&haptics->input_dev->mutex); in da7280_resume()
1293 spin_lock_irq(&haptics->input_dev->event_lock); in da7280_resume()
1294 haptics->suspended = false; in da7280_resume()
1295 spin_unlock_irq(&haptics->input_dev->event_lock); in da7280_resume()
1298 mutex_unlock(&haptics->input_dev->mutex); in da7280_resume()