Skip to content

Commit 740bebf

Browse files
committed
Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/hid/hid
Pull HID fixes from Jiri Kosina: - fix for Intel-ISH driver to make sure it gets aoutoloaded only on matching devices and not universally (Thomas Weißschuh) - fix for Wacom driver reporting invalid contact under certain circumstances (Jason Gerecke) - probing fix for ft260 dirver (Michael Zaidman) - fix for generic keycode remapping (Thomas Weißschuh) - fix for division by zero in hid-magicmouse (Claudia Pellegrino) - other tiny assorted fixes and new device IDs * 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/hid/hid: HID: multitouch: Fix Iiyama ProLite T1931SAW (0eef:0001 again!) HID: nintendo: eliminate dead datastructures in !CONFIG_NINTENDO_FF case HID: magicmouse: prevent division by 0 on scroll HID: thrustmaster: fix sparse warnings HID: Ignore battery for Elan touchscreen on HP Envy X360 15-eu0xxx HID: input: set usage type to key on keycode remap HID: input: Fix parsing of HID_CP_CONSUMER_CONTROL fields HID: ft260: fix i2c probing for hwmon devices Revert "HID: hid-asus.c: Maps key 0x35 (display off) to KEY_SCREENLOCK" HID: intel-ish-hid: fix module device-id handling mod_devicetable: fix kdocs for ishtp_device_id HID: wacom: Use "Confidence" flag to prevent reporting invalid contacts HID: nintendo: unlock on error in joycon_leds_create() platform/x86: isthp_eclite: only load for matching devices platform/chrome: chros_ec_ishtp: only load for matching devices HID: intel-ish-hid: hid-client: only load for matching devices HID: intel-ish-hid: fw-loader: only load for matching devices HID: intel-ish-hid: use constants for modaliases HID: intel-ish-hid: add support for MODULE_DEVICE_TABLE()
2 parents 5d9f4cf + 32bea35 commit 740bebf

19 files changed

Lines changed: 120 additions & 49 deletions

