blob: 28a2e37d734679627fcf2748bb69132467030a3e (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
|
/* Copyright 2019 The Chromium OS Authors. All rights reserved.
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
/* Driver for the Goodix GT7288 touch controller. */
#ifndef __CROS_EC_TOUCHPAD_GT7288_H
#define __CROS_EC_TOUCHPAD_GT7288_H
#include <stdbool.h>
#include <stddef.h>
/* The maximum number of contacts that can be reported at once. */
#define GT7288_MAX_CONTACTS 5
/**
* struct gt7288_version_info - version information for the chip.
* @product_id: HID product ID (0x01F0 for touchpads, 0x01F1 for touchscreens).
* @version_id: the firmware version. For touchpads equipped with a fingerprint
* sensor, the MSB will be 1.
*/
struct gt7288_version_info {
uint16_t product_id;
uint16_t version_id;
};
/**
* gt7288_get_version_info() - Reads version information from the GT7288.
* @info: the version information.
*
* Return: EC_SUCCESS or an error code.
*/
int gt7288_get_version_info(struct gt7288_version_info *info);
/**
* struct gt7288_contact - data describing a single contact.
* @id: a 4-bit ID that uniquely identifies the contact during its lifecycle.
* @x: the absolute X coordinate.
* @y: the absolute Y coordinate.
* @tip: whether the fingertip is touching the pad. (Currently always true.)
* @confidence: whether the controller considers the touch a finger (true) or
* palm (false).
*/
struct gt7288_contact {
uint8_t id;
uint16_t x;
uint16_t y;
bool tip;
bool confidence;
};
/**
* struct gt7288_report - data from a complete report in PTP mode.
* @timestamp: a relative timestamp, in units of 100µs.
* @num_contacts: the number of contacts on the pad.
* @button_down: whether the button is pressed.
* @contacts: an array of structs describing the individual contacts.
*/
struct gt7288_ptp_report {
uint16_t timestamp;
size_t num_contacts;
bool button_down;
struct gt7288_contact contacts[GT7288_MAX_CONTACTS];
};
/**
* gt7288_read_ptp_report() - Reads a complete report, when the GT7288 is in PTP
* mode.
* @report: the report that is read.
*
* Return: EC_SUCCESS or an error code.
*/
int gt7288_read_ptp_report(struct gt7288_ptp_report *report);
#endif /* __CROS_EC_TOUCHPAD_GT7288_H */
|