Skip to content
Merged
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
27 changes: 22 additions & 5 deletions drivers/input/apple_mtp_kbd.c
Original file line number Diff line number Diff line change
Expand Up @@ -431,6 +431,22 @@ static int get_rtkit_helper(struct udevice *dev)
return 0;
}

/*
* The earlier stage hands an MTP to the OS halted when the device tree names
* it, by its ADT path, in /chosen/linux-enablement-mac,dapf-halted-handoff.
* The OS then cold-starts it, and MTP firmware that has run once does not
* survive a second start, so U-Boot must not start it either.
*/
static bool apple_mtp_halted_for_os(void)
{
ofnode chosen = ofnode_path("/chosen");

return ofnode_valid(chosen) &&
ofnode_stringlist_search(chosen,
"linux-enablement-mac,dapf-halted-handoff",
"/arm-io/mtp") >= 0;
}

static int apple_mtp_kbd_probe(struct udevice *dev)
{
struct apple_mtp_kbd_priv *priv = dev_get_priv(dev);
Expand All @@ -442,12 +458,13 @@ static int apple_mtp_kbd_probe(struct udevice *dev)
fdt_addr_t reg;

/*
* J813 and J604 cannot restart MTP after U-Boot shuts it down, and Linux
* wakes the T6050 MTP from the state iBoot left it in. J713 retains its
* running helper and replays discovery packets to Linux at OS handoff.
* An MTP handed to the OS halted (J604, J715) and the J813 MTP cannot
* be restarted after U-Boot shuts them down, and Linux wakes the T6050
* MTP from the state iBoot left it in. J713 retains its running helper
* and replays discovery packets to Linux at OS handoff.
*/
if (of_machine_is_compatible("apple,j813") ||
of_machine_is_compatible("apple,j604") ||
if (apple_mtp_halted_for_os() ||
of_machine_is_compatible("apple,j813") ||
of_machine_is_compatible("apple,t6050"))
return -ENODEV;
priv->j713 = of_machine_is_compatible("apple,j713") ||
Expand Down