Lines Matching +full:event +full:- +full:touch +full:- +full:alt
1 // SPDX-License-Identifier: GPL-2.0+
3 * Azoteq IQS269A Capacitive Touch Controller
8 * inductive keys as well as Hall-effect switches, and one for each of the two
149 #define IQS269_ATI_POLL_SLEEP_US (iqs269->delay_mult * 10000)
150 #define IQS269_ATI_POLL_TIMEOUT_US (iqs269->delay_mult * 500000)
151 #define IQS269_ATI_STABLE_DELAY_MS (iqs269->delay_mult * 150)
201 .name = "event-prox",
207 .name = "event-prox-alt",
214 .name = "event-touch",
220 .name = "event-touch-alt",
227 .name = "event-deep",
233 .name = "event-deep-alt",
313 return -EINVAL; in iqs269_ati_mode_set()
316 return -EINVAL; in iqs269_ati_mode_set()
318 mutex_lock(&iqs269->lock); in iqs269_ati_mode_set()
320 engine_a = be16_to_cpu(iqs269->ch_reg[ch_num].engine_a); in iqs269_ati_mode_set()
325 iqs269->ch_reg[ch_num].engine_a = cpu_to_be16(engine_a); in iqs269_ati_mode_set()
326 iqs269->ati_current = false; in iqs269_ati_mode_set()
328 mutex_unlock(&iqs269->lock); in iqs269_ati_mode_set()
339 return -EINVAL; in iqs269_ati_mode_get()
341 mutex_lock(&iqs269->lock); in iqs269_ati_mode_get()
342 engine_a = be16_to_cpu(iqs269->ch_reg[ch_num].engine_a); in iqs269_ati_mode_get()
343 mutex_unlock(&iqs269->lock); in iqs269_ati_mode_get()
357 return -EINVAL; in iqs269_ati_base_set()
377 return -EINVAL; in iqs269_ati_base_set()
380 mutex_lock(&iqs269->lock); in iqs269_ati_base_set()
382 engine_b = be16_to_cpu(iqs269->ch_reg[ch_num].engine_b); in iqs269_ati_base_set()
387 iqs269->ch_reg[ch_num].engine_b = cpu_to_be16(engine_b); in iqs269_ati_base_set()
388 iqs269->ati_current = false; in iqs269_ati_base_set()
390 mutex_unlock(&iqs269->lock); in iqs269_ati_base_set()
401 return -EINVAL; in iqs269_ati_base_get()
403 mutex_lock(&iqs269->lock); in iqs269_ati_base_get()
404 engine_b = be16_to_cpu(iqs269->ch_reg[ch_num].engine_b); in iqs269_ati_base_get()
405 mutex_unlock(&iqs269->lock); in iqs269_ati_base_get()
425 return -EINVAL; in iqs269_ati_base_get()
435 return -EINVAL; in iqs269_ati_target_set()
438 return -EINVAL; in iqs269_ati_target_set()
440 mutex_lock(&iqs269->lock); in iqs269_ati_target_set()
442 engine_b = be16_to_cpu(iqs269->ch_reg[ch_num].engine_b); in iqs269_ati_target_set()
447 iqs269->ch_reg[ch_num].engine_b = cpu_to_be16(engine_b); in iqs269_ati_target_set()
448 iqs269->ati_current = false; in iqs269_ati_target_set()
450 mutex_unlock(&iqs269->lock); in iqs269_ati_target_set()
461 return -EINVAL; in iqs269_ati_target_get()
463 mutex_lock(&iqs269->lock); in iqs269_ati_target_get()
464 engine_b = be16_to_cpu(iqs269->ch_reg[ch_num].engine_b); in iqs269_ati_target_get()
465 mutex_unlock(&iqs269->lock); in iqs269_ati_target_get()
483 return -EINVAL; in iqs269_parse_mask()
493 return -EINVAL; in iqs269_parse_mask()
504 struct i2c_client *client = iqs269->client; in iqs269_parse_chan()
513 dev_err(&client->dev, "Failed to read channel number: %d\n", in iqs269_parse_chan()
517 dev_err(&client->dev, "Invalid channel number: %u\n", reg); in iqs269_parse_chan()
518 return -EINVAL; in iqs269_parse_chan()
521 iqs269->sys_reg.active |= BIT(reg); in iqs269_parse_chan()
522 if (!fwnode_property_present(ch_node, "azoteq,reseed-disable")) in iqs269_parse_chan()
523 iqs269->sys_reg.reseed |= BIT(reg); in iqs269_parse_chan()
525 if (fwnode_property_present(ch_node, "azoteq,blocking-enable")) in iqs269_parse_chan()
526 iqs269->sys_reg.blocking |= BIT(reg); in iqs269_parse_chan()
528 if (fwnode_property_present(ch_node, "azoteq,slider0-select")) in iqs269_parse_chan()
529 iqs269->sys_reg.slider_select[0] |= BIT(reg); in iqs269_parse_chan()
531 if (fwnode_property_present(ch_node, "azoteq,slider1-select")) in iqs269_parse_chan()
532 iqs269->sys_reg.slider_select[1] |= BIT(reg); in iqs269_parse_chan()
534 ch_reg = &iqs269->ch_reg[reg]; in iqs269_parse_chan()
536 error = regmap_raw_read(iqs269->regmap, in iqs269_parse_chan()
542 error = iqs269_parse_mask(ch_node, "azoteq,rx-enable", in iqs269_parse_chan()
543 &ch_reg->rx_enable); in iqs269_parse_chan()
545 dev_err(&client->dev, "Invalid channel %u RX enable mask: %d\n", in iqs269_parse_chan()
550 error = iqs269_parse_mask(ch_node, "azoteq,tx-enable", in iqs269_parse_chan()
551 &ch_reg->tx_enable); in iqs269_parse_chan()
553 dev_err(&client->dev, "Invalid channel %u TX enable mask: %d\n", in iqs269_parse_chan()
558 engine_a = be16_to_cpu(ch_reg->engine_a); in iqs269_parse_chan()
559 engine_b = be16_to_cpu(ch_reg->engine_b); in iqs269_parse_chan()
562 if (fwnode_property_present(ch_node, "azoteq,meas-cap-decrease")) in iqs269_parse_chan()
566 if (fwnode_property_present(ch_node, "azoteq,rx-float-inactive")) in iqs269_parse_chan()
571 if (!fwnode_property_read_u32(ch_node, "azoteq,local-cap-size", &val)) { in iqs269_parse_chan()
585 dev_err(&client->dev, in iqs269_parse_chan()
588 return -EINVAL; in iqs269_parse_chan()
593 if (fwnode_property_present(ch_node, "azoteq,invert-enable")) in iqs269_parse_chan()
596 if (!fwnode_property_read_u32(ch_node, "azoteq,proj-bias", &val)) { in iqs269_parse_chan()
598 dev_err(&client->dev, in iqs269_parse_chan()
601 return -EINVAL; in iqs269_parse_chan()
608 if (!fwnode_property_read_u32(ch_node, "azoteq,sense-mode", &val)) { in iqs269_parse_chan()
610 dev_err(&client->dev, in iqs269_parse_chan()
613 return -EINVAL; in iqs269_parse_chan()
620 if (!fwnode_property_read_u32(ch_node, "azoteq,sense-freq", &val)) { in iqs269_parse_chan()
622 dev_err(&client->dev, in iqs269_parse_chan()
625 return -EINVAL; in iqs269_parse_chan()
633 if (fwnode_property_present(ch_node, "azoteq,static-enable")) in iqs269_parse_chan()
636 ch_reg->engine_a = cpu_to_be16(engine_a); in iqs269_parse_chan()
637 ch_reg->engine_b = cpu_to_be16(engine_b); in iqs269_parse_chan()
639 if (!fwnode_property_read_u32(ch_node, "azoteq,ati-mode", &val)) { in iqs269_parse_chan()
642 dev_err(&client->dev, in iqs269_parse_chan()
648 if (!fwnode_property_read_u32(ch_node, "azoteq,ati-base", &val)) { in iqs269_parse_chan()
651 dev_err(&client->dev, in iqs269_parse_chan()
657 if (!fwnode_property_read_u32(ch_node, "azoteq,ati-target", &val)) { in iqs269_parse_chan()
660 dev_err(&client->dev, in iqs269_parse_chan()
667 error = iqs269_parse_mask(ch_node, "azoteq,assoc-select", in iqs269_parse_chan()
668 &ch_reg->assoc_select); in iqs269_parse_chan()
670 dev_err(&client->dev, "Invalid channel %u association: %d\n", in iqs269_parse_chan()
675 if (!fwnode_property_read_u32(ch_node, "azoteq,assoc-weight", &val)) { in iqs269_parse_chan()
677 dev_err(&client->dev, in iqs269_parse_chan()
680 return -EINVAL; in iqs269_parse_chan()
683 ch_reg->assoc_weight = val; in iqs269_parse_chan()
694 dev_err(&client->dev, in iqs269_parse_chan()
697 return -EINVAL; in iqs269_parse_chan()
700 ch_reg->thresh[iqs269_events[i].th_offs] = val; in iqs269_parse_chan()
704 u8 *hyst = &ch_reg->hyst; in iqs269_parse_chan()
707 dev_err(&client->dev, in iqs269_parse_chan()
710 return -EINVAL; in iqs269_parse_chan()
729 if (iqs269->hall_enable) { in iqs269_parse_chan()
730 iqs269->switches[i].code = val; in iqs269_parse_chan()
731 iqs269->switches[i].enabled = true; in iqs269_parse_chan()
736 if (iqs269->hall_enable) in iqs269_parse_chan()
741 iqs269->keycode[i * IQS269_NUM_CH + reg] = val; in iqs269_parse_chan()
744 iqs269->sys_reg.event_mask &= ~iqs269_events[i].mask; in iqs269_parse_chan()
752 struct iqs269_sys_reg *sys_reg = &iqs269->sys_reg; in iqs269_parse_prop()
753 struct i2c_client *client = iqs269->client; in iqs269_parse_prop()
759 iqs269->hall_enable = device_property_present(&client->dev, in iqs269_parse_prop()
760 "azoteq,hall-enable"); in iqs269_parse_prop()
762 if (!device_property_read_u32(&client->dev, "azoteq,suspend-mode", in iqs269_parse_prop()
765 dev_err(&client->dev, "Invalid suspend mode: %u\n", in iqs269_parse_prop()
767 return -EINVAL; in iqs269_parse_prop()
770 iqs269->suspend_mode = val; in iqs269_parse_prop()
773 error = regmap_raw_read(iqs269->regmap, IQS269_SYS_SETTINGS, sys_reg, in iqs269_parse_prop()
778 if (!device_property_read_u32(&client->dev, "azoteq,filt-str-lp-lta", in iqs269_parse_prop()
781 dev_err(&client->dev, "Invalid filter strength: %u\n", in iqs269_parse_prop()
783 return -EINVAL; in iqs269_parse_prop()
786 sys_reg->filter &= ~IQS269_FILT_STR_LP_LTA_MASK; in iqs269_parse_prop()
787 sys_reg->filter |= (val << IQS269_FILT_STR_LP_LTA_SHIFT); in iqs269_parse_prop()
790 if (!device_property_read_u32(&client->dev, "azoteq,filt-str-lp-cnt", in iqs269_parse_prop()
793 dev_err(&client->dev, "Invalid filter strength: %u\n", in iqs269_parse_prop()
795 return -EINVAL; in iqs269_parse_prop()
798 sys_reg->filter &= ~IQS269_FILT_STR_LP_CNT_MASK; in iqs269_parse_prop()
799 sys_reg->filter |= (val << IQS269_FILT_STR_LP_CNT_SHIFT); in iqs269_parse_prop()
802 if (!device_property_read_u32(&client->dev, "azoteq,filt-str-np-lta", in iqs269_parse_prop()
805 dev_err(&client->dev, "Invalid filter strength: %u\n", in iqs269_parse_prop()
807 return -EINVAL; in iqs269_parse_prop()
810 sys_reg->filter &= ~IQS269_FILT_STR_NP_LTA_MASK; in iqs269_parse_prop()
811 sys_reg->filter |= (val << IQS269_FILT_STR_NP_LTA_SHIFT); in iqs269_parse_prop()
814 if (!device_property_read_u32(&client->dev, "azoteq,filt-str-np-cnt", in iqs269_parse_prop()
817 dev_err(&client->dev, "Invalid filter strength: %u\n", in iqs269_parse_prop()
819 return -EINVAL; in iqs269_parse_prop()
822 sys_reg->filter &= ~IQS269_FILT_STR_NP_CNT_MASK; in iqs269_parse_prop()
823 sys_reg->filter |= val; in iqs269_parse_prop()
826 if (!device_property_read_u32(&client->dev, "azoteq,rate-np-ms", in iqs269_parse_prop()
829 dev_err(&client->dev, "Invalid report rate: %u\n", val); in iqs269_parse_prop()
830 return -EINVAL; in iqs269_parse_prop()
833 sys_reg->rate_np = val; in iqs269_parse_prop()
836 if (!device_property_read_u32(&client->dev, "azoteq,rate-lp-ms", in iqs269_parse_prop()
839 dev_err(&client->dev, "Invalid report rate: %u\n", val); in iqs269_parse_prop()
840 return -EINVAL; in iqs269_parse_prop()
843 sys_reg->rate_lp = val; in iqs269_parse_prop()
846 if (!device_property_read_u32(&client->dev, "azoteq,rate-ulp-ms", in iqs269_parse_prop()
849 dev_err(&client->dev, "Invalid report rate: %u\n", val); in iqs269_parse_prop()
850 return -EINVAL; in iqs269_parse_prop()
853 sys_reg->rate_ulp = val / 16; in iqs269_parse_prop()
856 if (!device_property_read_u32(&client->dev, "azoteq,timeout-pwr-ms", in iqs269_parse_prop()
859 dev_err(&client->dev, "Invalid timeout: %u\n", val); in iqs269_parse_prop()
860 return -EINVAL; in iqs269_parse_prop()
863 sys_reg->timeout_pwr = val / 512; in iqs269_parse_prop()
866 if (!device_property_read_u32(&client->dev, "azoteq,timeout-lta-ms", in iqs269_parse_prop()
869 dev_err(&client->dev, "Invalid timeout: %u\n", val); in iqs269_parse_prop()
870 return -EINVAL; in iqs269_parse_prop()
873 sys_reg->timeout_lta = val / 512; in iqs269_parse_prop()
876 misc_a = be16_to_cpu(sys_reg->misc_a); in iqs269_parse_prop()
877 misc_b = be16_to_cpu(sys_reg->misc_b); in iqs269_parse_prop()
880 if (device_property_present(&client->dev, "azoteq,ati-band-disable")) in iqs269_parse_prop()
884 if (device_property_present(&client->dev, "azoteq,ati-lp-only")) in iqs269_parse_prop()
888 if (device_property_present(&client->dev, "azoteq,ati-band-tighten")) in iqs269_parse_prop()
892 if (device_property_present(&client->dev, "azoteq,filt-disable")) in iqs269_parse_prop()
895 if (!device_property_read_u32(&client->dev, "azoteq,gpio3-select", in iqs269_parse_prop()
898 dev_err(&client->dev, "Invalid GPIO3 selection: %u\n", in iqs269_parse_prop()
900 return -EINVAL; in iqs269_parse_prop()
908 if (device_property_present(&client->dev, "azoteq,dual-direction")) in iqs269_parse_prop()
911 if (!device_property_read_u32(&client->dev, "azoteq,tx-freq", &val)) { in iqs269_parse_prop()
913 dev_err(&client->dev, in iqs269_parse_prop()
915 return -EINVAL; in iqs269_parse_prop()
923 if (device_property_present(&client->dev, "azoteq,global-cap-increase")) in iqs269_parse_prop()
926 if (!device_property_read_u32(&client->dev, "azoteq,reseed-select", in iqs269_parse_prop()
929 dev_err(&client->dev, "Invalid reseed selection: %u\n", in iqs269_parse_prop()
931 return -EINVAL; in iqs269_parse_prop()
939 if (device_property_present(&client->dev, "azoteq,tracking-enable")) in iqs269_parse_prop()
942 if (!device_property_read_u32(&client->dev, "azoteq,filt-str-slider", in iqs269_parse_prop()
945 dev_err(&client->dev, "Invalid filter strength: %u\n", in iqs269_parse_prop()
947 return -EINVAL; in iqs269_parse_prop()
954 sys_reg->misc_a = cpu_to_be16(misc_a); in iqs269_parse_prop()
955 sys_reg->misc_b = cpu_to_be16(misc_b); in iqs269_parse_prop()
957 sys_reg->active = 0; in iqs269_parse_prop()
958 sys_reg->reseed = 0; in iqs269_parse_prop()
960 sys_reg->blocking = 0; in iqs269_parse_prop()
962 sys_reg->slider_select[0] = 0; in iqs269_parse_prop()
963 sys_reg->slider_select[1] = 0; in iqs269_parse_prop()
965 sys_reg->event_mask = ~((u8)IQS269_EVENT_MASK_SYS); in iqs269_parse_prop()
967 device_for_each_child_node(&client->dev, ch_node) { in iqs269_parse_prop()
976 * Volunteer all active channels to participate in ATI when REDO-ATI is in iqs269_parse_prop()
979 sys_reg->redo_ati = sys_reg->active; in iqs269_parse_prop()
981 general = be16_to_cpu(sys_reg->general); in iqs269_parse_prop()
983 if (device_property_present(&client->dev, "azoteq,clk-div")) { in iqs269_parse_prop()
985 iqs269->delay_mult = 4; in iqs269_parse_prop()
988 iqs269->delay_mult = 1; in iqs269_parse_prop()
992 * Configure the device to automatically switch between normal and low- in iqs269_parse_prop()
993 * power modes as a function of sensing activity. Ultra-low-power mode, in iqs269_parse_prop()
1000 if (!device_property_read_u32(&client->dev, "azoteq,ulp-update", in iqs269_parse_prop()
1003 dev_err(&client->dev, "Invalid update rate: %u\n", val); in iqs269_parse_prop()
1004 return -EINVAL; in iqs269_parse_prop()
1012 if (device_property_present(&client->dev, "azoteq,reseed-offset")) in iqs269_parse_prop()
1018 * As per the datasheet, enable streaming during normal-power mode if in iqs269_parse_prop()
1019 * either slider is in use. In that case, the device returns to event in iqs269_parse_prop()
1020 * mode during low-power mode. in iqs269_parse_prop()
1022 if (sys_reg->slider_select[0] || sys_reg->slider_select[1]) in iqs269_parse_prop()
1028 sys_reg->general = cpu_to_be16(general); in iqs269_parse_prop()
1035 struct iqs269_sys_reg *sys_reg = &iqs269->sys_reg; in iqs269_dev_init()
1040 mutex_lock(&iqs269->lock); in iqs269_dev_init()
1042 error = regmap_update_bits(iqs269->regmap, IQS269_HALL_UI, in iqs269_dev_init()
1044 iqs269->hall_enable ? ~0 : 0); in iqs269_dev_init()
1049 if (!(sys_reg->active & BIT(i))) in iqs269_dev_init()
1052 ch_reg = &iqs269->ch_reg[i]; in iqs269_dev_init()
1054 error = regmap_raw_write(iqs269->regmap, in iqs269_dev_init()
1063 * The REDO-ATI and ATI channel selection fields must be written in the in iqs269_dev_init()
1067 error = regmap_raw_write(iqs269->regmap, IQS269_SYS_SETTINGS, sys_reg, in iqs269_dev_init()
1072 error = regmap_read_poll_timeout(iqs269->regmap, IQS269_SYS_FLAGS, val, in iqs269_dev_init()
1080 iqs269->ati_current = true; in iqs269_dev_init()
1083 mutex_unlock(&iqs269->lock); in iqs269_dev_init()
1090 struct i2c_client *client = iqs269->client; in iqs269_input_init()
1096 iqs269->keypad = devm_input_allocate_device(&client->dev); in iqs269_input_init()
1097 if (!iqs269->keypad) in iqs269_input_init()
1098 return -ENOMEM; in iqs269_input_init()
1100 iqs269->keypad->keycodemax = ARRAY_SIZE(iqs269->keycode); in iqs269_input_init()
1101 iqs269->keypad->keycode = iqs269->keycode; in iqs269_input_init()
1102 iqs269->keypad->keycodesize = sizeof(*iqs269->keycode); in iqs269_input_init()
1104 iqs269->keypad->name = "iqs269a_keypad"; in iqs269_input_init()
1105 iqs269->keypad->id.bustype = BUS_I2C; in iqs269_input_init()
1107 if (iqs269->hall_enable) { in iqs269_input_init()
1108 error = regmap_raw_read(iqs269->regmap, IQS269_SYS_FLAGS, in iqs269_input_init()
1111 dev_err(&client->dev, in iqs269_input_init()
1124 sw_code = iqs269->switches[i].code; in iqs269_input_init()
1127 keycode = iqs269->keycode[i * IQS269_NUM_CH + j]; in iqs269_input_init()
1130 * Hall-effect sensing repurposes a pair of dedicated in iqs269_input_init()
1135 if (iqs269->hall_enable && in iqs269_input_init()
1136 iqs269->switches[i].enabled) { in iqs269_input_init()
1137 input_set_capability(iqs269->keypad, in iqs269_input_init()
1139 input_report_switch(iqs269->keypad, in iqs269_input_init()
1146 if (iqs269->hall_enable) in iqs269_input_init()
1152 input_set_capability(iqs269->keypad, in iqs269_input_init()
1158 input_sync(iqs269->keypad); in iqs269_input_init()
1160 error = input_register_device(iqs269->keypad); in iqs269_input_init()
1162 dev_err(&client->dev, "Failed to register keypad: %d\n", error); in iqs269_input_init()
1167 if (!iqs269->sys_reg.slider_select[i]) in iqs269_input_init()
1170 iqs269->slider[i] = devm_input_allocate_device(&client->dev); in iqs269_input_init()
1171 if (!iqs269->slider[i]) in iqs269_input_init()
1172 return -ENOMEM; in iqs269_input_init()
1174 iqs269->slider[i]->name = i ? "iqs269a_slider_1" in iqs269_input_init()
1176 iqs269->slider[i]->id.bustype = BUS_I2C; in iqs269_input_init()
1178 input_set_capability(iqs269->slider[i], EV_KEY, BTN_TOUCH); in iqs269_input_init()
1179 input_set_abs_params(iqs269->slider[i], ABS_X, 0, 255, 0, 0); in iqs269_input_init()
1181 error = input_register_device(iqs269->slider[i]); in iqs269_input_init()
1183 dev_err(&client->dev, in iqs269_input_init()
1194 struct i2c_client *client = iqs269->client; in iqs269_report()
1201 error = regmap_raw_read(iqs269->regmap, IQS269_SYS_FLAGS, &flags, in iqs269_report()
1204 dev_err(&client->dev, "Failed to read device status: %d\n", in iqs269_report()
1211 * in the event of an I2C communication error. In this case, the device in iqs269_report()
1215 dev_err(&client->dev, "Unexpected device reset\n"); in iqs269_report()
1219 dev_err(&client->dev, in iqs269_report()
1220 "Failed to re-initialize device: %d\n", error); in iqs269_report()
1225 error = regmap_raw_read(iqs269->regmap, IQS269_SLIDER_X, slider_x, in iqs269_report()
1228 dev_err(&client->dev, "Failed to read slider position: %d\n", in iqs269_report()
1234 if (!iqs269->sys_reg.slider_select[i]) in iqs269_report()
1239 * slider is in a state of touch. in iqs269_report()
1242 iqs269->sys_reg.slider_select[i]) { in iqs269_report()
1243 input_report_key(iqs269->slider[i], BTN_TOUCH, 1); in iqs269_report()
1244 input_report_abs(iqs269->slider[i], ABS_X, slider_x[i]); in iqs269_report()
1246 input_report_key(iqs269->slider[i], BTN_TOUCH, 0); in iqs269_report()
1249 input_sync(iqs269->slider[i]); in iqs269_report()
1259 sw_code = iqs269->switches[i].code; in iqs269_report()
1262 keycode = iqs269->keycode[i * IQS269_NUM_CH + j]; in iqs269_report()
1266 if (iqs269->hall_enable && in iqs269_report()
1267 iqs269->switches[i].enabled) in iqs269_report()
1268 input_report_switch(iqs269->keypad, in iqs269_report()
1274 if (iqs269->hall_enable) in iqs269_report()
1279 input_report_key(iqs269->keypad, keycode, in iqs269_report()
1285 input_sync(iqs269->keypad); in iqs269_report()
1311 struct i2c_client *client = iqs269->client; in counts_show()
1315 if (!iqs269->ati_current || iqs269->hall_enable) in counts_show()
1316 return -EPERM; in counts_show()
1323 disable_irq(client->irq); in counts_show()
1325 error = regmap_raw_read(iqs269->regmap, in counts_show()
1326 IQS269_CHx_COUNTS + iqs269->ch_num * 2, in counts_show()
1330 enable_irq(client->irq); in counts_show()
1342 struct i2c_client *client = iqs269->client; in hall_bin_show()
1346 disable_irq(client->irq); in hall_bin_show()
1348 error = regmap_read(iqs269->regmap, IQS269_CAL_DATA_A, &val); in hall_bin_show()
1351 enable_irq(client->irq); in hall_bin_show()
1356 switch (iqs269->ch_reg[IQS269_CHx_HALL_ACTIVE].rx_enable & in hall_bin_show()
1357 iqs269->ch_reg[IQS269_CHx_HALL_INACTIVE].rx_enable) { in hall_bin_show()
1369 return -EINVAL; in hall_bin_show()
1380 return scnprintf(buf, PAGE_SIZE, "%u\n", iqs269->hall_enable); in hall_enable_show()
1395 mutex_lock(&iqs269->lock); in hall_enable_store()
1397 iqs269->hall_enable = val; in hall_enable_store()
1398 iqs269->ati_current = false; in hall_enable_store()
1400 mutex_unlock(&iqs269->lock); in hall_enable_store()
1410 return scnprintf(buf, PAGE_SIZE, "%u\n", iqs269->ch_num); in ch_number_show()
1426 return -EINVAL; in ch_number_store()
1428 iqs269->ch_num = val; in ch_number_store()
1439 iqs269->ch_reg[iqs269->ch_num].rx_enable); in rx_enable_show()
1455 return -EINVAL; in rx_enable_store()
1457 mutex_lock(&iqs269->lock); in rx_enable_store()
1459 iqs269->ch_reg[iqs269->ch_num].rx_enable = val; in rx_enable_store()
1460 iqs269->ati_current = false; in rx_enable_store()
1462 mutex_unlock(&iqs269->lock); in rx_enable_store()
1474 error = iqs269_ati_mode_get(iqs269, iqs269->ch_num, &val); in ati_mode_show()
1493 error = iqs269_ati_mode_set(iqs269, iqs269->ch_num, val); in ati_mode_store()
1507 error = iqs269_ati_base_get(iqs269, iqs269->ch_num, &val); in ati_base_show()
1526 error = iqs269_ati_base_set(iqs269, iqs269->ch_num, val); in ati_base_store()
1540 error = iqs269_ati_target_get(iqs269, iqs269->ch_num, &val); in ati_target_show()
1559 error = iqs269_ati_target_set(iqs269, iqs269->ch_num, val); in ati_target_store()
1571 return scnprintf(buf, PAGE_SIZE, "%u\n", iqs269->ati_current); in ati_trigger_show()
1579 struct i2c_client *client = iqs269->client; in ati_trigger_store()
1590 disable_irq(client->irq); in ati_trigger_store()
1595 enable_irq(client->irq); in ati_trigger_store()
1642 iqs269 = devm_kzalloc(&client->dev, sizeof(*iqs269), GFP_KERNEL); in iqs269_probe()
1644 return -ENOMEM; in iqs269_probe()
1647 iqs269->client = client; in iqs269_probe()
1649 iqs269->regmap = devm_regmap_init_i2c(client, &iqs269_regmap_config); in iqs269_probe()
1650 if (IS_ERR(iqs269->regmap)) { in iqs269_probe()
1651 error = PTR_ERR(iqs269->regmap); in iqs269_probe()
1652 dev_err(&client->dev, "Failed to initialize register map: %d\n", in iqs269_probe()
1657 mutex_init(&iqs269->lock); in iqs269_probe()
1659 error = regmap_raw_read(iqs269->regmap, IQS269_VER_INFO, &ver_info, in iqs269_probe()
1665 dev_err(&client->dev, "Unrecognized product number: 0x%02X\n", in iqs269_probe()
1667 return -EINVAL; in iqs269_probe()
1676 dev_err(&client->dev, "Failed to initialize device: %d\n", in iqs269_probe()
1685 error = devm_request_threaded_irq(&client->dev, client->irq, in iqs269_probe()
1687 client->name, iqs269); in iqs269_probe()
1689 dev_err(&client->dev, "Failed to request IRQ: %d\n", error); in iqs269_probe()
1693 error = devm_device_add_group(&client->dev, &iqs269_attr_group); in iqs269_probe()
1695 dev_err(&client->dev, "Failed to add attributes: %d\n", error); in iqs269_probe()
1703 struct i2c_client *client = iqs269->client; in iqs269_suspend()
1707 if (!iqs269->suspend_mode) in iqs269_suspend()
1710 disable_irq(client->irq); in iqs269_suspend()
1715 * transition into normal-power mode. in iqs269_suspend()
1717 error = regmap_update_bits(iqs269->regmap, IQS269_SYS_SETTINGS, in iqs269_suspend()
1724 * into normal-power mode before a manual mode switch is performed. in iqs269_suspend()
1726 error = regmap_read_poll_timeout(iqs269->regmap, IQS269_SYS_FLAGS, val, in iqs269_suspend()
1733 error = regmap_update_bits(iqs269->regmap, IQS269_SYS_SETTINGS, in iqs269_suspend()
1735 iqs269->suspend_mode << in iqs269_suspend()
1745 error = regmap_read_poll_timeout(iqs269->regmap, IQS269_SYS_FLAGS, val, in iqs269_suspend()
1747 == (iqs269->suspend_mode << in iqs269_suspend()
1754 enable_irq(client->irq); in iqs269_suspend()
1762 struct i2c_client *client = iqs269->client; in iqs269_resume()
1766 if (!iqs269->suspend_mode) in iqs269_resume()
1769 disable_irq(client->irq); in iqs269_resume()
1771 error = regmap_update_bits(iqs269->regmap, IQS269_SYS_SETTINGS, in iqs269_resume()
1777 * This check ensures the device has returned to normal-power mode in iqs269_resume()
1778 * before automatic power mode switching is re-enabled. in iqs269_resume()
1780 error = regmap_read_poll_timeout(iqs269->regmap, IQS269_SYS_FLAGS, val, in iqs269_resume()
1787 error = regmap_update_bits(iqs269->regmap, IQS269_SYS_SETTINGS, in iqs269_resume()
1801 enable_irq(client->irq); in iqs269_resume()
1825 MODULE_DESCRIPTION("Azoteq IQS269A Capacitive Touch Controller");