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

Commit 099d24de authored by Huashan Qu's avatar Huashan Qu
Browse files

cnss2: Check CNSS_MHI_POWER_OFF state in cnss_pci_suspend_bus()



In the process of idle shutdown, cnss_pci_power_off_mhi()
already done with CNSS_MHI_POWER_OFF state set, but
cnss_suspend_pci_link() doesn't complete yet, so PCI_LINK_DOWN
won't be set, at the same time system suspend comes, it will be
failed with CNSS_MHI_SUSPEND state set checking at
cnss_pci_suspend_bus()/cnss_pci_set_mhi_state().

When mhi state is already CNSS_MHI_POWER_OFF,  no need to do pci
suspend link related operation while such actions also will be done
through cnss_qca6290_shutdown()/cnss_suspend_pci_link(). Fix is to
check CNSS_MHI_POWER_OFF state in cnss_pci_suspend_bus().

Change-Id: I2e03dffdc29b5c9743209cbd29c16345d414af35
Signed-off-by: default avatarHuashan Qu <hqu@codeaurora.org>
parent 95755ee9
Loading
Loading
Loading
Loading
+5 −1
Original line number Diff line number Diff line
@@ -1569,12 +1569,15 @@ static void cnss_pci_set_mhi_state_bit(struct cnss_pci_data *pci_priv,
		clear_bit(CNSS_MHI_INIT, &pci_priv->mhi_state);
		break;
	case CNSS_MHI_POWER_ON:
		clear_bit(CNSS_MHI_POWER_OFF, &pci_priv->mhi_state);
		set_bit(CNSS_MHI_POWER_ON, &pci_priv->mhi_state);
		break;
	case CNSS_MHI_POWERING_OFF:
		set_bit(CNSS_MHI_POWERING_OFF, &pci_priv->mhi_state);
		break;
	case CNSS_MHI_POWER_OFF:
		set_bit(CNSS_MHI_POWER_OFF, &pci_priv->mhi_state);
		fallthrough;
	case CNSS_MHI_FORCE_POWER_OFF:
		clear_bit(CNSS_MHI_POWER_ON, &pci_priv->mhi_state);
		clear_bit(CNSS_MHI_POWERING_OFF, &pci_priv->mhi_state);
@@ -3025,7 +3028,8 @@ int cnss_pci_suspend_bus(struct cnss_pci_data *pci_priv)
	struct pci_dev *pci_dev = pci_priv->pci_dev;
	int ret = 0;

	if (pci_priv->pci_link_state == PCI_LINK_DOWN)
	if (pci_priv->pci_link_state == PCI_LINK_DOWN ||
	    test_bit(CNSS_MHI_POWER_OFF, &pci_priv->mhi_state))
		goto out;

	if (cnss_pci_set_mhi_state(pci_priv, CNSS_MHI_SUSPEND)) {