Lines Matching +full:event +full:- +full:touch
1 // SPDX-License-Identifier: GPL-2.0-or-later
34 __u8 event; member
61 .addr = client->addr, in icn8318_read_touch_data()
66 .addr = client->addr, in icn8318_read_touch_data()
73 return i2c_transfer(client->adapter, msg, 2); in icn8318_read_touch_data()
76 static inline bool icn8318_touch_active(u8 event) in icn8318_touch_active() argument
78 return (event == ICN8318_EVENT_UPDATE1) || in icn8318_touch_active()
79 (event == ICN8318_EVENT_UPDATE2); in icn8318_touch_active()
85 struct device *dev = &data->client->dev; in icn8318_irq()
89 ret = icn8318_read_touch_data(data->client, &touch_data); in icn8318_irq()
91 dev_err(dev, "Error reading touch data: %d\n", ret); in icn8318_irq()
112 struct icn8318_touch *touch = &touch_data.touches[i]; in icn8318_irq() local
113 bool act = icn8318_touch_active(touch->event); in icn8318_irq()
115 input_mt_slot(data->input, touch->slot); in icn8318_irq()
116 input_mt_report_slot_state(data->input, MT_TOOL_FINGER, act); in icn8318_irq()
120 touchscreen_report_pos(data->input, &data->prop, in icn8318_irq()
121 be16_to_cpu(touch->x), in icn8318_irq()
122 be16_to_cpu(touch->y), true); in icn8318_irq()
125 input_mt_sync_frame(data->input); in icn8318_irq()
126 input_sync(data->input); in icn8318_irq()
135 enable_irq(data->client->irq); in icn8318_start()
136 gpiod_set_value_cansleep(data->wake_gpio, 1); in icn8318_start()
145 disable_irq(data->client->irq); in icn8318_stop()
146 i2c_smbus_write_byte_data(data->client, ICN8318_REG_POWER, in icn8318_stop()
148 gpiod_set_value_cansleep(data->wake_gpio, 0); in icn8318_stop()
156 mutex_lock(&data->input->mutex); in icn8318_suspend()
157 if (data->input->users) in icn8318_suspend()
158 icn8318_stop(data->input); in icn8318_suspend()
159 mutex_unlock(&data->input->mutex); in icn8318_suspend()
168 mutex_lock(&data->input->mutex); in icn8318_resume()
169 if (data->input->users) in icn8318_resume()
170 icn8318_start(data->input); in icn8318_resume()
171 mutex_unlock(&data->input->mutex); in icn8318_resume()
182 struct device *dev = &client->dev; in icn8318_probe()
187 if (!client->irq) { in icn8318_probe()
189 return -EINVAL; in icn8318_probe()
194 return -ENOMEM; in icn8318_probe()
196 data->wake_gpio = devm_gpiod_get(dev, "wake", GPIOD_OUT_LOW); in icn8318_probe()
197 if (IS_ERR(data->wake_gpio)) { in icn8318_probe()
198 error = PTR_ERR(data->wake_gpio); in icn8318_probe()
199 if (error != -EPROBE_DEFER) in icn8318_probe()
206 return -ENOMEM; in icn8318_probe()
208 input->name = client->name; in icn8318_probe()
209 input->id.bustype = BUS_I2C; in icn8318_probe()
210 input->open = icn8318_start; in icn8318_probe()
211 input->close = icn8318_stop; in icn8318_probe()
212 input->dev.parent = dev; in icn8318_probe()
217 touchscreen_parse_properties(input, true, &data->prop); in icn8318_probe()
220 dev_err(dev, "Error touchscreen-size-x and/or -y missing\n"); in icn8318_probe()
221 return -EINVAL; in icn8318_probe()
229 data->client = client; in icn8318_probe()
230 data->input = input; in icn8318_probe()
233 error = devm_request_threaded_irq(dev, client->irq, NULL, icn8318_irq, in icn8318_probe()
234 IRQF_ONESHOT, client->name, data); in icn8318_probe()
241 icn8318_stop(data->input); in icn8318_probe()
258 /* This is useless for OF-enabled devices, but it is needed by I2C subsystem */