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
97 buf[i] = (reg_addr >> (reg_addr_width - (i + 1) * 8)) & 0xff; in icn8505_read_xfer()
99 ret = i2c_transfer(client->adapter, msg, 2); in icn8505_read_xfer()
102 ret = -EIO; in icn8505_read_xfer()
104 dev_err(&client->dev, in icn8505_read_xfer()
117 u8 buf[3 + 32]; /* 3 bytes for 24 bit reg-addr + 32 bytes max len */ in icn8505_write_xfer()
126 return -EINVAL; in icn8505_write_xfer()
129 buf[i] = (reg_addr >> (reg_addr_width - (i + 1) * 8)) & 0xff; in icn8505_write_xfer()
133 ret = i2c_transfer(client->adapter, &msg, 1); in icn8505_write_xfer()
136 ret = -EIO; in icn8505_write_xfer()
138 dev_err(&client->dev, in icn8505_write_xfer()
150 return icn8505_read_xfer(icn8505->client, icn8505->client->addr, reg, in icn8505_read_data()
159 error = icn8505_read_xfer(icn8505->client, icn8505->client->addr, reg, in icn8505_read_reg_silent()
169 return icn8505_write_xfer(icn8505->client, icn8505->client->addr, reg, in icn8505_write_reg()
176 return icn8505_read_xfer(icn8505->client, ICN8505_PROG_I2C_ADDR, reg, in icn8505_read_prog_data()
183 return icn8505_write_xfer(icn8505->client, ICN8505_PROG_I2C_ADDR, reg, in icn8505_write_prog_data()
189 return icn8505_write_xfer(icn8505->client, ICN8505_PROG_I2C_ADDR, reg, in icn8505_write_prog_reg()
202 struct device *dev = &icn8505->client->dev; in icn8505_try_fw_upload()
227 return -ENODEV; in icn8505_try_fw_upload()
238 for (offset = 0; offset < fw->size; offset += count) { in icn8505_try_fw_upload()
239 count = min_t(size_t, fw->size - offset, 32); in icn8505_try_fw_upload()
241 fw->data + offset, count); in icn8505_try_fw_upload()
256 if (get_unaligned_le16(buf) != fw->size) { in icn8505_try_fw_upload()
258 return -EIO; in icn8505_try_fw_upload()
265 crc = crc32_be(0, fw->data, fw->size); in icn8505_try_fw_upload()
268 return -EIO; in icn8505_try_fw_upload()
282 struct device *dev = &icn8505->client->dev; in icn8505_upload_fw()
291 error = firmware_request_platform(&fw, icn8505->firmware_name, dev); in icn8505_upload_fw()
316 static bool icn8505_touch_active(u8 event) in icn8505_touch_active() argument
318 return event == ICN8505_EVENT_UPDATE1 || in icn8505_touch_active()
319 event == ICN8505_EVENT_UPDATE2; in icn8505_touch_active()
325 struct device *dev = &icn8505->client->dev; in icn8505_irq()
332 dev_err(dev, "Error reading touch data: %d\n", error); in icn8505_irq()
343 struct icn8505_touch *touch = &touch_data.touches[i]; in icn8505_irq() local
344 bool act = icn8505_touch_active(touch->event); in icn8505_irq()
346 input_mt_slot(icn8505->input, touch->slot); in icn8505_irq()
347 input_mt_report_slot_state(icn8505->input, MT_TOOL_FINGER, act); in icn8505_irq()
351 touchscreen_report_pos(icn8505->input, &icn8505->prop, in icn8505_irq()
352 get_unaligned_le16(touch->x), in icn8505_irq()
353 get_unaligned_le16(touch->y), in icn8505_irq()
357 input_mt_sync_frame(icn8505->input); in icn8505_irq()
358 input_report_key(icn8505->input, KEY_LEFTMETA, in icn8505_irq()
360 input_sync(icn8505->input); in icn8505_irq()
375 return -ENODEV; in icn8505_probe_acpi()
377 status = acpi_evaluate_object(adev->handle, "_SUB", NULL, &buffer); in icn8505_probe_acpi()
380 if (obj->type == ACPI_TYPE_STRING) in icn8505_probe_acpi()
381 subsys = obj->string.pointer; in icn8505_probe_acpi()
389 snprintf(icn8505->firmware_name, sizeof(icn8505->firmware_name), in icn8505_probe_acpi()
390 "chipone/icn8505-%s.fw", subsys); in icn8505_probe_acpi()
398 struct device *dev = &client->dev; in icn8505_probe()
404 if (!client->irq) { in icn8505_probe()
406 return -EINVAL; in icn8505_probe()
411 return -ENOMEM; in icn8505_probe()
415 return -ENOMEM; in icn8505_probe()
417 input->name = client->name; in icn8505_probe()
418 input->id.bustype = BUS_I2C; in icn8505_probe()
424 icn8505->client = client; in icn8505_probe()
425 icn8505->input = input; in icn8505_probe()
444 le16_to_cpu(resolution[0]) - 1, 0, 0); in icn8505_probe()
446 le16_to_cpu(resolution[1]) - 1, 0, 0); in icn8505_probe()
448 touchscreen_parse_properties(input, true, &icn8505->prop); in icn8505_probe()
451 dev_err(dev, "Error touchscreen-size-x and/or -y missing\n"); in icn8505_probe()
452 return -EINVAL; in icn8505_probe()
460 error = devm_request_threaded_irq(dev, client->irq, NULL, icn8505_irq, in icn8505_probe()
461 IRQF_ONESHOT, client->name, icn8505); in icn8505_probe()
479 disable_irq(icn8505->client->irq); in icn8505_suspend()
495 enable_irq(icn8505->client->irq); in icn8505_resume()