Merge branch 'for-6.16/core' into for-linus

- power management improvement for multitouch devices (Werner Sembach)
This commit is contained in:
Jiri Kosina 2025-06-03 09:32:30 +02:00
commit c48228c476
3 changed files with 24 additions and 1 deletions

View File

@ -2396,6 +2396,9 @@ int hid_hw_open(struct hid_device *hdev)
ret = hdev->ll_driver->open(hdev);
if (ret)
hdev->ll_open_count--;
if (hdev->driver->on_hid_hw_open)
hdev->driver->on_hid_hw_open(hdev);
}
mutex_unlock(&hdev->ll_open_lock);
@ -2415,8 +2418,12 @@ EXPORT_SYMBOL_GPL(hid_hw_open);
void hid_hw_close(struct hid_device *hdev)
{
mutex_lock(&hdev->ll_open_lock);
if (!--hdev->ll_open_count)
if (!--hdev->ll_open_count) {
hdev->ll_driver->close(hdev);
if (hdev->driver->on_hid_hw_close)
hdev->driver->on_hid_hw_close(hdev);
}
mutex_unlock(&hdev->ll_open_lock);
}
EXPORT_SYMBOL_GPL(hid_hw_close);

View File

@ -1887,6 +1887,16 @@ static void mt_remove(struct hid_device *hdev)
hid_hw_stop(hdev);
}
static void mt_on_hid_hw_open(struct hid_device *hdev)
{
mt_set_modes(hdev, HID_LATENCY_NORMAL, TOUCHPAD_REPORT_ALL);
}
static void mt_on_hid_hw_close(struct hid_device *hdev)
{
mt_set_modes(hdev, HID_LATENCY_HIGH, TOUCHPAD_REPORT_NONE);
}
/*
* This list contains only:
* - VID/PID of products not working with the default multitouch handling
@ -2354,5 +2364,7 @@ static struct hid_driver mt_driver = {
.suspend = pm_ptr(mt_suspend),
.reset_resume = pm_ptr(mt_reset_resume),
.resume = pm_ptr(mt_resume),
.on_hid_hw_open = mt_on_hid_hw_open,
.on_hid_hw_close = mt_on_hid_hw_close,
};
module_hid_driver(mt_driver);

View File

@ -795,6 +795,8 @@ struct hid_usage_id {
* @suspend: invoked on suspend (NULL means nop)
* @resume: invoked on resume if device was not reset (NULL means nop)
* @reset_resume: invoked on resume if device was reset (NULL means nop)
* @on_hid_hw_open: invoked when hid core opens first instance (NULL means nop)
* @on_hid_hw_close: invoked when hid core closes last instance (NULL means nop)
*
* probe should return -errno on error, or 0 on success. During probe,
* input will not be passed to raw_event unless hid_device_io_start is
@ -850,6 +852,8 @@ struct hid_driver {
int (*suspend)(struct hid_device *hdev, pm_message_t message);
int (*resume)(struct hid_device *hdev);
int (*reset_resume)(struct hid_device *hdev);
void (*on_hid_hw_open)(struct hid_device *hdev);
void (*on_hid_hw_close)(struct hid_device *hdev);
/* private: */
struct device_driver driver;