Skip to content

Commit

Permalink
Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel…
Browse files Browse the repository at this point in the history
…/git/hid/hid

Pull HID updates from Jiri Kosina:

 - Lenovo X1 Tablet support improvements from Mikael Wikström

 - "heartbeat" report fix for several Wacom devices from Jason Gerecke

 - bounds checking fix in hid-roccat from Dan Carpenter

 - stylus battery reporting fix from Dmitry Torokhov

 - i2c-hid support for wakeup from suspend-to-idle from Kai-Heng Feng

 - new driver for Vivaldi devices from Sean O'Brien

 - other assorted small fixes and device ID additions

* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/hid/hid:
  HID: i2c-hid: Enable wakeup capability from Suspend-to-Idle
  HID: add vivaldi HID driver
  HID: hid-input: fix stylus battery reporting
  HID: wacom: Avoid entering wacom_wac_pen_report for pad / battery
  HID: i2c-hid: fix kerneldoc warnings in i2c-hid-core.c
  HID: core: fix kerneldoc warnings in hid-core.c
  HID: multitouch: Lenovo X1 Tablet Gen2 trackpoint and buttons
  HID: multitouch: Lenovo X1 Tablet Gen3 trackpoint and buttons
  HID: alps: clean up indentation issue
  HID: intel-ish-hid: simplify the return expression of ishtp_bus_remove_device()
  HID: hid-debug: fix nonblocking read semantics wrt EIO/ERESTARTSYS
  HID: i2c-hid: Prefer asynchronous probe
  HID: ite: Add USB id match for Acer One S1003 keyboard dock
  HID: roccat: add bounds checking in kone_sysfs_write_settings()
  HID: wiimote: narrow spinlock range in wiimote_hid_event()
  HID: wiimote: make handlers[] const
  HID: apple: Add support for Matias wireless keyboard
  HID: cp2112: Use irqchip template
  • Loading branch information
torvalds committed Oct 15, 2020
2 parents 0cd7d97 + 3504e85 commit bf36c6b
Show file tree
Hide file tree
Showing 18 changed files with 244 additions and 43 deletions.
9 changes: 9 additions & 0 deletions drivers/hid/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -397,6 +397,15 @@ config HID_GOOGLE_HAMMER
help
Say Y here if you have a Google Hammer device.

config HID_VIVALDI
tristate "Vivaldi Keyboard"
depends on HID
help
Say Y here if you want to enable support for Vivaldi keyboards.

Vivaldi keyboards use a vendor-specific (Google) HID usage to report
how the keys in the top row are physically ordered.

config HID_GT683R
tristate "MSI GT68xR LED support"
depends on LEDS_CLASS && USB_HID
Expand Down
1 change: 1 addition & 0 deletions drivers/hid/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ obj-$(CONFIG_HID_GEMBIRD) += hid-gembird.o
obj-$(CONFIG_HID_GFRM) += hid-gfrm.o
obj-$(CONFIG_HID_GLORIOUS) += hid-glorious.o
obj-$(CONFIG_HID_GOOGLE_HAMMER) += hid-google-hammer.o
obj-$(CONFIG_HID_VIVALDI) += hid-vivaldi.o
obj-$(CONFIG_HID_GT683R) += hid-gt683r.o
obj-$(CONFIG_HID_GYRATION) += hid-gyration.o
obj-$(CONFIG_HID_HOLTEK) += hid-holtek-kbd.o
Expand Down
2 changes: 1 addition & 1 deletion drivers/hid/hid-alps.c
Original file line number Diff line number Diff line change
Expand Up @@ -526,7 +526,7 @@ static int u1_init(struct hid_device *hdev, struct alps_dev *pri_data)