drivers/hid/hid-asus.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -854,7 +854,7 @@ static int asus_input_mapping(struct hid_device *hdev,
854854
switch (usage->hid & HID_USAGE) {
855855
case 0x10: asus_map_key_clear(KEY_BRIGHTNESSDOWN); break;
856856
case 0x20: asus_map_key_clear(KEY_BRIGHTNESSUP); break;
857-
case 0x35: asus_map_key_clear(KEY_SCREENLOCK); break;
857+
case 0x35: asus_map_key_clear(KEY_DISPLAY_OFF); break;
858858
case 0x6c: asus_map_key_clear(KEY_SLEEP); break;
859859
case 0x7c: asus_map_key_clear(KEY_MICMUTE); break;
860860
case 0x82: asus_map_key_clear(KEY_CAMERA); break;

drivers/hid/hid-ft260.c

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -966,24 +966,23 @@ static int ft260_probe(struct hid_device *hdev, const struct hid_device_id *id)
966966
mutex_init(&dev->lock);
967967
init_completion(&dev->wait);
968968

969+
ret = ft260_xfer_status(dev);
970+
if (ret)
971+
ft260_i2c_reset(hdev);
972+
973+
i2c_set_adapdata(&dev->adap, dev);
969974
ret = i2c_add_adapter(&dev->adap);
970975
if (ret) {
971976
hid_err(hdev, "failed to add i2c adapter\n");
972977
goto err_hid_close;
973978
}
974979

975-
i2c_set_adapdata(&dev->adap, dev);
976-
977980
ret = sysfs_create_group(&hdev->dev.kobj, &ft260_attr_group);
978981
if (ret < 0) {
979982
hid_err(hdev, "failed to create sysfs attrs\n");
980983
goto err_i2c_free;
981984
}
982985

983-
ret = ft260_xfer_status(dev);
984-
if (ret)
985-
ft260_i2c_reset(hdev);
986-
987986
return 0;
988987

989988
err_i2c_free:

drivers/hid/hid-ids.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -397,6 +397,7 @@
397397
#define USB_DEVICE_ID_TOSHIBA_CLICK_L9W 0x0401
398398
#define USB_DEVICE_ID_HP_X2 0x074d
399399
#define USB_DEVICE_ID_HP_X2_10_COVER 0x0755
400+
#define I2C_DEVICE_ID_HP_ENVY_X360_15 0x2d05
400401
#define I2C_DEVICE_ID_HP_SPECTRE_X360_15 0x2817
401402
#define USB_DEVICE_ID_ASUS_UX550_TOUCHSCREEN 0x2706
402403
#define I2C_DEVICE_ID_SURFACE_GO_TOUCHSCREEN 0x261A

drivers/hid/hid-input.c

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -160,6 +160,7 @@ static int hidinput_setkeycode(struct input_dev *dev,
160160
if (usage) {
161161
*old_keycode = usage->type == EV_KEY ?
162162
usage->code : KEY_RESERVED;
163+
usage->type = EV_KEY;
163164
usage->code = ke->keycode;
164165

165166
clear_bit(*old_keycode, dev->keybit);
@@ -324,6 +325,8 @@ static const struct hid_device_id hid_battery_quirks[] = {
324325
HID_BATTERY_QUIRK_IGNORE },
325326
{ HID_USB_DEVICE(USB_VENDOR_ID_ELAN, USB_DEVICE_ID_ASUS_UX550_TOUCHSCREEN),
326327
HID_BATTERY_QUIRK_IGNORE },
328+
{ HID_I2C_DEVICE(USB_VENDOR_ID_ELAN, I2C_DEVICE_ID_HP_ENVY_X360_15),
329+
HID_BATTERY_QUIRK_IGNORE },
327330
{ HID_I2C_DEVICE(USB_VENDOR_ID_ELAN, I2C_DEVICE_ID_HP_SPECTRE_X360_15),
328331
HID_BATTERY_QUIRK_IGNORE },
329332
{ HID_I2C_DEVICE(USB_VENDOR_ID_ELAN, I2C_DEVICE_ID_SURFACE_GO_TOUCHSCREEN),
@@ -650,10 +653,9 @@ static void hidinput_configure_usage(struct hid_input *hidinput, struct hid_fiel
650653
code += KEY_MACRO1;
651654
else
652655
code += BTN_TRIGGER_HAPPY - 0x1e;
653-
} else {
654-
goto ignore;
656+
break;
655657
}
656-
break;
658+
fallthrough;
657659
default:
658660
switch (field->physical) {
659661
case HID_GD_MOUSE:

drivers/hid/hid-magicmouse.c

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -256,8 +256,11 @@ static void magicmouse_emit_touch(struct magicmouse_sc *msc, int raw_id, u8 *tda
256256
unsigned long now = jiffies;
257257
int step_x = msc->touches[id].scroll_x - x;
258258
int step_y = msc->touches[id].scroll_y - y;
259-
int step_hr = ((64 - (int)scroll_speed) * msc->scroll_accel) /
260-
SCROLL_HR_STEPS;
259+
int step_hr =
260+
max_t(int,
261+
((64 - (int)scroll_speed) * msc->scroll_accel) /
262+
SCROLL_HR_STEPS,
263+
1);
261264
int step_x_hr = msc->touches[id].scroll_x_hr - x;
262265
int step_y_hr = msc->touches[id].scroll_y_hr - y;
263266

drivers/hid/hid-multitouch.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1888,6 +1888,11 @@ static const struct hid_device_id mt_devices[] = {
18881888
MT_USB_DEVICE(USB_VENDOR_ID_CVTOUCH,
18891889
USB_DEVICE_ID_CVTOUCH_SCREEN) },
18901890

1891+
/* eGalax devices (SAW) */
1892+
{ .driver_data = MT_CLS_EXPORT_ALL_INPUTS,
1893+
MT_USB_DEVICE(USB_VENDOR_ID_DWAV,
1894+
USB_DEVICE_ID_EGALAX_TOUCHCONTROLLER) },
1895+
18911896
/* eGalax devices (resistive) */
18921897
{ .driver_data = MT_CLS_EGALAX,
18931898
MT_USB_DEVICE(USB_VENDOR_ID_DWAV,

drivers/hid/hid-nintendo.c

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -189,6 +189,7 @@ struct joycon_rumble_amp_data {
189189
u16 amp;
190190
};
191191

192+
#if IS_ENABLED(CONFIG_NINTENDO_FF)
192193
/*
193194
* These tables are from
194195
* https://github.com/dekuNukem/Nintendo_Switch_Reverse_Engineering/blob/master/rumble_data_table.md
@@ -289,6 +290,10 @@ static const struct joycon_rumble_amp_data joycon_rumble_amplitudes[] = {
289290
{ 0xc2, 0x8070, 940 }, { 0xc4, 0x0071, 960 }, { 0xc6, 0x8071, 981 },
290291
{ 0xc8, 0x0072, joycon_max_rumble_amp }
291292
};
293+
static const u16 JC_RUMBLE_DFLT_LOW_FREQ = 160;
294+
static const u16 JC_RUMBLE_DFLT_HIGH_FREQ = 320;
295+
#endif /* IS_ENABLED(CONFIG_NINTENDO_FF) */
296+
static const u16 JC_RUMBLE_PERIOD_MS = 50;
292297

293298
/* States for controller state machine */
294299
enum joycon_ctlr_state {
@@ -397,9 +402,6 @@ struct joycon_input_report {
397402
#define JC_RUMBLE_DATA_SIZE 8
398403
#define JC_RUMBLE_QUEUE_SIZE 8
399404

400-
static const u16 JC_RUMBLE_DFLT_LOW_FREQ = 160;
401-
static const u16 JC_RUMBLE_DFLT_HIGH_FREQ = 320;
402-
static const u16 JC_RUMBLE_PERIOD_MS = 50;
403405
static const unsigned short JC_RUMBLE_ZERO_AMP_PKT_CNT = 5;
404406

405407
static const char * const joycon_player_led_names[] = {
@@ -1850,8 +1852,10 @@ static int joycon_leds_create(struct joycon_ctlr *ctlr)
18501852
d_name,
18511853
"green",
18521854
joycon_player_led_names[i]);
1853-
if (!name)
1855+
if (!name) {
1856+
mutex_unlock(&joycon_input_num_mutex);
18541857
return -ENOMEM;
1858+
}
18551859

18561860
led = &ctlr->leds[i];
18571861
led->name = name;
@@ -1864,6 +1868,7 @@ static int joycon_leds_create(struct joycon_ctlr *ctlr)
18641868
ret = devm_led_classdev_register(&hdev->dev, led);
18651869
if (ret) {
18661870
hid_err(hdev, "Failed registering %s LED\n", led->name);
1871+
mutex_unlock(&joycon_input_num_mutex);
18671872
return ret;
18681873
}
18691874
}

drivers/hid/hid-thrustmaster.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -205,7 +205,7 @@ static void thrustmaster_model_handler(struct urb *urb)
205205
struct tm_wheel *tm_wheel = hid_get_drvdata(hdev);
206206
uint16_t model = 0;
207207
int i, ret;
208-
const struct tm_wheel_info *twi = 0;
208+
const struct tm_wheel_info *twi = NULL;
209209

210210
if (urb->status) {
211211
hid_err(hdev, "URB to get model id failed with error %d\n", urb->status);
@@ -238,7 +238,7 @@ static void thrustmaster_model_handler(struct urb *urb)
238238
tm_wheel->usb_dev,
239239
usb_sndctrlpipe(tm_wheel->usb_dev, 0),
240240
(char *)tm_wheel->change_request,
241-
0, 0, // We do not expect any response from the wheel
241+
NULL, 0, // We do not expect any response from the wheel
242242
thrustmaster_change_handler,
243243
hdev
244244
);
@@ -272,7 +272,7 @@ static void thrustmaster_remove(struct hid_device *hdev)
272272
static int thrustmaster_probe(struct hid_device *hdev, const struct hid_device_id *id)
273273
{
274274
int ret = 0;
275-
struct tm_wheel *tm_wheel = 0;
275+
struct tm_wheel *tm_wheel = NULL;
276276

277277
ret = hid_parse(hdev);
278278
if (ret) {

drivers/hid/intel-ish-hid/ishtp-fw-loader.c

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -76,9 +76,12 @@ enum ish_loader_commands {
7676
#define LOADER_XFER_MODE_ISHTP BIT(1)
7777

7878
/* ISH Transport Loader client unique GUID */
79-
static const guid_t loader_ishtp_guid =
80-
GUID_INIT(0xc804d06a, 0x55bd, 0x4ea7,
81-
0xad, 0xed, 0x1e, 0x31, 0x22, 0x8c, 0x76, 0xdc);
79+
static const struct ishtp_device_id loader_ishtp_id_table[] = {
80+
{ .guid = GUID_INIT(0xc804d06a, 0x55bd, 0x4ea7,
81+
0xad, 0xed, 0x1e, 0x31, 0x22, 0x8c, 0x76, 0xdc) },
82+
{ }
83+
};
84+
MODULE_DEVICE_TABLE(ishtp, loader_ishtp_id_table);
8285

8386
#define FILENAME_SIZE 256
8487

@@ -880,7 +883,7 @@ static int loader_init(struct ishtp_cl *loader_ishtp_cl, int reset)
880883

881884
fw_client =
882885
ishtp_fw_cl_get_client(ishtp_get_ishtp_device(loader_ishtp_cl),
883-
&loader_ishtp_guid);
886+
&loader_ishtp_id_table[0].guid);
884887
if (!fw_client) {
885888
dev_err(cl_data_to_dev(client_data),
886889
"ISH client uuid not found\n");
@@ -1057,7 +1060,7 @@ static int loader_ishtp_cl_reset(struct ishtp_cl_device *cl_device)
10571060

10581061
static struct ishtp_cl_driver loader_ishtp_cl_driver = {
10591062
.name = "ish-loader",
1060-
.guid = &loader_ishtp_guid,
1063+
.id = loader_ishtp_id_table,
10611064
.probe = loader_ishtp_cl_probe,
10621065
.remove = loader_ishtp_cl_remove,
10631066
.reset = loader_ishtp_cl_reset,
@@ -1083,4 +1086,3 @@ MODULE_DESCRIPTION("ISH ISH-TP Host firmware Loader Client Driver");
10831086
MODULE_AUTHOR("Rushikesh S Kadam <rushikesh.s.kadam@intel.com>");
10841087

10851088
MODULE_LICENSE("GPL v2");
1086-
MODULE_ALIAS("ishtp:*");

drivers/hid/intel-ish-hid/ishtp-hid-client.c

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,12 @@
1212
#include "ishtp-hid.h"
1313

1414
/* ISH Transport protocol (ISHTP in short) GUID */
15-
static const guid_t hid_ishtp_guid =
16-
GUID_INIT(0x33AECD58, 0xB679, 0x4E54,
17-
0x9B, 0xD9, 0xA0, 0x4D, 0x34, 0xF0, 0xC2, 0x26);
15+
static const struct ishtp_device_id hid_ishtp_id_table[] = {
16+
{ .guid = GUID_INIT(0x33AECD58, 0xB679, 0x4E54,
17+
0x9B, 0xD9, 0xA0, 0x4D, 0x34, 0xF0, 0xC2, 0x26), },
18+
{ }
19+
};
20+
MODULE_DEVICE_TABLE(ishtp, hid_ishtp_id_table);
1821

1922
/* Rx ring buffer pool size */
2023
#define HID_CL_RX_RING_SIZE 32
@@ -662,7 +665,7 @@ static int hid_ishtp_cl_init(struct ishtp_cl *hid_ishtp_cl, int reset)
662665
ishtp_set_tx_ring_size(hid_ishtp_cl, HID_CL_TX_RING_SIZE);
663666
ishtp_set_rx_ring_size(hid_ishtp_cl, HID_CL_RX_RING_SIZE);
664667

665-
fw_client = ishtp_fw_cl_get_client(dev, &hid_ishtp_guid);
668+
fw_client = ishtp_fw_cl_get_client(dev, &hid_ishtp_id_table[0].guid);
666669
if (!fw_client) {
667670
dev_err(cl_data_to_dev(client_data),
668671
"ish client uuid not found\n");
@@ -945,7 +948,7 @@ static const struct dev_pm_ops hid_ishtp_pm_ops = {
945948

946949
static struct ishtp_cl_driver hid_ishtp_cl_driver = {
947950
.name = "ish-hid",
948-
.guid = &hid_ishtp_guid,
951+
.id = hid_ishtp_id_table,
949952
.probe = hid_ishtp_cl_probe,
950953
.remove = hid_ishtp_cl_remove,
951954
.reset = hid_ishtp_cl_reset,
@@ -981,4 +984,3 @@ MODULE_AUTHOR("Daniel Drubin <daniel.drubin@intel.com>");
981984
MODULE_AUTHOR("Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>");
982985

983986
MODULE_LICENSE("GPL");
984-
MODULE_ALIAS("ishtp:*");

0 commit comments

Comments
 (0)