Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 23 additions & 0 deletions drivers/hid/dockchannel-hid/dockchannel-hid.c
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,7 @@ struct dchid_iface {
bool deferred;
bool starting;
bool open;
bool reports_enabled;
struct completion ready;

void *hid_desc;
Expand Down Expand Up @@ -803,6 +804,28 @@ static int dchid_open(struct hid_device *hdev)
if (READ_ONCE(iface->dchid->stopping))
return -ESHUTDOWN;

/*
* Announcing MTP firmware can send keyboard READY during enumeration
* without streaming input. Enable it when the first HID consumer opens,
* after interface creation, and require a fresh readiness notification.
* A live bootloader handoff already has keyboard reporting enabled.
*/
if (!strcmp(iface->name, "keyboard") && !iface->reports_enabled &&
of_property_read_bool(iface->dchid->dev->of_node, "apple,no-stm") &&
of_property_match_string(iface->dchid->helper_link->supplier->of_node,
"apple,rtkit-handoff", "mtp-live-v1") < 0) {
reinit_completion(&iface->ready);
ret = dchid_enable_interface(iface);
if (ret < 0)
return ret;
if (!wait_for_completion_timeout(&iface->ready,
msecs_to_jiffies(START_TIMEOUT_MS))) {
dev_err(iface->dchid->dev, "keyboard input enable timed out\n");
return -ETIMEDOUT;
}
iface->reports_enabled = true;
}

if (!completion_done(&iface->ready)) {
ret = dchid_start_interface(iface);
if (ret < 0)
Expand Down