1/* $OpenBSD: ietp.h,v 1.2 2024/05/13 01:15:50 jsg Exp $ */
2/*
3 * Elantech touchpad I2C driver
4 *
5 * Copyright (c) 2015, 2016 joshua stein <jcs@openbsd.org>
6 * Copyright (c) 2020, 2022 Vladimir Kondratyev <wulf@FreeBSD.org>
7 * Copyright (c) 2023 vladimir serbinenko <phcoder@gmail.com>
8 *
9 * Permission to use, copy, modify, and distribute this software for any
10 * purpose with or without fee is hereby granted, provided that the above
11 * copyright notice and this permission notice appear in all copies.
12 *
13 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
14 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
15 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
16 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
17 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
18 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
19 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
20 */
21
22#include "ihidev.h" // For i2c_hid_desc
23
24struct ietp_softc {
25	struct device	sc_dev;
26	i2c_tag_t	sc_tag;
27	i2c_addr_t	sc_addr;
28	void		*sc_ih;
29	union {
30		uint8_t	hid_desc_buf[sizeof(struct i2c_hid_desc)];
31		struct i2c_hid_desc hid_desc;
32	};
33
34	u_int		sc_isize;
35	u_char		*sc_ibuf;
36
37	int		sc_refcnt;
38
39	int		sc_dying;
40
41	struct device   *sc_wsmousedev;
42
43  	uint8_t			sc_buttons;
44
45	uint8_t			report_id;
46	size_t			report_len;
47
48	uint16_t	product_id;
49	uint16_t	ic_type;
50
51	int32_t		pressure_base;
52	uint16_t	max_x;
53	uint16_t	max_y;
54	uint16_t	trace_x;
55	uint16_t	trace_y;
56	uint16_t	res_x;		/* dots per mm */
57	uint16_t	res_y;
58	bool		hi_precision;
59	bool		is_clickpad;
60};
61
62int ietp_ioctl(void *, u_long, caddr_t, int, struct proc *);
63int ietp_enable(void *dev);
64void ietp_disable(void *dev);
65