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 various devices which are apparently based on the same chipset
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  4)  *  from certain vendor which produces chips that contain wrong LogicalMaximum
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  5)  *  value in their HID report descriptor. Currently supported devices are:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  6)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  7)  *    Ortek PKB-1700
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  8)  *    Ortek WKB-2000
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  9)  *    iHome IMAC-A210S
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 10)  *    Skycable wireless presenter
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 11)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 12)  *  Copyright (c) 2010 Johnathon Harris <jmharris@gmail.com>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 13)  *  Copyright (c) 2011 Jiri Kosina
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 14)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 15) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 16) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 17)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 18) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 19) #include <linux/device.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 20) #include <linux/hid.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 21) #include <linux/module.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 22) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 23) #include "hid-ids.h"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 24) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 25) static __u8 *ortek_report_fixup(struct hid_device *hdev, __u8 *rdesc,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 26) 		unsigned int *rsize)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 27) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 28) 	if (*rsize >= 56 && rdesc[54] == 0x25 && rdesc[55] == 0x01) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 29) 		hid_info(hdev, "Fixing up logical maximum in report descriptor (Ortek)\n");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 30) 		rdesc[55] = 0x92;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 31) 	} else if (*rsize >= 54 && rdesc[52] == 0x25 && rdesc[53] == 0x01) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 32) 		hid_info(hdev, "Fixing up logical maximum in report descriptor (Skycable)\n");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 33) 		rdesc[53] = 0x65;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 34) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 35) 	return rdesc;
^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) static const struct hid_device_id ortek_devices[] = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 39) 	{ HID_USB_DEVICE(USB_VENDOR_ID_ORTEK, USB_DEVICE_ID_ORTEK_PKB1700) },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 40) 	{ HID_USB_DEVICE(USB_VENDOR_ID_ORTEK, USB_DEVICE_ID_ORTEK_WKB2000) },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 41) 	{ HID_USB_DEVICE(USB_VENDOR_ID_ORTEK, USB_DEVICE_ID_ORTEK_IHOME_IMAC_A210S) },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 42) 	{ HID_USB_DEVICE(USB_VENDOR_ID_SKYCABLE, USB_DEVICE_ID_SKYCABLE_WIRELESS_PRESENTER) },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 43) 	{ }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 44) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 45) MODULE_DEVICE_TABLE(hid, ortek_devices);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 46) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 47) static struct hid_driver ortek_driver = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 48) 	.name = "ortek",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 49) 	.id_table = ortek_devices,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 50) 	.report_fixup = ortek_report_fixup
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 51) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 52) module_hid_driver(ortek_driver);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 53) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 54) MODULE_LICENSE("GPL");