Skip to content

Commit 604250d

Browse files
author
Jiri Kosina
committed
Merge branches 'for-4.13/ish' and 'for-4.13/ite' into for-linus
Conflicts: drivers/hid/hid-core.c
3 parents 4f94ff4 + 1694130 + 6e7edab commit 604250d

File tree

15 files changed

+125
-53
lines changed

15 files changed

+125
-53
lines changed

drivers/hid/Kconfig

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -388,6 +388,13 @@ config HID_ICADE
388388
To compile this driver as a module, choose M here: the
389389
module will be called hid-icade.
390390

391+
config HID_ITE
392+
tristate "ITE devices"
393+
depends on HID
394+
default !EXPERT
395+
---help---
396+
Support for ITE devices not fully compliant with HID standard.
397+
391398
config HID_TWINHAN
392399
tristate "Twinhan IR remote control"
393400
depends on HID

drivers/hid/Makefile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ obj-$(CONFIG_HID_HOLTEK) += hid-holtek-mouse.o
5050
obj-$(CONFIG_HID_HOLTEK) += hid-holtekff.o
5151
obj-$(CONFIG_HID_HYPERV_MOUSE) += hid-hyperv.o
5252
obj-$(CONFIG_HID_ICADE) += hid-icade.o
53+
obj-$(CONFIG_HID_ITE) += hid-ite.o
5354
obj-$(CONFIG_HID_KENSINGTON) += hid-kensington.o
5455
obj-$(CONFIG_HID_KEYTOUCH) += hid-keytouch.o
5556
obj-$(CONFIG_HID_KYE) += hid-kye.o

drivers/hid/hid-core.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1985,6 +1985,9 @@ static const struct hid_device_id hid_have_special_driver[] = {
19851985
#if IS_ENABLED(CONFIG_HID_ICADE)
19861986
{ HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_ION, USB_DEVICE_ID_ICADE) },
19871987
#endif
1988+
#if IS_ENABLED(CONFIG_HID_ITE)
1989+
{ HID_USB_DEVICE(USB_VENDOR_ID_ITE, USB_DEVICE_ID_ITE8595) },
1990+
#endif
19881991
#if IS_ENABLED(CONFIG_HID_KENSINGTON)
19891992
{ HID_USB_DEVICE(USB_VENDOR_ID_KENSINGTON, USB_DEVICE_ID_KS_SLIMBLADE) },
19901993
#endif

drivers/hid/hid-ids.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -565,6 +565,7 @@
565565
#define USB_DEVICE_ID_ITE_LENOVO_YOGA 0x8386
566566
#define USB_DEVICE_ID_ITE_LENOVO_YOGA2 0x8350
567567
#define USB_DEVICE_ID_ITE_LENOVO_YOGA900 0x8396
568+
#define USB_DEVICE_ID_ITE8595 0x8595
568569

569570
#define USB_VENDOR_ID_JABRA 0x0b0e
570571
#define USB_DEVICE_ID_JABRA_SPEAK_410 0x0412

drivers/hid/hid-input.c

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -656,6 +656,15 @@ static void hidinput_configure_usage(struct hid_input *hidinput, struct hid_fiel
656656
case HID_GD_START: map_key_clear(BTN_START); break;
657657
case HID_GD_SELECT: map_key_clear(BTN_SELECT); break;
658658

659+
case HID_GD_RFKILL_BTN:
660+
/* MS wireless radio ctl extension, also check CA */
661+
if (field->application == HID_GD_WIRELESS_RADIO_CTLS) {
662+
map_key_clear(KEY_RFKILL);
663+
/* We need to simulate the btn release */
664+
field->flags |= HID_MAIN_ITEM_RELATIVE;
665+
break;
666+
}
667+
659668
default: goto unknown;
660669
}
661670

drivers/hid/hid-ite.c

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
/*
2+
* HID driver for some ITE "special" devices
3+
* Copyright (c) 2017 Hans de Goede <[email protected]>
4+
*
5+
* This program is free software; you can redistribute it and/or modify
6+
* it under the terms of the GNU General Public License version 2 as
7+
* published by the Free Software Foundation.
8+
*/
9+
10+
#include <linux/device.h>
11+
#include <linux/input.h>
12+
#include <linux/hid.h>
13+
#include <linux/module.h>
14+
15+
#include "hid-ids.h"
16+
17+
static int ite_event(struct hid_device *hdev, struct hid_field *field,
18+
struct hid_usage *usage, __s32 value)
19+
{
20+
struct input_dev *input;
21+
22+
if (!(hdev->claimed & HID_CLAIMED_INPUT) || !field->hidinput)
23+
return 0;
24+
25+
input = field->hidinput->input;
26+
27+
/*
28+
* The ITE8595 always reports 0 as value for the rfkill button. Luckily
29+
* it is the only button in its report, and it sends a report on
30+
* release only, so receiving a report means the button was pressed.
31+
*/
32+
if (usage->hid == HID_GD_RFKILL_BTN) {
33+
input_event(input, EV_KEY, KEY_RFKILL, 1);
34+
input_sync(input);
35+
input_event(input, EV_KEY, KEY_RFKILL, 0);
36+
input_sync(input);
37+
return 1;
38+
}
39+
40+
return 0;
41+
}
42+
43+
static const struct hid_device_id ite_devices[] = {
44+
{ HID_USB_DEVICE(USB_VENDOR_ID_ITE, USB_DEVICE_ID_ITE8595) },
45+
{ }
46+
};
47+
MODULE_DEVICE_TABLE(hid, ite_devices);
48+
49+
static struct hid_driver ite_driver = {
50+
.name = "itetech",
51+
.id_table = ite_devices,
52+
.event = ite_event,
53+
};
54+
module_hid_driver(ite_driver);
55+
56+
MODULE_LICENSE("GPL");

