Lines Matching +full:ati +full:- +full:target
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",
463 struct iqs626_sys_reg *sys_reg = &iqs626->sys_reg; in iqs626_parse_events()
464 struct i2c_client *client = iqs626->client; in iqs626_parse_events()
473 thresh = sys_reg->ch_reg_ulp.thresh; in iqs626_parse_events()
474 hyst = &sys_reg->ch_reg_ulp.hyst; in iqs626_parse_events()
479 thresh = &sys_reg->tp_grp_reg.ch_reg_tp[0].thresh; in iqs626_parse_events()
480 hyst = &sys_reg->tp_grp_reg.hyst; in iqs626_parse_events()
486 i = ch_id - IQS626_CH_GEN_0; in iqs626_parse_events()
487 thresh = sys_reg->ch_reg_gen[i].thresh; in iqs626_parse_events()
488 hyst = &sys_reg->ch_reg_gen[i].hyst; in iqs626_parse_events()
492 thresh = &sys_reg->ch_reg_hall.thresh; in iqs626_parse_events()
493 hyst = &sys_reg->ch_reg_hall.hyst; in iqs626_parse_events()
497 return -EINVAL; in iqs626_parse_events()
518 iqs626->kp_code[ch_id][i] = val; in iqs626_parse_events()
521 "linux,input-type", in iqs626_parse_events()
530 dev_err(&client->dev, in iqs626_parse_events()
534 return -EINVAL; in iqs626_parse_events()
537 iqs626->kp_type[ch_id][i] = val; in iqs626_parse_events()
539 sys_reg->event_mask &= ~iqs626_events[i].mask; in iqs626_parse_events()
545 dev_err(&client->dev, in iqs626_parse_events()
549 return -EINVAL; in iqs626_parse_events()
566 dev_err(&client->dev, in iqs626_parse_events()
570 return -EINVAL; in iqs626_parse_events()
589 struct iqs626_sys_reg *sys_reg = &iqs626->sys_reg; in iqs626_parse_ati_target()
590 struct i2c_client *client = iqs626->client; in iqs626_parse_ati_target()
597 ati_target = &sys_reg->ch_reg_ulp.ati_target; in iqs626_parse_ati_target()
602 ati_target = &sys_reg->tp_grp_reg.ati_target; in iqs626_parse_ati_target()
608 i = ch_id - IQS626_CH_GEN_0; in iqs626_parse_ati_target()
609 ati_target = &sys_reg->ch_reg_gen[i].ati_target; in iqs626_parse_ati_target()
613 ati_target = &sys_reg->ch_reg_hall.ati_target; in iqs626_parse_ati_target()
617 return -EINVAL; in iqs626_parse_ati_target()
620 if (!fwnode_property_read_u32(ch_node, "azoteq,ati-target", &val)) { in iqs626_parse_ati_target()
622 dev_err(&client->dev, in iqs626_parse_ati_target()
623 "Invalid %s channel ATI target: %u\n", in iqs626_parse_ati_target()
625 return -EINVAL; in iqs626_parse_ati_target()
633 !fwnode_property_read_u32(ch_node, "azoteq,ati-base", &val)) { in iqs626_parse_ati_target()
652 dev_err(&client->dev, in iqs626_parse_ati_target()
653 "Invalid %s channel ATI base: %u\n", in iqs626_parse_ati_target()
655 return -EINVAL; in iqs626_parse_ati_target()
669 struct i2c_client *client = iqs626->client; in iqs626_parse_pins()
678 dev_err(&client->dev, in iqs626_parse_pins()
681 return -EINVAL; in iqs626_parse_pins()
683 dev_err(&client->dev, in iqs626_parse_pins()
691 dev_err(&client->dev, in iqs626_parse_pins()
701 dev_err(&client->dev, in iqs626_parse_pins()
704 return -EINVAL; in iqs626_parse_pins()
717 struct iqs626_sys_reg *sys_reg = &iqs626->sys_reg; in iqs626_parse_trackpad()
718 struct i2c_client *client = iqs626->client; in iqs626_parse_trackpad()
719 u8 *hyst = &sys_reg->tp_grp_reg.hyst; in iqs626_parse_trackpad()
723 if (!fwnode_property_read_u32(ch_node, "azoteq,lta-update", &val)) { in iqs626_parse_trackpad()
725 dev_err(&client->dev, in iqs626_parse_trackpad()
728 return -EINVAL; in iqs626_parse_trackpad()
731 sys_reg->misc_a &= ~IQS626_MISC_A_TPx_LTA_UPDATE_MASK; in iqs626_parse_trackpad()
732 sys_reg->misc_a |= (val << IQS626_MISC_A_TPx_LTA_UPDATE_SHIFT); in iqs626_parse_trackpad()
735 if (!fwnode_property_read_u32(ch_node, "azoteq,filt-str-trackpad", in iqs626_parse_trackpad()
738 dev_err(&client->dev, in iqs626_parse_trackpad()
741 return -EINVAL; in iqs626_parse_trackpad()
744 sys_reg->misc_b &= ~IQS626_MISC_B_FILT_STR_TPx; in iqs626_parse_trackpad()
745 sys_reg->misc_b |= val; in iqs626_parse_trackpad()
748 if (!fwnode_property_read_u32(ch_node, "azoteq,filt-str-np-cnt", in iqs626_parse_trackpad()
751 dev_err(&client->dev, in iqs626_parse_trackpad()
754 return -EINVAL; in iqs626_parse_trackpad()
761 if (!fwnode_property_read_u32(ch_node, "azoteq,filt-str-lp-cnt", in iqs626_parse_trackpad()
764 dev_err(&client->dev, in iqs626_parse_trackpad()
767 return -EINVAL; in iqs626_parse_trackpad()
775 u8 *ati_base = &sys_reg->tp_grp_reg.ch_reg_tp[i].ati_base; in iqs626_parse_trackpad()
776 u8 *thresh = &sys_reg->tp_grp_reg.ch_reg_tp[i].thresh; in iqs626_parse_trackpad()
780 snprintf(tc_name, sizeof(tc_name), "channel-%d", i); in iqs626_parse_trackpad()
786 if (!fwnode_property_read_u32(tc_node, "azoteq,ati-base", in iqs626_parse_trackpad()
790 dev_err(&client->dev, in iqs626_parse_trackpad()
791 "Invalid %s %s ATI base: %u\n", in iqs626_parse_trackpad()
794 return -EINVAL; in iqs626_parse_trackpad()
797 *ati_base = val - IQS626_TPx_ATI_BASE_MIN; in iqs626_parse_trackpad()
803 dev_err(&client->dev, in iqs626_parse_trackpad()
807 return -EINVAL; in iqs626_parse_trackpad()
821 dev_err(&client->dev, "Too many keycodes present\n"); in iqs626_parse_trackpad()
822 return -EINVAL; in iqs626_parse_trackpad()
824 dev_err(&client->dev, "Failed to count keycodes: %d\n", count); in iqs626_parse_trackpad()
829 iqs626->tp_code, count); in iqs626_parse_trackpad()
831 dev_err(&client->dev, "Failed to read keycodes: %d\n", error); in iqs626_parse_trackpad()
835 sys_reg->misc_b &= ~IQS626_MISC_B_TPx_SWIPE; in iqs626_parse_trackpad()
836 if (fwnode_property_present(ch_node, "azoteq,gesture-swipe")) in iqs626_parse_trackpad()
837 sys_reg->misc_b |= IQS626_MISC_B_TPx_SWIPE; in iqs626_parse_trackpad()
839 if (!fwnode_property_read_u32(ch_node, "azoteq,timeout-tap-ms", in iqs626_parse_trackpad()
842 dev_err(&client->dev, in iqs626_parse_trackpad()
845 return -EINVAL; in iqs626_parse_trackpad()
848 sys_reg->timeout_tap = val / 16; in iqs626_parse_trackpad()
851 if (!fwnode_property_read_u32(ch_node, "azoteq,timeout-swipe-ms", in iqs626_parse_trackpad()
854 dev_err(&client->dev, in iqs626_parse_trackpad()
857 return -EINVAL; in iqs626_parse_trackpad()
860 sys_reg->timeout_swipe = val / 16; in iqs626_parse_trackpad()
863 if (!fwnode_property_read_u32(ch_node, "azoteq,thresh-swipe", in iqs626_parse_trackpad()
866 dev_err(&client->dev, in iqs626_parse_trackpad()
869 return -EINVAL; in iqs626_parse_trackpad()
872 sys_reg->thresh_swipe = val; in iqs626_parse_trackpad()
875 sys_reg->event_mask &= ~IQS626_EVENT_MASK_GESTURE; in iqs626_parse_trackpad()
884 struct iqs626_sys_reg *sys_reg = &iqs626->sys_reg; in iqs626_parse_channel()
885 struct i2c_client *client = iqs626->client; in iqs626_parse_channel()
893 engine = sys_reg->ch_reg_ulp.engine; in iqs626_parse_channel()
898 engine = sys_reg->tp_grp_reg.engine; in iqs626_parse_channel()
904 i = ch_id - IQS626_CH_GEN_0; in iqs626_parse_channel()
905 engine = sys_reg->ch_reg_gen[i].engine; in iqs626_parse_channel()
909 engine = &sys_reg->ch_reg_hall.engine; in iqs626_parse_channel()
913 return -EINVAL; in iqs626_parse_channel()
924 if (!fwnode_property_present(ch_node, "azoteq,ati-exclude")) in iqs626_parse_channel()
925 sys_reg->redo_ati |= iqs626_channels[ch_id].active; in iqs626_parse_channel()
927 if (!fwnode_property_present(ch_node, "azoteq,reseed-disable")) in iqs626_parse_channel()
928 sys_reg->reseed |= iqs626_channels[ch_id].active; in iqs626_parse_channel()
931 if (fwnode_property_present(ch_node, "azoteq,meas-cap-decrease")) in iqs626_parse_channel()
935 if (!fwnode_property_read_u32(ch_node, "azoteq,rx-inactive", &val)) { in iqs626_parse_channel()
959 dev_err(&client->dev, in iqs626_parse_channel()
962 return -EINVAL; in iqs626_parse_channel()
971 if (fwnode_property_present(ch_node, "azoteq,dual-direction")) in iqs626_parse_channel()
975 if (fwnode_property_present(ch_node, "azoteq,filt-disable")) in iqs626_parse_channel()
978 if (!fwnode_property_read_u32(ch_node, "azoteq,ati-mode", &val)) { in iqs626_parse_channel()
980 dev_err(&client->dev, in iqs626_parse_channel()
981 "Invalid %s channel ATI mode: %u\n", in iqs626_parse_channel()
983 return -EINVAL; in iqs626_parse_channel()
994 if (!fwnode_property_read_u32(ch_node, "azoteq,cct-increase", in iqs626_parse_channel()
996 unsigned int orig_val = val--; in iqs626_parse_channel()
1017 dev_err(&client->dev, in iqs626_parse_channel()
1020 return -EINVAL; in iqs626_parse_channel()
1034 if (!fwnode_property_read_u32(ch_node, "azoteq,proj-bias", &val)) { in iqs626_parse_channel()
1036 dev_err(&client->dev, in iqs626_parse_channel()
1039 return -EINVAL; in iqs626_parse_channel()
1046 if (!fwnode_property_read_u32(ch_node, "azoteq,sense-freq", &val)) { in iqs626_parse_channel()
1048 dev_err(&client->dev, in iqs626_parse_channel()
1051 return -EINVAL; in iqs626_parse_channel()
1059 if (fwnode_property_present(ch_node, "azoteq,ati-band-tighten")) in iqs626_parse_channel()
1066 sys_reg->ch_reg_ulp.hyst &= ~IQS626_ULP_PROJ_ENABLE; in iqs626_parse_channel()
1067 if (fwnode_property_present(ch_node, "azoteq,proj-enable")) in iqs626_parse_channel()
1068 sys_reg->ch_reg_ulp.hyst |= IQS626_ULP_PROJ_ENABLE; in iqs626_parse_channel()
1070 filter = &sys_reg->ch_reg_ulp.filter; in iqs626_parse_channel()
1072 rx_enable = &sys_reg->ch_reg_ulp.rx_enable; in iqs626_parse_channel()
1073 tx_enable = &sys_reg->ch_reg_ulp.tx_enable; in iqs626_parse_channel()
1075 i = ch_id - IQS626_CH_GEN_0; in iqs626_parse_channel()
1076 filter = &sys_reg->ch_reg_gen[i].filter; in iqs626_parse_channel()
1078 rx_enable = &sys_reg->ch_reg_gen[i].rx_enable; in iqs626_parse_channel()
1079 tx_enable = &sys_reg->ch_reg_gen[i].tx_enable; in iqs626_parse_channel()
1082 if (!fwnode_property_read_u32(ch_node, "azoteq,filt-str-np-cnt", in iqs626_parse_channel()
1085 dev_err(&client->dev, in iqs626_parse_channel()
1088 return -EINVAL; in iqs626_parse_channel()
1095 if (!fwnode_property_read_u32(ch_node, "azoteq,filt-str-lp-cnt", in iqs626_parse_channel()
1098 dev_err(&client->dev, in iqs626_parse_channel()
1101 return -EINVAL; in iqs626_parse_channel()
1108 if (!fwnode_property_read_u32(ch_node, "azoteq,filt-str-np-lta", in iqs626_parse_channel()
1111 dev_err(&client->dev, in iqs626_parse_channel()
1114 return -EINVAL; in iqs626_parse_channel()
1121 if (!fwnode_property_read_u32(ch_node, "azoteq,filt-str-lp-lta", in iqs626_parse_channel()
1124 dev_err(&client->dev, in iqs626_parse_channel()
1127 return -EINVAL; in iqs626_parse_channel()
1134 error = iqs626_parse_pins(iqs626, ch_node, "azoteq,rx-enable", in iqs626_parse_channel()
1139 error = iqs626_parse_pins(iqs626, ch_node, "azoteq,tx-enable", in iqs626_parse_channel()
1148 if (!fwnode_property_read_u32(ch_node, "azoteq,local-cap-size", in iqs626_parse_channel()
1150 unsigned int orig_val = val--; in iqs626_parse_channel()
1153 dev_err(&client->dev, in iqs626_parse_channel()
1156 return -EINVAL; in iqs626_parse_channel()
1165 if (!fwnode_property_read_u32(ch_node, "azoteq,sense-mode", &val)) { in iqs626_parse_channel()
1167 dev_err(&client->dev, in iqs626_parse_channel()
1170 return -EINVAL; in iqs626_parse_channel()
1177 if (!fwnode_property_read_u32(ch_node, "azoteq,tx-freq", &val)) { in iqs626_parse_channel()
1179 dev_err(&client->dev, in iqs626_parse_channel()
1182 return -EINVAL; in iqs626_parse_channel()
1190 if (fwnode_property_present(ch_node, "azoteq,invert-enable")) in iqs626_parse_channel()
1194 if (fwnode_property_present(ch_node, "azoteq,comp-disable")) in iqs626_parse_channel()
1198 if (fwnode_property_present(ch_node, "azoteq,static-enable")) in iqs626_parse_channel()
1201 i = ch_id - IQS626_CH_GEN_0; in iqs626_parse_channel()
1202 assoc_select = &sys_reg->ch_reg_gen[i].assoc_select; in iqs626_parse_channel()
1203 assoc_weight = &sys_reg->ch_reg_gen[i].assoc_weight; in iqs626_parse_channel()
1206 if (!fwnode_property_present(ch_node, "azoteq,assoc-select")) in iqs626_parse_channel()
1210 if (fwnode_property_match_string(ch_node, "azoteq,assoc-select", in iqs626_parse_channel()
1217 if (fwnode_property_read_u32(ch_node, "azoteq,assoc-weight", &val)) in iqs626_parse_channel()
1221 dev_err(&client->dev, in iqs626_parse_channel()
1224 return -EINVAL; in iqs626_parse_channel()
1234 struct iqs626_sys_reg *sys_reg = &iqs626->sys_reg; in iqs626_parse_prop()
1235 struct i2c_client *client = iqs626->client; in iqs626_parse_prop()
1241 if (!device_property_read_u32(&client->dev, "azoteq,suspend-mode", in iqs626_parse_prop()
1244 dev_err(&client->dev, "Invalid suspend mode: %u\n", in iqs626_parse_prop()
1246 return -EINVAL; in iqs626_parse_prop()
1249 iqs626->suspend_mode = val; in iqs626_parse_prop()
1252 error = regmap_raw_read(iqs626->regmap, IQS626_SYS_SETTINGS, sys_reg, in iqs626_parse_prop()
1257 general = be16_to_cpu(sys_reg->general); in iqs626_parse_prop()
1260 if (device_property_present(&client->dev, "azoteq,clk-div")) in iqs626_parse_prop()
1263 if (device_property_present(&client->dev, "azoteq,ulp-enable")) in iqs626_parse_prop()
1266 if (!device_property_read_u32(&client->dev, "azoteq,ulp-update", in iqs626_parse_prop()
1269 dev_err(&client->dev, "Invalid update rate: %u\n", val); in iqs626_parse_prop()
1270 return -EINVAL; in iqs626_parse_prop()
1277 sys_reg->misc_a &= ~IQS626_MISC_A_ATI_BAND_DISABLE; in iqs626_parse_prop()
1278 if (device_property_present(&client->dev, "azoteq,ati-band-disable")) in iqs626_parse_prop()
1279 sys_reg->misc_a |= IQS626_MISC_A_ATI_BAND_DISABLE; in iqs626_parse_prop()
1281 sys_reg->misc_a &= ~IQS626_MISC_A_ATI_LP_ONLY; in iqs626_parse_prop()
1282 if (device_property_present(&client->dev, "azoteq,ati-lp-only")) in iqs626_parse_prop()
1283 sys_reg->misc_a |= IQS626_MISC_A_ATI_LP_ONLY; in iqs626_parse_prop()
1285 if (!device_property_read_u32(&client->dev, "azoteq,gpio3-select", in iqs626_parse_prop()
1288 dev_err(&client->dev, "Invalid GPIO3 selection: %u\n", in iqs626_parse_prop()
1290 return -EINVAL; in iqs626_parse_prop()
1293 sys_reg->misc_a &= ~IQS626_MISC_A_GPIO3_SELECT_MASK; in iqs626_parse_prop()
1294 sys_reg->misc_a |= val; in iqs626_parse_prop()
1297 if (!device_property_read_u32(&client->dev, "azoteq,reseed-select", in iqs626_parse_prop()
1300 dev_err(&client->dev, "Invalid reseed selection: %u\n", in iqs626_parse_prop()
1302 return -EINVAL; in iqs626_parse_prop()
1305 sys_reg->misc_b &= ~IQS626_MISC_B_RESEED_UI_SEL_MASK; in iqs626_parse_prop()
1306 sys_reg->misc_b |= (val << IQS626_MISC_B_RESEED_UI_SEL_SHIFT); in iqs626_parse_prop()
1309 sys_reg->misc_b &= ~IQS626_MISC_B_THRESH_EXTEND; in iqs626_parse_prop()
1310 if (device_property_present(&client->dev, "azoteq,thresh-extend")) in iqs626_parse_prop()
1311 sys_reg->misc_b |= IQS626_MISC_B_THRESH_EXTEND; in iqs626_parse_prop()
1313 sys_reg->misc_b &= ~IQS626_MISC_B_TRACKING_UI_ENABLE; in iqs626_parse_prop()
1314 if (device_property_present(&client->dev, "azoteq,tracking-enable")) in iqs626_parse_prop()
1315 sys_reg->misc_b |= IQS626_MISC_B_TRACKING_UI_ENABLE; in iqs626_parse_prop()
1317 sys_reg->misc_b &= ~IQS626_MISC_B_RESEED_OFFSET; in iqs626_parse_prop()
1318 if (device_property_present(&client->dev, "azoteq,reseed-offset")) in iqs626_parse_prop()
1319 sys_reg->misc_b |= IQS626_MISC_B_RESEED_OFFSET; in iqs626_parse_prop()
1321 if (!device_property_read_u32(&client->dev, "azoteq,rate-np-ms", in iqs626_parse_prop()
1324 dev_err(&client->dev, "Invalid report rate: %u\n", val); in iqs626_parse_prop()
1325 return -EINVAL; in iqs626_parse_prop()
1328 sys_reg->rate_np = val; in iqs626_parse_prop()
1331 if (!device_property_read_u32(&client->dev, "azoteq,rate-lp-ms", in iqs626_parse_prop()
1334 dev_err(&client->dev, "Invalid report rate: %u\n", val); in iqs626_parse_prop()
1335 return -EINVAL; in iqs626_parse_prop()
1338 sys_reg->rate_lp = val; in iqs626_parse_prop()
1341 if (!device_property_read_u32(&client->dev, "azoteq,rate-ulp-ms", in iqs626_parse_prop()
1344 dev_err(&client->dev, "Invalid report rate: %u\n", val); in iqs626_parse_prop()
1345 return -EINVAL; in iqs626_parse_prop()
1348 sys_reg->rate_ulp = val / 16; in iqs626_parse_prop()
1351 if (!device_property_read_u32(&client->dev, "azoteq,timeout-pwr-ms", in iqs626_parse_prop()
1354 dev_err(&client->dev, "Invalid timeout: %u\n", val); in iqs626_parse_prop()
1355 return -EINVAL; in iqs626_parse_prop()
1358 sys_reg->timeout_pwr = val / 512; in iqs626_parse_prop()
1361 if (!device_property_read_u32(&client->dev, "azoteq,timeout-lta-ms", in iqs626_parse_prop()
1364 dev_err(&client->dev, "Invalid timeout: %u\n", val); in iqs626_parse_prop()
1365 return -EINVAL; in iqs626_parse_prop()
1368 sys_reg->timeout_lta = val / 512; in iqs626_parse_prop()
1371 sys_reg->event_mask = ~((u8)IQS626_EVENT_MASK_SYS); in iqs626_parse_prop()
1372 sys_reg->redo_ati = 0; in iqs626_parse_prop()
1374 sys_reg->reseed = 0; in iqs626_parse_prop()
1375 sys_reg->active = 0; in iqs626_parse_prop()
1378 ch_node = device_get_named_child_node(&client->dev, in iqs626_parse_prop()
1388 sys_reg->active |= iqs626_channels[i].active; in iqs626_parse_prop()
1394 * Enable streaming during normal-power mode if the trackpad is used to in iqs626_parse_prop()
1396 * returns to event mode during low-power mode. in iqs626_parse_prop()
1398 if (sys_reg->active & iqs626_channels[IQS626_CH_TP_2].active && in iqs626_parse_prop()
1399 sys_reg->event_mask & IQS626_EVENT_MASK_GESTURE) in iqs626_parse_prop()
1405 sys_reg->general = cpu_to_be16(general); in iqs626_parse_prop()
1407 error = regmap_raw_write(iqs626->regmap, IQS626_SYS_SETTINGS, in iqs626_parse_prop()
1408 &iqs626->sys_reg, sizeof(iqs626->sys_reg)); in iqs626_parse_prop()
1419 struct iqs626_sys_reg *sys_reg = &iqs626->sys_reg; in iqs626_input_init()
1420 struct i2c_client *client = iqs626->client; in iqs626_input_init()
1423 iqs626->keypad = devm_input_allocate_device(&client->dev); in iqs626_input_init()
1424 if (!iqs626->keypad) in iqs626_input_init()
1425 return -ENOMEM; in iqs626_input_init()
1427 iqs626->keypad->keycodemax = ARRAY_SIZE(iqs626->kp_code); in iqs626_input_init()
1428 iqs626->keypad->keycode = iqs626->kp_code; in iqs626_input_init()
1429 iqs626->keypad->keycodesize = sizeof(**iqs626->kp_code); in iqs626_input_init()
1431 iqs626->keypad->name = "iqs626a_keypad"; in iqs626_input_init()
1432 iqs626->keypad->id.bustype = BUS_I2C; in iqs626_input_init()
1435 if (!(sys_reg->active & iqs626_channels[i].active)) in iqs626_input_init()
1439 if (!iqs626->kp_type[i][j]) in iqs626_input_init()
1442 input_set_capability(iqs626->keypad, in iqs626_input_init()
1443 iqs626->kp_type[i][j], in iqs626_input_init()
1444 iqs626->kp_code[i][j]); in iqs626_input_init()
1448 if (!(sys_reg->active & iqs626_channels[IQS626_CH_TP_2].active)) in iqs626_input_init()
1451 iqs626->trackpad = devm_input_allocate_device(&client->dev); in iqs626_input_init()
1452 if (!iqs626->trackpad) in iqs626_input_init()
1453 return -ENOMEM; in iqs626_input_init()
1455 iqs626->trackpad->keycodemax = ARRAY_SIZE(iqs626->tp_code); in iqs626_input_init()
1456 iqs626->trackpad->keycode = iqs626->tp_code; in iqs626_input_init()
1457 iqs626->trackpad->keycodesize = sizeof(*iqs626->tp_code); in iqs626_input_init()
1459 iqs626->trackpad->name = "iqs626a_trackpad"; in iqs626_input_init()
1460 iqs626->trackpad->id.bustype = BUS_I2C; in iqs626_input_init()
1466 if (sys_reg->event_mask & IQS626_EVENT_MASK_GESTURE) { in iqs626_input_init()
1469 input_set_capability(iqs626->trackpad, EV_KEY, BTN_TOUCH); in iqs626_input_init()
1470 input_set_abs_params(iqs626->trackpad, ABS_Y, 0, 255, 0, 0); in iqs626_input_init()
1472 if ((sys_reg->active & tp_mask) == tp_mask) in iqs626_input_init()
1473 input_set_abs_params(iqs626->trackpad, in iqs626_input_init()
1476 input_set_abs_params(iqs626->trackpad, in iqs626_input_init()
1479 touchscreen_parse_properties(iqs626->trackpad, false, in iqs626_input_init()
1480 &iqs626->prop); in iqs626_input_init()
1483 if (iqs626->tp_code[i] != KEY_RESERVED) in iqs626_input_init()
1484 input_set_capability(iqs626->trackpad, EV_KEY, in iqs626_input_init()
1485 iqs626->tp_code[i]); in iqs626_input_init()
1488 error = input_register_device(iqs626->trackpad); in iqs626_input_init()
1490 dev_err(&client->dev, "Failed to register trackpad: %d\n", in iqs626_input_init()
1498 struct iqs626_sys_reg *sys_reg = &iqs626->sys_reg; in iqs626_report()
1499 struct i2c_client *client = iqs626->client; in iqs626_report()
1506 error = regmap_raw_read(iqs626->regmap, IQS626_SYS_FLAGS, &flags, in iqs626_report()
1509 dev_err(&client->dev, "Failed to read device status: %d\n", in iqs626_report()
1520 dev_err(&client->dev, "Unexpected device reset\n"); in iqs626_report()
1522 error = regmap_raw_write(iqs626->regmap, IQS626_SYS_SETTINGS, in iqs626_report()
1525 dev_err(&client->dev, in iqs626_report()
1526 "Failed to re-initialize device: %d\n", error); in iqs626_report()
1539 if (sys_reg->active & iqs626_channels[IQS626_CH_HALL].active) { in iqs626_report()
1540 error = regmap_raw_read(iqs626->regmap, IQS626_HALL_OUTPUT, in iqs626_report()
1543 dev_err(&client->dev, in iqs626_report()
1554 if (!(sys_reg->active & iqs626_channels[i].active)) in iqs626_report()
1558 if (!iqs626->kp_type[i][j]) in iqs626_report()
1566 input_event(iqs626->keypad, iqs626->kp_type[i][j], in iqs626_report()
1567 iqs626->kp_code[i][j], !!state); in iqs626_report()
1571 input_sync(iqs626->keypad); in iqs626_report()
1574 * The following completion signals that ATI has finished, any initial in iqs626_report()
1577 complete_all(&iqs626->ati_done); in iqs626_report()
1579 if (!(sys_reg->active & iqs626_channels[IQS626_CH_TP_2].active)) in iqs626_report()
1582 if (sys_reg->event_mask & IQS626_EVENT_MASK_GESTURE) { in iqs626_report()
1586 input_report_key(iqs626->trackpad, BTN_TOUCH, state); in iqs626_report()
1589 touchscreen_report_pos(iqs626->trackpad, &iqs626->prop, in iqs626_report()
1594 input_report_key(iqs626->trackpad, iqs626->tp_code[i], in iqs626_report()
1598 input_sync(iqs626->trackpad); in iqs626_report()
1605 input_report_key(iqs626->trackpad, in iqs626_report()
1606 iqs626->tp_code[i], 0); in iqs626_report()
1610 input_sync(iqs626->trackpad); in iqs626_report()
1644 iqs626 = devm_kzalloc(&client->dev, sizeof(*iqs626), GFP_KERNEL); in iqs626_probe()
1646 return -ENOMEM; in iqs626_probe()
1649 iqs626->client = client; in iqs626_probe()
1651 iqs626->regmap = devm_regmap_init_i2c(client, &iqs626_regmap_config); in iqs626_probe()
1652 if (IS_ERR(iqs626->regmap)) { in iqs626_probe()
1653 error = PTR_ERR(iqs626->regmap); in iqs626_probe()
1654 dev_err(&client->dev, "Failed to initialize register map: %d\n", in iqs626_probe()
1659 init_completion(&iqs626->ati_done); in iqs626_probe()
1661 error = regmap_raw_read(iqs626->regmap, IQS626_VER_INFO, &ver_info, in iqs626_probe()
1667 dev_err(&client->dev, "Unrecognized product number: 0x%02X\n", in iqs626_probe()
1669 return -EINVAL; in iqs626_probe()
1680 error = devm_request_threaded_irq(&client->dev, client->irq, in iqs626_probe()
1682 client->name, iqs626); in iqs626_probe()
1684 dev_err(&client->dev, "Failed to request IRQ: %d\n", error); in iqs626_probe()
1688 if (!wait_for_completion_timeout(&iqs626->ati_done, in iqs626_probe()
1690 dev_err(&client->dev, "Failed to complete ATI\n"); in iqs626_probe()
1691 return -ETIMEDOUT; in iqs626_probe()
1696 * until ATI is complete and the initial switch states are read. in iqs626_probe()
1698 error = input_register_device(iqs626->keypad); in iqs626_probe()
1700 dev_err(&client->dev, "Failed to register keypad: %d\n", error); in iqs626_probe()
1708 struct i2c_client *client = iqs626->client; in iqs626_suspend()
1712 if (!iqs626->suspend_mode) in iqs626_suspend()
1715 disable_irq(client->irq); in iqs626_suspend()
1720 * transition into normal-power mode. in iqs626_suspend()
1722 error = regmap_update_bits(iqs626->regmap, IQS626_SYS_SETTINGS, in iqs626_suspend()
1729 * into normal-power mode before a manual mode switch is performed. in iqs626_suspend()
1731 error = regmap_read_poll_timeout(iqs626->regmap, IQS626_SYS_FLAGS, val, in iqs626_suspend()
1738 error = regmap_update_bits(iqs626->regmap, IQS626_SYS_SETTINGS, in iqs626_suspend()
1740 iqs626->suspend_mode << in iqs626_suspend()
1750 error = regmap_read_poll_timeout(iqs626->regmap, IQS626_SYS_FLAGS, val, in iqs626_suspend()
1752 == (iqs626->suspend_mode << in iqs626_suspend()
1759 enable_irq(client->irq); in iqs626_suspend()
1767 struct i2c_client *client = iqs626->client; in iqs626_resume()
1771 if (!iqs626->suspend_mode) in iqs626_resume()
1774 disable_irq(client->irq); in iqs626_resume()
1776 error = regmap_update_bits(iqs626->regmap, IQS626_SYS_SETTINGS, in iqs626_resume()
1782 * This check ensures the device has returned to normal-power mode in iqs626_resume()
1783 * before automatic power mode switching is re-enabled. in iqs626_resume()
1785 error = regmap_read_poll_timeout(iqs626->regmap, IQS626_SYS_FLAGS, val, in iqs626_resume()
1792 error = regmap_update_bits(iqs626->regmap, IQS626_SYS_SETTINGS, in iqs626_resume()
1806 enable_irq(client->irq); in iqs626_resume()