ret = u1_read_write_register(hdev, ADDRESS_U1_NUM_SENS_Y,
&sen_line_num_y, 0, true);
if (ret < 0) {
if (ret < 0) {
dev_err(&hdev->dev, "failed U1_NUM_SENS_Y (%d)\n", ret);
goto exit;
}
Expand Down
2 changes: 2 additions & 0 deletions drivers/hid/hid-apple.c
Original file line number Diff line number Diff line change
Expand Up @@ -503,6 +503,8 @@ static const struct hid_device_id apple_devices[] = {
.driver_data = APPLE_HAS_FN },
{ HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_REVB_ISO),
.driver_data = APPLE_HAS_FN },
{ HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_REVB_ISO),
.driver_data = APPLE_HAS_FN },
{ HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_REVB_JIS),
.driver_data = APPLE_HAS_FN },
{ HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_WIRELESS_ANSI),
Expand Down
15 changes: 11 additions & 4 deletions drivers/hid/hid-core.c
Original file line number Diff line number Diff line change
Expand Up @@ -814,6 +814,13 @@ static void hid_scan_collection(struct hid_parser *parser, unsigned type)

if ((parser->global.usage_page << 16) >= HID_UP_MSVENDOR)
parser->scan_flags |= HID_SCAN_FLAG_VENDOR_SPECIFIC;

if ((parser->global.usage_page << 16) == HID_UP_GOOGLEVENDOR)
for (i = 0; i < parser->local.usage_index; i++)
if (parser->local.usage[i] ==
(HID_UP_GOOGLEVENDOR | 0x0001))
parser->device->group =
HID_GROUP_VIVALDI;
}