drivers/hid/intel-ish-hid/Kconfig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
menu "Intel ISH HID support"
2-
depends on X86_64 && PCI
2+
depends on (X86_64 || COMPILE_TEST) && PCI
33

44
config INTEL_ISH_HID
55
tristate "Intel Integrated Sensor Hub"

drivers/hid/intel-ish-hid/ipc/hw-ish.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,8 @@
2626
#define BXT_Bx_DEVICE_ID 0x1AA2
2727
#define APL_Ax_DEVICE_ID 0x5AA2
2828
#define SPT_Ax_DEVICE_ID 0x9D35
29+
#define CNL_Ax_DEVICE_ID 0x9DFC
30+
#define GLK_Ax_DEVICE_ID 0x31A2
2931

3032
#define REVISION_ID_CHT_A0 0x6
3133
#define REVISION_ID_CHT_Ax_SI 0x0

drivers/hid/intel-ish-hid/ipc/ipc.c

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -296,17 +296,12 @@ static int write_ipc_from_queue(struct ishtp_device *dev)
296296
/* If sending MNG_SYNC_FW_CLOCK, update clock again */
297297
if (IPC_HEADER_GET_PROTOCOL(doorbell_val) == IPC_PROTOCOL_MNG &&
298298
IPC_HEADER_GET_MNG_CMD(doorbell_val) == MNG_SYNC_FW_CLOCK) {
299-
struct timespec ts_system;
300-
struct timeval tv_utc;
301-
uint64_t usec_system, usec_utc;
299+
uint64_t usec_system, usec_utc;
302300
struct ipc_time_update_msg time_update;
303301
struct time_sync_format ts_format;
304302

305-
get_monotonic_boottime(&ts_system);
306-
do_gettimeofday(&tv_utc);
307-
usec_system = (timespec_to_ns(&ts_system)) / NSEC_PER_USEC;
308-
usec_utc = (uint64_t)tv_utc.tv_sec * 1000000 +
309-
((uint32_t)tv_utc.tv_usec);
303+
usec_system = ktime_to_us(ktime_get_boottime());
304+
usec_utc = ktime_to_us(ktime_get_real());
310305
ts_format.ts1_source = HOST_SYSTEM_TIME_USEC;
311306
ts_format.ts2_source = HOST_UTC_TIME_USEC;
312307
ts_format.reserved = 0;
@@ -575,15 +570,13 @@ static void fw_reset_work_fn(struct work_struct *unused)
575570
static void _ish_sync_fw_clock(struct ishtp_device *dev)
576571
{
577572
static unsigned long prev_sync;
578-
struct timespec ts;
579573
uint64_t usec;
580574

581575
if (prev_sync && jiffies - prev_sync < 20 * HZ)
582576
return;
583577

584578
prev_sync = jiffies;
585-
get_monotonic_boottime(&ts);
586-
usec = (timespec_to_ns(&ts)) / NSEC_PER_USEC;
579+
usec = ktime_to_us(ktime_get_boottime());
587580
ipc_send_mng_msg(dev, MNG_SYNC_FW_CLOCK, &usec, sizeof(uint64_t));
588581
}
589582

drivers/hid/intel-ish-hid/ipc/pci-ish.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,8 @@ static const struct pci_device_id ish_pci_tbl[] = {
3535
{PCI_DEVICE(PCI_VENDOR_ID_INTEL, BXT_Bx_DEVICE_ID)},
3636
{PCI_DEVICE(PCI_VENDOR_ID_INTEL, APL_Ax_DEVICE_ID)},
3737
{PCI_DEVICE(PCI_VENDOR_ID_INTEL, SPT_Ax_DEVICE_ID)},
38+
{PCI_DEVICE(PCI_VENDOR_ID_INTEL, CNL_Ax_DEVICE_ID)},
39+
{PCI_DEVICE(PCI_VENDOR_ID_INTEL, GLK_Ax_DEVICE_ID)},
3840
{0, }
3941
};
4042
MODULE_DEVICE_TABLE(pci, ish_pci_tbl);

0 commit comments

Comments
 (0)