summaryrefslogtreecommitdiff
path: root/sys/dev/i2c/ietp.h
blob: c0ba21632b3c350efbc8e3b1e9d394247833cc81 (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
/* $OpenBSD: ietp.h,v 1.1 2023/07/08 02:43:02 jcs Exp $ */
/*
 * Elantech touchpad I2C driver
 *
 * Copyright (c) 2015, 2016 joshua stein <jcs@openbsd.org>
 * Copyright (c) 2020, 2022 Vladimir Kondratyev <wulf@FreeBSD.org>
 * Copyright (c) 2023 vladimir serbinenko <phcoder@gmail.com>
 *
 * Permission to use, copy, modify, and distribute this software for any
 * purpose with or without fee is hereby granted, provided that the above
 * copyright notice and this permission notice appear in all copies.
 *
 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
 */

#include "ihidev.h" // For i2c_hid_desc

struct ietp_softc {
	struct device	sc_dev;
	i2c_tag_t	sc_tag;
	i2c_addr_t	sc_addr;
	void		*sc_ih;
	union {
		uint8_t	hid_desc_buf[sizeof(struct i2c_hid_desc)];
		struct i2c_hid_desc hid_desc;
	};

	u_int		sc_isize;
	u_char		*sc_ibuf;

	int		sc_refcnt;

	int		sc_dying;

	struct device   *sc_wsmousedev;

  	uint8_t			sc_buttons;

	uint8_t			report_id;
	size_t			report_len;

	uint16_t	product_id;
	uint16_t	ic_type;

	int32_t		pressure_base;
	uint16_t	max_x;
	uint16_t	max_y;
	uint16_t	trace_x;
	uint16_t	trace_y;
	uint16_t	res_x;		/* dots per mm */
	uint16_t	res_y;
	bool		hi_precision;
	bool		is_clickpad;
};

int ietp_open(struct ietp_softc *);
void ietp_close(struct ietp_softc *);
int ietp_ioctl(void *, u_long, caddr_t, int, struct proc *);
int ietp_enable(void *dev);
void ietp_disable(void *dev);