Lines Matching +full:ati +full:- +full:comp +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",
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()
472 thresh = sys_reg->ch_reg_ulp.thresh; in iqs626_parse_events()
473 hyst = &sys_reg->ch_reg_ulp.hyst; in iqs626_parse_events()
478 thresh = &sys_reg->tp_grp_reg.ch_reg_tp[0].thresh; in iqs626_parse_events()
479 hyst = &sys_reg->tp_grp_reg.hyst; in iqs626_parse_events()
485 i = ch_id - IQS626_CH_GEN_0; in iqs626_parse_events()
486 thresh = sys_reg->ch_reg_gen[i].thresh; in iqs626_parse_events()
487 hyst = &sys_reg->ch_reg_gen[i].hyst; in iqs626_parse_events()
491 thresh = &sys_reg->ch_reg_hall.thresh; in iqs626_parse_events()
492 hyst = &sys_reg->ch_reg_hall.hyst; in iqs626_parse_events()
496 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()
533 return -EINVAL; in iqs626_parse_events()
536 iqs626->kp_type[ch_id][i] = val; in iqs626_parse_events()
538 sys_reg->event_mask &= ~iqs626_events[i].mask; in iqs626_parse_events()
544 dev_err(&client->dev, in iqs626_parse_events()
547 return -EINVAL; in iqs626_parse_events()
564 dev_err(&client->dev, in iqs626_parse_events()
567 return -EINVAL; in iqs626_parse_events()
584 struct iqs626_sys_reg *sys_reg = &iqs626->sys_reg; in iqs626_parse_ati_target()
585 struct i2c_client *client = iqs626->client; in iqs626_parse_ati_target()
592 ati_target = &sys_reg->ch_reg_ulp.ati_target; in iqs626_parse_ati_target()
597 ati_target = &sys_reg->tp_grp_reg.ati_target; in iqs626_parse_ati_target()
603 i = ch_id - IQS626_CH_GEN_0; in iqs626_parse_ati_target()
604 ati_target = &sys_reg->ch_reg_gen[i].ati_target; in iqs626_parse_ati_target()
608 ati_target = &sys_reg->ch_reg_hall.ati_target; in iqs626_parse_ati_target()
612 return -EINVAL; in iqs626_parse_ati_target()
615 if (!fwnode_property_read_u32(ch_node, "azoteq,ati-target", &val)) { in iqs626_parse_ati_target()
617 dev_err(&client->dev, in iqs626_parse_ati_target()
618 "Invalid %s channel ATI target: %u\n", in iqs626_parse_ati_target()
620 return -EINVAL; in iqs626_parse_ati_target()
628 !fwnode_property_read_u32(ch_node, "azoteq,ati-base", &val)) { in iqs626_parse_ati_target()
647 dev_err(&client->dev, in iqs626_parse_ati_target()
648 "Invalid %s channel ATI base: %u\n", in iqs626_parse_ati_target()
650 return -EINVAL; in iqs626_parse_ati_target()
664 struct i2c_client *client = iqs626->client; in iqs626_parse_pins()
673 dev_err(&client->dev, in iqs626_parse_pins()
676 return -EINVAL; in iqs626_parse_pins()
678 dev_err(&client->dev, in iqs626_parse_pins()
686 dev_err(&client->dev, in iqs626_parse_pins()
696 dev_err(&client->dev, in iqs626_parse_pins()
699 return -EINVAL; in iqs626_parse_pins()
712 struct iqs626_sys_reg *sys_reg = &iqs626->sys_reg; in iqs626_parse_trackpad()
713 struct i2c_client *client = iqs626->client; in iqs626_parse_trackpad()
714 u8 *hyst = &sys_reg->tp_grp_reg.hyst; in iqs626_parse_trackpad()
718 if (!fwnode_property_read_u32(ch_node, "azoteq,lta-update", &val)) { in iqs626_parse_trackpad()
720 dev_err(&client->dev, in iqs626_parse_trackpad()
723 return -EINVAL; in iqs626_parse_trackpad()
726 sys_reg->misc_a &= ~IQS626_MISC_A_TPx_LTA_UPDATE_MASK; in iqs626_parse_trackpad()
727 sys_reg->misc_a |= (val << IQS626_MISC_A_TPx_LTA_UPDATE_SHIFT); in iqs626_parse_trackpad()
730 if (!fwnode_property_read_u32(ch_node, "azoteq,filt-str-trackpad", in iqs626_parse_trackpad()
733 dev_err(&client->dev, in iqs626_parse_trackpad()
736 return -EINVAL; in iqs626_parse_trackpad()
739 sys_reg->misc_b &= ~IQS626_MISC_B_FILT_STR_TPx; in iqs626_parse_trackpad()
740 sys_reg->misc_b |= val; in iqs626_parse_trackpad()
743 if (!fwnode_property_read_u32(ch_node, "azoteq,filt-str-np-cnt", in iqs626_parse_trackpad()
746 dev_err(&client->dev, in iqs626_parse_trackpad()
749 return -EINVAL; in iqs626_parse_trackpad()
756 if (!fwnode_property_read_u32(ch_node, "azoteq,filt-str-lp-cnt", in iqs626_parse_trackpad()
759 dev_err(&client->dev, in iqs626_parse_trackpad()
762 return -EINVAL; in iqs626_parse_trackpad()
770 u8 *ati_base = &sys_reg->tp_grp_reg.ch_reg_tp[i].ati_base; in iqs626_parse_trackpad()
771 u8 *thresh = &sys_reg->tp_grp_reg.ch_reg_tp[i].thresh; in iqs626_parse_trackpad()
774 snprintf(tc_name, sizeof(tc_name), "channel-%d", i); in iqs626_parse_trackpad()
781 if (!fwnode_property_read_u32(tc_node, "azoteq,ati-base", in iqs626_parse_trackpad()
785 dev_err(&client->dev, in iqs626_parse_trackpad()
786 "Invalid %s %s ATI base: %u\n", in iqs626_parse_trackpad()
788 return -EINVAL; in iqs626_parse_trackpad()
791 *ati_base = val - IQS626_TPx_ATI_BASE_MIN; in iqs626_parse_trackpad()
797 dev_err(&client->dev, in iqs626_parse_trackpad()
800 return -EINVAL; in iqs626_parse_trackpad()
812 dev_err(&client->dev, "Too many keycodes present\n"); in iqs626_parse_trackpad()
813 return -EINVAL; in iqs626_parse_trackpad()
815 dev_err(&client->dev, "Failed to count keycodes: %d\n", count); in iqs626_parse_trackpad()
820 iqs626->tp_code, count); in iqs626_parse_trackpad()
822 dev_err(&client->dev, "Failed to read keycodes: %d\n", error); in iqs626_parse_trackpad()
826 sys_reg->misc_b &= ~IQS626_MISC_B_TPx_SWIPE; in iqs626_parse_trackpad()
827 if (fwnode_property_present(ch_node, "azoteq,gesture-swipe")) in iqs626_parse_trackpad()
828 sys_reg->misc_b |= IQS626_MISC_B_TPx_SWIPE; in iqs626_parse_trackpad()
830 if (!fwnode_property_read_u32(ch_node, "azoteq,timeout-tap-ms", in iqs626_parse_trackpad()
833 dev_err(&client->dev, in iqs626_parse_trackpad()
836 return -EINVAL; in iqs626_parse_trackpad()
839 sys_reg->timeout_tap = val / 16; in iqs626_parse_trackpad()
842 if (!fwnode_property_read_u32(ch_node, "azoteq,timeout-swipe-ms", in iqs626_parse_trackpad()
845 dev_err(&client->dev, in iqs626_parse_trackpad()
848 return -EINVAL; in iqs626_parse_trackpad()
851 sys_reg->timeout_swipe = val / 16; in iqs626_parse_trackpad()
854 if (!fwnode_property_read_u32(ch_node, "azoteq,thresh-swipe", in iqs626_parse_trackpad()
857 dev_err(&client->dev, in iqs626_parse_trackpad()
860 return -EINVAL; in iqs626_parse_trackpad()
863 sys_reg->thresh_swipe = val; in iqs626_parse_trackpad()
866 sys_reg->event_mask &= ~IQS626_EVENT_MASK_GESTURE; in iqs626_parse_trackpad()
875 struct iqs626_sys_reg *sys_reg = &iqs626->sys_reg; in iqs626_parse_channel()
876 struct i2c_client *client = iqs626->client; in iqs626_parse_channel()
884 engine = sys_reg->ch_reg_ulp.engine; in iqs626_parse_channel()
889 engine = sys_reg->tp_grp_reg.engine; in iqs626_parse_channel()
895 i = ch_id - IQS626_CH_GEN_0; in iqs626_parse_channel()
896 engine = sys_reg->ch_reg_gen[i].engine; in iqs626_parse_channel()
900 engine = &sys_reg->ch_reg_hall.engine; in iqs626_parse_channel()
904 return -EINVAL; in iqs626_parse_channel()
915 if (!fwnode_property_present(ch_node, "azoteq,ati-exclude")) in iqs626_parse_channel()
916 sys_reg->redo_ati |= iqs626_channels[ch_id].active; in iqs626_parse_channel()
918 if (!fwnode_property_present(ch_node, "azoteq,reseed-disable")) in iqs626_parse_channel()
919 sys_reg->reseed |= iqs626_channels[ch_id].active; in iqs626_parse_channel()
922 if (fwnode_property_present(ch_node, "azoteq,meas-cap-decrease")) in iqs626_parse_channel()
926 if (!fwnode_property_read_u32(ch_node, "azoteq,rx-inactive", &val)) { in iqs626_parse_channel()
950 dev_err(&client->dev, in iqs626_parse_channel()
953 return -EINVAL; in iqs626_parse_channel()
962 if (fwnode_property_present(ch_node, "azoteq,dual-direction")) in iqs626_parse_channel()
966 if (fwnode_property_present(ch_node, "azoteq,filt-disable")) in iqs626_parse_channel()
969 if (!fwnode_property_read_u32(ch_node, "azoteq,ati-mode", &val)) { in iqs626_parse_channel()
971 dev_err(&client->dev, in iqs626_parse_channel()
972 "Invalid %s channel ATI mode: %u\n", in iqs626_parse_channel()
974 return -EINVAL; in iqs626_parse_channel()
985 if (!fwnode_property_read_u32(ch_node, "azoteq,cct-increase", in iqs626_parse_channel()
987 unsigned int orig_val = val--; in iqs626_parse_channel()
1008 dev_err(&client->dev, in iqs626_parse_channel()
1011 return -EINVAL; in iqs626_parse_channel()
1025 if (!fwnode_property_read_u32(ch_node, "azoteq,proj-bias", &val)) { in iqs626_parse_channel()
1027 dev_err(&client->dev, in iqs626_parse_channel()
1030 return -EINVAL; in iqs626_parse_channel()
1037 if (!fwnode_property_read_u32(ch_node, "azoteq,sense-freq", &val)) { in iqs626_parse_channel()
1039 dev_err(&client->dev, in iqs626_parse_channel()
1042 return -EINVAL; in iqs626_parse_channel()
1050 if (fwnode_property_present(ch_node, "azoteq,ati-band-tighten")) in iqs626_parse_channel()
1057 sys_reg->ch_reg_ulp.hyst &= ~IQS626_ULP_PROJ_ENABLE; in iqs626_parse_channel()
1058 if (fwnode_property_present(ch_node, "azoteq,proj-enable")) in iqs626_parse_channel()
1059 sys_reg->ch_reg_ulp.hyst |= IQS626_ULP_PROJ_ENABLE; in iqs626_parse_channel()
1061 filter = &sys_reg->ch_reg_ulp.filter; in iqs626_parse_channel()
1063 rx_enable = &sys_reg->ch_reg_ulp.rx_enable; in iqs626_parse_channel()
1064 tx_enable = &sys_reg->ch_reg_ulp.tx_enable; in iqs626_parse_channel()
1066 i = ch_id - IQS626_CH_GEN_0; in iqs626_parse_channel()
1067 filter = &sys_reg->ch_reg_gen[i].filter; in iqs626_parse_channel()
1069 rx_enable = &sys_reg->ch_reg_gen[i].rx_enable; in iqs626_parse_channel()
1070 tx_enable = &sys_reg->ch_reg_gen[i].tx_enable; in iqs626_parse_channel()
1073 if (!fwnode_property_read_u32(ch_node, "azoteq,filt-str-np-cnt", in iqs626_parse_channel()
1076 dev_err(&client->dev, in iqs626_parse_channel()
1079 return -EINVAL; in iqs626_parse_channel()
1086 if (!fwnode_property_read_u32(ch_node, "azoteq,filt-str-lp-cnt", in iqs626_parse_channel()
1089 dev_err(&client->dev, in iqs626_parse_channel()
1092 return -EINVAL; in iqs626_parse_channel()
1099 if (!fwnode_property_read_u32(ch_node, "azoteq,filt-str-np-lta", in iqs626_parse_channel()
1102 dev_err(&client->dev, in iqs626_parse_channel()
1105 return -EINVAL; in iqs626_parse_channel()
1112 if (!fwnode_property_read_u32(ch_node, "azoteq,filt-str-lp-lta", in iqs626_parse_channel()
1115 dev_err(&client->dev, in iqs626_parse_channel()
1118 return -EINVAL; in iqs626_parse_channel()
1125 error = iqs626_parse_pins(iqs626, ch_node, "azoteq,rx-enable", in iqs626_parse_channel()
1130 error = iqs626_parse_pins(iqs626, ch_node, "azoteq,tx-enable", in iqs626_parse_channel()
1139 if (!fwnode_property_read_u32(ch_node, "azoteq,local-cap-size", in iqs626_parse_channel()
1141 unsigned int orig_val = val--; in iqs626_parse_channel()
1144 dev_err(&client->dev, in iqs626_parse_channel()
1147 return -EINVAL; in iqs626_parse_channel()
1156 if (!fwnode_property_read_u32(ch_node, "azoteq,sense-mode", &val)) { in iqs626_parse_channel()
1158 dev_err(&client->dev, in iqs626_parse_channel()
1161 return -EINVAL; in iqs626_parse_channel()
1168 if (!fwnode_property_read_u32(ch_node, "azoteq,tx-freq", &val)) { in iqs626_parse_channel()
1170 dev_err(&client->dev, in iqs626_parse_channel()
1173 return -EINVAL; in iqs626_parse_channel()
1181 if (fwnode_property_present(ch_node, "azoteq,invert-enable")) in iqs626_parse_channel()
1185 if (fwnode_property_present(ch_node, "azoteq,comp-disable")) in iqs626_parse_channel()
1189 if (fwnode_property_present(ch_node, "azoteq,static-enable")) in iqs626_parse_channel()
1192 i = ch_id - IQS626_CH_GEN_0; in iqs626_parse_channel()
1193 assoc_select = &sys_reg->ch_reg_gen[i].assoc_select; in iqs626_parse_channel()
1194 assoc_weight = &sys_reg->ch_reg_gen[i].assoc_weight; in iqs626_parse_channel()
1197 if (!fwnode_property_present(ch_node, "azoteq,assoc-select")) in iqs626_parse_channel()
1201 if (fwnode_property_match_string(ch_node, "azoteq,assoc-select", in iqs626_parse_channel()
1208 if (fwnode_property_read_u32(ch_node, "azoteq,assoc-weight", &val)) in iqs626_parse_channel()
1212 dev_err(&client->dev, in iqs626_parse_channel()
1215 return -EINVAL; in iqs626_parse_channel()
1225 struct iqs626_sys_reg *sys_reg = &iqs626->sys_reg; in iqs626_parse_prop()
1226 struct i2c_client *client = iqs626->client; in iqs626_parse_prop()
1231 if (!device_property_read_u32(&client->dev, "azoteq,suspend-mode", in iqs626_parse_prop()
1234 dev_err(&client->dev, "Invalid suspend mode: %u\n", in iqs626_parse_prop()
1236 return -EINVAL; in iqs626_parse_prop()
1239 iqs626->suspend_mode = val; in iqs626_parse_prop()
1242 error = regmap_raw_read(iqs626->regmap, IQS626_SYS_SETTINGS, sys_reg, in iqs626_parse_prop()
1247 general = be16_to_cpu(sys_reg->general); in iqs626_parse_prop()
1250 if (device_property_present(&client->dev, "azoteq,clk-div")) in iqs626_parse_prop()
1253 if (device_property_present(&client->dev, "azoteq,ulp-enable")) in iqs626_parse_prop()
1256 if (!device_property_read_u32(&client->dev, "azoteq,ulp-update", in iqs626_parse_prop()
1259 dev_err(&client->dev, "Invalid update rate: %u\n", val); in iqs626_parse_prop()
1260 return -EINVAL; in iqs626_parse_prop()
1267 sys_reg->misc_a &= ~IQS626_MISC_A_ATI_BAND_DISABLE; in iqs626_parse_prop()
1268 if (device_property_present(&client->dev, "azoteq,ati-band-disable")) in iqs626_parse_prop()
1269 sys_reg->misc_a |= IQS626_MISC_A_ATI_BAND_DISABLE; in iqs626_parse_prop()
1271 sys_reg->misc_a &= ~IQS626_MISC_A_ATI_LP_ONLY; in iqs626_parse_prop()
1272 if (device_property_present(&client->dev, "azoteq,ati-lp-only")) in iqs626_parse_prop()
1273 sys_reg->misc_a |= IQS626_MISC_A_ATI_LP_ONLY; in iqs626_parse_prop()
1275 if (!device_property_read_u32(&client->dev, "azoteq,gpio3-select", in iqs626_parse_prop()
1278 dev_err(&client->dev, "Invalid GPIO3 selection: %u\n", in iqs626_parse_prop()
1280 return -EINVAL; in iqs626_parse_prop()
1283 sys_reg->misc_a &= ~IQS626_MISC_A_GPIO3_SELECT_MASK; in iqs626_parse_prop()
1284 sys_reg->misc_a |= val; in iqs626_parse_prop()
1287 if (!device_property_read_u32(&client->dev, "azoteq,reseed-select", in iqs626_parse_prop()
1290 dev_err(&client->dev, "Invalid reseed selection: %u\n", in iqs626_parse_prop()
1292 return -EINVAL; in iqs626_parse_prop()
1295 sys_reg->misc_b &= ~IQS626_MISC_B_RESEED_UI_SEL_MASK; in iqs626_parse_prop()
1296 sys_reg->misc_b |= (val << IQS626_MISC_B_RESEED_UI_SEL_SHIFT); in iqs626_parse_prop()
1299 sys_reg->misc_b &= ~IQS626_MISC_B_THRESH_EXTEND; in iqs626_parse_prop()
1300 if (device_property_present(&client->dev, "azoteq,thresh-extend")) in iqs626_parse_prop()
1301 sys_reg->misc_b |= IQS626_MISC_B_THRESH_EXTEND; in iqs626_parse_prop()
1303 sys_reg->misc_b &= ~IQS626_MISC_B_TRACKING_UI_ENABLE; in iqs626_parse_prop()
1304 if (device_property_present(&client->dev, "azoteq,tracking-enable")) in iqs626_parse_prop()
1305 sys_reg->misc_b |= IQS626_MISC_B_TRACKING_UI_ENABLE; in iqs626_parse_prop()
1307 sys_reg->misc_b &= ~IQS626_MISC_B_RESEED_OFFSET; in iqs626_parse_prop()
1308 if (device_property_present(&client->dev, "azoteq,reseed-offset")) in iqs626_parse_prop()
1309 sys_reg->misc_b |= IQS626_MISC_B_RESEED_OFFSET; in iqs626_parse_prop()
1311 if (!device_property_read_u32(&client->dev, "azoteq,rate-np-ms", in iqs626_parse_prop()
1314 dev_err(&client->dev, "Invalid report rate: %u\n", val); in iqs626_parse_prop()
1315 return -EINVAL; in iqs626_parse_prop()
1318 sys_reg->rate_np = val; in iqs626_parse_prop()
1321 if (!device_property_read_u32(&client->dev, "azoteq,rate-lp-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_lp = val; in iqs626_parse_prop()
1331 if (!device_property_read_u32(&client->dev, "azoteq,rate-ulp-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_ulp = val / 16; in iqs626_parse_prop()
1341 if (!device_property_read_u32(&client->dev, "azoteq,timeout-pwr-ms", in iqs626_parse_prop()
1344 dev_err(&client->dev, "Invalid timeout: %u\n", val); in iqs626_parse_prop()
1345 return -EINVAL; in iqs626_parse_prop()
1348 sys_reg->timeout_pwr = val / 512; in iqs626_parse_prop()
1351 if (!device_property_read_u32(&client->dev, "azoteq,timeout-lta-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_lta = val / 512; in iqs626_parse_prop()
1361 sys_reg->event_mask = ~((u8)IQS626_EVENT_MASK_SYS); in iqs626_parse_prop()
1362 sys_reg->redo_ati = 0; in iqs626_parse_prop()
1364 sys_reg->reseed = 0; in iqs626_parse_prop()
1365 sys_reg->active = 0; in iqs626_parse_prop()
1369 device_get_named_child_node(&client->dev, in iqs626_parse_prop()
1378 sys_reg->active |= iqs626_channels[i].active; in iqs626_parse_prop()
1384 * Enable streaming during normal-power mode if the trackpad is used to in iqs626_parse_prop()
1386 * returns to event mode during low-power mode. in iqs626_parse_prop()
1388 if (sys_reg->active & iqs626_channels[IQS626_CH_TP_2].active && in iqs626_parse_prop()
1389 sys_reg->event_mask & IQS626_EVENT_MASK_GESTURE) in iqs626_parse_prop()
1395 sys_reg->general = cpu_to_be16(general); in iqs626_parse_prop()
1397 error = regmap_raw_write(iqs626->regmap, IQS626_SYS_SETTINGS, in iqs626_parse_prop()
1398 &iqs626->sys_reg, sizeof(iqs626->sys_reg)); in iqs626_parse_prop()
1409 struct iqs626_sys_reg *sys_reg = &iqs626->sys_reg; in iqs626_input_init()
1410 struct i2c_client *client = iqs626->client; in iqs626_input_init()
1413 iqs626->keypad = devm_input_allocate_device(&client->dev); in iqs626_input_init()
1414 if (!iqs626->keypad) in iqs626_input_init()
1415 return -ENOMEM; in iqs626_input_init()
1417 iqs626->keypad->keycodemax = ARRAY_SIZE(iqs626->kp_code); in iqs626_input_init()
1418 iqs626->keypad->keycode = iqs626->kp_code; in iqs626_input_init()
1419 iqs626->keypad->keycodesize = sizeof(**iqs626->kp_code); in iqs626_input_init()
1421 iqs626->keypad->name = "iqs626a_keypad"; in iqs626_input_init()
1422 iqs626->keypad->id.bustype = BUS_I2C; in iqs626_input_init()
1425 if (!(sys_reg->active & iqs626_channels[i].active)) in iqs626_input_init()
1429 if (!iqs626->kp_type[i][j]) in iqs626_input_init()
1432 input_set_capability(iqs626->keypad, in iqs626_input_init()
1433 iqs626->kp_type[i][j], in iqs626_input_init()
1434 iqs626->kp_code[i][j]); in iqs626_input_init()
1438 if (!(sys_reg->active & iqs626_channels[IQS626_CH_TP_2].active)) in iqs626_input_init()
1441 iqs626->trackpad = devm_input_allocate_device(&client->dev); in iqs626_input_init()
1442 if (!iqs626->trackpad) in iqs626_input_init()
1443 return -ENOMEM; in iqs626_input_init()
1445 iqs626->trackpad->keycodemax = ARRAY_SIZE(iqs626->tp_code); in iqs626_input_init()
1446 iqs626->trackpad->keycode = iqs626->tp_code; in iqs626_input_init()
1447 iqs626->trackpad->keycodesize = sizeof(*iqs626->tp_code); in iqs626_input_init()
1449 iqs626->trackpad->name = "iqs626a_trackpad"; in iqs626_input_init()
1450 iqs626->trackpad->id.bustype = BUS_I2C; in iqs626_input_init()
1456 if (sys_reg->event_mask & IQS626_EVENT_MASK_GESTURE) { in iqs626_input_init()
1459 input_set_capability(iqs626->trackpad, EV_KEY, BTN_TOUCH); in iqs626_input_init()
1460 input_set_abs_params(iqs626->trackpad, ABS_Y, 0, 255, 0, 0); in iqs626_input_init()
1462 if ((sys_reg->active & tp_mask) == tp_mask) in iqs626_input_init()
1463 input_set_abs_params(iqs626->trackpad, in iqs626_input_init()
1466 input_set_abs_params(iqs626->trackpad, in iqs626_input_init()
1469 touchscreen_parse_properties(iqs626->trackpad, false, in iqs626_input_init()
1470 &iqs626->prop); in iqs626_input_init()
1473 if (iqs626->tp_code[i] != KEY_RESERVED) in iqs626_input_init()
1474 input_set_capability(iqs626->trackpad, EV_KEY, in iqs626_input_init()
1475 iqs626->tp_code[i]); in iqs626_input_init()
1478 error = input_register_device(iqs626->trackpad); in iqs626_input_init()
1480 dev_err(&client->dev, "Failed to register trackpad: %d\n", in iqs626_input_init()
1488 struct iqs626_sys_reg *sys_reg = &iqs626->sys_reg; in iqs626_report()
1489 struct i2c_client *client = iqs626->client; in iqs626_report()
1496 error = regmap_raw_read(iqs626->regmap, IQS626_SYS_FLAGS, &flags, in iqs626_report()
1499 dev_err(&client->dev, "Failed to read device status: %d\n", in iqs626_report()
1510 dev_err(&client->dev, "Unexpected device reset\n"); in iqs626_report()
1512 error = regmap_raw_write(iqs626->regmap, IQS626_SYS_SETTINGS, in iqs626_report()
1515 dev_err(&client->dev, in iqs626_report()
1516 "Failed to re-initialize device: %d\n", error); in iqs626_report()
1529 if (sys_reg->active & iqs626_channels[IQS626_CH_HALL].active) { in iqs626_report()
1530 error = regmap_raw_read(iqs626->regmap, IQS626_HALL_OUTPUT, in iqs626_report()
1533 dev_err(&client->dev, in iqs626_report()
1544 if (!(sys_reg->active & iqs626_channels[i].active)) in iqs626_report()
1548 if (!iqs626->kp_type[i][j]) in iqs626_report()
1556 input_event(iqs626->keypad, iqs626->kp_type[i][j], in iqs626_report()
1557 iqs626->kp_code[i][j], !!state); in iqs626_report()
1561 input_sync(iqs626->keypad); in iqs626_report()
1564 * The following completion signals that ATI has finished, any initial in iqs626_report()
1567 complete_all(&iqs626->ati_done); in iqs626_report()
1569 if (!(sys_reg->active & iqs626_channels[IQS626_CH_TP_2].active)) in iqs626_report()
1572 if (sys_reg->event_mask & IQS626_EVENT_MASK_GESTURE) { in iqs626_report()
1576 input_report_key(iqs626->trackpad, BTN_TOUCH, state); in iqs626_report()
1579 touchscreen_report_pos(iqs626->trackpad, &iqs626->prop, in iqs626_report()
1584 input_report_key(iqs626->trackpad, iqs626->tp_code[i], in iqs626_report()
1588 input_sync(iqs626->trackpad); in iqs626_report()
1595 input_report_key(iqs626->trackpad, in iqs626_report()
1596 iqs626->tp_code[i], 0); in iqs626_report()
1600 input_sync(iqs626->trackpad); in iqs626_report()
1634 iqs626 = devm_kzalloc(&client->dev, sizeof(*iqs626), GFP_KERNEL); in iqs626_probe()
1636 return -ENOMEM; in iqs626_probe()
1639 iqs626->client = client; in iqs626_probe()
1641 iqs626->regmap = devm_regmap_init_i2c(client, &iqs626_regmap_config); in iqs626_probe()
1642 if (IS_ERR(iqs626->regmap)) { in iqs626_probe()
1643 error = PTR_ERR(iqs626->regmap); in iqs626_probe()
1644 dev_err(&client->dev, "Failed to initialize register map: %d\n", in iqs626_probe()
1649 init_completion(&iqs626->ati_done); in iqs626_probe()
1651 error = regmap_raw_read(iqs626->regmap, IQS626_VER_INFO, &ver_info, in iqs626_probe()
1657 dev_err(&client->dev, "Unrecognized product number: 0x%02X\n", in iqs626_probe()
1659 return -EINVAL; in iqs626_probe()
1670 error = devm_request_threaded_irq(&client->dev, client->irq, in iqs626_probe()
1672 client->name, iqs626); in iqs626_probe()
1674 dev_err(&client->dev, "Failed to request IRQ: %d\n", error); in iqs626_probe()
1678 if (!wait_for_completion_timeout(&iqs626->ati_done, in iqs626_probe()
1680 dev_err(&client->dev, "Failed to complete ATI\n"); in iqs626_probe()
1681 return -ETIMEDOUT; in iqs626_probe()
1686 * until ATI is complete and the initial switch states are read. in iqs626_probe()
1688 error = input_register_device(iqs626->keypad); in iqs626_probe()
1690 dev_err(&client->dev, "Failed to register keypad: %d\n", error); in iqs626_probe()
1698 struct i2c_client *client = iqs626->client; in iqs626_suspend()
1702 if (!iqs626->suspend_mode) in iqs626_suspend()
1705 disable_irq(client->irq); in iqs626_suspend()
1710 * transition into normal-power mode. in iqs626_suspend()
1712 error = regmap_update_bits(iqs626->regmap, IQS626_SYS_SETTINGS, in iqs626_suspend()
1719 * into normal-power mode before a manual mode switch is performed. in iqs626_suspend()
1721 error = regmap_read_poll_timeout(iqs626->regmap, IQS626_SYS_FLAGS, val, in iqs626_suspend()
1728 error = regmap_update_bits(iqs626->regmap, IQS626_SYS_SETTINGS, in iqs626_suspend()
1730 iqs626->suspend_mode << in iqs626_suspend()
1740 error = regmap_read_poll_timeout(iqs626->regmap, IQS626_SYS_FLAGS, val, in iqs626_suspend()
1742 == (iqs626->suspend_mode << in iqs626_suspend()
1749 enable_irq(client->irq); in iqs626_suspend()
1757 struct i2c_client *client = iqs626->client; in iqs626_resume()
1761 if (!iqs626->suspend_mode) in iqs626_resume()
1764 disable_irq(client->irq); in iqs626_resume()
1766 error = regmap_update_bits(iqs626->regmap, IQS626_SYS_SETTINGS, in iqs626_resume()
1772 * This check ensures the device has returned to normal-power mode in iqs626_resume()
1773 * before automatic power mode switching is re-enabled. in iqs626_resume()
1775 error = regmap_read_poll_timeout(iqs626->regmap, IQS626_SYS_FLAGS, val, in iqs626_resume()
1782 error = regmap_update_bits(iqs626->regmap, IQS626_SYS_SETTINGS, in iqs626_resume()
1796 enable_irq(client->irq); in iqs626_resume()