Lines Matching +full:event +full:- +full:prox

1 // SPDX-License-Identifier: GPL-2.0+
8 * inductive keys as well as Hall-effect switches, and one for each of the two
225 .name = "event-prox",
231 .name = "event-prox-alt",
238 .name = "event-touch",
244 .name = "event-touch-alt",
251 .name = "event-deep",
257 .name = "event-deep-alt",
339 * Slider 1 is unavailable if the touch-and-hold option is enabled via in iqs269_slider_type()
341 * the touch-and-hold timer ceiling. in iqs269_slider_type()
343 if (slider_num && (iqs269->otp_option & IQS269_OTP_OPTION_HOLD)) in iqs269_slider_type()
346 if (!iqs269->sys_reg.slider_select[slider_num]) in iqs269_slider_type()
350 if (iqs269->sl_code[slider_num][i] != KEY_RESERVED) in iqs269_slider_type()
359 struct iqs269_ch_reg *ch_reg = iqs269->sys_reg.ch_reg; in iqs269_ati_mode_set()
363 return -EINVAL; in iqs269_ati_mode_set()
366 return -EINVAL; in iqs269_ati_mode_set()
368 guard(mutex)(&iqs269->lock); in iqs269_ati_mode_set()
376 iqs269->ati_current = false; in iqs269_ati_mode_set()
384 struct iqs269_ch_reg *ch_reg = iqs269->sys_reg.ch_reg; in iqs269_ati_mode_get()
388 return -EINVAL; in iqs269_ati_mode_get()
390 guard(mutex)(&iqs269->lock); in iqs269_ati_mode_get()
403 struct iqs269_ch_reg *ch_reg = iqs269->sys_reg.ch_reg; in iqs269_ati_base_set()
407 return -EINVAL; in iqs269_ati_base_set()
427 return -EINVAL; in iqs269_ati_base_set()
430 guard(mutex)(&iqs269->lock); in iqs269_ati_base_set()
438 iqs269->ati_current = false; in iqs269_ati_base_set()
446 struct iqs269_ch_reg *ch_reg = iqs269->sys_reg.ch_reg; in iqs269_ati_base_get()
450 return -EINVAL; in iqs269_ati_base_get()
452 guard(mutex)(&iqs269->lock); in iqs269_ati_base_get()
474 return -EINVAL; in iqs269_ati_base_get()
481 struct iqs269_ch_reg *ch_reg = iqs269->sys_reg.ch_reg; in iqs269_ati_target_set()
485 return -EINVAL; in iqs269_ati_target_set()
488 return -EINVAL; in iqs269_ati_target_set()
490 guard(mutex)(&iqs269->lock); in iqs269_ati_target_set()
498 iqs269->ati_current = false; in iqs269_ati_target_set()
506 struct iqs269_ch_reg *ch_reg = iqs269->sys_reg.ch_reg; in iqs269_ati_target_get()
510 return -EINVAL; in iqs269_ati_target_get()
512 guard(mutex)(&iqs269->lock); in iqs269_ati_target_get()
531 return -EINVAL; in iqs269_parse_mask()
541 return -EINVAL; in iqs269_parse_mask()
552 struct i2c_client *client = iqs269->client; in iqs269_parse_chan()
560 dev_err(&client->dev, "Failed to read channel number: %d\n", in iqs269_parse_chan()
564 dev_err(&client->dev, "Invalid channel number: %u\n", reg); in iqs269_parse_chan()
565 return -EINVAL; in iqs269_parse_chan()
568 iqs269->sys_reg.active |= BIT(reg); in iqs269_parse_chan()
569 if (!fwnode_property_present(ch_node, "azoteq,reseed-disable")) in iqs269_parse_chan()
570 iqs269->sys_reg.reseed |= BIT(reg); in iqs269_parse_chan()
572 if (fwnode_property_present(ch_node, "azoteq,blocking-enable")) in iqs269_parse_chan()
573 iqs269->sys_reg.blocking |= BIT(reg); in iqs269_parse_chan()
575 if (fwnode_property_present(ch_node, "azoteq,slider0-select")) in iqs269_parse_chan()
576 iqs269->sys_reg.slider_select[0] |= BIT(reg); in iqs269_parse_chan()
578 if (fwnode_property_present(ch_node, "azoteq,slider1-select") && in iqs269_parse_chan()
579 !(iqs269->otp_option & IQS269_OTP_OPTION_HOLD)) in iqs269_parse_chan()
580 iqs269->sys_reg.slider_select[1] |= BIT(reg); in iqs269_parse_chan()
582 ch_reg = &iqs269->sys_reg.ch_reg[reg]; in iqs269_parse_chan()
584 error = iqs269_parse_mask(ch_node, "azoteq,rx-enable", in iqs269_parse_chan()
585 &ch_reg->rx_enable); in iqs269_parse_chan()
587 dev_err(&client->dev, "Invalid channel %u RX enable mask: %d\n", in iqs269_parse_chan()
592 error = iqs269_parse_mask(ch_node, "azoteq,tx-enable", in iqs269_parse_chan()
593 &ch_reg->tx_enable); in iqs269_parse_chan()
595 dev_err(&client->dev, "Invalid channel %u TX enable mask: %d\n", in iqs269_parse_chan()
600 engine_a = be16_to_cpu(ch_reg->engine_a); in iqs269_parse_chan()
601 engine_b = be16_to_cpu(ch_reg->engine_b); in iqs269_parse_chan()
604 if (fwnode_property_present(ch_node, "azoteq,meas-cap-decrease")) in iqs269_parse_chan()
608 if (fwnode_property_present(ch_node, "azoteq,rx-float-inactive")) in iqs269_parse_chan()
613 if (!fwnode_property_read_u32(ch_node, "azoteq,local-cap-size", &val)) { in iqs269_parse_chan()
627 dev_err(&client->dev, in iqs269_parse_chan()
630 return -EINVAL; in iqs269_parse_chan()
635 if (fwnode_property_present(ch_node, "azoteq,invert-enable")) in iqs269_parse_chan()
638 if (!fwnode_property_read_u32(ch_node, "azoteq,proj-bias", &val)) { in iqs269_parse_chan()
640 dev_err(&client->dev, in iqs269_parse_chan()
643 return -EINVAL; in iqs269_parse_chan()
650 if (!fwnode_property_read_u32(ch_node, "azoteq,sense-mode", &val)) { in iqs269_parse_chan()
652 dev_err(&client->dev, in iqs269_parse_chan()
655 return -EINVAL; in iqs269_parse_chan()
662 if (!fwnode_property_read_u32(ch_node, "azoteq,sense-freq", &val)) { in iqs269_parse_chan()
664 dev_err(&client->dev, in iqs269_parse_chan()
667 return -EINVAL; in iqs269_parse_chan()
675 if (fwnode_property_present(ch_node, "azoteq,static-enable")) in iqs269_parse_chan()
678 ch_reg->engine_a = cpu_to_be16(engine_a); in iqs269_parse_chan()
679 ch_reg->engine_b = cpu_to_be16(engine_b); in iqs269_parse_chan()
681 if (!fwnode_property_read_u32(ch_node, "azoteq,ati-mode", &val)) { in iqs269_parse_chan()
684 dev_err(&client->dev, in iqs269_parse_chan()
690 if (!fwnode_property_read_u32(ch_node, "azoteq,ati-base", &val)) { in iqs269_parse_chan()
693 dev_err(&client->dev, in iqs269_parse_chan()
699 if (!fwnode_property_read_u32(ch_node, "azoteq,ati-target", &val)) { in iqs269_parse_chan()
702 dev_err(&client->dev, in iqs269_parse_chan()
709 error = iqs269_parse_mask(ch_node, "azoteq,assoc-select", in iqs269_parse_chan()
710 &ch_reg->assoc_select); in iqs269_parse_chan()
712 dev_err(&client->dev, "Invalid channel %u association: %d\n", in iqs269_parse_chan()
717 if (!fwnode_property_read_u32(ch_node, "azoteq,assoc-weight", &val)) { in iqs269_parse_chan()
719 dev_err(&client->dev, in iqs269_parse_chan()
722 return -EINVAL; in iqs269_parse_chan()
725 ch_reg->assoc_weight = val; in iqs269_parse_chan()
737 dev_err(&client->dev, in iqs269_parse_chan()
740 return -EINVAL; in iqs269_parse_chan()
743 ch_reg->thresh[iqs269_events[i].th_offs] = val; in iqs269_parse_chan()
747 u8 *hyst = &ch_reg->hyst; in iqs269_parse_chan()
750 dev_err(&client->dev, in iqs269_parse_chan()
753 return -EINVAL; in iqs269_parse_chan()
768 if (error == -EINVAL) { in iqs269_parse_chan()
771 dev_err(&client->dev, in iqs269_parse_chan()
779 if (iqs269->hall_enable) { in iqs269_parse_chan()
780 iqs269->switches[i].code = val; in iqs269_parse_chan()
781 iqs269->switches[i].enabled = true; in iqs269_parse_chan()
786 if (iqs269->hall_enable) in iqs269_parse_chan()
791 iqs269->keycode[i * IQS269_NUM_CH + reg] = val; in iqs269_parse_chan()
794 iqs269->sys_reg.event_mask &= ~iqs269_events[i].mask; in iqs269_parse_chan()
802 struct iqs269_sys_reg *sys_reg = &iqs269->sys_reg; in iqs269_parse_prop()
803 struct i2c_client *client = iqs269->client; in iqs269_parse_prop()
808 iqs269->hall_enable = device_property_present(&client->dev, in iqs269_parse_prop()
809 "azoteq,hall-enable"); in iqs269_parse_prop()
811 error = regmap_raw_read(iqs269->regmap, IQS269_SYS_SETTINGS, sys_reg, in iqs269_parse_prop()
816 if (!device_property_read_u32(&client->dev, "azoteq,filt-str-lp-lta", in iqs269_parse_prop()
819 dev_err(&client->dev, "Invalid filter strength: %u\n", in iqs269_parse_prop()
821 return -EINVAL; in iqs269_parse_prop()
824 sys_reg->filter &= ~IQS269_FILT_STR_LP_LTA_MASK; in iqs269_parse_prop()
825 sys_reg->filter |= (val << IQS269_FILT_STR_LP_LTA_SHIFT); in iqs269_parse_prop()
828 if (!device_property_read_u32(&client->dev, "azoteq,filt-str-lp-cnt", in iqs269_parse_prop()
831 dev_err(&client->dev, "Invalid filter strength: %u\n", in iqs269_parse_prop()
833 return -EINVAL; in iqs269_parse_prop()
836 sys_reg->filter &= ~IQS269_FILT_STR_LP_CNT_MASK; in iqs269_parse_prop()
837 sys_reg->filter |= (val << IQS269_FILT_STR_LP_CNT_SHIFT); in iqs269_parse_prop()
840 if (!device_property_read_u32(&client->dev, "azoteq,filt-str-np-lta", in iqs269_parse_prop()
843 dev_err(&client->dev, "Invalid filter strength: %u\n", in iqs269_parse_prop()
845 return -EINVAL; in iqs269_parse_prop()
848 sys_reg->filter &= ~IQS269_FILT_STR_NP_LTA_MASK; in iqs269_parse_prop()
849 sys_reg->filter |= (val << IQS269_FILT_STR_NP_LTA_SHIFT); in iqs269_parse_prop()
852 if (!device_property_read_u32(&client->dev, "azoteq,filt-str-np-cnt", in iqs269_parse_prop()
855 dev_err(&client->dev, "Invalid filter strength: %u\n", in iqs269_parse_prop()
857 return -EINVAL; in iqs269_parse_prop()
860 sys_reg->filter &= ~IQS269_FILT_STR_NP_CNT_MASK; in iqs269_parse_prop()
861 sys_reg->filter |= val; in iqs269_parse_prop()
864 if (!device_property_read_u32(&client->dev, "azoteq,rate-np-ms", in iqs269_parse_prop()
867 dev_err(&client->dev, "Invalid report rate: %u\n", val); in iqs269_parse_prop()
868 return -EINVAL; in iqs269_parse_prop()
871 sys_reg->rate_np = val; in iqs269_parse_prop()
874 if (!device_property_read_u32(&client->dev, "azoteq,rate-lp-ms", in iqs269_parse_prop()
877 dev_err(&client->dev, "Invalid report rate: %u\n", val); in iqs269_parse_prop()
878 return -EINVAL; in iqs269_parse_prop()
881 sys_reg->rate_lp = val; in iqs269_parse_prop()
884 if (!device_property_read_u32(&client->dev, "azoteq,rate-ulp-ms", in iqs269_parse_prop()
887 dev_err(&client->dev, "Invalid report rate: %u\n", val); in iqs269_parse_prop()
888 return -EINVAL; in iqs269_parse_prop()
891 sys_reg->rate_ulp = val / 16; in iqs269_parse_prop()
894 if (!device_property_read_u32(&client->dev, "azoteq,timeout-pwr-ms", in iqs269_parse_prop()
897 dev_err(&client->dev, "Invalid timeout: %u\n", val); in iqs269_parse_prop()
898 return -EINVAL; in iqs269_parse_prop()
901 sys_reg->timeout_pwr = val / 512; in iqs269_parse_prop()
904 if (!device_property_read_u32(&client->dev, "azoteq,timeout-lta-ms", in iqs269_parse_prop()
907 dev_err(&client->dev, "Invalid timeout: %u\n", val); in iqs269_parse_prop()
908 return -EINVAL; in iqs269_parse_prop()
911 sys_reg->timeout_lta = val / 512; in iqs269_parse_prop()
914 misc_a = be16_to_cpu(sys_reg->misc_a); in iqs269_parse_prop()
915 misc_b = be16_to_cpu(sys_reg->misc_b); in iqs269_parse_prop()
918 if (device_property_present(&client->dev, "azoteq,ati-band-disable")) in iqs269_parse_prop()
922 if (device_property_present(&client->dev, "azoteq,ati-lp-only")) in iqs269_parse_prop()
926 if (device_property_present(&client->dev, "azoteq,ati-band-tighten")) in iqs269_parse_prop()
930 if (device_property_present(&client->dev, "azoteq,filt-disable")) in iqs269_parse_prop()
933 if (!device_property_read_u32(&client->dev, "azoteq,gpio3-select", in iqs269_parse_prop()
936 dev_err(&client->dev, "Invalid GPIO3 selection: %u\n", in iqs269_parse_prop()
938 return -EINVAL; in iqs269_parse_prop()
946 if (device_property_present(&client->dev, "azoteq,dual-direction")) in iqs269_parse_prop()
949 if (!device_property_read_u32(&client->dev, "azoteq,tx-freq", &val)) { in iqs269_parse_prop()
951 dev_err(&client->dev, in iqs269_parse_prop()
953 return -EINVAL; in iqs269_parse_prop()
961 if (device_property_present(&client->dev, "azoteq,global-cap-increase")) in iqs269_parse_prop()
964 if (!device_property_read_u32(&client->dev, "azoteq,reseed-select", in iqs269_parse_prop()
967 dev_err(&client->dev, "Invalid reseed selection: %u\n", in iqs269_parse_prop()
969 return -EINVAL; in iqs269_parse_prop()
977 if (device_property_present(&client->dev, "azoteq,tracking-enable")) in iqs269_parse_prop()
980 if (!device_property_read_u32(&client->dev, "azoteq,filt-str-slider", in iqs269_parse_prop()
983 dev_err(&client->dev, "Invalid filter strength: %u\n", in iqs269_parse_prop()
985 return -EINVAL; in iqs269_parse_prop()
992 sys_reg->misc_a = cpu_to_be16(misc_a); in iqs269_parse_prop()
993 sys_reg->misc_b = cpu_to_be16(misc_b); in iqs269_parse_prop()
995 sys_reg->active = 0; in iqs269_parse_prop()
996 sys_reg->reseed = 0; in iqs269_parse_prop()
998 sys_reg->blocking = 0; in iqs269_parse_prop()
1000 sys_reg->slider_select[0] = 0; in iqs269_parse_prop()
1008 * repurposed for the touch-and-hold timer ceiling. in iqs269_parse_prop()
1010 if (iqs269->otp_option & IQS269_OTP_OPTION_HOLD) { in iqs269_parse_prop()
1011 if (!device_property_read_u32(&client->dev, in iqs269_parse_prop()
1012 "azoteq,touch-hold-ms", &val)) { in iqs269_parse_prop()
1015 dev_err(&client->dev, in iqs269_parse_prop()
1016 "Invalid touch-and-hold ceiling: %u\n", in iqs269_parse_prop()
1018 return -EINVAL; in iqs269_parse_prop()
1021 sys_reg->slider_select[1] = val / 256; in iqs269_parse_prop()
1022 } else if (iqs269->ver_info.fw_num < IQS269_VER_INFO_FW_NUM_3) { in iqs269_parse_prop()
1024 * The default touch-and-hold timer ceiling initially in iqs269_parse_prop()
1026 * the device experienced a soft reset between power- in iqs269_parse_prop()
1031 * device is re-initialized. in iqs269_parse_prop()
1033 sys_reg->slider_select[1] = IQS269_TOUCH_HOLD_DEFAULT; in iqs269_parse_prop()
1036 sys_reg->slider_select[1] = 0; in iqs269_parse_prop()
1039 sys_reg->event_mask = ~((u8)IQS269_EVENT_MASK_SYS); in iqs269_parse_prop()
1041 device_for_each_child_node_scoped(&client->dev, ch_node) { in iqs269_parse_prop()
1048 * Volunteer all active channels to participate in ATI when REDO-ATI is in iqs269_parse_prop()
1051 sys_reg->redo_ati = sys_reg->active; in iqs269_parse_prop()
1053 general = be16_to_cpu(sys_reg->general); in iqs269_parse_prop()
1055 if (device_property_present(&client->dev, "azoteq,clk-div")) in iqs269_parse_prop()
1059 * Configure the device to automatically switch between normal and low- in iqs269_parse_prop()
1060 * power modes as a function of sensing activity. Ultra-low-power mode, in iqs269_parse_prop()
1067 if (!device_property_read_u32(&client->dev, "azoteq,suspend-mode", in iqs269_parse_prop()
1070 dev_err(&client->dev, "Invalid suspend mode: %u\n", in iqs269_parse_prop()
1072 return -EINVAL; in iqs269_parse_prop()
1078 if (!device_property_read_u32(&client->dev, "azoteq,ulp-update", in iqs269_parse_prop()
1081 dev_err(&client->dev, "Invalid update rate: %u\n", val); in iqs269_parse_prop()
1082 return -EINVAL; in iqs269_parse_prop()
1089 if (device_property_present(&client->dev, "linux,keycodes")) { in iqs269_parse_prop()
1091 int count = device_property_count_u32(&client->dev, in iqs269_parse_prop()
1094 dev_err(&client->dev, "Too many keycodes present\n"); in iqs269_parse_prop()
1095 return -EINVAL; in iqs269_parse_prop()
1097 dev_err(&client->dev, "Failed to count keycodes: %d\n", in iqs269_parse_prop()
1102 error = device_property_read_u32_array(&client->dev, in iqs269_parse_prop()
1104 *iqs269->sl_code, count); in iqs269_parse_prop()
1106 dev_err(&client->dev, "Failed to read keycodes: %d\n", in iqs269_parse_prop()
1111 if (device_property_present(&client->dev, in iqs269_parse_prop()
1112 "azoteq,gesture-swipe")) in iqs269_parse_prop()
1119 if (iqs269->ver_info.fw_num < IQS269_VER_INFO_FW_NUM_3) in iqs269_parse_prop()
1122 if (!device_property_read_u32(&client->dev, in iqs269_parse_prop()
1123 "azoteq,timeout-tap-ms", &val)) { in iqs269_parse_prop()
1125 dev_err(&client->dev, "Invalid timeout: %u\n", in iqs269_parse_prop()
1127 return -EINVAL; in iqs269_parse_prop()
1130 sys_reg->timeout_tap = val / (16 / scale); in iqs269_parse_prop()
1133 if (!device_property_read_u32(&client->dev, in iqs269_parse_prop()
1134 "azoteq,timeout-swipe-ms", in iqs269_parse_prop()
1137 dev_err(&client->dev, "Invalid timeout: %u\n", in iqs269_parse_prop()
1139 return -EINVAL; in iqs269_parse_prop()
1142 sys_reg->timeout_swipe = val / (16 / scale); in iqs269_parse_prop()
1145 if (!device_property_read_u32(&client->dev, in iqs269_parse_prop()
1146 "azoteq,thresh-swipe", &val)) { in iqs269_parse_prop()
1148 dev_err(&client->dev, "Invalid threshold: %u\n", in iqs269_parse_prop()
1150 return -EINVAL; in iqs269_parse_prop()
1153 sys_reg->thresh_swipe = val; in iqs269_parse_prop()
1156 sys_reg->event_mask &= ~IQS269_EVENT_MASK_GESTURE; in iqs269_parse_prop()
1160 if (device_property_present(&client->dev, "azoteq,reseed-offset")) in iqs269_parse_prop()
1166 * As per the datasheet, enable streaming during normal-power mode if in iqs269_parse_prop()
1168 * device returns to event mode during low-power mode. in iqs269_parse_prop()
1177 sys_reg->general = cpu_to_be16(general); in iqs269_parse_prop()
1192 guard(mutex)(&iqs269->lock); in iqs269_dev_init()
1196 * to restore any OTP-enabled functionality after a soft reset. in iqs269_dev_init()
1198 if (iqs269->otp_option == IQS269_OTP_OPTION_TWS && in iqs269_dev_init()
1199 iqs269->ver_info.fw_num < IQS269_VER_INFO_FW_NUM_3) { in iqs269_dev_init()
1200 error = regmap_multi_reg_write(iqs269->regmap, iqs269_tws_init, in iqs269_dev_init()
1206 error = regmap_update_bits(iqs269->regmap, IQS269_HALL_UI, in iqs269_dev_init()
1208 iqs269->hall_enable ? ~0 : 0); in iqs269_dev_init()
1212 error = regmap_raw_write(iqs269->regmap, IQS269_SYS_SETTINGS, in iqs269_dev_init()
1213 &iqs269->sys_reg, sizeof(iqs269->sys_reg)); in iqs269_dev_init()
1223 iqs269->ati_current = true; in iqs269_dev_init()
1230 struct i2c_client *client = iqs269->client; in iqs269_input_init()
1234 iqs269->keypad = devm_input_allocate_device(&client->dev); in iqs269_input_init()
1235 if (!iqs269->keypad) in iqs269_input_init()
1236 return -ENOMEM; in iqs269_input_init()
1238 iqs269->keypad->keycodemax = ARRAY_SIZE(iqs269->keycode); in iqs269_input_init()
1239 iqs269->keypad->keycode = iqs269->keycode; in iqs269_input_init()
1240 iqs269->keypad->keycodesize = sizeof(*iqs269->keycode); in iqs269_input_init()
1242 iqs269->keypad->name = "iqs269a_keypad"; in iqs269_input_init()
1243 iqs269->keypad->id.bustype = BUS_I2C; in iqs269_input_init()
1246 sw_code = iqs269->switches[i].code; in iqs269_input_init()
1249 keycode = iqs269->keycode[i * IQS269_NUM_CH + j]; in iqs269_input_init()
1252 * Hall-effect sensing repurposes a pair of dedicated in iqs269_input_init()
1257 if (iqs269->hall_enable && in iqs269_input_init()
1258 iqs269->switches[i].enabled) in iqs269_input_init()
1259 input_set_capability(iqs269->keypad, in iqs269_input_init()
1264 if (iqs269->hall_enable) in iqs269_input_init()
1270 input_set_capability(iqs269->keypad, in iqs269_input_init()
1280 iqs269->slider[i] = devm_input_allocate_device(&client->dev); in iqs269_input_init()
1281 if (!iqs269->slider[i]) in iqs269_input_init()
1282 return -ENOMEM; in iqs269_input_init()
1284 iqs269->slider[i]->keycodemax = ARRAY_SIZE(iqs269->sl_code[i]); in iqs269_input_init()
1285 iqs269->slider[i]->keycode = iqs269->sl_code[i]; in iqs269_input_init()
1286 iqs269->slider[i]->keycodesize = sizeof(**iqs269->sl_code); in iqs269_input_init()
1288 iqs269->slider[i]->name = i ? "iqs269a_slider_1" in iqs269_input_init()
1290 iqs269->slider[i]->id.bustype = BUS_I2C; in iqs269_input_init()
1293 if (iqs269->sl_code[i][j] != KEY_RESERVED) in iqs269_input_init()
1294 input_set_capability(iqs269->slider[i], EV_KEY, in iqs269_input_init()
1295 iqs269->sl_code[i][j]); in iqs269_input_init()
1298 * Present the slider as a narrow trackpad if one or more chan- in iqs269_input_init()
1303 input_set_capability(iqs269->slider[i], in iqs269_input_init()
1305 input_set_abs_params(iqs269->slider[i], in iqs269_input_init()
1309 error = input_register_device(iqs269->slider[i]); in iqs269_input_init()
1311 dev_err(&client->dev, in iqs269_input_init()
1322 struct i2c_client *client = iqs269->client; in iqs269_report()
1329 error = regmap_raw_read(iqs269->regmap, IQS269_SYS_FLAGS, &flags, in iqs269_report()
1332 dev_err(&client->dev, "Failed to read device status: %d\n", in iqs269_report()
1339 * in the event of an I2C communication error. In this case, the device in iqs269_report()
1343 dev_err(&client->dev, "Unexpected device reset\n"); in iqs269_report()
1347 dev_err(&client->dev, in iqs269_report()
1348 "Failed to re-initialize device: %d\n", error); in iqs269_report()
1358 error = regmap_raw_read(iqs269->regmap, IQS269_SLIDER_X, in iqs269_report()
1361 dev_err(&client->dev, in iqs269_report()
1376 input_report_key(iqs269->slider[i], in iqs269_report()
1377 iqs269->sl_code[i][j], in iqs269_report()
1385 input_sync(iqs269->slider[i]); in iqs269_report()
1393 input_report_key(iqs269->slider[i], in iqs269_report()
1394 iqs269->sl_code[i][j], in iqs269_report()
1404 state &= iqs269->sys_reg.slider_select[i]; in iqs269_report()
1406 input_report_key(iqs269->slider[i], BTN_TOUCH, state); in iqs269_report()
1409 input_report_abs(iqs269->slider[i], in iqs269_report()
1414 input_sync(iqs269->slider[i]); in iqs269_report()
1424 sw_code = iqs269->switches[i].code; in iqs269_report()
1427 keycode = iqs269->keycode[i * IQS269_NUM_CH + j]; in iqs269_report()
1431 if (iqs269->hall_enable && in iqs269_report()
1432 iqs269->switches[i].enabled) in iqs269_report()
1433 input_report_switch(iqs269->keypad, in iqs269_report()
1439 if (iqs269->hall_enable) in iqs269_report()
1444 input_report_key(iqs269->keypad, keycode, in iqs269_report()
1450 input_sync(iqs269->keypad); in iqs269_report()
1456 complete_all(&iqs269->ati_done); in iqs269_report()
1482 struct i2c_client *client = iqs269->client; in counts_show()
1486 if (!iqs269->ati_current || iqs269->hall_enable) in counts_show()
1487 return -EPERM; in counts_show()
1489 if (!completion_done(&iqs269->ati_done)) in counts_show()
1490 return -EBUSY; in counts_show()
1497 disable_irq(client->irq); in counts_show()
1499 error = regmap_raw_read(iqs269->regmap, in counts_show()
1500 IQS269_CHx_COUNTS + iqs269->ch_num * 2, in counts_show()
1504 enable_irq(client->irq); in counts_show()
1516 struct iqs269_ch_reg *ch_reg = iqs269->sys_reg.ch_reg; in hall_bin_show()
1517 struct i2c_client *client = iqs269->client; in hall_bin_show()
1521 disable_irq(client->irq); in hall_bin_show()
1523 error = regmap_read(iqs269->regmap, IQS269_CAL_DATA_A, &val); in hall_bin_show()
1526 enable_irq(client->irq); in hall_bin_show()
1544 return -EINVAL; in hall_bin_show()
1555 return sysfs_emit(buf, "%u\n", iqs269->hall_enable); in hall_enable_show()
1570 guard(mutex)(&iqs269->lock); in hall_enable_store()
1572 iqs269->hall_enable = val; in hall_enable_store()
1573 iqs269->ati_current = false; in hall_enable_store()
1583 return sysfs_emit(buf, "%u\n", iqs269->ch_num); in ch_number_show()
1599 return -EINVAL; in ch_number_store()
1601 iqs269->ch_num = val; in ch_number_store()
1610 struct iqs269_ch_reg *ch_reg = iqs269->sys_reg.ch_reg; in rx_enable_show()
1612 return sysfs_emit(buf, "%u\n", ch_reg[iqs269->ch_num].rx_enable); in rx_enable_show()
1620 struct iqs269_ch_reg *ch_reg = iqs269->sys_reg.ch_reg; in rx_enable_store()
1629 return -EINVAL; in rx_enable_store()
1631 guard(mutex)(&iqs269->lock); in rx_enable_store()
1633 ch_reg[iqs269->ch_num].rx_enable = val; in rx_enable_store()
1634 iqs269->ati_current = false; in rx_enable_store()
1646 error = iqs269_ati_mode_get(iqs269, iqs269->ch_num, &val); in ati_mode_show()
1665 error = iqs269_ati_mode_set(iqs269, iqs269->ch_num, val); in ati_mode_store()
1679 error = iqs269_ati_base_get(iqs269, iqs269->ch_num, &val); in ati_base_show()
1698 error = iqs269_ati_base_set(iqs269, iqs269->ch_num, val); in ati_base_store()
1712 error = iqs269_ati_target_get(iqs269, iqs269->ch_num, &val); in ati_target_show()
1731 error = iqs269_ati_target_set(iqs269, iqs269->ch_num, val); in ati_target_store()
1744 iqs269->ati_current && in ati_trigger_show()
1745 completion_done(&iqs269->ati_done)); in ati_trigger_show()
1753 struct i2c_client *client = iqs269->client; in ati_trigger_store()
1764 disable_irq(client->irq); in ati_trigger_store()
1765 reinit_completion(&iqs269->ati_done); in ati_trigger_store()
1770 enable_irq(client->irq); in ati_trigger_store()
1775 if (!wait_for_completion_timeout(&iqs269->ati_done, in ati_trigger_store()
1777 return -ETIMEDOUT; in ati_trigger_store()
1817 iqs269 = devm_kzalloc(&client->dev, sizeof(*iqs269), GFP_KERNEL); in iqs269_probe()
1819 return -ENOMEM; in iqs269_probe()
1822 iqs269->client = client; in iqs269_probe()
1824 iqs269->regmap = devm_regmap_init_i2c(client, &iqs269_regmap_config); in iqs269_probe()
1825 if (IS_ERR(iqs269->regmap)) { in iqs269_probe()
1826 error = PTR_ERR(iqs269->regmap); in iqs269_probe()
1827 dev_err(&client->dev, "Failed to initialize register map: %d\n", in iqs269_probe()
1832 mutex_init(&iqs269->lock); in iqs269_probe()
1833 init_completion(&iqs269->ati_done); in iqs269_probe()
1835 iqs269->otp_option = (uintptr_t)device_get_match_data(&client->dev); in iqs269_probe()
1837 error = regmap_raw_read(iqs269->regmap, IQS269_VER_INFO, in iqs269_probe()
1838 &iqs269->ver_info, sizeof(iqs269->ver_info)); in iqs269_probe()
1842 if (iqs269->ver_info.prod_num != IQS269_VER_INFO_PROD_NUM) { in iqs269_probe()
1843 dev_err(&client->dev, "Unrecognized product number: 0x%02X\n", in iqs269_probe()
1844 iqs269->ver_info.prod_num); in iqs269_probe()
1845 return -EINVAL; in iqs269_probe()
1854 dev_err(&client->dev, "Failed to initialize device: %d\n", in iqs269_probe()
1863 error = devm_request_threaded_irq(&client->dev, client->irq, in iqs269_probe()
1865 client->name, iqs269); in iqs269_probe()
1867 dev_err(&client->dev, "Failed to request IRQ: %d\n", error); in iqs269_probe()
1871 if (!wait_for_completion_timeout(&iqs269->ati_done, in iqs269_probe()
1873 dev_err(&client->dev, "Failed to complete ATI\n"); in iqs269_probe()
1874 return -ETIMEDOUT; in iqs269_probe()
1881 error = input_register_device(iqs269->keypad); in iqs269_probe()
1883 dev_err(&client->dev, "Failed to register keypad: %d\n", error); in iqs269_probe()
1892 u16 general = be16_to_cpu(iqs269->sys_reg.general); in iqs269_general_get()
1903 struct i2c_client *client = iqs269->client; in iqs269_suspend()
1910 disable_irq(client->irq); in iqs269_suspend()
1912 error = regmap_write(iqs269->regmap, IQS269_SYS_SETTINGS, general); in iqs269_suspend()
1915 enable_irq(client->irq); in iqs269_suspend()
1923 struct i2c_client *client = iqs269->client; in iqs269_resume()
1930 disable_irq(client->irq); in iqs269_resume()
1932 error = regmap_write(iqs269->regmap, IQS269_SYS_SETTINGS, in iqs269_resume()
1935 error = regmap_write(iqs269->regmap, IQS269_SYS_SETTINGS, in iqs269_resume()
1939 enable_irq(client->irq); in iqs269_resume()
1952 .compatible = "azoteq,iqs269a-00",
1956 .compatible = "azoteq,iqs269a-d0",