Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 5c548226 authored by Ohad Ben-Cohen's avatar Ohad Ben-Cohen Committed by David S. Miller
Browse files

[BLUETOOTH]: Always send explicit hci_ll wake-up acks.



In the (rare) event of simultaneous mutual wake up requests,
do send the chip an explicit wake-up ack. This is required
for Texas Instruments's BRF6350 chip.

Signed-off-by: default avatarOhad Ben-Cohen <ohad@bencohen.org>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent f951375d
Loading
Loading
Loading
Loading
+14 −9
Original line number Original line Diff line number Diff line
@@ -204,6 +204,19 @@ static void ll_device_want_to_wakeup(struct hci_uart *hu)
	spin_lock_irqsave(&ll->hcill_lock, flags);
	spin_lock_irqsave(&ll->hcill_lock, flags);


	switch (ll->hcill_state) {
	switch (ll->hcill_state) {
	case HCILL_ASLEEP_TO_AWAKE:
		/*
		 * This state means that both the host and the BRF chip
		 * have simultaneously sent a wake-up-indication packet.
		 * Traditionaly, in this case, receiving a wake-up-indication
		 * was enough and an additional wake-up-ack wasn't needed.
		 * This has changed with the BRF6350, which does require an
		 * explicit wake-up-ack. Other BRF versions, which do not
		 * require an explicit ack here, do accept it, thus it is
		 * perfectly safe to always send one.
		 */
		BT_DBG("dual wake-up-indication");
		/* deliberate fall-through - do not add break */
	case HCILL_ASLEEP:
	case HCILL_ASLEEP:
		/* acknowledge device wake up */
		/* acknowledge device wake up */
		if (send_hcill_cmd(HCILL_WAKE_UP_ACK, hu) < 0) {
		if (send_hcill_cmd(HCILL_WAKE_UP_ACK, hu) < 0) {
@@ -211,16 +224,8 @@ static void ll_device_want_to_wakeup(struct hci_uart *hu)
			goto out;
			goto out;
		}
		}
		break;
		break;
	case HCILL_ASLEEP_TO_AWAKE:
		/*
		 * this state means that a wake-up-indication
		 * is already on its way to the device,
		 * and will serve as the required wake-up-ack
		 */
		BT_DBG("dual wake-up-indication");
		break;
	default:
	default:
		/* any other state are illegal */
		/* any other state is illegal */
		BT_ERR("received HCILL_WAKE_UP_IND in state %ld", ll->hcill_state);
		BT_ERR("received HCILL_WAKE_UP_IND in state %ld", ll->hcill_state);
		break;
		break;
	}
	}