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

1 // SPDX-License-Identifier: GPL-2.0-or-later
116 [IQS7222_REG_GRP_CYCLE] = "cycle-%d",
117 [IQS7222_REG_GRP_CHAN] = "channel-%d",
118 [IQS7222_REG_GRP_SLDR] = "slider-%d",
120 [IQS7222_REG_GRP_GPIO] = "gpio-%d",
150 .name = "event-prox",
155 .name = "event-touch",
162 { .name = "event-press", },
164 .name = "event-tap",
171 .name = "event-swipe-pos",
178 .name = "event-swipe-neg",
185 .name = "event-flick-pos",
192 .name = "event-flick-neg",
202 .name = "event-press",
206 .name = "event-tap",
214 .name = "event-swipe-x-pos",
223 .name = "event-swipe-y-pos",
232 .name = "event-swipe-x-neg",
241 .name = "event-swipe-y-neg",
250 .name = "event-flick-x-pos",
259 .name = "event-flick-y-pos",
268 .name = "event-flick-x-neg",
277 .name = "event-flick-y-neg",
819 .name = "azoteq,conv-period",
827 .name = "azoteq,conv-frac",
835 .name = "azoteq,rx-float-inactive",
843 .name = "azoteq,dead-time-enable",
850 .name = "azoteq,tx-freq-fosc",
857 .name = "azoteq,vbias-enable",
864 .name = "azoteq,sense-mode",
873 .name = "azoteq,iref-enable",
880 .name = "azoteq,iref-level",
888 .name = "azoteq,iref-trim",
896 .name = "azoteq,max-counts",
904 .name = "azoteq,auto-mode",
912 .name = "azoteq,ati-frac-div-fine",
920 .name = "azoteq,ati-frac-div-coarse",
928 .name = "azoteq,ati-comp-select",
936 .name = "azoteq,ati-band",
944 .name = "azoteq,global-halt",
951 .name = "azoteq,invert-enable",
958 .name = "azoteq,dual-direction",
965 .name = "azoteq,samp-cap-double",
972 .name = "azoteq,vref-half",
979 .name = "azoteq,proj-bias",
987 .name = "azoteq,ati-target",
996 .name = "azoteq,ati-base",
1005 .name = "azoteq,ati-mode",
1014 .name = "azoteq,ati-frac-div-fine",
1022 .name = "azoteq,ati-frac-mult-coarse",
1030 .name = "azoteq,ati-frac-div-coarse",
1038 .name = "azoteq,ati-comp-div",
1046 .name = "azoteq,ati-comp-select",
1054 .name = "azoteq,debounce-exit",
1063 .name = "azoteq,debounce-enter",
1100 .name = "azoteq,lta-beta-lp",
1105 .label = "low-power mode long-term average beta",
1108 .name = "azoteq,lta-beta-np",
1113 .label = "normal-power mode long-term average beta",
1116 .name = "azoteq,counts-beta-lp",
1121 .label = "low-power mode counts beta",
1124 .name = "azoteq,counts-beta-np",
1129 .label = "normal-power mode counts beta",
1132 .name = "azoteq,lta-fast-beta-lp",
1137 .label = "low-power mode long-term average fast beta",
1140 .name = "azoteq,lta-fast-beta-np",
1145 .label = "normal-power mode long-term average fast beta",
1148 .name = "azoteq,lower-cal",
1156 .name = "azoteq,static-beta",
1164 .name = "azoteq,bottom-beta",
1173 .name = "azoteq,static-beta",
1181 .name = "azoteq,bottom-beta",
1190 .name = "azoteq,bottom-speed",
1198 .name = "azoteq,upper-cal",
1206 .name = "azoteq,gesture-max-ms",
1216 .name = "azoteq,gesture-max-ms",
1226 .name = "azoteq,gesture-min-ms",
1236 .name = "azoteq,gesture-min-ms",
1246 .name = "azoteq,gesture-dist",
1256 .name = "azoteq,gesture-dist",
1266 .name = "azoteq,gesture-max-ms",
1276 .name = "azoteq,gesture-max-ms",
1286 .name = "azoteq,num-rows",
1296 .name = "azoteq,num-cols",
1306 .name = "azoteq,lower-cal-y",
1314 .name = "azoteq,lower-cal-x",
1322 .name = "azoteq,upper-cal-y",
1330 .name = "azoteq,upper-cal-x",
1338 .name = "azoteq,top-speed",
1347 .name = "azoteq,bottom-speed",
1355 .name = "azoteq,gesture-min-ms",
1365 .name = "azoteq,gesture-max-ms",
1375 .name = "azoteq,gesture-max-ms",
1385 .name = "azoteq,gesture-dist",
1394 .name = "azoteq,gesture-dist",
1403 .name = "drive-open-drain",
1410 .name = "azoteq,timeout-ati-ms",
1419 .name = "azoteq,rate-ati-ms",
1427 .name = "azoteq,timeout-np-ms",
1432 .label = "normal-power mode timeout",
1435 .name = "azoteq,rate-np-ms",
1441 .label = "normal-power mode report rate",
1444 .name = "azoteq,timeout-lp-ms",
1449 .label = "low-power mode timeout",
1452 .name = "azoteq,rate-lp-ms",
1458 .label = "low-power mode report rate",
1461 .name = "azoteq,timeout-ulp-ms",
1466 .label = "ultra-low-power mode timeout",
1469 .name = "azoteq,rate-ulp-ms",
1475 .label = "ultra-low-power mode report rate",
1507 return iqs7222->cycle_setup[row]; in iqs7222_setup()
1510 return iqs7222->glbl_setup; in iqs7222_setup()
1513 return iqs7222->btn_setup[row]; in iqs7222_setup()
1516 return iqs7222->chan_setup[row]; in iqs7222_setup()
1519 return iqs7222->filt_setup; in iqs7222_setup()
1522 return iqs7222->sldr_setup[row]; in iqs7222_setup()
1525 return iqs7222->tpad_setup; in iqs7222_setup()
1528 return iqs7222->gpio_setup[row]; in iqs7222_setup()
1531 return iqs7222->sys_setup; in iqs7222_setup()
1546 ret = gpiod_get_value_cansleep(iqs7222->irq_gpio); in iqs7222_irq_poll()
1553 return -EBUSY; in iqs7222_irq_poll()
1558 struct i2c_client *client = iqs7222->client; in iqs7222_hard_reset()
1561 if (!iqs7222->reset_gpio) in iqs7222_hard_reset()
1564 gpiod_set_value_cansleep(iqs7222->reset_gpio, 1); in iqs7222_hard_reset()
1567 gpiod_set_value_cansleep(iqs7222->reset_gpio, 0); in iqs7222_hard_reset()
1571 dev_err(&client->dev, "Failed to reset device: %d\n", error); in iqs7222_hard_reset()
1583 * pin. Attempts to do so while RDY is deasserted return an ACK; how- in iqs7222_force_comms()
1586 * Unsolicited communication must be preceded by a special force com- in iqs7222_force_comms()
1594 ret = gpiod_get_value_cansleep(iqs7222->irq_gpio); in iqs7222_force_comms()
1600 ret = i2c_master_send(iqs7222->client, msg_buf, sizeof(msg_buf)); in iqs7222_force_comms()
1603 ret = -EIO; in iqs7222_force_comms()
1621 struct i2c_client *client = iqs7222->client; in iqs7222_read_burst()
1624 .addr = client->addr, in iqs7222_read_burst()
1630 .addr = client->addr, in iqs7222_read_burst()
1652 ret = i2c_transfer(client->adapter, msg, ARRAY_SIZE(msg)); in iqs7222_read_burst()
1655 ret = -EIO; in iqs7222_read_burst()
1662 ret = -ENODATA; in iqs7222_read_burst()
1677 dev_err(&client->dev, in iqs7222_read_burst()
1703 struct i2c_client *client = iqs7222->client; in iqs7222_write_burst()
1708 return -ENOMEM; in iqs7222_write_burst()
1734 ret = -EIO; in iqs7222_write_burst()
1749 dev_err(&client->dev, in iqs7222_write_burst()
1764 struct i2c_client *client = iqs7222->client; in iqs7222_ati_trigger()
1782 * Trigger ATI from streaming and normal-power modes so that in iqs7222_ati_trigger()
1814 * Use stream-in-touch mode if either slider reports in iqs7222_ati_trigger()
1817 sys_setup |= test_bit(EV_ABS, iqs7222->keypad->evbit) in iqs7222_ati_trigger()
1826 dev_err(&client->dev, in iqs7222_ati_trigger()
1832 return -ETIMEDOUT; in iqs7222_ati_trigger()
1837 const struct iqs7222_dev_desc *dev_desc = iqs7222->dev_desc; in iqs7222_dev_init()
1838 int comms_offset = dev_desc->comms_offset; in iqs7222_dev_init()
1847 iqs7222->sys_setup[0] | in iqs7222_dev_init()
1854 * Take advantage of the stop-bit disable function, if available, to in iqs7222_dev_init()
1875 int num_row = dev_desc->reg_grps[i].num_row; in iqs7222_dev_init()
1876 int num_col = dev_desc->reg_grps[i].num_col; in iqs7222_dev_init()
1877 u16 reg = dev_desc->reg_grps[i].base; in iqs7222_dev_init()
1879 u16 val_len = dev_desc->reg_grps[i].val_len ? : num_col * sizeof(*val_buf); in iqs7222_dev_init()
1891 return -ENOMEM; in iqs7222_dev_init()
1910 error = -EINVAL; in iqs7222_dev_init()
1943 iqs7222->sys_setup[0] &= ~IQS7222_SYS_SETUP_INTF_MODE_MASK; in iqs7222_dev_init()
1944 iqs7222->sys_setup[0] &= ~IQS7222_SYS_SETUP_PWR_MODE_MASK; in iqs7222_dev_init()
1953 struct i2c_client *client = iqs7222->client; in iqs7222_dev_info()
1975 iqs7222->dev_desc = &iqs7222_devs[i]; in iqs7222_dev_info()
1980 dev_err(&client->dev, "Unsupported firmware revision: %u.%u\n", in iqs7222_dev_info()
1983 dev_err(&client->dev, "Unrecognized product number: %u\n", in iqs7222_dev_info()
1986 return -EINVAL; in iqs7222_dev_info()
1993 const struct iqs7222_dev_desc *dev_desc = iqs7222->dev_desc; in iqs7222_gpio_select()
1994 struct i2c_client *client = iqs7222->client; in iqs7222_gpio_select()
1995 int num_gpio = dev_desc->reg_grps[IQS7222_REG_GRP_GPIO].num_row; in iqs7222_gpio_select()
2002 if (!fwnode_property_present(child_node, "azoteq,gpio-select")) in iqs7222_gpio_select()
2005 count = fwnode_property_count_u32(child_node, "azoteq,gpio-select"); in iqs7222_gpio_select()
2007 dev_err(&client->dev, "Invalid number of %s GPIOs\n", in iqs7222_gpio_select()
2009 return -EINVAL; in iqs7222_gpio_select()
2011 dev_err(&client->dev, "Failed to count %s GPIOs: %d\n", in iqs7222_gpio_select()
2017 "azoteq,gpio-select", in iqs7222_gpio_select()
2020 dev_err(&client->dev, "Failed to read %s GPIOs: %d\n", in iqs7222_gpio_select()
2029 dev_err(&client->dev, "Invalid %s GPIO: %u\n", in iqs7222_gpio_select()
2031 return -EINVAL; in iqs7222_gpio_select()
2034 gpio_setup = iqs7222->gpio_setup[gpio_sel[i]]; in iqs7222_gpio_select()
2037 dev_err(&client->dev, in iqs7222_gpio_select()
2038 "Conflicting GPIO %u event types\n", in iqs7222_gpio_select()
2040 return -EINVAL; in iqs7222_gpio_select()
2058 struct i2c_client *client = iqs7222->client; in iqs7222_parse_props()
2110 dev_err(&client->dev, "Failed to read %s %s: %d\n", in iqs7222_parse_props()
2116 val_max = GENMASK(reg_width - 1, 0) * val_pitch; in iqs7222_parse_props()
2119 dev_err(&client->dev, "Invalid %s %s: %u\n", in iqs7222_parse_props()
2121 return -EINVAL; in iqs7222_parse_props()
2124 setup[reg_offset] &= ~GENMASK(reg_shift + reg_width - 1, in iqs7222_parse_props()
2141 struct i2c_client *client = iqs7222->client; in iqs7222_parse_event()
2155 if (error == -EINVAL) { in iqs7222_parse_event()
2158 dev_err(&client->dev, "Failed to read %s code: %d\n", in iqs7222_parse_event()
2164 input_set_capability(iqs7222->keypad, EV_KEY, *event_code); in iqs7222_parse_event()
2168 error = fwnode_property_read_u32(event_node, "linux,input-type", in iqs7222_parse_event()
2170 if (error == -EINVAL) { in iqs7222_parse_event()
2173 dev_err(&client->dev, "Failed to read %s input type: %d\n", in iqs7222_parse_event()
2177 dev_err(&client->dev, "Invalid %s input type: %d\n", in iqs7222_parse_event()
2179 return -EINVAL; in iqs7222_parse_event()
2182 input_set_capability(iqs7222->keypad, *event_type, *event_code); in iqs7222_parse_event()
2190 u16 *cycle_setup = iqs7222->cycle_setup[cycle_index]; in iqs7222_parse_cycle()
2191 struct i2c_client *client = iqs7222->client; in iqs7222_parse_cycle()
2202 * CTx pins (CTx0-8). in iqs7222_parse_cycle()
2204 if (!fwnode_property_present(cycle_node, "azoteq,tx-enable")) in iqs7222_parse_cycle()
2207 count = fwnode_property_count_u32(cycle_node, "azoteq,tx-enable"); in iqs7222_parse_cycle()
2209 dev_err(&client->dev, "Failed to count %s CTx pins: %d\n", in iqs7222_parse_cycle()
2213 dev_err(&client->dev, "Invalid number of %s CTx pins\n", in iqs7222_parse_cycle()
2215 return -EINVAL; in iqs7222_parse_cycle()
2218 error = fwnode_property_read_u32_array(cycle_node, "azoteq,tx-enable", in iqs7222_parse_cycle()
2221 dev_err(&client->dev, "Failed to read %s CTx pins: %d\n", in iqs7222_parse_cycle()
2226 cycle_setup[1] &= ~GENMASK(7 + ARRAY_SIZE(pins) - 1, 7); in iqs7222_parse_cycle()
2230 dev_err(&client->dev, "Invalid %s CTx pin: %u\n", in iqs7222_parse_cycle()
2232 return -EINVAL; in iqs7222_parse_cycle()
2244 const struct iqs7222_dev_desc *dev_desc = iqs7222->dev_desc; in iqs7222_parse_chan()
2245 struct i2c_client *client = iqs7222->client; in iqs7222_parse_chan()
2246 int num_chan = dev_desc->reg_grps[IQS7222_REG_GRP_CHAN].num_row; in iqs7222_parse_chan()
2249 u16 *chan_setup = iqs7222->chan_setup[chan_index]; in iqs7222_parse_chan()
2250 u16 *sys_setup = iqs7222->sys_setup; in iqs7222_parse_chan()
2253 if (dev_desc->allow_offset && in iqs7222_parse_chan()
2254 fwnode_property_present(chan_node, "azoteq,ulp-allow")) in iqs7222_parse_chan()
2255 sys_setup[dev_desc->allow_offset] &= ~BIT(chan_index); in iqs7222_parse_chan()
2263 if (dev_desc->reg_grps[IQS7222_REG_GRP_CHAN].num_col > 4 && in iqs7222_parse_chan()
2264 fwnode_property_present(chan_node, "azoteq,ref-select")) { in iqs7222_parse_chan()
2267 error = fwnode_property_read_u32(chan_node, "azoteq,ref-select", in iqs7222_parse_chan()
2270 dev_err(&client->dev, in iqs7222_parse_chan()
2277 dev_err(&client->dev, in iqs7222_parse_chan()
2280 return -EINVAL; in iqs7222_parse_chan()
2283 ref_setup = iqs7222->chan_setup[val]; in iqs7222_parse_chan()
2292 error = fwnode_property_read_u32(chan_node, "azoteq,ref-weight", in iqs7222_parse_chan()
2296 dev_err(&client->dev, in iqs7222_parse_chan()
2299 return -EINVAL; in iqs7222_parse_chan()
2303 } else if (error != -EINVAL) { in iqs7222_parse_chan()
2304 dev_err(&client->dev, in iqs7222_parse_chan()
2317 ref_setup[4] = dev_desc->touch_link; in iqs7222_parse_chan()
2318 if (fwnode_property_present(chan_node, "azoteq,use-prox")) in iqs7222_parse_chan()
2319 ref_setup[4] -= 2; in iqs7222_parse_chan()
2320 } else if (dev_desc->reg_grps[IQS7222_REG_GRP_TPAD].num_row && in iqs7222_parse_chan()
2322 "azoteq,counts-filt-enable")) { in iqs7222_parse_chan()
2330 if (fwnode_property_present(chan_node, "azoteq,rx-enable")) { in iqs7222_parse_chan()
2333 * the channels can use CRx0-3, while the second half can use in iqs7222_parse_chan()
2334 * CRx4-7. in iqs7222_parse_chan()
2340 "azoteq,rx-enable"); in iqs7222_parse_chan()
2342 dev_err(&client->dev, in iqs7222_parse_chan()
2347 dev_err(&client->dev, in iqs7222_parse_chan()
2350 return -EINVAL; in iqs7222_parse_chan()
2354 "azoteq,rx-enable", in iqs7222_parse_chan()
2357 dev_err(&client->dev, in iqs7222_parse_chan()
2363 chan_setup[0] &= ~GENMASK(4 + ARRAY_SIZE(pins) - 1, 4); in iqs7222_parse_chan()
2369 dev_err(&client->dev, in iqs7222_parse_chan()
2372 return -EINVAL; in iqs7222_parse_chan()
2375 chan_setup[0] |= BIT(pins[i] + 4 - min_crx); in iqs7222_parse_chan()
2389 "azoteq,timeout-press-ms", in iqs7222_parse_chan()
2394 * registers as opposed to channel-specific registers. in iqs7222_parse_chan()
2396 u16 *setup = dev_desc->reg_grps in iqs7222_parse_chan()
2398 &iqs7222->btn_setup[chan_index][2] : in iqs7222_parse_chan()
2402 dev_err(&client->dev, in iqs7222_parse_chan()
2405 return -EINVAL; in iqs7222_parse_chan()
2410 } else if (error != -EINVAL) { in iqs7222_parse_chan()
2411 dev_err(&client->dev, in iqs7222_parse_chan()
2421 dev_desc->touch_link - (i ? 0 : 2), in iqs7222_parse_chan()
2422 &iqs7222->kp_type[chan_index][i], in iqs7222_parse_chan()
2423 &iqs7222->kp_code[chan_index][i]); in iqs7222_parse_chan()
2427 if (!dev_desc->event_offset) in iqs7222_parse_chan()
2430 sys_setup[dev_desc->event_offset] |= event_enable; in iqs7222_parse_chan()
2435 * to a channel node, but reside within the button (event) group. in iqs7222_parse_chan()
2445 const struct iqs7222_dev_desc *dev_desc = iqs7222->dev_desc; in iqs7222_parse_sldr()
2446 struct i2c_client *client = iqs7222->client; in iqs7222_parse_sldr()
2447 int num_chan = dev_desc->reg_grps[IQS7222_REG_GRP_CHAN].num_row; in iqs7222_parse_sldr()
2450 u16 *event_mask = &iqs7222->sys_setup[dev_desc->event_offset]; in iqs7222_parse_sldr()
2451 u16 *sldr_setup = iqs7222->sldr_setup[sldr_index]; in iqs7222_parse_sldr()
2459 count = fwnode_property_count_u32(sldr_node, "azoteq,channel-select"); in iqs7222_parse_sldr()
2461 dev_err(&client->dev, "Failed to count %s channels: %d\n", in iqs7222_parse_sldr()
2465 dev_err(&client->dev, "Invalid number of %s channels\n", in iqs7222_parse_sldr()
2467 return -EINVAL; in iqs7222_parse_sldr()
2471 "azoteq,channel-select", in iqs7222_parse_sldr()
2474 dev_err(&client->dev, "Failed to read %s channels: %d\n", in iqs7222_parse_sldr()
2482 * the slider-related register addresses are offset by one. in iqs7222_parse_sldr()
2484 reg_offset = dev_desc->sldr_res < U16_MAX ? 0 : 1; in iqs7222_parse_sldr()
2487 sldr_setup[3 + reg_offset] &= ~GENMASK(ext_chan - 1, 0); in iqs7222_parse_sldr()
2495 dev_err(&client->dev, "Invalid %s channel: %u\n", in iqs7222_parse_sldr()
2497 return -EINVAL; in iqs7222_parse_sldr()
2508 sldr_setup[4 + reg_offset] = dev_desc->touch_link; in iqs7222_parse_sldr()
2509 if (fwnode_property_present(sldr_node, "azoteq,use-prox")) in iqs7222_parse_sldr()
2510 sldr_setup[4 + reg_offset] -= 2; in iqs7222_parse_sldr()
2512 error = fwnode_property_read_u32(sldr_node, "azoteq,slider-size", &val); in iqs7222_parse_sldr()
2514 if (val > dev_desc->sldr_res) { in iqs7222_parse_sldr()
2515 dev_err(&client->dev, "Invalid %s size: %u\n", in iqs7222_parse_sldr()
2517 return -EINVAL; in iqs7222_parse_sldr()
2527 } else if (error != -EINVAL) { in iqs7222_parse_sldr()
2528 dev_err(&client->dev, "Failed to read %s size: %d\n", in iqs7222_parse_sldr()
2535 dev_err(&client->dev, "Undefined %s size\n", in iqs7222_parse_sldr()
2537 return -EINVAL; in iqs7222_parse_sldr()
2540 error = fwnode_property_read_u32(sldr_node, "azoteq,top-speed", &val); in iqs7222_parse_sldr()
2543 dev_err(&client->dev, "Invalid %s top speed: %u\n", in iqs7222_parse_sldr()
2545 return -EINVAL; in iqs7222_parse_sldr()
2554 } else if (error != -EINVAL) { in iqs7222_parse_sldr()
2555 dev_err(&client->dev, "Failed to read %s top speed: %d\n", in iqs7222_parse_sldr()
2562 u16 sldr_max = sldr_setup[3] - 1; in iqs7222_parse_sldr()
2570 sldr_max = sldr_max * 16 - 1; in iqs7222_parse_sldr()
2573 input_set_abs_params(iqs7222->keypad, val, 0, sldr_max, 0, 0); in iqs7222_parse_sldr()
2574 iqs7222->sl_axis[sldr_index] = val; in iqs7222_parse_sldr()
2575 } else if (error != -EINVAL) { in iqs7222_parse_sldr()
2576 dev_err(&client->dev, "Failed to read %s axis: %d\n", in iqs7222_parse_sldr()
2581 if (dev_desc->wheel_enable) { in iqs7222_parse_sldr()
2582 sldr_setup[0] &= ~dev_desc->wheel_enable; in iqs7222_parse_sldr()
2583 if (iqs7222->sl_axis[sldr_index] == ABS_WHEEL) in iqs7222_parse_sldr()
2584 sldr_setup[0] |= dev_desc->wheel_enable; in iqs7222_parse_sldr()
2611 else if (dev_desc->legacy_gesture && in iqs7222_parse_sldr()
2614 else if (dev_desc->legacy_gesture && in iqs7222_parse_sldr()
2621 * The press/release event does not expose a direct GPIO link, in iqs7222_parse_sldr()
2632 &iqs7222->sl_code[sldr_index][i]); in iqs7222_parse_sldr()
2639 if (!dev_desc->event_offset) in iqs7222_parse_sldr()
2643 * The press/release event is determined based on whether the in iqs7222_parse_sldr()
2649 else if (sldr_setup[4 + reg_offset] == dev_desc->touch_link) in iqs7222_parse_sldr()
2661 dev_desc->wheel_enable ? in iqs7222_parse_sldr()
2669 const struct iqs7222_dev_desc *dev_desc = iqs7222->dev_desc; in iqs7222_parse_tpad()
2670 struct touchscreen_properties *prop = &iqs7222->prop; in iqs7222_parse_tpad()
2671 struct i2c_client *client = iqs7222->client; in iqs7222_parse_tpad()
2672 int num_chan = dev_desc->reg_grps[IQS7222_REG_GRP_CHAN].num_row; in iqs7222_parse_tpad()
2674 u16 *event_mask = &iqs7222->sys_setup[dev_desc->event_offset]; in iqs7222_parse_tpad()
2675 u16 *tpad_setup = iqs7222->tpad_setup; in iqs7222_parse_tpad()
2684 count = fwnode_property_count_u32(tpad_node, "azoteq,channel-select"); in iqs7222_parse_tpad()
2686 dev_err(&client->dev, "Failed to count %s channels: %d\n", in iqs7222_parse_tpad()
2690 dev_err(&client->dev, "Invalid number of %s channels\n", in iqs7222_parse_tpad()
2692 return -EINVAL; in iqs7222_parse_tpad()
2696 "azoteq,channel-select", in iqs7222_parse_tpad()
2699 dev_err(&client->dev, "Failed to read %s channels: %d\n", in iqs7222_parse_tpad()
2704 tpad_setup[6] &= ~GENMASK(num_chan - 1, 0); in iqs7222_parse_tpad()
2712 dev_err(&client->dev, "Invalid %s channel: %u\n", in iqs7222_parse_tpad()
2714 return -EINVAL; in iqs7222_parse_tpad()
2725 tpad_setup[7] = dev_desc->touch_link; in iqs7222_parse_tpad()
2726 if (fwnode_property_present(tpad_node, "azoteq,use-prox")) in iqs7222_parse_tpad()
2727 tpad_setup[7] -= 2; in iqs7222_parse_tpad()
2742 "azoteq,gesture-angle-tighten")) in iqs7222_parse_tpad()
2752 &iqs7222->tp_code[i]); in iqs7222_parse_tpad()
2756 if (!dev_desc->event_offset) in iqs7222_parse_tpad()
2760 * The press/release event is determined based on whether the in iqs7222_parse_tpad()
2766 else if (tpad_setup[7] == dev_desc->touch_link) in iqs7222_parse_tpad()
2772 if (!iqs7222->tp_code[0]) in iqs7222_parse_tpad()
2775 input_set_abs_params(iqs7222->keypad, ABS_X, in iqs7222_parse_tpad()
2776 0, (tpad_setup[4] ? : 1) - 1, 0, 0); in iqs7222_parse_tpad()
2778 input_set_abs_params(iqs7222->keypad, ABS_Y, in iqs7222_parse_tpad()
2779 0, (tpad_setup[5] ? : 1) - 1, 0, 0); in iqs7222_parse_tpad()
2781 touchscreen_parse_properties(iqs7222->keypad, false, prop); in iqs7222_parse_tpad()
2783 if (prop->max_x >= U16_MAX || prop->max_y >= U16_MAX) { in iqs7222_parse_tpad()
2784 dev_err(&client->dev, "Invalid trackpad size: %u*%u\n", in iqs7222_parse_tpad()
2785 prop->max_x, prop->max_y); in iqs7222_parse_tpad()
2786 return -EINVAL; in iqs7222_parse_tpad()
2789 tpad_setup[4] = prop->max_x + 1; in iqs7222_parse_tpad()
2790 tpad_setup[5] = prop->max_y + 1; in iqs7222_parse_tpad()
2809 struct i2c_client *client = iqs7222->client; in iqs7222_parse_reg_grp()
2819 reg_grp_node = device_get_named_child_node(&client->dev, in iqs7222_parse_reg_grp()
2822 reg_grp_node = fwnode_handle_get(dev_fwnode(&client->dev)); in iqs7222_parse_reg_grp()
2845 const struct iqs7222_dev_desc *dev_desc = iqs7222->dev_desc; in iqs7222_parse_all()
2846 const struct iqs7222_reg_grp_desc *reg_grps = dev_desc->reg_grps; in iqs7222_parse_all()
2847 u16 *sys_setup = iqs7222->sys_setup; in iqs7222_parse_all()
2850 if (dev_desc->allow_offset) in iqs7222_parse_all()
2851 sys_setup[dev_desc->allow_offset] = U16_MAX; in iqs7222_parse_all()
2853 if (dev_desc->event_offset) in iqs7222_parse_all()
2854 sys_setup[dev_desc->event_offset] = IQS7222_EVENT_MASK_ATI; in iqs7222_parse_all()
2857 u16 *gpio_setup = iqs7222->gpio_setup[i]; in iqs7222_parse_all()
2877 u16 *chan_setup = iqs7222->chan_setup[i]; in iqs7222_parse_all()
2886 u16 *sldr_setup = iqs7222->sldr_setup[i]; in iqs7222_parse_all()
2904 const struct iqs7222_dev_desc *dev_desc = iqs7222->dev_desc; in iqs7222_report()
2905 struct i2c_client *client = iqs7222->client; in iqs7222_report()
2906 int num_chan = dev_desc->reg_grps[IQS7222_REG_GRP_CHAN].num_row; in iqs7222_report()
2907 int num_stat = dev_desc->reg_grps[IQS7222_REG_GRP_STAT].num_col; in iqs7222_report()
2917 dev_err(&client->dev, "Unexpected device reset\n"); in iqs7222_report()
2922 dev_err(&client->dev, "Unexpected ATI error\n"); in iqs7222_report()
2930 u16 *chan_setup = iqs7222->chan_setup[i]; in iqs7222_report()
2946 if (!iqs7222->kp_type[i][j]) in iqs7222_report()
2949 input_event(iqs7222->keypad, in iqs7222_report()
2950 iqs7222->kp_type[i][j], in iqs7222_report()
2951 iqs7222->kp_code[i][j], in iqs7222_report()
2956 for (i = 0; i < dev_desc->reg_grps[IQS7222_REG_GRP_SLDR].num_row; i++) { in iqs7222_report()
2957 u16 *sldr_setup = iqs7222->sldr_setup[i]; in iqs7222_report()
2964 if (sldr_pos < dev_desc->sldr_res) in iqs7222_report()
2965 input_report_abs(iqs7222->keypad, iqs7222->sl_axis[i], in iqs7222_report()
2968 input_report_key(iqs7222->keypad, iqs7222->sl_code[i][0], in iqs7222_report()
2969 sldr_pos < dev_desc->sldr_res); in iqs7222_report()
2975 if (dev_desc->sldr_res == U16_MAX) in iqs7222_report()
2982 * Skip the press/release event, as it does not have separate in iqs7222_report()
2989 input_report_key(iqs7222->keypad, in iqs7222_report()
2990 iqs7222->sl_code[i][j], in iqs7222_report()
2994 input_sync(iqs7222->keypad); in iqs7222_report()
2997 input_report_key(iqs7222->keypad, in iqs7222_report()
2998 iqs7222->sl_code[i][j], 0); in iqs7222_report()
3001 for (i = 0; i < dev_desc->reg_grps[IQS7222_REG_GRP_TPAD].num_row; i++) { in iqs7222_report()
3006 input_report_key(iqs7222->keypad, iqs7222->tp_code[0], in iqs7222_report()
3010 touchscreen_report_pos(iqs7222->keypad, &iqs7222->prop, in iqs7222_report()
3017 * Skip the press/release event, as it does not have separate in iqs7222_report()
3024 input_report_key(iqs7222->keypad, in iqs7222_report()
3025 iqs7222->tp_code[j], in iqs7222_report()
3029 input_sync(iqs7222->keypad); in iqs7222_report()
3032 input_report_key(iqs7222->keypad, in iqs7222_report()
3033 iqs7222->tp_code[j], 0); in iqs7222_report()
3036 input_sync(iqs7222->keypad); in iqs7222_report()
3054 iqs7222 = devm_kzalloc(&client->dev, sizeof(*iqs7222), GFP_KERNEL); in iqs7222_probe()
3056 return -ENOMEM; in iqs7222_probe()
3059 iqs7222->client = client; in iqs7222_probe()
3061 iqs7222->keypad = devm_input_allocate_device(&client->dev); in iqs7222_probe()
3062 if (!iqs7222->keypad) in iqs7222_probe()
3063 return -ENOMEM; in iqs7222_probe()
3065 iqs7222->keypad->name = client->name; in iqs7222_probe()
3066 iqs7222->keypad->id.bustype = BUS_I2C; in iqs7222_probe()
3073 iqs7222->irq_gpio = devm_gpiod_get(&client->dev, "irq", GPIOD_IN); in iqs7222_probe()
3074 if (IS_ERR(iqs7222->irq_gpio)) { in iqs7222_probe()
3075 error = PTR_ERR(iqs7222->irq_gpio); in iqs7222_probe()
3076 dev_err(&client->dev, "Failed to request IRQ GPIO: %d\n", in iqs7222_probe()
3081 iqs7222->reset_gpio = devm_gpiod_get_optional(&client->dev, "reset", in iqs7222_probe()
3083 if (IS_ERR(iqs7222->reset_gpio)) { in iqs7222_probe()
3084 error = PTR_ERR(iqs7222->reset_gpio); in iqs7222_probe()
3085 dev_err(&client->dev, "Failed to request reset GPIO: %d\n", in iqs7222_probe()
3114 error = input_register_device(iqs7222->keypad); in iqs7222_probe()
3116 dev_err(&client->dev, "Failed to register device: %d\n", error); in iqs7222_probe()
3120 irq = gpiod_to_irq(iqs7222->irq_gpio); in iqs7222_probe()
3124 irq_flags = gpiod_is_active_low(iqs7222->irq_gpio) ? IRQF_TRIGGER_LOW in iqs7222_probe()
3128 error = devm_request_threaded_irq(&client->dev, irq, NULL, iqs7222_irq, in iqs7222_probe()
3129 irq_flags, client->name, iqs7222); in iqs7222_probe()
3131 dev_err(&client->dev, "Failed to request IRQ: %d\n", error); in iqs7222_probe()