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 fixes from Jiri Kosina:

 - resume timing fix for intel-ish driver (Ye Xiang)

 - fix for using incorrect MMIO register in amd_sfh driver (Dylan
   MacKenzie)

 - Cintiq 24HDT / 27QHDT regression fix and touch processing fix for
   Wacom driver (Jason Gerecke)

 - device removal bugfix for ft260 driver (Michael Zaidman)

 - other small assorted fixes

* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/hid/hid:
  HID: ft260: fix device removal due to USB disconnect
  HID: wacom: Skip processing of touches with negative slot values
  HID: wacom: Re-enable touch by default for Cintiq 24HDT / 27QHDT
  HID: Kconfig: Fix spelling mistake "Uninterruptable" -> "Uninterruptible"
  HID: apple: Add support for Keychron K1 wireless keyboard
  HID: fix typo in Kconfig
  HID: ft260: fix format type warning in ft260_word_show()
  HID: amd_sfh: Use correct MMIO register for DMA address
  HID: asus: Remove check for same LED brightness on set
  HID: intel-ish-hid: use async resume function
  • Loading branch information
torvalds committed Jul 30, 2021
2 parents ad6ec09 + db8d3a2 commit 8723bc8
Show file tree
Hide file tree
Showing 11 changed files with 57 additions and 33 deletions.
2 changes: 1 addition & 1 deletion drivers/hid/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -576,7 +576,7 @@ config HID_LOGITECH_HIDPP
depends on HID_LOGITECH
select POWER_SUPPLY
help
Support for Logitech devices relyingon the HID++ Logitech specification
Support for Logitech devices relying on the HID++ Logitech specification