static int hid_scan_main(struct hid_parser *parser, struct hid_item *item)
Expand Down Expand Up @@ -920,7 +927,7 @@ static int hid_scan_report(struct hid_device *hid)
/**
* hid_parse_report - parse device report
*
* @device: hid device
* @hid: hid device
* @start: report start
* @size: report size
*
Expand All @@ -945,7 +952,7 @@ static const char * const hid_report_names[] = {
/**
* hid_validate_values - validate existing device report's value indexes
*
* @device: hid device
* @hid: hid device
* @type: which report type to examine
* @id: which report ID to examine (0 for first)
* @field_index: which report field to examine
Expand Down Expand Up @@ -1444,7 +1451,7 @@ static int search(__s32 *array, __s32 value, unsigned n)
* hid_match_report - check if driver's raw_event should be called
*
* @hid: hid device
* @report_type: type to match against
* @report: hid report to match against
*
* compare hid->driver->report_table->report_type to report->type
*/
Expand Down Expand Up @@ -2120,7 +2127,7 @@ struct hid_dynid {

/**
* store_new_id - add a new HID device ID to this driver and re-probe devices
* @driver: target device driver
* @drv: target device driver
* @buf: buffer for scanning device ID data
* @count: input size
*
Expand Down
19 changes: 10 additions & 9 deletions drivers/hid/hid-cp2112.c
Original file line number Diff line number Diff line change
Expand Up @@ -1235,6 +1235,7 @@ static int cp2112_probe(struct hid_device *hdev, const struct hid_device_id *id)
struct cp2112_device *dev;
u8 buf[3];
struct cp2112_smbus_config_report config;
struct gpio_irq_chip *girq;
int ret;

dev = devm_kzalloc(&hdev->dev, sizeof(*dev), GFP_KERNEL);
Expand Down Expand Up @@ -1338,6 +1339,15 @@ static int cp2112_probe(struct hid_device *hdev, const struct hid_device_id *id)
dev->gc.can_sleep = 1;
dev->gc.parent = &hdev->dev;

girq = &dev->gc.irq;
girq->chip = &cp2112_gpio_irqchip;
/* The event comes from the outside so no parent handler */
girq->parent_handler = NULL;
girq->num_parents = 0;
girq->parents = NULL;
girq->default_type = IRQ_TYPE_NONE;
girq->handler = handle_simple_irq;

ret = gpiochip_add_data(&dev->gc, dev);
if (ret < 0) {
hid_err(hdev, "error registering gpio chip\n");
Expand All @@ -1353,17 +1363,8 @@ static int cp2112_probe(struct hid_device *hdev, const struct hid_device_id *id)
chmod_sysfs_attrs(hdev);
hid_hw_power(hdev, PM_HINT_NORMAL);

ret = gpiochip_irqchip_add(&dev->gc, &cp2112_gpio_irqchip, 0,
handle_simple_irq, IRQ_TYPE_NONE);
if (ret) {
dev_err(dev->gc.parent, "failed to add IRQ chip\n");
goto err_sysfs_remove;
}

return ret;

err_sysfs_remove:
sysfs_remove_group(&hdev->dev.kobj, &cp2112_attr_group);
err_gpiochip_remove:
gpiochip_remove(&dev->gc);
err_free_i2c:
Expand Down
10 changes: 5 additions & 5 deletions drivers/hid/hid-debug.c
Original file line number Diff line number Diff line change
Expand Up @@ -1101,11 +1101,6 @@ static ssize_t hid_debug_events_read(struct file *file, char __user *buffer,
set_current_state(TASK_INTERRUPTIBLE);

while (kfifo_is_empty(&list->hid_debug_fifo)) {
if (file->f_flags & O_NONBLOCK) {
ret = -EAGAIN;
break;
}

if (signal_pending(current)) {
ret = -ERESTARTSYS;
break;
Expand All @@ -1122,6 +1117,11 @@ static ssize_t hid_debug_events_read(struct file *file, char __user *buffer,
goto out;
}

if (file->f_flags & O_NONBLOCK) {
ret = -EAGAIN;
break;
}

/* allow O_NONBLOCK from other threads */
mutex_unlock(&list->read_mutex);
schedule();
Expand Down
3 changes: 3 additions & 0 deletions drivers/hid/hid-ids.h
Original file line number Diff line number Diff line change
Expand Up @@ -727,6 +727,8 @@
#define USB_DEVICE_ID_LENOVO_TP10UBKBD 0x6062
#define USB_DEVICE_ID_LENOVO_TPPRODOCK 0x6067
#define USB_DEVICE_ID_LENOVO_X1_COVER 0x6085
#define USB_DEVICE_ID_LENOVO_X1_TAB 0x60a3
#define USB_DEVICE_ID_LENOVO_X1_TAB3 0x60b5
#define USB_DEVICE_ID_LENOVO_PIXART_USB_MOUSE_608D 0x608d
#define USB_DEVICE_ID_LENOVO_PIXART_USB_MOUSE_6019 0x6019
#define USB_DEVICE_ID_LENOVO_PIXART_USB_MOUSE_602E 0x602e
Expand Down Expand Up @@ -1123,6 +1125,7 @@
#define USB_DEVICE_ID_SYNAPTICS_DELL_K12A 0x2819
#define USB_DEVICE_ID_SYNAPTICS_ACER_SWITCH5_012 0x2968
#define USB_DEVICE_ID_SYNAPTICS_TP_V103 0x5710
#define USB_DEVICE_ID_SYNAPTICS_ACER_ONE_S1003 0x73f5
#define USB_DEVICE_ID_SYNAPTICS_ACER_SWITCH5 0x81a7

#define USB_VENDOR_ID_TEXAS_INSTRUMENTS 0x2047
Expand Down
4 changes: 2 additions & 2 deletions drivers/hid/hid-input.c
Original file line number Diff line number Diff line change
Expand Up @@ -797,7 +797,7 @@ static void hidinput_configure_usage(struct hid_input *hidinput, struct hid_fiel
case 0x3b: /* Battery Strength */
hidinput_setup_battery(device, HID_INPUT_REPORT, field);
usage->type = EV_PWR;
goto ignore;
return;

case 0x3c: /* Invert */
map_key_clear(BTN_TOOL_RUBBER);
Expand Down Expand Up @@ -1059,7 +1059,7 @@ static void hidinput_configure_usage(struct hid_input *hidinput, struct hid_fiel
case HID_DC_BATTERYSTRENGTH:
hidinput_setup_battery(device, HID_INPUT_REPORT, field);
usage->type = EV_PWR;
goto ignore;
return;
}
goto unknown;

Expand Down
4 changes: 4 additions & 0 deletions drivers/hid/hid-ite.c
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,10 @@ static const struct hid_device_id ite_devices[] = {
{ HID_DEVICE(BUS_USB, HID_GROUP_GENERIC,
USB_VENDOR_ID_SYNAPTICS,
USB_DEVICE_ID_SYNAPTICS_ACER_SWITCH5_012) },
/* ITE8910 USB kbd ctlr, with Synaptics touchpad connected to it. */
{ HID_DEVICE(BUS_USB, HID_GROUP_GENERIC,
USB_VENDOR_ID_SYNAPTICS,
USB_DEVICE_ID_SYNAPTICS_ACER_ONE_S1003) },
{ }
};
MODULE_DEVICE_TABLE(hid, ite_devices);
Expand Down
12 changes: 12 additions & 0 deletions drivers/hid/hid-multitouch.c
Original file line number Diff line number Diff line change
Expand Up @@ -1973,6 +1973,18 @@ static const struct hid_device_id mt_devices[] = {
HID_DEVICE(BUS_I2C, HID_GROUP_GENERIC,
USB_VENDOR_ID_LG, I2C_DEVICE_ID_LG_7010) },

/* Lenovo X1 TAB Gen 2 */
{ .driver_data = MT_CLS_WIN_8_FORCE_MULTI_INPUT,
HID_DEVICE(BUS_USB, HID_GROUP_MULTITOUCH_WIN_8,
USB_VENDOR_ID_LENOVO,
USB_DEVICE_ID_LENOVO_X1_TAB) },

/* Lenovo X1 TAB Gen 3 */
{ .driver_data = MT_CLS_WIN_8_FORCE_MULTI_INPUT,
HID_DEVICE(BUS_USB, HID_GROUP_MULTITOUCH_WIN_8,
USB_VENDOR_ID_LENOVO,
USB_DEVICE_ID_LENOVO_X1_TAB3) },

/* MosArt panels */
{ .driver_data = MT_CLS_CONFIDENCE_MINUS_ONE,
MT_USB_DEVICE(USB_VENDOR_ID_ASUS,
Expand Down
23 changes: 16 additions & 7 deletions drivers/hid/hid-roccat-kone.c
Original file line number Diff line number Diff line change
Expand Up @@ -294,31 +294,40 @@ static ssize_t kone_sysfs_write_settings(struct file *fp, struct kobject *kobj,
struct kone_device *kone = hid_get_drvdata(dev_get_drvdata(dev));
struct usb_device *usb_dev = interface_to_usbdev(to_usb_interface(dev));
int retval = 0, difference, old_profile;
struct kone_settings *settings = (struct kone_settings *)buf;

/* I need to get my data in one piece */
if (off != 0 || count != sizeof(struct kone_settings))
return -EINVAL;

mutex_lock(&kone->kone_lock);
difference = memcmp(buf, &kone->settings, sizeof(struct kone_settings));
difference = memcmp(settings, &kone->settings,
sizeof(struct kone_settings));
if (difference) {
retval = kone_set_settings(usb_dev,
(struct kone_settings const *)buf);
if (retval) {
mutex_unlock(&kone->kone_lock);
return retval;
if (settings->startup_profile < 1 ||
settings->startup_profile > 5) {
retval = -EINVAL;
goto unlock;
}

retval = kone_set_settings(usb_dev, settings);
if (retval)
goto unlock;

old_profile = kone->settings.startup_profile;
memcpy(&kone->settings, buf, sizeof(struct kone_settings));
memcpy(&kone->settings, settings, sizeof(struct kone_settings));

kone_profile_activated(kone, kone->settings.startup_profile);

if (kone->settings.startup_profile != old_profile)
kone_profile_report(kone, kone->settings.startup_profile);
}
unlock:
mutex_unlock(&kone->kone_lock);

if (retval)
return retval;

return sizeof(struct kone_settings);
}
static BIN_ATTR(settings, 0660, kone_sysfs_read_settings,
Expand Down
Loading

0 comments on commit bf36c6b

Please sign in to comment.