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

Commit f0c23394 authored by Jack Pham's avatar Jack Pham
Browse files

usb: pd: qpnp-pdphy: Remove rx_busy flag



Having this flag was causing PD TX messages to incorrectly
get blocked in the case where the policy engine state machine
worker got scheduled to run in the RX IRQ, but before the
handler exits and clears the flag. This caused false errors
that an RX message is pending. Remove usage of this flag as
it was doing more harm than good.

Change-Id: Iffccfc9ffafac6017192d86d8d97d5534890c7b5
Signed-off-by: default avatarJack Pham <jackp@codeaurora.org>
parent c4be61c3
Loading
Loading
Loading
Loading
+2 −13
Original line number Diff line number Diff line
@@ -112,7 +112,6 @@ struct usb_pdphy {
	int tx_status;
	u8 frame_filter_val;
	bool in_test_data_mode;
	bool rx_busy;

	enum data_role data_role;
	enum power_role power_role;
@@ -490,7 +489,7 @@ int pd_phy_write(u16 hdr, const u8 *data, size_t data_len, enum pd_sop_type sop)
	}

	ret = pdphy_reg_read(pdphy, &val, USB_PDPHY_RX_ACKNOWLEDGE, 1);
	if (ret || val || pdphy->rx_busy) {
	if (ret || val) {
		dev_err(pdphy->dev, "%s: RX message pending\n", __func__);
		return -EBUSY;
	}
@@ -668,15 +667,6 @@ static int pd_phy_bist_mode(u8 bist_mode)
			BIST_MODE_MASK | BIST_ENABLE, bist_mode | BIST_ENABLE);
}

static irqreturn_t pdphy_msg_rx_irq(int irq, void *data)
{
	struct usb_pdphy *pdphy = data;

	pdphy->rx_busy = true;

	return IRQ_WAKE_THREAD;
}

static irqreturn_t pdphy_msg_rx_irq_thread(int irq, void *data)
{
	u8 size, rx_status, frame_type;
@@ -733,7 +723,6 @@ static irqreturn_t pdphy_msg_rx_irq_thread(int irq, void *data)
		false);
	pdphy->rx_bytes += size + 1;
done:
	pdphy->rx_busy = false;
	return IRQ_HANDLED;
}

@@ -819,7 +808,7 @@ static int pdphy_probe(struct platform_device *pdev)
		return ret;

	ret = pdphy_request_irq(pdphy, pdev->dev.of_node,
		&pdphy->msg_rx_irq, "msg-rx", pdphy_msg_rx_irq,
		&pdphy->msg_rx_irq, "msg-rx", NULL,
		pdphy_msg_rx_irq_thread, (IRQF_TRIGGER_RISING | IRQF_ONESHOT));
	if (ret < 0)
		return ret;