Say Y if you want support for Logitech devices relying on the HID++
specification. Such devices are the various Logitech Touchpads (T650,
Expand Down
2 changes: 1 addition & 1 deletion drivers/hid/amd-sfh-hid/amd_sfh_pcie.c
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ static void amd_stop_sensor_v2(struct amd_mp2_dev *privdata, u16 sensor_idx)
cmd_base.cmd_v2.sensor_id = sensor_idx;
cmd_base.cmd_v2.length = 16;

writeq(0x0, privdata->mmio + AMD_C2P_MSG2);
writeq(0x0, privdata->mmio + AMD_C2P_MSG1);
writel(cmd_base.ul, privdata->mmio + AMD_C2P_MSG0);
}

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 @@ -501,6 +501,8 @@ static const struct hid_device_id apple_devices[] = {
APPLE_RDESC_JIS },
{ HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_REVB_ANSI),
.driver_data = APPLE_HAS_FN },
{ HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_REVB_ANSI),
.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),
Expand Down
3 changes: 0 additions & 3 deletions drivers/hid/hid-asus.c
Original file line number Diff line number Diff line change
Expand Up @@ -485,9 +485,6 @@ static void asus_kbd_backlight_set(struct led_classdev *led_cdev,
{
struct asus_kbd_leds *led = container_of(led_cdev, struct asus_kbd_leds,
cdev);
if (led->brightness == brightness)
return;

led->brightness = brightness;
schedule_work(&led->work);
}
Expand Down
27 changes: 9 additions & 18 deletions drivers/hid/hid-ft260.c
Original file line number Diff line number Diff line change
Expand Up @@ -742,7 +742,7 @@ static int ft260_is_interface_enabled(struct hid_device *hdev)
int ret;

ret = ft260_get_system_config(hdev, &cfg);
if (ret)
if (ret < 0)
return ret;

ft260_dbg("interface: 0x%02x\n", interface);
Expand All @@ -754,23 +754,16 @@ static int ft260_is_interface_enabled(struct hid_device *hdev)
switch (cfg.chip_mode) {
case FT260_MODE_ALL:
case FT260_MODE_BOTH:
if (interface == 1) {
if (interface == 1)
hid_info(hdev, "uart interface is not supported\n");
return 0;
}
ret = 1;
else
ret = 1;
break;
case FT260_MODE_UART:
if (interface == 0) {
hid_info(hdev, "uart is unsupported on interface 0\n");
ret = 0;
}
hid_info(hdev, "uart interface is not supported\n");
break;
case FT260_MODE_I2C:
if (interface == 1) {
hid_info(hdev, "i2c is unsupported on interface 1\n");
ret = 0;
}
ret = 1;
break;
}
return ret;
Expand All @@ -785,7 +778,7 @@ static int ft260_byte_show(struct hid_device *hdev, int id, u8 *cfg, int len,
if (ret < 0)
return ret;

return scnprintf(buf, PAGE_SIZE, "%hi\n", *field);
return scnprintf(buf, PAGE_SIZE, "%d\n", *field);
}

static int ft260_word_show(struct hid_device *hdev, int id, u8 *cfg, int len,
Expand All @@ -797,7 +790,7 @@ static int ft260_word_show(struct hid_device *hdev, int id, u8 *cfg, int len,
if (ret < 0)
return ret;

return scnprintf(buf, PAGE_SIZE, "%hi\n", le16_to_cpu(*field));
return scnprintf(buf, PAGE_SIZE, "%d\n", le16_to_cpu(*field));
}

#define FT260_ATTR_SHOW(name, reptype, id, type, func) \
Expand Down Expand Up @@ -1004,11 +997,9 @@ static int ft260_probe(struct hid_device *hdev, const struct hid_device_id *id)

static void ft260_remove(struct hid_device *hdev)
{
int ret;
struct ft260_device *dev = hid_get_drvdata(hdev);

ret = ft260_is_interface_enabled(hdev);
if (ret <= 0)
if (!dev)
return;

sysfs_remove_group(&hdev->dev.kobj, &ft260_attr_group);
Expand Down
15 changes: 14 additions & 1 deletion drivers/hid/intel-ish-hid/ishtp-hid-client.c
Original file line number Diff line number Diff line change
Expand Up @@ -784,6 +784,17 @@ static void hid_ishtp_cl_reset_handler(struct work_struct *work)
}
}

static void hid_ishtp_cl_resume_handler(struct work_struct *work)
{
struct ishtp_cl_data *client_data = container_of(work, struct ishtp_cl_data, resume_work);
struct ishtp_cl *hid_ishtp_cl = client_data->hid_ishtp_cl;

if (ishtp_wait_resume(ishtp_get_ishtp_device(hid_ishtp_cl))) {
client_data->suspended = false;
wake_up_interruptible(&client_data->ishtp_resume_wait);
}
}

ishtp_print_log ishtp_hid_print_trace;

/**
Expand Down Expand Up @@ -822,6 +833,8 @@ static int hid_ishtp_cl_probe(struct ishtp_cl_device *cl_device)
init_waitqueue_head(&client_data->ishtp_resume_wait);

INIT_WORK(&client_data->work, hid_ishtp_cl_reset_handler);
INIT_WORK(&client_data->resume_work, hid_ishtp_cl_resume_handler);


ishtp_hid_print_trace = ishtp_trace_callback(cl_device);

Expand Down Expand Up @@ -921,7 +934,7 @@ static int hid_ishtp_cl_resume(struct device *device)

hid_ishtp_trace(client_data, "%s hid_ishtp_cl %p\n", __func__,
hid_ishtp_cl);
client_data->suspended = false;
schedule_work(&client_data->resume_work);
return 0;
}

Expand Down
1 change: 1 addition & 0 deletions drivers/hid/intel-ish-hid/ishtp-hid.h
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,7 @@ struct ishtp_cl_data {
int multi_packet_cnt;

struct work_struct work;
struct work_struct resume_work;
struct ishtp_cl_device *cl_device;
};

Expand Down
29 changes: 22 additions & 7 deletions drivers/hid/intel-ish-hid/ishtp/bus.c
Original file line number Diff line number Diff line change
Expand Up @@ -314,13 +314,6 @@ static int ishtp_cl_device_resume(struct device *dev)
if (!device)
return 0;

/*
* When ISH needs hard reset, it is done asynchrnously, hence bus
* resume will be called before full ISH resume
*/
if (device->ishtp_dev->resume_flag)
return 0;

driver = to_ishtp_cl_driver(dev->driver);
if (driver && driver->driver.pm) {
if (driver->driver.pm->resume)
Expand Down Expand Up @@ -849,6 +842,28 @@ struct device *ishtp_device(struct ishtp_cl_device *device)
}
EXPORT_SYMBOL(ishtp_device);

/**
* ishtp_wait_resume() - Wait for IPC resume
*
* Wait for IPC resume
*
* Return: resume complete or not
*/
bool ishtp_wait_resume(struct ishtp_device *dev)
{
/* 50ms to get resume response */
#define WAIT_FOR_RESUME_ACK_MS 50

/* Waiting to get resume response */
if (dev->resume_flag)
wait_event_interruptible_timeout(dev->resume_wait,
!dev->resume_flag,
msecs_to_jiffies(WAIT_FOR_RESUME_ACK_MS));

return (!dev->resume_flag);
}
EXPORT_SYMBOL_GPL(ishtp_wait_resume);

/**
* ishtp_get_pci_device() - Return PCI device dev pointer
* This interface is used to return PCI device pointer
Expand Down
2 changes: 1 addition & 1 deletion drivers/hid/usbhid/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ config USB_HIDDEV
help
Say Y here if you want to support HID devices (from the USB
specification standpoint) that aren't strictly user interface
devices, like monitor controls and Uninterruptable Power Supplies.
devices, like monitor controls and Uninterruptible Power Supplies.

This module supports these devices separately using a separate
event interface on /dev/usb/hiddevX (char 180:96 to 180:111).
Expand Down
5 changes: 4 additions & 1 deletion drivers/hid/wacom_wac.c
Original file line number Diff line number Diff line change
Expand Up @@ -2548,6 +2548,9 @@ static void wacom_wac_finger_slot(struct wacom_wac *wacom_wac,
int slot;

slot = input_mt_get_slot_by_key(input, hid_data->id);
if (slot < 0)
return;

input_mt_slot(input, slot);
input_mt_report_slot_state(input, MT_TOOL_FINGER, prox);
}
Expand Down Expand Up @@ -3831,7 +3834,7 @@ int wacom_setup_touch_input_capabilities(struct input_dev *input_dev,
wacom_wac->shared->touch->product == 0xF6) {
input_dev->evbit[0] |= BIT_MASK(EV_SW);
__set_bit(SW_MUTE_DEVICE, input_dev->swbit);
wacom_wac->shared->has_mute_touch_switch = true;
wacom_wac->has_mute_touch_switch = true;
}
fallthrough;

Expand Down
2 changes: 2 additions & 0 deletions include/linux/intel-ish-client-if.h
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,8 @@ int ishtp_register_event_cb(struct ishtp_cl_device *device,

/* Get the device * from ishtp device instance */
struct device *ishtp_device(struct ishtp_cl_device *cl_device);
/* wait for IPC resume */
bool ishtp_wait_resume(struct ishtp_device *dev);
/* Trace interface for clients */
ishtp_print_log ishtp_trace_callback(struct ishtp_cl_device *cl_device);
/* Get device pointer of PCI device for DMA acces */
Expand Down

0 comments on commit 8723bc8

Please sign in to comment.