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-or-later
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  2) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  3)  *  HID driver for PenMount touchscreens
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  4)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  5)  *  Copyright (c) 2014 Christian Gmeiner <christian.gmeiner <at> gmail.com>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  6)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  7)  *  based on hid-penmount copyrighted by
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  8)  *    PenMount Touch Solutions <penmount <at> seed.net.tw>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  9)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 10) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 11) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 12)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 13) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 14) #include <linux/module.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 15) #include <linux/hid.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 16) #include "hid-ids.h"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 17) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 18) static int penmount_input_mapping(struct hid_device *hdev,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 19) 		struct hid_input *hi, struct hid_field *field,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 20) 		struct hid_usage *usage, unsigned long **bit, int *max)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 21) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 22) 	if ((usage->hid & HID_USAGE_PAGE) == HID_UP_BUTTON) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 23) 		if (((usage->hid - 1) & HID_USAGE) == 0) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 24) 			hid_map_usage(hi, usage, bit, max, EV_KEY, BTN_TOUCH);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 25) 			return 1;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 26) 		} else {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 27) 			return -1;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 28) 		}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 29) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 30) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 31) 	return 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 32) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 33) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 34) static const struct hid_device_id penmount_devices[] = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 35) 	{ HID_USB_DEVICE(USB_VENDOR_ID_PENMOUNT, USB_DEVICE_ID_PENMOUNT_6000) },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 36) 	{ }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 37) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 38) MODULE_DEVICE_TABLE(hid, penmount_devices);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 39) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 40) static struct hid_driver penmount_driver = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 41) 	.name = "hid-penmount",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 42) 	.id_table = penmount_devices,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 43) 	.input_mapping = penmount_input_mapping,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 44) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 45) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 46) module_hid_driver(penmount_driver);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 47) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 48) MODULE_AUTHOR("Christian Gmeiner <christian.gmeiner@gmail.com>");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 49) MODULE_DESCRIPTION("PenMount HID TouchScreen driver");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 50) MODULE_LICENSE("GPL");