Lines Matching +full:their +full:- +full:claim +full:- +full:gpios
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",
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",
1163 .name = "azoteq,static-beta",
1171 .name = "azoteq,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()
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()
2093 * their corresponding properties are present. 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()
2207 * based on channel number, any cycle can claim any of the device's 9 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()
2336 if (fwnode_property_present(chan_node, "azoteq,rx-enable")) { in iqs7222_parse_chan()
2338 * Each channel can claim up to 4 CRx pins. The first half of 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()
2412 return -EINVAL; in iqs7222_parse_chan()
2417 } else if (error != -EINVAL) { in iqs7222_parse_chan()
2418 dev_err(&client->dev, in iqs7222_parse_chan()
2429 dev_desc->touch_link - (i ? 0 : 2), in iqs7222_parse_chan()
2430 &iqs7222->kp_type[chan_index][i], in iqs7222_parse_chan()
2431 &iqs7222->kp_code[chan_index][i]); in iqs7222_parse_chan()
2436 if (!dev_desc->event_offset) in iqs7222_parse_chan()
2439 sys_setup[dev_desc->event_offset] |= event_enable; in iqs7222_parse_chan()
2454 const struct iqs7222_dev_desc *dev_desc = iqs7222->dev_desc; in iqs7222_parse_sldr()
2455 struct i2c_client *client = iqs7222->client; in iqs7222_parse_sldr()
2456 int num_chan = dev_desc->reg_grps[IQS7222_REG_GRP_CHAN].num_row; in iqs7222_parse_sldr()
2459 u16 *event_mask = &iqs7222->sys_setup[dev_desc->event_offset]; in iqs7222_parse_sldr()
2460 u16 *sldr_setup = iqs7222->sldr_setup[sldr_index]; in iqs7222_parse_sldr()
2468 count = fwnode_property_count_u32(sldr_node, "azoteq,channel-select"); in iqs7222_parse_sldr()
2470 dev_err(&client->dev, "Failed to count %s channels: %d\n", in iqs7222_parse_sldr()
2474 dev_err(&client->dev, "Invalid number of %s channels\n", in iqs7222_parse_sldr()
2476 return -EINVAL; in iqs7222_parse_sldr()
2480 "azoteq,channel-select", in iqs7222_parse_sldr()
2483 dev_err(&client->dev, "Failed to read %s channels: %d\n", in iqs7222_parse_sldr()
2491 * the slider-related register addresses are offset by one. in iqs7222_parse_sldr()
2493 reg_offset = dev_desc->sldr_res < U16_MAX ? 0 : 1; in iqs7222_parse_sldr()
2496 sldr_setup[3 + reg_offset] &= ~GENMASK(ext_chan - 1, 0); in iqs7222_parse_sldr()
2504 dev_err(&client->dev, "Invalid %s channel: %u\n", in iqs7222_parse_sldr()
2506 return -EINVAL; in iqs7222_parse_sldr()
2517 sldr_setup[4 + reg_offset] = dev_desc->touch_link; in iqs7222_parse_sldr()
2518 if (fwnode_property_present(sldr_node, "azoteq,use-prox")) in iqs7222_parse_sldr()
2519 sldr_setup[4 + reg_offset] -= 2; in iqs7222_parse_sldr()
2521 error = fwnode_property_read_u32(sldr_node, "azoteq,slider-size", &val); in iqs7222_parse_sldr()
2523 if (val > dev_desc->sldr_res) { in iqs7222_parse_sldr()
2524 dev_err(&client->dev, "Invalid %s size: %u\n", in iqs7222_parse_sldr()
2526 return -EINVAL; in iqs7222_parse_sldr()
2536 } else if (error != -EINVAL) { in iqs7222_parse_sldr()
2537 dev_err(&client->dev, "Failed to read %s size: %d\n", in iqs7222_parse_sldr()
2544 dev_err(&client->dev, "Undefined %s size\n", in iqs7222_parse_sldr()
2546 return -EINVAL; in iqs7222_parse_sldr()
2549 error = fwnode_property_read_u32(sldr_node, "azoteq,top-speed", &val); in iqs7222_parse_sldr()
2552 dev_err(&client->dev, "Invalid %s top speed: %u\n", in iqs7222_parse_sldr()
2554 return -EINVAL; in iqs7222_parse_sldr()
2563 } else if (error != -EINVAL) { in iqs7222_parse_sldr()
2564 dev_err(&client->dev, "Failed to read %s top speed: %d\n", in iqs7222_parse_sldr()
2571 u16 sldr_max = sldr_setup[3] - 1; in iqs7222_parse_sldr()
2579 sldr_max = sldr_max * 16 - 1; in iqs7222_parse_sldr()
2582 input_set_abs_params(iqs7222->keypad, val, 0, sldr_max, 0, 0); in iqs7222_parse_sldr()
2583 iqs7222->sl_axis[sldr_index] = val; in iqs7222_parse_sldr()
2584 } else if (error != -EINVAL) { in iqs7222_parse_sldr()
2585 dev_err(&client->dev, "Failed to read %s axis: %d\n", in iqs7222_parse_sldr()
2590 if (dev_desc->wheel_enable) { in iqs7222_parse_sldr()
2591 sldr_setup[0] &= ~dev_desc->wheel_enable; in iqs7222_parse_sldr()
2592 if (iqs7222->sl_axis[sldr_index] == ABS_WHEEL) in iqs7222_parse_sldr()
2593 sldr_setup[0] |= dev_desc->wheel_enable; in iqs7222_parse_sldr()
2620 else if (dev_desc->legacy_gesture && in iqs7222_parse_sldr()
2623 else if (dev_desc->legacy_gesture && in iqs7222_parse_sldr()
2641 &iqs7222->sl_code[sldr_index][i]); in iqs7222_parse_sldr()
2649 if (!dev_desc->event_offset) in iqs7222_parse_sldr()
2659 else if (sldr_setup[4 + reg_offset] == dev_desc->touch_link) in iqs7222_parse_sldr()
2671 dev_desc->wheel_enable ? in iqs7222_parse_sldr()
2679 const struct iqs7222_dev_desc *dev_desc = iqs7222->dev_desc; in iqs7222_parse_tpad()
2680 struct touchscreen_properties *prop = &iqs7222->prop; in iqs7222_parse_tpad()
2681 struct i2c_client *client = iqs7222->client; in iqs7222_parse_tpad()
2682 int num_chan = dev_desc->reg_grps[IQS7222_REG_GRP_CHAN].num_row; in iqs7222_parse_tpad()
2684 u16 *event_mask = &iqs7222->sys_setup[dev_desc->event_offset]; in iqs7222_parse_tpad()
2685 u16 *tpad_setup = iqs7222->tpad_setup; in iqs7222_parse_tpad()
2694 count = fwnode_property_count_u32(tpad_node, "azoteq,channel-select"); in iqs7222_parse_tpad()
2696 dev_err(&client->dev, "Failed to count %s channels: %d\n", in iqs7222_parse_tpad()
2700 dev_err(&client->dev, "Invalid number of %s channels\n", in iqs7222_parse_tpad()
2702 return -EINVAL; in iqs7222_parse_tpad()
2706 "azoteq,channel-select", in iqs7222_parse_tpad()
2709 dev_err(&client->dev, "Failed to read %s channels: %d\n", in iqs7222_parse_tpad()
2714 tpad_setup[6] &= ~GENMASK(num_chan - 1, 0); in iqs7222_parse_tpad()
2722 dev_err(&client->dev, "Invalid %s channel: %u\n", in iqs7222_parse_tpad()
2724 return -EINVAL; in iqs7222_parse_tpad()
2735 tpad_setup[7] = dev_desc->touch_link; in iqs7222_parse_tpad()
2736 if (fwnode_property_present(tpad_node, "azoteq,use-prox")) in iqs7222_parse_tpad()
2737 tpad_setup[7] -= 2; in iqs7222_parse_tpad()
2752 "azoteq,gesture-angle-tighten")) in iqs7222_parse_tpad()
2762 &iqs7222->tp_code[i]); in iqs7222_parse_tpad()
2767 if (!dev_desc->event_offset) in iqs7222_parse_tpad()
2777 else if (tpad_setup[7] == dev_desc->touch_link) in iqs7222_parse_tpad()
2783 if (!iqs7222->tp_code[0]) in iqs7222_parse_tpad()
2786 input_set_abs_params(iqs7222->keypad, ABS_X, in iqs7222_parse_tpad()
2787 0, (tpad_setup[4] ? : 1) - 1, 0, 0); in iqs7222_parse_tpad()
2789 input_set_abs_params(iqs7222->keypad, ABS_Y, in iqs7222_parse_tpad()
2790 0, (tpad_setup[5] ? : 1) - 1, 0, 0); in iqs7222_parse_tpad()
2792 touchscreen_parse_properties(iqs7222->keypad, false, prop); in iqs7222_parse_tpad()
2794 if (prop->max_x >= U16_MAX || prop->max_y >= U16_MAX) { in iqs7222_parse_tpad()
2795 dev_err(&client->dev, "Invalid trackpad size: %u*%u\n", in iqs7222_parse_tpad()
2796 prop->max_x, prop->max_y); in iqs7222_parse_tpad()
2797 return -EINVAL; in iqs7222_parse_tpad()
2800 tpad_setup[4] = prop->max_x + 1; in iqs7222_parse_tpad()
2801 tpad_setup[5] = prop->max_y + 1; in iqs7222_parse_tpad()
2820 struct i2c_client *client = iqs7222->client; in iqs7222_parse_reg_grp()
2830 reg_grp_node = device_get_named_child_node(&client->dev, in iqs7222_parse_reg_grp()
2833 reg_grp_node = fwnode_handle_get(dev_fwnode(&client->dev)); in iqs7222_parse_reg_grp()
2853 const struct iqs7222_dev_desc *dev_desc = iqs7222->dev_desc; in iqs7222_parse_all()
2854 const struct iqs7222_reg_grp_desc *reg_grps = dev_desc->reg_grps; in iqs7222_parse_all()
2855 u16 *sys_setup = iqs7222->sys_setup; in iqs7222_parse_all()
2858 if (dev_desc->allow_offset) in iqs7222_parse_all()
2859 sys_setup[dev_desc->allow_offset] = U16_MAX; in iqs7222_parse_all()
2861 if (dev_desc->event_offset) in iqs7222_parse_all()
2862 sys_setup[dev_desc->event_offset] = IQS7222_EVENT_MASK_ATI; in iqs7222_parse_all()
2865 u16 *gpio_setup = iqs7222->gpio_setup[i]; in iqs7222_parse_all()
2885 u16 *chan_setup = iqs7222->chan_setup[i]; in iqs7222_parse_all()
2894 u16 *sldr_setup = iqs7222->sldr_setup[i]; in iqs7222_parse_all()
2912 const struct iqs7222_dev_desc *dev_desc = iqs7222->dev_desc; in iqs7222_report()
2913 struct i2c_client *client = iqs7222->client; in iqs7222_report()
2914 int num_chan = dev_desc->reg_grps[IQS7222_REG_GRP_CHAN].num_row; in iqs7222_report()
2915 int num_stat = dev_desc->reg_grps[IQS7222_REG_GRP_STAT].num_col; in iqs7222_report()
2925 dev_err(&client->dev, "Unexpected device reset\n"); in iqs7222_report()
2930 dev_err(&client->dev, "Unexpected ATI error\n"); in iqs7222_report()
2938 u16 *chan_setup = iqs7222->chan_setup[i]; in iqs7222_report()
2954 if (!iqs7222->kp_type[i][j]) in iqs7222_report()
2957 input_event(iqs7222->keypad, in iqs7222_report()
2958 iqs7222->kp_type[i][j], in iqs7222_report()
2959 iqs7222->kp_code[i][j], in iqs7222_report()
2964 for (i = 0; i < dev_desc->reg_grps[IQS7222_REG_GRP_SLDR].num_row; i++) { in iqs7222_report()
2965 u16 *sldr_setup = iqs7222->sldr_setup[i]; in iqs7222_report()
2972 if (sldr_pos < dev_desc->sldr_res) in iqs7222_report()
2973 input_report_abs(iqs7222->keypad, iqs7222->sl_axis[i], in iqs7222_report()
2976 input_report_key(iqs7222->keypad, iqs7222->sl_code[i][0], in iqs7222_report()
2977 sldr_pos < dev_desc->sldr_res); in iqs7222_report()
2983 if (dev_desc->sldr_res == U16_MAX) in iqs7222_report()
2997 input_report_key(iqs7222->keypad, in iqs7222_report()
2998 iqs7222->sl_code[i][j], in iqs7222_report()
3002 input_sync(iqs7222->keypad); in iqs7222_report()
3005 input_report_key(iqs7222->keypad, in iqs7222_report()
3006 iqs7222->sl_code[i][j], 0); in iqs7222_report()
3009 for (i = 0; i < dev_desc->reg_grps[IQS7222_REG_GRP_TPAD].num_row; i++) { in iqs7222_report()
3014 input_report_key(iqs7222->keypad, iqs7222->tp_code[0], in iqs7222_report()
3018 touchscreen_report_pos(iqs7222->keypad, &iqs7222->prop, in iqs7222_report()
3032 input_report_key(iqs7222->keypad, in iqs7222_report()
3033 iqs7222->tp_code[j], in iqs7222_report()
3037 input_sync(iqs7222->keypad); in iqs7222_report()
3040 input_report_key(iqs7222->keypad, in iqs7222_report()
3041 iqs7222->tp_code[j], 0); in iqs7222_report()
3044 input_sync(iqs7222->keypad); in iqs7222_report()
3062 iqs7222 = devm_kzalloc(&client->dev, sizeof(*iqs7222), GFP_KERNEL); in iqs7222_probe()
3064 return -ENOMEM; in iqs7222_probe()
3067 iqs7222->client = client; in iqs7222_probe()
3069 iqs7222->keypad = devm_input_allocate_device(&client->dev); in iqs7222_probe()
3070 if (!iqs7222->keypad) in iqs7222_probe()
3071 return -ENOMEM; in iqs7222_probe()
3073 iqs7222->keypad->name = client->name; in iqs7222_probe()
3074 iqs7222->keypad->id.bustype = BUS_I2C; in iqs7222_probe()
3081 iqs7222->irq_gpio = devm_gpiod_get(&client->dev, "irq", GPIOD_IN); in iqs7222_probe()
3082 if (IS_ERR(iqs7222->irq_gpio)) { in iqs7222_probe()
3083 error = PTR_ERR(iqs7222->irq_gpio); in iqs7222_probe()
3084 dev_err(&client->dev, "Failed to request IRQ GPIO: %d\n", in iqs7222_probe()
3089 iqs7222->reset_gpio = devm_gpiod_get_optional(&client->dev, "reset", in iqs7222_probe()
3091 if (IS_ERR(iqs7222->reset_gpio)) { in iqs7222_probe()
3092 error = PTR_ERR(iqs7222->reset_gpio); in iqs7222_probe()
3093 dev_err(&client->dev, "Failed to request reset GPIO: %d\n", in iqs7222_probe()
3122 error = input_register_device(iqs7222->keypad); in iqs7222_probe()
3124 dev_err(&client->dev, "Failed to register device: %d\n", error); in iqs7222_probe()
3128 irq = gpiod_to_irq(iqs7222->irq_gpio); in iqs7222_probe()
3132 irq_flags = gpiod_is_active_low(iqs7222->irq_gpio) ? IRQF_TRIGGER_LOW in iqs7222_probe()
3136 error = devm_request_threaded_irq(&client->dev, irq, NULL, iqs7222_irq, in iqs7222_probe()
3137 irq_flags, client->name, iqs7222); in iqs7222_probe()
3139 dev_err(&client->dev, "Failed to request IRQ: %d\n", error); in iqs7222_probe()