^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) * drivers/input/tablet/wacom.h
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 4) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 5) * USB Wacom tablet support
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 6) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 7) * Copyright (c) 2000-2004 Vojtech Pavlik <vojtech@ucw.cz>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 8) * Copyright (c) 2000 Andreas Bach Aaen <abach@stofanet.dk>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 9) * Copyright (c) 2000 Clifford Wolf <clifford@clifford.at>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 10) * Copyright (c) 2000 Sam Mosel <sam.mosel@computer.org>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 11) * Copyright (c) 2000 James E. Blair <corvus@gnu.org>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 12) * Copyright (c) 2000 Daniel Egger <egger@suse.de>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 13) * Copyright (c) 2001 Frederic Lepied <flepied@mandrakesoft.com>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 14) * Copyright (c) 2004 Panagiotis Issaris <panagiotis.issaris@mech.kuleuven.ac.be>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 15) * Copyright (c) 2002-2011 Ping Cheng <pingc@wacom.com>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 16) * Copyright (c) 2014 Benjamin Tissoires <benjamin.tissoires@redhat.com>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 17) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 18) * ChangeLog:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 19) * v0.1 (vp) - Initial release
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 20) * v0.2 (aba) - Support for all buttons / combinations
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 21) * v0.3 (vp) - Support for Intuos added
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 22) * v0.4 (sm) - Support for more Intuos models, menustrip
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 23) * relative mode, proximity.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 24) * v0.5 (vp) - Big cleanup, nifty features removed,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 25) * they belong in userspace
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 26) * v1.8 (vp) - Submit URB only when operating, moved to CVS,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 27) * use input_report_key instead of report_btn and
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 28) * other cleanups
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 29) * v1.11 (vp) - Add URB ->dev setting for new kernels
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 30) * v1.11 (jb) - Add support for the 4D Mouse & Lens
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 31) * v1.12 (de) - Add support for two more inking pen IDs
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 32) * v1.14 (vp) - Use new USB device id probing scheme.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 33) * Fix Wacom Graphire mouse wheel
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 34) * v1.18 (vp) - Fix mouse wheel direction
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 35) * Make mouse relative
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 36) * v1.20 (fl) - Report tool id for Intuos devices
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 37) * - Multi tools support
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 38) * - Corrected Intuos protocol decoding (airbrush, 4D mouse, lens cursor...)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 39) * - Add PL models support
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 40) * - Fix Wacom Graphire mouse wheel again
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 41) * v1.21 (vp) - Removed protocol descriptions
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 42) * - Added MISC_SERIAL for tool serial numbers
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 43) * (gb) - Identify version on module load.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 44) * v1.21.1 (fl) - added Graphire2 support
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 45) * v1.21.2 (fl) - added Intuos2 support
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 46) * - added all the PL ids
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 47) * v1.21.3 (fl) - added another eraser id from Neil Okamoto
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 48) * - added smooth filter for Graphire from Peri Hankey
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 49) * - added PenPartner support from Olaf van Es
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 50) * - new tool ids from Ole Martin Bjoerndalen
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 51) * v1.29 (pc) - Add support for more tablets
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 52) * - Fix pressure reporting
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 53) * v1.30 (vp) - Merge 2.4 and 2.5 drivers
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 54) * - Since 2.5 now has input_sync(), remove MSC_SERIAL abuse
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 55) * - Cleanups here and there
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 56) * v1.30.1 (pi) - Added Graphire3 support
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 57) * v1.40 (pc) - Add support for several new devices, fix eraser reporting, ...
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 58) * v1.43 (pc) - Added support for Cintiq 21UX
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 59) * - Fixed a Graphire bug
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 60) * - Merged wacom_intuos3_irq into wacom_intuos_irq
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 61) * v1.44 (pc) - Added support for Graphire4, Cintiq 710, Intuos3 6x11, etc.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 62) * - Report Device IDs
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 63) * v1.45 (pc) - Added support for DTF 521, Intuos3 12x12 and 12x19
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 64) * - Minor data report fix
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 65) * v1.46 (pc) - Split wacom.c into wacom_sys.c and wacom_wac.c,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 66) * - where wacom_sys.c deals with system specific code,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 67) * - and wacom_wac.c deals with Wacom specific code
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 68) * - Support Intuos3 4x6
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 69) * v1.47 (pc) - Added support for Bamboo
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 70) * v1.48 (pc) - Added support for Bamboo1, BambooFun, and Cintiq 12WX
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 71) * v1.49 (pc) - Added support for USB Tablet PC (0x90, 0x93, and 0x9A)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 72) * v1.50 (pc) - Fixed a TabletPC touch bug in 2.6.28
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 73) * v1.51 (pc) - Added support for Intuos4
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 74) * v1.52 (pc) - Query Wacom data upon system resume
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 75) * - add defines for features->type
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 76) * - add new devices (0x9F, 0xE2, and 0XE3)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 77) * v2.00 (bt) - conversion to a HID driver
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 78) * - integration of the Bluetooth devices
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 79) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 80)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 81) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 82) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 83) #ifndef WACOM_H
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 84) #define WACOM_H
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 85) #include <linux/kernel.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 86) #include <linux/slab.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 87) #include <linux/module.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 88) #include <linux/mod_devicetable.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 89) #include <linux/hid.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 90) #include <linux/kfifo.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 91) #include <linux/leds.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 92) #include <linux/usb/input.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 93) #include <linux/power_supply.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 94) #include <asm/unaligned.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 95)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 96) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 97) * Version Information
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 98) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 99) #define DRIVER_VERSION "v2.00"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 100) #define DRIVER_AUTHOR "Vojtech Pavlik <vojtech@ucw.cz>"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 101) #define DRIVER_DESC "USB Wacom tablet driver"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 102)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 103) #define USB_VENDOR_ID_WACOM 0x056a
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 104) #define USB_VENDOR_ID_LENOVO 0x17ef
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 105)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 106) enum wacom_worker {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 107) WACOM_WORKER_WIRELESS,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 108) WACOM_WORKER_BATTERY,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 109) WACOM_WORKER_REMOTE,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 110) WACOM_WORKER_MODE_CHANGE,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 111) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 112)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 113) struct wacom;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 114)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 115) struct wacom_led {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 116) struct led_classdev cdev;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 117) struct led_trigger trigger;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 118) struct wacom *wacom;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 119) unsigned int group;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 120) unsigned int id;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 121) u8 llv;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 122) u8 hlv;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 123) bool held;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 124) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 125)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 126) struct wacom_group_leds {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 127) u8 select; /* status led selector (0..3) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 128) struct wacom_led *leds;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 129) unsigned int count;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 130) struct device *dev;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 131) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 132)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 133) struct wacom_battery {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 134) struct wacom *wacom;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 135) struct power_supply_desc bat_desc;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 136) struct power_supply *battery;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 137) char bat_name[WACOM_NAME_MAX];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 138) int bat_status;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 139) int battery_capacity;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 140) int bat_charging;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 141) int bat_connected;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 142) int ps_connected;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 143) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 144)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 145) struct wacom_remote {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 146) spinlock_t remote_lock;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 147) struct kfifo remote_fifo;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 148) struct kobject *remote_dir;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 149) struct {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 150) struct attribute_group group;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 151) u32 serial;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 152) struct input_dev *input;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 153) bool registered;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 154) struct wacom_battery battery;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 155) } remotes[WACOM_MAX_REMOTES];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 156) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 157)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 158) struct wacom {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 159) struct usb_device *usbdev;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 160) struct usb_interface *intf;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 161) struct wacom_wac wacom_wac;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 162) struct hid_device *hdev;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 163) struct mutex lock;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 164) struct work_struct wireless_work;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 165) struct work_struct battery_work;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 166) struct work_struct remote_work;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 167) struct delayed_work init_work;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 168) struct wacom_remote *remote;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 169) struct work_struct mode_change_work;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 170) bool generic_has_leds;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 171) struct wacom_leds {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 172) struct wacom_group_leds *groups;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 173) unsigned int count;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 174) u8 llv; /* status led brightness no button (1..127) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 175) u8 hlv; /* status led brightness button pressed (1..127) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 176) u8 img_lum; /* OLED matrix display brightness */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 177) u8 max_llv; /* maximum brightness of LED (llv) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 178) u8 max_hlv; /* maximum brightness of LED (hlv) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 179) } led;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 180) struct wacom_battery battery;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 181) bool resources;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 182) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 183)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 184) static inline void wacom_schedule_work(struct wacom_wac *wacom_wac,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 185) enum wacom_worker which)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 186) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 187) struct wacom *wacom = container_of(wacom_wac, struct wacom, wacom_wac);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 188)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 189) switch (which) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 190) case WACOM_WORKER_WIRELESS:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 191) schedule_work(&wacom->wireless_work);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 192) break;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 193) case WACOM_WORKER_BATTERY:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 194) schedule_work(&wacom->battery_work);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 195) break;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 196) case WACOM_WORKER_REMOTE:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 197) schedule_work(&wacom->remote_work);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 198) break;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 199) case WACOM_WORKER_MODE_CHANGE:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 200) schedule_work(&wacom->mode_change_work);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 201) break;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 202) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 203) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 204)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 205) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 206) * Convert a signed 32-bit integer to an unsigned n-bit integer. Undoes
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 207) * the normally-helpful work of 'hid_snto32' for fields that use signed
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 208) * ranges for questionable reasons.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 209) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 210) static inline __u32 wacom_s32tou(s32 value, __u8 n)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 211) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 212) switch (n) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 213) case 8: return ((__u8)value);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 214) case 16: return ((__u16)value);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 215) case 32: return ((__u32)value);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 216) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 217) return value & (1 << (n - 1)) ? value & (~(~0U << n)) : value;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 218) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 219)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 220) extern const struct hid_device_id wacom_ids[];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 221)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 222) void wacom_wac_irq(struct wacom_wac *wacom_wac, size_t len);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 223) void wacom_setup_device_quirks(struct wacom *wacom);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 224) int wacom_setup_pen_input_capabilities(struct input_dev *input_dev,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 225) struct wacom_wac *wacom_wac);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 226) int wacom_setup_touch_input_capabilities(struct input_dev *input_dev,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 227) struct wacom_wac *wacom_wac);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 228) int wacom_setup_pad_input_capabilities(struct input_dev *input_dev,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 229) struct wacom_wac *wacom_wac);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 230) void wacom_wac_usage_mapping(struct hid_device *hdev,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 231) struct hid_field *field, struct hid_usage *usage);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 232) void wacom_wac_event(struct hid_device *hdev, struct hid_field *field,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 233) struct hid_usage *usage, __s32 value);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 234) void wacom_wac_report(struct hid_device *hdev, struct hid_report *report);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 235) void wacom_battery_work(struct work_struct *work);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 236) enum led_brightness wacom_leds_brightness_get(struct wacom_led *led);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 237) struct wacom_led *wacom_led_find(struct wacom *wacom, unsigned int group,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 238) unsigned int id);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 239) struct wacom_led *wacom_led_next(struct wacom *wacom, struct wacom_led *cur);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 240) int wacom_equivalent_usage(int usage);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 241) int wacom_initialize_leds(struct wacom *wacom);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 242) #endif