Lines Matching +full:assoc +full:- +full:select
1 // SPDX-License-Identifier: GPL-2.0+
8 * inductive keys as well as Hall-effect switches, and one for a trackpad that
227 .name = "event-prox",
233 .name = "event-prox-alt",
240 .name = "event-touch",
246 .name = "event-touch-alt",
253 .name = "event-deep",
259 .name = "event-deep-alt",
367 .name = "ulp-0",
378 .name = "trackpad-3x2",
386 .name = "trackpad-3x3",
394 .name = "generic-0",
407 .name = "generic-1",
420 .name = "generic-2",
464 struct iqs626_sys_reg *sys_reg = &iqs626->sys_reg; in iqs626_parse_events()
465 struct i2c_client *client = iqs626->client; in iqs626_parse_events()
476 thresh = sys_reg->ch_reg_ulp.thresh; in iqs626_parse_events()
477 hyst = &sys_reg->ch_reg_ulp.hyst; in iqs626_parse_events()
482 thresh = &sys_reg->tp_grp_reg.ch_reg_tp[0].thresh; in iqs626_parse_events()
483 hyst = &sys_reg->tp_grp_reg.hyst; in iqs626_parse_events()
489 i = ch_id - IQS626_CH_GEN_0; in iqs626_parse_events()
490 thresh = sys_reg->ch_reg_gen[i].thresh; in iqs626_parse_events()
491 hyst = &sys_reg->ch_reg_gen[i].hyst; in iqs626_parse_events()
495 thresh = &sys_reg->ch_reg_hall.thresh; in iqs626_parse_events()
496 hyst = &sys_reg->ch_reg_hall.hyst; in iqs626_parse_events()
500 return -EINVAL; in iqs626_parse_events()
521 iqs626->kp_code[ch_id][i] = val; in iqs626_parse_events()
524 "linux,input-type", in iqs626_parse_events()
533 dev_err(&client->dev, in iqs626_parse_events()
536 return -EINVAL; in iqs626_parse_events()
539 iqs626->kp_type[ch_id][i] = val; in iqs626_parse_events()
541 sys_reg->event_mask &= ~iqs626_events[i].mask; in iqs626_parse_events()
547 dev_err(&client->dev, in iqs626_parse_events()
550 return -EINVAL; in iqs626_parse_events()
567 dev_err(&client->dev, in iqs626_parse_events()
570 return -EINVAL; in iqs626_parse_events()
587 dev_err(&client->dev, in iqs626_parse_events()
595 dev_err(&client->dev, in iqs626_parse_events()
598 return -EINVAL; in iqs626_parse_events()
601 sys_reg->tp_grp_reg.ch_reg_tp[j].thresh = thresh_tp[j]; in iqs626_parse_events()
613 struct iqs626_sys_reg *sys_reg = &iqs626->sys_reg; in iqs626_parse_ati_target()
614 struct i2c_client *client = iqs626->client; in iqs626_parse_ati_target()
623 ati_target = &sys_reg->ch_reg_ulp.ati_target; in iqs626_parse_ati_target()
628 ati_target = &sys_reg->tp_grp_reg.ati_target; in iqs626_parse_ati_target()
634 i = ch_id - IQS626_CH_GEN_0; in iqs626_parse_ati_target()
635 ati_target = &sys_reg->ch_reg_gen[i].ati_target; in iqs626_parse_ati_target()
639 ati_target = &sys_reg->ch_reg_hall.ati_target; in iqs626_parse_ati_target()
643 return -EINVAL; in iqs626_parse_ati_target()
646 if (!fwnode_property_read_u32(ch_node, "azoteq,ati-target", &val)) { in iqs626_parse_ati_target()
648 dev_err(&client->dev, in iqs626_parse_ati_target()
651 return -EINVAL; in iqs626_parse_ati_target()
659 !fwnode_property_read_u32(ch_node, "azoteq,ati-base", &val)) { in iqs626_parse_ati_target()
678 dev_err(&client->dev, in iqs626_parse_ati_target()
681 return -EINVAL; in iqs626_parse_ati_target()
690 if (!fwnode_property_present(ch_node, "azoteq,ati-base")) in iqs626_parse_ati_target()
693 error = fwnode_property_read_u32_array(ch_node, "azoteq,ati-base", in iqs626_parse_ati_target()
696 dev_err(&client->dev, in iqs626_parse_ati_target()
705 dev_err(&client->dev, in iqs626_parse_ati_target()
708 return -EINVAL; in iqs626_parse_ati_target()
711 ati_base[i] -= IQS626_TPx_ATI_BASE_MIN; in iqs626_parse_ati_target()
712 sys_reg->tp_grp_reg.ch_reg_tp[i].ati_base = ati_base[i]; in iqs626_parse_ati_target()
722 struct i2c_client *client = iqs626->client; in iqs626_parse_pins()
731 dev_err(&client->dev, in iqs626_parse_pins()
734 return -EINVAL; in iqs626_parse_pins()
736 dev_err(&client->dev, in iqs626_parse_pins()
744 dev_err(&client->dev, in iqs626_parse_pins()
754 dev_err(&client->dev, in iqs626_parse_pins()
757 return -EINVAL; in iqs626_parse_pins()
769 struct iqs626_sys_reg *sys_reg = &iqs626->sys_reg; in iqs626_parse_trackpad()
770 struct i2c_client *client = iqs626->client; in iqs626_parse_trackpad()
771 u8 *hyst = &sys_reg->tp_grp_reg.hyst; in iqs626_parse_trackpad()
775 if (!fwnode_property_read_u32(ch_node, "azoteq,lta-update", &val)) { in iqs626_parse_trackpad()
777 dev_err(&client->dev, in iqs626_parse_trackpad()
780 return -EINVAL; in iqs626_parse_trackpad()
783 sys_reg->misc_a &= ~IQS626_MISC_A_TPx_LTA_UPDATE_MASK; in iqs626_parse_trackpad()
784 sys_reg->misc_a |= (val << IQS626_MISC_A_TPx_LTA_UPDATE_SHIFT); in iqs626_parse_trackpad()
787 if (!fwnode_property_read_u32(ch_node, "azoteq,filt-str-trackpad", in iqs626_parse_trackpad()
790 dev_err(&client->dev, in iqs626_parse_trackpad()
793 return -EINVAL; in iqs626_parse_trackpad()
796 sys_reg->misc_b &= ~IQS626_MISC_B_FILT_STR_TPx; in iqs626_parse_trackpad()
797 sys_reg->misc_b |= val; in iqs626_parse_trackpad()
800 if (!fwnode_property_read_u32(ch_node, "azoteq,filt-str-np-cnt", in iqs626_parse_trackpad()
803 dev_err(&client->dev, in iqs626_parse_trackpad()
806 return -EINVAL; in iqs626_parse_trackpad()
813 if (!fwnode_property_read_u32(ch_node, "azoteq,filt-str-lp-cnt", in iqs626_parse_trackpad()
816 dev_err(&client->dev, in iqs626_parse_trackpad()
819 return -EINVAL; in iqs626_parse_trackpad()
831 dev_err(&client->dev, "Too many keycodes present\n"); in iqs626_parse_trackpad()
832 return -EINVAL; in iqs626_parse_trackpad()
834 dev_err(&client->dev, "Failed to count keycodes: %d\n", count); in iqs626_parse_trackpad()
839 iqs626->tp_code, count); in iqs626_parse_trackpad()
841 dev_err(&client->dev, "Failed to read keycodes: %d\n", error); in iqs626_parse_trackpad()
845 sys_reg->misc_b &= ~IQS626_MISC_B_TPx_SWIPE; in iqs626_parse_trackpad()
846 if (fwnode_property_present(ch_node, "azoteq,gesture-swipe")) in iqs626_parse_trackpad()
847 sys_reg->misc_b |= IQS626_MISC_B_TPx_SWIPE; in iqs626_parse_trackpad()
849 if (!fwnode_property_read_u32(ch_node, "azoteq,timeout-tap-ms", in iqs626_parse_trackpad()
852 dev_err(&client->dev, in iqs626_parse_trackpad()
855 return -EINVAL; in iqs626_parse_trackpad()
858 sys_reg->timeout_tap = val / 16; in iqs626_parse_trackpad()
861 if (!fwnode_property_read_u32(ch_node, "azoteq,timeout-swipe-ms", in iqs626_parse_trackpad()
864 dev_err(&client->dev, in iqs626_parse_trackpad()
867 return -EINVAL; in iqs626_parse_trackpad()
870 sys_reg->timeout_swipe = val / 16; in iqs626_parse_trackpad()
873 if (!fwnode_property_read_u32(ch_node, "azoteq,thresh-swipe", in iqs626_parse_trackpad()
876 dev_err(&client->dev, in iqs626_parse_trackpad()
879 return -EINVAL; in iqs626_parse_trackpad()
882 sys_reg->thresh_swipe = val; in iqs626_parse_trackpad()
885 sys_reg->event_mask &= ~IQS626_EVENT_MASK_GESTURE; in iqs626_parse_trackpad()
895 struct iqs626_sys_reg *sys_reg = &iqs626->sys_reg; in iqs626_parse_channel()
896 struct i2c_client *client = iqs626->client; in iqs626_parse_channel()
904 engine = sys_reg->ch_reg_ulp.engine; in iqs626_parse_channel()
909 engine = sys_reg->tp_grp_reg.engine; in iqs626_parse_channel()
915 i = ch_id - IQS626_CH_GEN_0; in iqs626_parse_channel()
916 engine = sys_reg->ch_reg_gen[i].engine; in iqs626_parse_channel()
920 engine = &sys_reg->ch_reg_hall.engine; in iqs626_parse_channel()
924 return -EINVAL; in iqs626_parse_channel()
928 if (fwnode_property_present(ch_node, "azoteq,meas-cap-decrease")) in iqs626_parse_channel()
932 if (!fwnode_property_read_u32(ch_node, "azoteq,rx-inactive", &val)) { in iqs626_parse_channel()
956 dev_err(&client->dev, in iqs626_parse_channel()
959 return -EINVAL; in iqs626_parse_channel()
968 if (fwnode_property_present(ch_node, "azoteq,dual-direction")) in iqs626_parse_channel()
972 if (fwnode_property_present(ch_node, "azoteq,filt-disable")) in iqs626_parse_channel()
975 if (!fwnode_property_read_u32(ch_node, "azoteq,ati-mode", &val)) { in iqs626_parse_channel()
977 dev_err(&client->dev, in iqs626_parse_channel()
980 return -EINVAL; in iqs626_parse_channel()
991 if (!fwnode_property_read_u32(ch_node, "azoteq,cct-increase", in iqs626_parse_channel()
993 unsigned int orig_val = val--; in iqs626_parse_channel()
1014 dev_err(&client->dev, in iqs626_parse_channel()
1017 return -EINVAL; in iqs626_parse_channel()
1031 if (!fwnode_property_read_u32(ch_node, "azoteq,proj-bias", &val)) { in iqs626_parse_channel()
1033 dev_err(&client->dev, in iqs626_parse_channel()
1036 return -EINVAL; in iqs626_parse_channel()
1043 if (!fwnode_property_read_u32(ch_node, "azoteq,sense-freq", &val)) { in iqs626_parse_channel()
1045 dev_err(&client->dev, in iqs626_parse_channel()
1048 return -EINVAL; in iqs626_parse_channel()
1056 if (fwnode_property_present(ch_node, "azoteq,ati-band-tighten")) in iqs626_parse_channel()
1063 sys_reg->ch_reg_ulp.hyst &= ~IQS626_ULP_PROJ_ENABLE; in iqs626_parse_channel()
1064 if (fwnode_property_present(ch_node, "azoteq,proj-enable")) in iqs626_parse_channel()
1065 sys_reg->ch_reg_ulp.hyst |= IQS626_ULP_PROJ_ENABLE; in iqs626_parse_channel()
1067 filter = &sys_reg->ch_reg_ulp.filter; in iqs626_parse_channel()
1069 rx_enable = &sys_reg->ch_reg_ulp.rx_enable; in iqs626_parse_channel()
1070 tx_enable = &sys_reg->ch_reg_ulp.tx_enable; in iqs626_parse_channel()
1072 i = ch_id - IQS626_CH_GEN_0; in iqs626_parse_channel()
1073 filter = &sys_reg->ch_reg_gen[i].filter; in iqs626_parse_channel()
1075 rx_enable = &sys_reg->ch_reg_gen[i].rx_enable; in iqs626_parse_channel()
1076 tx_enable = &sys_reg->ch_reg_gen[i].tx_enable; in iqs626_parse_channel()
1079 if (!fwnode_property_read_u32(ch_node, "azoteq,filt-str-np-cnt", in iqs626_parse_channel()
1082 dev_err(&client->dev, in iqs626_parse_channel()
1085 return -EINVAL; in iqs626_parse_channel()
1092 if (!fwnode_property_read_u32(ch_node, "azoteq,filt-str-lp-cnt", in iqs626_parse_channel()
1095 dev_err(&client->dev, in iqs626_parse_channel()
1098 return -EINVAL; in iqs626_parse_channel()
1105 if (!fwnode_property_read_u32(ch_node, "azoteq,filt-str-np-lta", in iqs626_parse_channel()
1108 dev_err(&client->dev, in iqs626_parse_channel()
1111 return -EINVAL; in iqs626_parse_channel()
1118 if (!fwnode_property_read_u32(ch_node, "azoteq,filt-str-lp-lta", in iqs626_parse_channel()
1121 dev_err(&client->dev, in iqs626_parse_channel()
1124 return -EINVAL; in iqs626_parse_channel()
1131 error = iqs626_parse_pins(iqs626, ch_node, "azoteq,rx-enable", in iqs626_parse_channel()
1136 error = iqs626_parse_pins(iqs626, ch_node, "azoteq,tx-enable", in iqs626_parse_channel()
1145 if (!fwnode_property_read_u32(ch_node, "azoteq,local-cap-size", in iqs626_parse_channel()
1147 unsigned int orig_val = val--; in iqs626_parse_channel()
1150 dev_err(&client->dev, in iqs626_parse_channel()
1153 return -EINVAL; in iqs626_parse_channel()
1162 if (!fwnode_property_read_u32(ch_node, "azoteq,sense-mode", &val)) { in iqs626_parse_channel()
1164 dev_err(&client->dev, in iqs626_parse_channel()
1167 return -EINVAL; in iqs626_parse_channel()
1174 if (!fwnode_property_read_u32(ch_node, "azoteq,tx-freq", &val)) { in iqs626_parse_channel()
1176 dev_err(&client->dev, in iqs626_parse_channel()
1179 return -EINVAL; in iqs626_parse_channel()
1187 if (fwnode_property_present(ch_node, "azoteq,invert-enable")) in iqs626_parse_channel()
1191 if (fwnode_property_present(ch_node, "azoteq,comp-disable")) in iqs626_parse_channel()
1195 if (fwnode_property_present(ch_node, "azoteq,static-enable")) in iqs626_parse_channel()
1198 i = ch_id - IQS626_CH_GEN_0; in iqs626_parse_channel()
1199 assoc_select = &sys_reg->ch_reg_gen[i].assoc_select; in iqs626_parse_channel()
1200 assoc_weight = &sys_reg->ch_reg_gen[i].assoc_weight; in iqs626_parse_channel()
1203 if (!fwnode_property_present(ch_node, "azoteq,assoc-select")) in iqs626_parse_channel()
1207 if (fwnode_property_match_string(ch_node, "azoteq,assoc-select", in iqs626_parse_channel()
1214 if (fwnode_property_read_u32(ch_node, "azoteq,assoc-weight", &val)) in iqs626_parse_channel()
1218 dev_err(&client->dev, in iqs626_parse_channel()
1221 return -EINVAL; in iqs626_parse_channel()
1231 struct iqs626_sys_reg *sys_reg = &iqs626->sys_reg; in iqs626_parse_prop()
1232 struct i2c_client *client = iqs626->client; in iqs626_parse_prop()
1238 if (!device_property_read_u32(&client->dev, "azoteq,suspend-mode", in iqs626_parse_prop()
1241 dev_err(&client->dev, "Invalid suspend mode: %u\n", in iqs626_parse_prop()
1243 return -EINVAL; in iqs626_parse_prop()
1246 iqs626->suspend_mode = val; in iqs626_parse_prop()
1249 error = regmap_raw_read(iqs626->regmap, IQS626_SYS_SETTINGS, sys_reg, in iqs626_parse_prop()
1254 general = be16_to_cpu(sys_reg->general); in iqs626_parse_prop()
1257 if (device_property_present(&client->dev, "azoteq,clk-div")) in iqs626_parse_prop()
1260 if (device_property_present(&client->dev, "azoteq,ulp-enable")) in iqs626_parse_prop()
1263 if (!device_property_read_u32(&client->dev, "azoteq,ulp-update", in iqs626_parse_prop()
1266 dev_err(&client->dev, "Invalid update rate: %u\n", val); in iqs626_parse_prop()
1267 return -EINVAL; in iqs626_parse_prop()
1274 sys_reg->misc_a &= ~IQS626_MISC_A_ATI_BAND_DISABLE; in iqs626_parse_prop()
1275 if (device_property_present(&client->dev, "azoteq,ati-band-disable")) in iqs626_parse_prop()
1276 sys_reg->misc_a |= IQS626_MISC_A_ATI_BAND_DISABLE; in iqs626_parse_prop()
1278 sys_reg->misc_a &= ~IQS626_MISC_A_ATI_LP_ONLY; in iqs626_parse_prop()
1279 if (device_property_present(&client->dev, "azoteq,ati-lp-only")) in iqs626_parse_prop()
1280 sys_reg->misc_a |= IQS626_MISC_A_ATI_LP_ONLY; in iqs626_parse_prop()
1282 if (!device_property_read_u32(&client->dev, "azoteq,gpio3-select", in iqs626_parse_prop()
1285 dev_err(&client->dev, "Invalid GPIO3 selection: %u\n", in iqs626_parse_prop()
1287 return -EINVAL; in iqs626_parse_prop()
1290 sys_reg->misc_a &= ~IQS626_MISC_A_GPIO3_SELECT_MASK; in iqs626_parse_prop()
1291 sys_reg->misc_a |= val; in iqs626_parse_prop()
1294 if (!device_property_read_u32(&client->dev, "azoteq,reseed-select", in iqs626_parse_prop()
1297 dev_err(&client->dev, "Invalid reseed selection: %u\n", in iqs626_parse_prop()
1299 return -EINVAL; in iqs626_parse_prop()
1302 sys_reg->misc_b &= ~IQS626_MISC_B_RESEED_UI_SEL_MASK; in iqs626_parse_prop()
1303 sys_reg->misc_b |= (val << IQS626_MISC_B_RESEED_UI_SEL_SHIFT); in iqs626_parse_prop()
1306 sys_reg->misc_b &= ~IQS626_MISC_B_THRESH_EXTEND; in iqs626_parse_prop()
1307 if (device_property_present(&client->dev, "azoteq,thresh-extend")) in iqs626_parse_prop()
1308 sys_reg->misc_b |= IQS626_MISC_B_THRESH_EXTEND; in iqs626_parse_prop()
1310 sys_reg->misc_b &= ~IQS626_MISC_B_TRACKING_UI_ENABLE; in iqs626_parse_prop()
1311 if (device_property_present(&client->dev, "azoteq,tracking-enable")) in iqs626_parse_prop()
1312 sys_reg->misc_b |= IQS626_MISC_B_TRACKING_UI_ENABLE; in iqs626_parse_prop()
1314 sys_reg->misc_b &= ~IQS626_MISC_B_RESEED_OFFSET; in iqs626_parse_prop()
1315 if (device_property_present(&client->dev, "azoteq,reseed-offset")) in iqs626_parse_prop()
1316 sys_reg->misc_b |= IQS626_MISC_B_RESEED_OFFSET; in iqs626_parse_prop()
1318 if (!device_property_read_u32(&client->dev, "azoteq,rate-np-ms", in iqs626_parse_prop()
1321 dev_err(&client->dev, "Invalid report rate: %u\n", val); in iqs626_parse_prop()
1322 return -EINVAL; in iqs626_parse_prop()
1325 sys_reg->rate_np = val; in iqs626_parse_prop()
1328 if (!device_property_read_u32(&client->dev, "azoteq,rate-lp-ms", in iqs626_parse_prop()
1331 dev_err(&client->dev, "Invalid report rate: %u\n", val); in iqs626_parse_prop()
1332 return -EINVAL; in iqs626_parse_prop()
1335 sys_reg->rate_lp = val; in iqs626_parse_prop()
1338 if (!device_property_read_u32(&client->dev, "azoteq,rate-ulp-ms", in iqs626_parse_prop()
1341 dev_err(&client->dev, "Invalid report rate: %u\n", val); in iqs626_parse_prop()
1342 return -EINVAL; in iqs626_parse_prop()
1345 sys_reg->rate_ulp = val / 16; in iqs626_parse_prop()
1348 if (!device_property_read_u32(&client->dev, "azoteq,timeout-pwr-ms", in iqs626_parse_prop()
1351 dev_err(&client->dev, "Invalid timeout: %u\n", val); in iqs626_parse_prop()
1352 return -EINVAL; in iqs626_parse_prop()
1355 sys_reg->timeout_pwr = val / 512; in iqs626_parse_prop()
1358 if (!device_property_read_u32(&client->dev, "azoteq,timeout-lta-ms", in iqs626_parse_prop()
1361 dev_err(&client->dev, "Invalid timeout: %u\n", val); in iqs626_parse_prop()
1362 return -EINVAL; in iqs626_parse_prop()
1365 sys_reg->timeout_lta = val / 512; in iqs626_parse_prop()
1368 sys_reg->event_mask = ~((u8)IQS626_EVENT_MASK_SYS); in iqs626_parse_prop()
1369 sys_reg->redo_ati = 0; in iqs626_parse_prop()
1371 sys_reg->reseed = 0; in iqs626_parse_prop()
1372 sys_reg->active = 0; in iqs626_parse_prop()
1375 ch_node = device_get_named_child_node(&client->dev, in iqs626_parse_prop()
1392 if (!fwnode_property_present(ch_node, "azoteq,ati-exclude")) in iqs626_parse_prop()
1393 sys_reg->redo_ati |= iqs626_channels[i].active; in iqs626_parse_prop()
1395 if (!fwnode_property_present(ch_node, "azoteq,reseed-disable")) in iqs626_parse_prop()
1396 sys_reg->reseed |= iqs626_channels[i].active; in iqs626_parse_prop()
1398 sys_reg->active |= iqs626_channels[i].active; in iqs626_parse_prop()
1404 * Enable streaming during normal-power mode if the trackpad is used to in iqs626_parse_prop()
1406 * returns to event mode during low-power mode. in iqs626_parse_prop()
1408 if (sys_reg->active & iqs626_channels[IQS626_CH_TP_2].active && in iqs626_parse_prop()
1409 sys_reg->event_mask & IQS626_EVENT_MASK_GESTURE) in iqs626_parse_prop()
1415 sys_reg->general = cpu_to_be16(general); in iqs626_parse_prop()
1417 error = regmap_raw_write(iqs626->regmap, IQS626_SYS_SETTINGS, in iqs626_parse_prop()
1418 &iqs626->sys_reg, sizeof(iqs626->sys_reg)); in iqs626_parse_prop()
1429 struct iqs626_sys_reg *sys_reg = &iqs626->sys_reg; in iqs626_input_init()
1430 struct i2c_client *client = iqs626->client; in iqs626_input_init()
1433 iqs626->keypad = devm_input_allocate_device(&client->dev); in iqs626_input_init()
1434 if (!iqs626->keypad) in iqs626_input_init()
1435 return -ENOMEM; in iqs626_input_init()
1437 iqs626->keypad->keycodemax = ARRAY_SIZE(iqs626->kp_code); in iqs626_input_init()
1438 iqs626->keypad->keycode = iqs626->kp_code; in iqs626_input_init()
1439 iqs626->keypad->keycodesize = sizeof(**iqs626->kp_code); in iqs626_input_init()
1441 iqs626->keypad->name = "iqs626a_keypad"; in iqs626_input_init()
1442 iqs626->keypad->id.bustype = BUS_I2C; in iqs626_input_init()
1445 if (!(sys_reg->active & iqs626_channels[i].active)) in iqs626_input_init()
1449 if (!iqs626->kp_type[i][j]) in iqs626_input_init()
1452 input_set_capability(iqs626->keypad, in iqs626_input_init()
1453 iqs626->kp_type[i][j], in iqs626_input_init()
1454 iqs626->kp_code[i][j]); in iqs626_input_init()
1458 if (!(sys_reg->active & iqs626_channels[IQS626_CH_TP_2].active)) in iqs626_input_init()
1461 iqs626->trackpad = devm_input_allocate_device(&client->dev); in iqs626_input_init()
1462 if (!iqs626->trackpad) in iqs626_input_init()
1463 return -ENOMEM; in iqs626_input_init()
1465 iqs626->trackpad->keycodemax = ARRAY_SIZE(iqs626->tp_code); in iqs626_input_init()
1466 iqs626->trackpad->keycode = iqs626->tp_code; in iqs626_input_init()
1467 iqs626->trackpad->keycodesize = sizeof(*iqs626->tp_code); in iqs626_input_init()
1469 iqs626->trackpad->name = "iqs626a_trackpad"; in iqs626_input_init()
1470 iqs626->trackpad->id.bustype = BUS_I2C; in iqs626_input_init()
1476 if (sys_reg->event_mask & IQS626_EVENT_MASK_GESTURE) { in iqs626_input_init()
1479 input_set_capability(iqs626->trackpad, EV_KEY, BTN_TOUCH); in iqs626_input_init()
1480 input_set_abs_params(iqs626->trackpad, ABS_Y, 0, 255, 0, 0); in iqs626_input_init()
1482 if ((sys_reg->active & tp_mask) == tp_mask) in iqs626_input_init()
1483 input_set_abs_params(iqs626->trackpad, in iqs626_input_init()
1486 input_set_abs_params(iqs626->trackpad, in iqs626_input_init()
1489 touchscreen_parse_properties(iqs626->trackpad, false, in iqs626_input_init()
1490 &iqs626->prop); in iqs626_input_init()
1493 if (iqs626->tp_code[i] != KEY_RESERVED) in iqs626_input_init()
1494 input_set_capability(iqs626->trackpad, EV_KEY, in iqs626_input_init()
1495 iqs626->tp_code[i]); in iqs626_input_init()
1498 error = input_register_device(iqs626->trackpad); in iqs626_input_init()
1500 dev_err(&client->dev, "Failed to register trackpad: %d\n", in iqs626_input_init()
1508 struct iqs626_sys_reg *sys_reg = &iqs626->sys_reg; in iqs626_report()
1509 struct i2c_client *client = iqs626->client; in iqs626_report()
1516 error = regmap_raw_read(iqs626->regmap, IQS626_SYS_FLAGS, &flags, in iqs626_report()
1519 dev_err(&client->dev, "Failed to read device status: %d\n", in iqs626_report()
1530 dev_err(&client->dev, "Unexpected device reset\n"); in iqs626_report()
1532 error = regmap_raw_write(iqs626->regmap, IQS626_SYS_SETTINGS, in iqs626_report()
1535 dev_err(&client->dev, in iqs626_report()
1536 "Failed to re-initialize device: %d\n", error); in iqs626_report()
1549 if (sys_reg->active & iqs626_channels[IQS626_CH_HALL].active) { in iqs626_report()
1550 error = regmap_raw_read(iqs626->regmap, IQS626_HALL_OUTPUT, in iqs626_report()
1553 dev_err(&client->dev, in iqs626_report()
1564 if (!(sys_reg->active & iqs626_channels[i].active)) in iqs626_report()
1568 if (!iqs626->kp_type[i][j]) in iqs626_report()
1576 input_event(iqs626->keypad, iqs626->kp_type[i][j], in iqs626_report()
1577 iqs626->kp_code[i][j], !!state); in iqs626_report()
1581 input_sync(iqs626->keypad); in iqs626_report()
1587 complete_all(&iqs626->ati_done); in iqs626_report()
1589 if (!(sys_reg->active & iqs626_channels[IQS626_CH_TP_2].active)) in iqs626_report()
1592 if (sys_reg->event_mask & IQS626_EVENT_MASK_GESTURE) { in iqs626_report()
1596 input_report_key(iqs626->trackpad, BTN_TOUCH, state); in iqs626_report()
1599 touchscreen_report_pos(iqs626->trackpad, &iqs626->prop, in iqs626_report()
1604 input_report_key(iqs626->trackpad, iqs626->tp_code[i], in iqs626_report()
1608 input_sync(iqs626->trackpad); in iqs626_report()
1615 input_report_key(iqs626->trackpad, in iqs626_report()
1616 iqs626->tp_code[i], 0); in iqs626_report()
1620 input_sync(iqs626->trackpad); in iqs626_report()
1654 iqs626 = devm_kzalloc(&client->dev, sizeof(*iqs626), GFP_KERNEL); in iqs626_probe()
1656 return -ENOMEM; in iqs626_probe()
1659 iqs626->client = client; in iqs626_probe()
1661 iqs626->regmap = devm_regmap_init_i2c(client, &iqs626_regmap_config); in iqs626_probe()
1662 if (IS_ERR(iqs626->regmap)) { in iqs626_probe()
1663 error = PTR_ERR(iqs626->regmap); in iqs626_probe()
1664 dev_err(&client->dev, "Failed to initialize register map: %d\n", in iqs626_probe()
1669 init_completion(&iqs626->ati_done); in iqs626_probe()
1671 error = regmap_raw_read(iqs626->regmap, IQS626_VER_INFO, &ver_info, in iqs626_probe()
1677 dev_err(&client->dev, "Unrecognized product number: 0x%02X\n", in iqs626_probe()
1679 return -EINVAL; in iqs626_probe()
1690 error = devm_request_threaded_irq(&client->dev, client->irq, in iqs626_probe()
1692 client->name, iqs626); in iqs626_probe()
1694 dev_err(&client->dev, "Failed to request IRQ: %d\n", error); in iqs626_probe()
1698 if (!wait_for_completion_timeout(&iqs626->ati_done, in iqs626_probe()
1700 dev_err(&client->dev, "Failed to complete ATI\n"); in iqs626_probe()
1701 return -ETIMEDOUT; in iqs626_probe()
1708 error = input_register_device(iqs626->keypad); in iqs626_probe()
1710 dev_err(&client->dev, "Failed to register keypad: %d\n", error); in iqs626_probe()
1718 struct i2c_client *client = iqs626->client; in iqs626_suspend()
1722 if (!iqs626->suspend_mode) in iqs626_suspend()
1725 disable_irq(client->irq); in iqs626_suspend()
1730 * transition into normal-power mode. in iqs626_suspend()
1732 error = regmap_update_bits(iqs626->regmap, IQS626_SYS_SETTINGS, in iqs626_suspend()
1739 * into normal-power mode before a manual mode switch is performed. in iqs626_suspend()
1741 error = regmap_read_poll_timeout(iqs626->regmap, IQS626_SYS_FLAGS, val, in iqs626_suspend()
1748 error = regmap_update_bits(iqs626->regmap, IQS626_SYS_SETTINGS, in iqs626_suspend()
1750 iqs626->suspend_mode << in iqs626_suspend()
1760 error = regmap_read_poll_timeout(iqs626->regmap, IQS626_SYS_FLAGS, val, in iqs626_suspend()
1762 == (iqs626->suspend_mode << in iqs626_suspend()
1769 enable_irq(client->irq); in iqs626_suspend()
1777 struct i2c_client *client = iqs626->client; in iqs626_resume()
1781 if (!iqs626->suspend_mode) in iqs626_resume()
1784 disable_irq(client->irq); in iqs626_resume()
1786 error = regmap_update_bits(iqs626->regmap, IQS626_SYS_SETTINGS, in iqs626_resume()
1792 * This check ensures the device has returned to normal-power mode in iqs626_resume()
1793 * before automatic power mode switching is re-enabled. in iqs626_resume()
1795 error = regmap_read_poll_timeout(iqs626->regmap, IQS626_SYS_FLAGS, val, in iqs626_resume()
1802 error = regmap_update_bits(iqs626->regmap, IQS626_SYS_SETTINGS, in iqs626_resume()
1816 enable_irq(client->irq); in iqs626_resume()