Lines Matching +full:counts +full:- +full:beta +full:- +full:np

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",
809 .name = "azoteq,conv-period",
817 .name = "azoteq,conv-frac",
825 .name = "azoteq,rx-float-inactive",
833 .name = "azoteq,dead-time-enable",
840 .name = "azoteq,tx-freq-fosc",
847 .name = "azoteq,vbias-enable",
854 .name = "azoteq,sense-mode",
863 .name = "azoteq,iref-enable",
870 .name = "azoteq,iref-level",
878 .name = "azoteq,iref-trim",
886 .name = "azoteq,max-counts",
891 .label = "maximum counts",
894 .name = "azoteq,auto-mode",
902 .name = "azoteq,ati-frac-div-fine",
910 .name = "azoteq,ati-frac-div-coarse",
918 .name = "azoteq,ati-comp-select",
926 .name = "azoteq,ati-band",
934 .name = "azoteq,global-halt",
941 .name = "azoteq,invert-enable",
948 .name = "azoteq,dual-direction",
955 .name = "azoteq,samp-cap-double",
962 .name = "azoteq,vref-half",
969 .name = "azoteq,proj-bias",
977 .name = "azoteq,ati-target",
986 .name = "azoteq,ati-base",
995 .name = "azoteq,ati-mode",
1004 .name = "azoteq,ati-frac-div-fine",
1012 .name = "azoteq,ati-frac-mult-coarse",
1020 .name = "azoteq,ati-frac-div-coarse",
1028 .name = "azoteq,ati-comp-div",
1036 .name = "azoteq,ati-comp-select",
1044 .name = "azoteq,debounce-exit",
1053 .name = "azoteq,debounce-enter",
1090 .name = "azoteq,lta-beta-lp",
1095 .label = "low-power mode long-term average beta",
1098 .name = "azoteq,lta-beta-np",
1103 .label = "normal-power mode long-term average beta",
1106 .name = "azoteq,counts-beta-lp",
1111 .label = "low-power mode counts beta",
1114 .name = "azoteq,counts-beta-np",
1119 .label = "normal-power mode counts beta",
1122 .name = "azoteq,lta-fast-beta-lp",
1127 .label = "low-power mode long-term average fast beta",
1130 .name = "azoteq,lta-fast-beta-np",
1135 .label = "normal-power mode long-term average fast beta",
1138 .name = "azoteq,lower-cal",
1146 .name = "azoteq,static-beta",
1154 .name = "azoteq,bottom-beta",
1160 .label = "bottom beta",
1163 .name = "azoteq,static-beta",
1171 .name = "azoteq,bottom-beta",
1177 .label = "bottom beta",
1180 .name = "azoteq,bottom-speed",
1188 .name = "azoteq,upper-cal",
1196 .name = "azoteq,gesture-max-ms",
1206 .name = "azoteq,gesture-max-ms",
1216 .name = "azoteq,gesture-min-ms",
1226 .name = "azoteq,gesture-min-ms",
1236 .name = "azoteq,gesture-dist",
1246 .name = "azoteq,gesture-dist",
1256 .name = "azoteq,gesture-max-ms",
1266 .name = "azoteq,gesture-max-ms",
1276 .name = "azoteq,num-rows",
1286 .name = "azoteq,num-cols",
1296 .name = "azoteq,lower-cal-y",
1304 .name = "azoteq,lower-cal-x",
1312 .name = "azoteq,upper-cal-y",
1320 .name = "azoteq,upper-cal-x",
1328 .name = "azoteq,top-speed",
1337 .name = "azoteq,bottom-speed",
1345 .name = "azoteq,gesture-min-ms",
1355 .name = "azoteq,gesture-max-ms",
1365 .name = "azoteq,gesture-max-ms",
1375 .name = "azoteq,gesture-dist",
1384 .name = "azoteq,gesture-dist",
1393 .name = "drive-open-drain",
1400 .name = "azoteq,timeout-ati-ms",
1409 .name = "azoteq,rate-ati-ms",
1417 .name = "azoteq,timeout-np-ms",
1422 .label = "normal-power mode timeout",
1425 .name = "azoteq,rate-np-ms",
1431 .label = "normal-power mode report rate",
1434 .name = "azoteq,timeout-lp-ms",
1439 .label = "low-power mode timeout",
1442 .name = "azoteq,rate-lp-ms",
1448 .label = "low-power mode report rate",
1451 .name = "azoteq,timeout-ulp-ms",
1456 .label = "ultra-low-power mode timeout",
1459 .name = "azoteq,rate-ulp-ms",
1465 .label = "ultra-low-power mode report rate",
1497 return iqs7222->cycle_setup[row]; in iqs7222_setup()
1500 return iqs7222->glbl_setup; in iqs7222_setup()
1503 return iqs7222->btn_setup[row]; in iqs7222_setup()
1506 return iqs7222->chan_setup[row]; in iqs7222_setup()
1509 return iqs7222->filt_setup; in iqs7222_setup()
1512 return iqs7222->sldr_setup[row]; in iqs7222_setup()
1515 return iqs7222->tpad_setup; in iqs7222_setup()
1518 return iqs7222->gpio_setup[row]; in iqs7222_setup()
1521 return iqs7222->sys_setup; in iqs7222_setup()
1536 ret = gpiod_get_value_cansleep(iqs7222->irq_gpio); in iqs7222_irq_poll()
1543 return -EBUSY; in iqs7222_irq_poll()
1548 struct i2c_client *client = iqs7222->client; in iqs7222_hard_reset()
1551 if (!iqs7222->reset_gpio) in iqs7222_hard_reset()
1554 gpiod_set_value_cansleep(iqs7222->reset_gpio, 1); in iqs7222_hard_reset()
1557 gpiod_set_value_cansleep(iqs7222->reset_gpio, 0); in iqs7222_hard_reset()
1561 dev_err(&client->dev, "Failed to reset device: %d\n", error); in iqs7222_hard_reset()
1573 * pin. Attempts to do so while RDY is deasserted return an ACK; how- in iqs7222_force_comms()
1576 * Unsolicited communication must be preceded by a special force com- in iqs7222_force_comms()
1584 ret = gpiod_get_value_cansleep(iqs7222->irq_gpio); in iqs7222_force_comms()
1590 ret = i2c_master_send(iqs7222->client, msg_buf, sizeof(msg_buf)); in iqs7222_force_comms()
1593 ret = -EIO; in iqs7222_force_comms()
1611 struct i2c_client *client = iqs7222->client; in iqs7222_read_burst()
1614 .addr = client->addr, in iqs7222_read_burst()
1620 .addr = client->addr, in iqs7222_read_burst()
1642 ret = i2c_transfer(client->adapter, msg, ARRAY_SIZE(msg)); in iqs7222_read_burst()
1645 ret = -EIO; in iqs7222_read_burst()
1652 ret = -ENODATA; in iqs7222_read_burst()
1667 dev_err(&client->dev, in iqs7222_read_burst()
1694 struct i2c_client *client = iqs7222->client; in iqs7222_write_burst()
1699 return -ENOMEM; in iqs7222_write_burst()
1725 ret = -EIO; in iqs7222_write_burst()
1740 dev_err(&client->dev, in iqs7222_write_burst()
1755 struct i2c_client *client = iqs7222->client; in iqs7222_ati_trigger()
1773 * Trigger ATI from streaming and normal-power modes so that in iqs7222_ati_trigger()
1805 * Use stream-in-touch mode if either slider reports in iqs7222_ati_trigger()
1808 sys_setup |= test_bit(EV_ABS, iqs7222->keypad->evbit) in iqs7222_ati_trigger()
1817 dev_err(&client->dev, in iqs7222_ati_trigger()
1823 return -ETIMEDOUT; in iqs7222_ati_trigger()
1828 const struct iqs7222_dev_desc *dev_desc = iqs7222->dev_desc; in iqs7222_dev_init()
1829 int comms_offset = dev_desc->comms_offset; in iqs7222_dev_init()
1835 * may change the reserved fields of the second filter beta register, in iqs7222_dev_init()
1838 * Writing the second filter beta register, in turn, may clobber the in iqs7222_dev_init()
1839 * system status register. As such, the filter beta register pair is in iqs7222_dev_init()
1843 u16 reg = dev_desc->reg_grps[IQS7222_REG_GRP_FILT].base + 1; in iqs7222_dev_init()
1847 iqs7222->sys_setup[0] | in iqs7222_dev_init()
1856 iqs7222->filt_setup[1] &= GENMASK(7, 0); in iqs7222_dev_init()
1857 iqs7222->filt_setup[1] |= (filt_setup & ~GENMASK(7, 0)); in iqs7222_dev_init()
1861 * Take advantage of the stop-bit disable function, if available, to in iqs7222_dev_init()
1882 int num_row = dev_desc->reg_grps[i].num_row; in iqs7222_dev_init()
1883 int num_col = dev_desc->reg_grps[i].num_col; in iqs7222_dev_init()
1884 u16 reg = dev_desc->reg_grps[i].base; in iqs7222_dev_init()
1897 return -ENOMEM; in iqs7222_dev_init()
1916 error = -EINVAL; in iqs7222_dev_init()
1949 iqs7222->sys_setup[0] &= ~IQS7222_SYS_SETUP_INTF_MODE_MASK; in iqs7222_dev_init()
1950 iqs7222->sys_setup[0] &= ~IQS7222_SYS_SETUP_PWR_MODE_MASK; in iqs7222_dev_init()
1959 struct i2c_client *client = iqs7222->client; in iqs7222_dev_info()
1981 iqs7222->dev_desc = &iqs7222_devs[i]; in iqs7222_dev_info()
1986 dev_err(&client->dev, "Unsupported firmware revision: %u.%u\n", in iqs7222_dev_info()
1989 dev_err(&client->dev, "Unrecognized product number: %u\n", in iqs7222_dev_info()
1992 return -EINVAL; in iqs7222_dev_info()
1999 const struct iqs7222_dev_desc *dev_desc = iqs7222->dev_desc; in iqs7222_gpio_select()
2000 struct i2c_client *client = iqs7222->client; in iqs7222_gpio_select()
2001 int num_gpio = dev_desc->reg_grps[IQS7222_REG_GRP_GPIO].num_row; in iqs7222_gpio_select()
2008 if (!fwnode_property_present(child_node, "azoteq,gpio-select")) in iqs7222_gpio_select()
2011 count = fwnode_property_count_u32(child_node, "azoteq,gpio-select"); in iqs7222_gpio_select()
2013 dev_err(&client->dev, "Invalid number of %s GPIOs\n", in iqs7222_gpio_select()
2015 return -EINVAL; in iqs7222_gpio_select()
2017 dev_err(&client->dev, "Failed to count %s GPIOs: %d\n", in iqs7222_gpio_select()
2023 "azoteq,gpio-select", in iqs7222_gpio_select()
2026 dev_err(&client->dev, "Failed to read %s GPIOs: %d\n", in iqs7222_gpio_select()
2035 dev_err(&client->dev, "Invalid %s GPIO: %u\n", in iqs7222_gpio_select()
2037 return -EINVAL; in iqs7222_gpio_select()
2040 gpio_setup = iqs7222->gpio_setup[gpio_sel[i]]; in iqs7222_gpio_select()
2043 dev_err(&client->dev, in iqs7222_gpio_select()
2046 return -EINVAL; in iqs7222_gpio_select()
2064 struct i2c_client *client = iqs7222->client; in iqs7222_parse_props()
2116 dev_err(&client->dev, "Failed to read %s %s: %d\n", in iqs7222_parse_props()
2122 val_max = GENMASK(reg_width - 1, 0) * val_pitch; in iqs7222_parse_props()
2125 dev_err(&client->dev, "Invalid %s %s: %u\n", in iqs7222_parse_props()
2127 return -EINVAL; in iqs7222_parse_props()
2130 setup[reg_offset] &= ~GENMASK(reg_shift + reg_width - 1, in iqs7222_parse_props()
2147 struct i2c_client *client = iqs7222->client; in iqs7222_parse_event()
2161 if (error == -EINVAL) { in iqs7222_parse_event()
2164 dev_err(&client->dev, "Failed to read %s code: %d\n", in iqs7222_parse_event()
2170 input_set_capability(iqs7222->keypad, EV_KEY, *event_code); in iqs7222_parse_event()
2174 error = fwnode_property_read_u32(event_node, "linux,input-type", in iqs7222_parse_event()
2176 if (error == -EINVAL) { in iqs7222_parse_event()
2179 dev_err(&client->dev, "Failed to read %s input type: %d\n", in iqs7222_parse_event()
2183 dev_err(&client->dev, "Invalid %s input type: %d\n", in iqs7222_parse_event()
2185 return -EINVAL; in iqs7222_parse_event()
2188 input_set_capability(iqs7222->keypad, *event_type, *event_code); in iqs7222_parse_event()
2196 u16 *cycle_setup = iqs7222->cycle_setup[cycle_index]; in iqs7222_parse_cycle()
2197 struct i2c_client *client = iqs7222->client; in iqs7222_parse_cycle()
2208 * CTx pins (CTx0-8). in iqs7222_parse_cycle()
2210 if (!fwnode_property_present(cycle_node, "azoteq,tx-enable")) in iqs7222_parse_cycle()
2213 count = fwnode_property_count_u32(cycle_node, "azoteq,tx-enable"); in iqs7222_parse_cycle()
2215 dev_err(&client->dev, "Failed to count %s CTx pins: %d\n", in iqs7222_parse_cycle()
2219 dev_err(&client->dev, "Invalid number of %s CTx pins\n", in iqs7222_parse_cycle()
2221 return -EINVAL; in iqs7222_parse_cycle()
2224 error = fwnode_property_read_u32_array(cycle_node, "azoteq,tx-enable", in iqs7222_parse_cycle()
2227 dev_err(&client->dev, "Failed to read %s CTx pins: %d\n", in iqs7222_parse_cycle()
2232 cycle_setup[1] &= ~GENMASK(7 + ARRAY_SIZE(pins) - 1, 7); in iqs7222_parse_cycle()
2236 dev_err(&client->dev, "Invalid %s CTx pin: %u\n", in iqs7222_parse_cycle()
2238 return -EINVAL; in iqs7222_parse_cycle()
2250 const struct iqs7222_dev_desc *dev_desc = iqs7222->dev_desc; in iqs7222_parse_chan()
2251 struct i2c_client *client = iqs7222->client; in iqs7222_parse_chan()
2252 int num_chan = dev_desc->reg_grps[IQS7222_REG_GRP_CHAN].num_row; in iqs7222_parse_chan()
2255 u16 *chan_setup = iqs7222->chan_setup[chan_index]; in iqs7222_parse_chan()
2256 u16 *sys_setup = iqs7222->sys_setup; in iqs7222_parse_chan()
2259 if (dev_desc->allow_offset && in iqs7222_parse_chan()
2260 fwnode_property_present(chan_node, "azoteq,ulp-allow")) in iqs7222_parse_chan()
2261 sys_setup[dev_desc->allow_offset] &= ~BIT(chan_index); in iqs7222_parse_chan()
2269 if (dev_desc->reg_grps[IQS7222_REG_GRP_CHAN].num_col > 4 && in iqs7222_parse_chan()
2270 fwnode_property_present(chan_node, "azoteq,ref-select")) { in iqs7222_parse_chan()
2273 error = fwnode_property_read_u32(chan_node, "azoteq,ref-select", in iqs7222_parse_chan()
2276 dev_err(&client->dev, in iqs7222_parse_chan()
2283 dev_err(&client->dev, in iqs7222_parse_chan()
2286 return -EINVAL; in iqs7222_parse_chan()
2289 ref_setup = iqs7222->chan_setup[val]; in iqs7222_parse_chan()
2298 error = fwnode_property_read_u32(chan_node, "azoteq,ref-weight", in iqs7222_parse_chan()
2302 dev_err(&client->dev, in iqs7222_parse_chan()
2305 return -EINVAL; in iqs7222_parse_chan()
2309 } else if (error != -EINVAL) { in iqs7222_parse_chan()
2310 dev_err(&client->dev, in iqs7222_parse_chan()
2323 ref_setup[4] = dev_desc->touch_link; in iqs7222_parse_chan()
2324 if (fwnode_property_present(chan_node, "azoteq,use-prox")) in iqs7222_parse_chan()
2325 ref_setup[4] -= 2; in iqs7222_parse_chan()
2326 } else if (dev_desc->reg_grps[IQS7222_REG_GRP_TPAD].num_row && in iqs7222_parse_chan()
2328 "azoteq,counts-filt-enable")) { in iqs7222_parse_chan()
2331 * is partially repurposed as a counts filter enable control. in iqs7222_parse_chan()
2336 if (fwnode_property_present(chan_node, "azoteq,rx-enable")) { in iqs7222_parse_chan()
2339 * the channels can use CRx0-3, while the second half can use in iqs7222_parse_chan()
2340 * CRx4-7. in iqs7222_parse_chan()
2346 "azoteq,rx-enable"); in iqs7222_parse_chan()
2348 dev_err(&client->dev, in iqs7222_parse_chan()
2353 dev_err(&client->dev, in iqs7222_parse_chan()
2356 return -EINVAL; in iqs7222_parse_chan()
2360 "azoteq,rx-enable", in iqs7222_parse_chan()
2363 dev_err(&client->dev, in iqs7222_parse_chan()
2369 chan_setup[0] &= ~GENMASK(4 + ARRAY_SIZE(pins) - 1, 4); in iqs7222_parse_chan()
2375 dev_err(&client->dev, in iqs7222_parse_chan()
2378 return -EINVAL; in iqs7222_parse_chan()
2381 chan_setup[0] |= BIT(pins[i] + 4 - min_crx); in iqs7222_parse_chan()
2395 "azoteq,timeout-press-ms", in iqs7222_parse_chan()
2400 * registers as opposed to channel-specific registers. in iqs7222_parse_chan()
2402 u16 *setup = dev_desc->reg_grps in iqs7222_parse_chan()
2404 &iqs7222->btn_setup[chan_index][2] : in iqs7222_parse_chan()
2408 dev_err(&client->dev, in iqs7222_parse_chan()
2411 return -EINVAL; in iqs7222_parse_chan()
2416 } else if (error != -EINVAL) { in iqs7222_parse_chan()
2417 dev_err(&client->dev, in iqs7222_parse_chan()
2427 dev_desc->touch_link - (i ? 0 : 2), in iqs7222_parse_chan()
2428 &iqs7222->kp_type[chan_index][i], in iqs7222_parse_chan()
2429 &iqs7222->kp_code[chan_index][i]); in iqs7222_parse_chan()
2433 if (!dev_desc->event_offset) in iqs7222_parse_chan()
2436 sys_setup[dev_desc->event_offset] |= event_enable; in iqs7222_parse_chan()
2451 const struct iqs7222_dev_desc *dev_desc = iqs7222->dev_desc; in iqs7222_parse_sldr()
2452 struct i2c_client *client = iqs7222->client; in iqs7222_parse_sldr()
2453 int num_chan = dev_desc->reg_grps[IQS7222_REG_GRP_CHAN].num_row; in iqs7222_parse_sldr()
2456 u16 *event_mask = &iqs7222->sys_setup[dev_desc->event_offset]; in iqs7222_parse_sldr()
2457 u16 *sldr_setup = iqs7222->sldr_setup[sldr_index]; in iqs7222_parse_sldr()
2465 count = fwnode_property_count_u32(sldr_node, "azoteq,channel-select"); in iqs7222_parse_sldr()
2467 dev_err(&client->dev, "Failed to count %s channels: %d\n", in iqs7222_parse_sldr()
2471 dev_err(&client->dev, "Invalid number of %s channels\n", in iqs7222_parse_sldr()
2473 return -EINVAL; in iqs7222_parse_sldr()
2477 "azoteq,channel-select", in iqs7222_parse_sldr()
2480 dev_err(&client->dev, "Failed to read %s channels: %d\n", in iqs7222_parse_sldr()
2488 * the slider-related register addresses are offset by one. in iqs7222_parse_sldr()
2490 reg_offset = dev_desc->sldr_res < U16_MAX ? 0 : 1; in iqs7222_parse_sldr()
2493 sldr_setup[3 + reg_offset] &= ~GENMASK(ext_chan - 1, 0); in iqs7222_parse_sldr()
2501 dev_err(&client->dev, "Invalid %s channel: %u\n", in iqs7222_parse_sldr()
2503 return -EINVAL; in iqs7222_parse_sldr()
2514 sldr_setup[4 + reg_offset] = dev_desc->touch_link; in iqs7222_parse_sldr()
2515 if (fwnode_property_present(sldr_node, "azoteq,use-prox")) in iqs7222_parse_sldr()
2516 sldr_setup[4 + reg_offset] -= 2; in iqs7222_parse_sldr()
2518 error = fwnode_property_read_u32(sldr_node, "azoteq,slider-size", &val); in iqs7222_parse_sldr()
2520 if (val > dev_desc->sldr_res) { in iqs7222_parse_sldr()
2521 dev_err(&client->dev, "Invalid %s size: %u\n", in iqs7222_parse_sldr()
2523 return -EINVAL; in iqs7222_parse_sldr()
2533 } else if (error != -EINVAL) { in iqs7222_parse_sldr()
2534 dev_err(&client->dev, "Failed to read %s size: %d\n", in iqs7222_parse_sldr()
2541 dev_err(&client->dev, "Undefined %s size\n", in iqs7222_parse_sldr()
2543 return -EINVAL; in iqs7222_parse_sldr()
2546 error = fwnode_property_read_u32(sldr_node, "azoteq,top-speed", &val); in iqs7222_parse_sldr()
2549 dev_err(&client->dev, "Invalid %s top speed: %u\n", in iqs7222_parse_sldr()
2551 return -EINVAL; in iqs7222_parse_sldr()
2560 } else if (error != -EINVAL) { in iqs7222_parse_sldr()
2561 dev_err(&client->dev, "Failed to read %s top speed: %d\n", in iqs7222_parse_sldr()
2568 u16 sldr_max = sldr_setup[3] - 1; in iqs7222_parse_sldr()
2576 sldr_max = sldr_max * 16 - 1; in iqs7222_parse_sldr()
2579 input_set_abs_params(iqs7222->keypad, val, 0, sldr_max, 0, 0); in iqs7222_parse_sldr()
2580 iqs7222->sl_axis[sldr_index] = val; in iqs7222_parse_sldr()
2581 } else if (error != -EINVAL) { in iqs7222_parse_sldr()
2582 dev_err(&client->dev, "Failed to read %s axis: %d\n", in iqs7222_parse_sldr()
2587 if (dev_desc->wheel_enable) { in iqs7222_parse_sldr()
2588 sldr_setup[0] &= ~dev_desc->wheel_enable; in iqs7222_parse_sldr()
2589 if (iqs7222->sl_axis[sldr_index] == ABS_WHEEL) in iqs7222_parse_sldr()
2590 sldr_setup[0] |= dev_desc->wheel_enable; in iqs7222_parse_sldr()
2617 else if (dev_desc->legacy_gesture && in iqs7222_parse_sldr()
2620 else if (dev_desc->legacy_gesture && in iqs7222_parse_sldr()
2638 &iqs7222->sl_code[sldr_index][i]); in iqs7222_parse_sldr()
2645 if (!dev_desc->event_offset) in iqs7222_parse_sldr()
2655 else if (sldr_setup[4 + reg_offset] == dev_desc->touch_link) in iqs7222_parse_sldr()
2667 dev_desc->wheel_enable ? in iqs7222_parse_sldr()
2675 const struct iqs7222_dev_desc *dev_desc = iqs7222->dev_desc; in iqs7222_parse_tpad()
2676 struct touchscreen_properties *prop = &iqs7222->prop; in iqs7222_parse_tpad()
2677 struct i2c_client *client = iqs7222->client; in iqs7222_parse_tpad()
2678 int num_chan = dev_desc->reg_grps[IQS7222_REG_GRP_CHAN].num_row; in iqs7222_parse_tpad()
2680 u16 *event_mask = &iqs7222->sys_setup[dev_desc->event_offset]; in iqs7222_parse_tpad()
2681 u16 *tpad_setup = iqs7222->tpad_setup; in iqs7222_parse_tpad()
2690 count = fwnode_property_count_u32(tpad_node, "azoteq,channel-select"); in iqs7222_parse_tpad()
2692 dev_err(&client->dev, "Failed to count %s channels: %d\n", in iqs7222_parse_tpad()
2696 dev_err(&client->dev, "Invalid number of %s channels\n", in iqs7222_parse_tpad()
2698 return -EINVAL; in iqs7222_parse_tpad()
2702 "azoteq,channel-select", in iqs7222_parse_tpad()
2705 dev_err(&client->dev, "Failed to read %s channels: %d\n", in iqs7222_parse_tpad()
2710 tpad_setup[6] &= ~GENMASK(num_chan - 1, 0); in iqs7222_parse_tpad()
2718 dev_err(&client->dev, "Invalid %s channel: %u\n", in iqs7222_parse_tpad()
2720 return -EINVAL; in iqs7222_parse_tpad()
2731 tpad_setup[7] = dev_desc->touch_link; in iqs7222_parse_tpad()
2732 if (fwnode_property_present(tpad_node, "azoteq,use-prox")) in iqs7222_parse_tpad()
2733 tpad_setup[7] -= 2; in iqs7222_parse_tpad()
2748 "azoteq,gesture-angle-tighten")) in iqs7222_parse_tpad()
2758 &iqs7222->tp_code[i]); in iqs7222_parse_tpad()
2762 if (!dev_desc->event_offset) in iqs7222_parse_tpad()
2772 else if (tpad_setup[7] == dev_desc->touch_link) in iqs7222_parse_tpad()
2778 if (!iqs7222->tp_code[0]) in iqs7222_parse_tpad()
2781 input_set_abs_params(iqs7222->keypad, ABS_X, in iqs7222_parse_tpad()
2782 0, (tpad_setup[4] ? : 1) - 1, 0, 0); in iqs7222_parse_tpad()
2784 input_set_abs_params(iqs7222->keypad, ABS_Y, in iqs7222_parse_tpad()
2785 0, (tpad_setup[5] ? : 1) - 1, 0, 0); in iqs7222_parse_tpad()
2787 touchscreen_parse_properties(iqs7222->keypad, false, prop); in iqs7222_parse_tpad()
2789 if (prop->max_x >= U16_MAX || prop->max_y >= U16_MAX) { in iqs7222_parse_tpad()
2790 dev_err(&client->dev, "Invalid trackpad size: %u*%u\n", in iqs7222_parse_tpad()
2791 prop->max_x, prop->max_y); in iqs7222_parse_tpad()
2792 return -EINVAL; in iqs7222_parse_tpad()
2795 tpad_setup[4] = prop->max_x + 1; in iqs7222_parse_tpad()
2796 tpad_setup[5] = prop->max_y + 1; in iqs7222_parse_tpad()
2815 struct i2c_client *client = iqs7222->client; in iqs7222_parse_reg_grp()
2825 reg_grp_node = device_get_named_child_node(&client->dev, in iqs7222_parse_reg_grp()
2828 reg_grp_node = fwnode_handle_get(dev_fwnode(&client->dev)); in iqs7222_parse_reg_grp()
2851 const struct iqs7222_dev_desc *dev_desc = iqs7222->dev_desc; in iqs7222_parse_all()
2852 const struct iqs7222_reg_grp_desc *reg_grps = dev_desc->reg_grps; in iqs7222_parse_all()
2853 u16 *sys_setup = iqs7222->sys_setup; in iqs7222_parse_all()
2856 if (dev_desc->allow_offset) in iqs7222_parse_all()
2857 sys_setup[dev_desc->allow_offset] = U16_MAX; in iqs7222_parse_all()
2859 if (dev_desc->event_offset) in iqs7222_parse_all()
2860 sys_setup[dev_desc->event_offset] = IQS7222_EVENT_MASK_ATI; in iqs7222_parse_all()
2863 u16 *gpio_setup = iqs7222->gpio_setup[i]; in iqs7222_parse_all()
2883 u16 *chan_setup = iqs7222->chan_setup[i]; in iqs7222_parse_all()
2892 u16 *sldr_setup = iqs7222->sldr_setup[i]; in iqs7222_parse_all()
2910 const struct iqs7222_dev_desc *dev_desc = iqs7222->dev_desc; in iqs7222_report()
2911 struct i2c_client *client = iqs7222->client; in iqs7222_report()
2912 int num_chan = dev_desc->reg_grps[IQS7222_REG_GRP_CHAN].num_row; in iqs7222_report()
2913 int num_stat = dev_desc->reg_grps[IQS7222_REG_GRP_STAT].num_col; in iqs7222_report()
2923 dev_err(&client->dev, "Unexpected device reset\n"); in iqs7222_report()
2928 dev_err(&client->dev, "Unexpected ATI error\n"); in iqs7222_report()
2936 u16 *chan_setup = iqs7222->chan_setup[i]; in iqs7222_report()
2952 if (!iqs7222->kp_type[i][j]) in iqs7222_report()
2955 input_event(iqs7222->keypad, in iqs7222_report()
2956 iqs7222->kp_type[i][j], in iqs7222_report()
2957 iqs7222->kp_code[i][j], in iqs7222_report()
2962 for (i = 0; i < dev_desc->reg_grps[IQS7222_REG_GRP_SLDR].num_row; i++) { in iqs7222_report()
2963 u16 *sldr_setup = iqs7222->sldr_setup[i]; in iqs7222_report()
2970 if (sldr_pos < dev_desc->sldr_res) in iqs7222_report()
2971 input_report_abs(iqs7222->keypad, iqs7222->sl_axis[i], in iqs7222_report()
2974 input_report_key(iqs7222->keypad, iqs7222->sl_code[i][0], in iqs7222_report()
2975 sldr_pos < dev_desc->sldr_res); in iqs7222_report()
2981 if (dev_desc->sldr_res == U16_MAX) in iqs7222_report()
2995 input_report_key(iqs7222->keypad, in iqs7222_report()
2996 iqs7222->sl_code[i][j], in iqs7222_report()
3000 input_sync(iqs7222->keypad); in iqs7222_report()
3003 input_report_key(iqs7222->keypad, in iqs7222_report()
3004 iqs7222->sl_code[i][j], 0); in iqs7222_report()
3007 for (i = 0; i < dev_desc->reg_grps[IQS7222_REG_GRP_TPAD].num_row; i++) { in iqs7222_report()
3012 input_report_key(iqs7222->keypad, iqs7222->tp_code[0], in iqs7222_report()
3016 touchscreen_report_pos(iqs7222->keypad, &iqs7222->prop, in iqs7222_report()
3030 input_report_key(iqs7222->keypad, in iqs7222_report()
3031 iqs7222->tp_code[j], in iqs7222_report()
3035 input_sync(iqs7222->keypad); in iqs7222_report()
3038 input_report_key(iqs7222->keypad, in iqs7222_report()
3039 iqs7222->tp_code[j], 0); in iqs7222_report()
3042 input_sync(iqs7222->keypad); in iqs7222_report()
3060 iqs7222 = devm_kzalloc(&client->dev, sizeof(*iqs7222), GFP_KERNEL); in iqs7222_probe()
3062 return -ENOMEM; in iqs7222_probe()
3065 iqs7222->client = client; in iqs7222_probe()
3067 iqs7222->keypad = devm_input_allocate_device(&client->dev); in iqs7222_probe()
3068 if (!iqs7222->keypad) in iqs7222_probe()
3069 return -ENOMEM; in iqs7222_probe()
3071 iqs7222->keypad->name = client->name; in iqs7222_probe()
3072 iqs7222->keypad->id.bustype = BUS_I2C; in iqs7222_probe()
3079 iqs7222->irq_gpio = devm_gpiod_get(&client->dev, "irq", GPIOD_IN); in iqs7222_probe()
3080 if (IS_ERR(iqs7222->irq_gpio)) { in iqs7222_probe()
3081 error = PTR_ERR(iqs7222->irq_gpio); in iqs7222_probe()
3082 dev_err(&client->dev, "Failed to request IRQ GPIO: %d\n", in iqs7222_probe()
3087 iqs7222->reset_gpio = devm_gpiod_get_optional(&client->dev, "reset", in iqs7222_probe()
3089 if (IS_ERR(iqs7222->reset_gpio)) { in iqs7222_probe()
3090 error = PTR_ERR(iqs7222->reset_gpio); in iqs7222_probe()
3091 dev_err(&client->dev, "Failed to request reset GPIO: %d\n", in iqs7222_probe()
3120 error = input_register_device(iqs7222->keypad); in iqs7222_probe()
3122 dev_err(&client->dev, "Failed to register device: %d\n", error); in iqs7222_probe()
3126 irq = gpiod_to_irq(iqs7222->irq_gpio); in iqs7222_probe()
3130 irq_flags = gpiod_is_active_low(iqs7222->irq_gpio) ? IRQF_TRIGGER_LOW in iqs7222_probe()
3134 error = devm_request_threaded_irq(&client->dev, irq, NULL, iqs7222_irq, in iqs7222_probe()
3135 irq_flags, client->name, iqs7222); in iqs7222_probe()
3137 dev_err(&client->dev, "Failed to request IRQ: %d\n", error); in iqs7222_probe()