Lines Matching +full:event +full:- +full:touch

1 // SPDX-License-Identifier: GPL-2.0+
5 * Copyright (c) 2015-2018 Red Hat Inc.
54 u8 event; member
96 buf[i] = (reg_addr >> (reg_addr_width - (i + 1) * 8)) & 0xff; in icn8505_read_xfer()
98 ret = i2c_transfer(client->adapter, msg, 2); in icn8505_read_xfer()
101 ret = -EIO; in icn8505_read_xfer()
103 dev_err(&client->dev, in icn8505_read_xfer()
116 u8 buf[3 + 32]; /* 3 bytes for 24 bit reg-addr + 32 bytes max len */ in icn8505_write_xfer()
125 return -EINVAL; in icn8505_write_xfer()
128 buf[i] = (reg_addr >> (reg_addr_width - (i + 1) * 8)) & 0xff; in icn8505_write_xfer()
132 ret = i2c_transfer(client->adapter, &msg, 1); in icn8505_write_xfer()
135 ret = -EIO; in icn8505_write_xfer()
137 dev_err(&client->dev, in icn8505_write_xfer()
149 return icn8505_read_xfer(icn8505->client, icn8505->client->addr, reg, in icn8505_read_data()
158 error = icn8505_read_xfer(icn8505->client, icn8505->client->addr, reg, in icn8505_read_reg_silent()
168 return icn8505_write_xfer(icn8505->client, icn8505->client->addr, reg, in icn8505_write_reg()
175 return icn8505_read_xfer(icn8505->client, ICN8505_PROG_I2C_ADDR, reg, in icn8505_read_prog_data()
182 return icn8505_write_xfer(icn8505->client, ICN8505_PROG_I2C_ADDR, reg, in icn8505_write_prog_data()
188 return icn8505_write_xfer(icn8505->client, ICN8505_PROG_I2C_ADDR, reg, in icn8505_write_prog_reg()
201 struct device *dev = &icn8505->client->dev; in icn8505_try_fw_upload()
226 return -ENODEV; in icn8505_try_fw_upload()
237 for (offset = 0; offset < fw->size; offset += count) { in icn8505_try_fw_upload()
238 count = min_t(size_t, fw->size - offset, 32); in icn8505_try_fw_upload()
240 fw->data + offset, count); in icn8505_try_fw_upload()
255 if (get_unaligned_le16(buf) != fw->size) { in icn8505_try_fw_upload()
257 return -EIO; in icn8505_try_fw_upload()
264 crc = crc32_be(0, fw->data, fw->size); in icn8505_try_fw_upload()
267 return -EIO; in icn8505_try_fw_upload()
281 struct device *dev = &icn8505->client->dev; in icn8505_upload_fw()
290 error = firmware_request_platform(&fw, icn8505->firmware_name, dev); in icn8505_upload_fw()
315 static bool icn8505_touch_active(u8 event) in icn8505_touch_active() argument
317 return event == ICN8505_EVENT_UPDATE1 || in icn8505_touch_active()
318 event == ICN8505_EVENT_UPDATE2; in icn8505_touch_active()
324 struct device *dev = &icn8505->client->dev; in icn8505_irq()
331 dev_err(dev, "Error reading touch data: %d\n", error); in icn8505_irq()
342 struct icn8505_touch *touch = &touch_data.touches[i]; in icn8505_irq() local
343 bool act = icn8505_touch_active(touch->event); in icn8505_irq()
345 input_mt_slot(icn8505->input, touch->slot); in icn8505_irq()
346 input_mt_report_slot_state(icn8505->input, MT_TOOL_FINGER, act); in icn8505_irq()
350 touchscreen_report_pos(icn8505->input, &icn8505->prop, in icn8505_irq()
351 get_unaligned_le16(touch->x), in icn8505_irq()
352 get_unaligned_le16(touch->y), in icn8505_irq()
356 input_mt_sync_frame(icn8505->input); in icn8505_irq()
357 input_report_key(icn8505->input, KEY_LEFTMETA, in icn8505_irq()
359 input_sync(icn8505->input); in icn8505_irq()
371 if (error == -ENODATA) in icn8505_probe_acpi()
376 snprintf(icn8505->firmware_name, sizeof(icn8505->firmware_name), in icn8505_probe_acpi()
377 "chipone/icn8505-%s.fw", subsys); in icn8505_probe_acpi()
385 struct device *dev = &client->dev; in icn8505_probe()
391 if (!client->irq) { in icn8505_probe()
393 return -EINVAL; in icn8505_probe()
398 return -ENOMEM; in icn8505_probe()
402 return -ENOMEM; in icn8505_probe()
404 input->name = client->name; in icn8505_probe()
405 input->id.bustype = BUS_I2C; in icn8505_probe()
411 icn8505->client = client; in icn8505_probe()
412 icn8505->input = input; in icn8505_probe()
431 le16_to_cpu(resolution[0]) - 1, 0, 0); in icn8505_probe()
433 le16_to_cpu(resolution[1]) - 1, 0, 0); in icn8505_probe()
435 touchscreen_parse_properties(input, true, &icn8505->prop); in icn8505_probe()
438 dev_err(dev, "Error touchscreen-size-x and/or -y missing\n"); in icn8505_probe()
439 return -EINVAL; in icn8505_probe()
447 error = devm_request_threaded_irq(dev, client->irq, NULL, icn8505_irq, in icn8505_probe()
448 IRQF_ONESHOT, client->name, icn8505); in icn8505_probe()
466 disable_irq(icn8505->client->irq); in icn8505_suspend()
482 enable_irq(icn8505->client->irq); in icn8505_resume()