Orange Pi5 kernel

Deprecated Linux kernel 5.10.110 for OrangePi 5/5B/5+ boards

3 Commits   0 Branches   0 Tags
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  1) /* SPDX-License-Identifier: GPL-2.0 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  2) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  3)  * OLPC HGPK (XO-1) touchpad PS/2 mouse driver
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  4)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  5) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  6) #ifndef _HGPK_H
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  7) #define _HGPK_H
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  8) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  9) #define HGPK_GS		0xff       /* The GlideSensor */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 10) #define HGPK_PT		0xcf       /* The PenTablet */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 11) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 12) enum hgpk_model_t {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 13) 	HGPK_MODEL_PREA = 0x0a,	/* pre-B1s */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 14) 	HGPK_MODEL_A = 0x14,	/* found on B1s, PT disabled in hardware */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 15) 	HGPK_MODEL_B = 0x28,	/* B2s, has capacitance issues */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 16) 	HGPK_MODEL_C = 0x3c,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 17) 	HGPK_MODEL_D = 0x50,	/* C1, mass production */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 18) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 19) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 20) enum hgpk_spew_flag {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 21) 	NO_SPEW,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 22) 	MAYBE_SPEWING,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 23) 	SPEW_DETECTED,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 24) 	RECALIBRATING,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 25) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 26) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 27) #define SPEW_WATCH_COUNT 42  /* at 12ms/packet, this is 1/2 second */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 28) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 29) enum hgpk_mode {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 30) 	HGPK_MODE_MOUSE,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 31) 	HGPK_MODE_GLIDESENSOR,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 32) 	HGPK_MODE_PENTABLET,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 33) 	HGPK_MODE_INVALID
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 34) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 35) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 36) struct hgpk_data {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 37) 	struct psmouse *psmouse;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 38) 	enum hgpk_mode mode;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 39) 	bool powered;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 40) 	enum hgpk_spew_flag spew_flag;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 41) 	int spew_count, x_tally, y_tally;	/* spew detection */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 42) 	unsigned long recalib_window;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 43) 	struct delayed_work recalib_wq;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 44) 	int abs_x, abs_y;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 45) 	int dupe_count;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 46) 	int xbigj, ybigj, xlast, ylast; /* jumpiness detection */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 47) 	int xsaw_secondary, ysaw_secondary; /* jumpiness detection */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 48) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 49) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 50) int hgpk_detect(struct psmouse *psmouse, bool set_properties);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 51) int hgpk_init(struct psmouse *psmouse);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 52) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 53) #ifdef CONFIG_MOUSE_PS2_OLPC
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 54) void hgpk_module_init(void);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 55) #else
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 56) static inline void hgpk_module_init(void)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 57) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 58) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 59) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 60) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 61) #endif