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

Commit 667e0236 authored by Yuanyuan Liu's avatar Yuanyuan Liu
Browse files

cnss: Record modem power status and notify when wlan is up



FW needs to know modem power status before accessing the
shared gpio. Cnss driver is responsible for subscribing
SSR modem status and informing FW through wlan host driver.
Currently, if cnss driver receives SSR notification
while wlan is off, it discards the message, which causes
asynchrony between FW and modem.
This change is to solve the above problem by recording modem
power status in cnss when wlan is off and sending the most
recent modem power status to wlan as soon as it is turned on.

Change-Id: Ia4ee77364e402d1e6cca9dd62b8b611e9cbb760d
Signed-off-by: default avatarYuanyuan Liu <yuanliu@codeaurora.org>
CRs-Fixed: 625634
parent 773c2fbd
Loading
Loading
Loading
Loading
+13 −4
Original line number Diff line number Diff line
@@ -92,6 +92,7 @@ static struct cnss_data {
	struct pm_qos_request qos_request;
	void *modem_notify_handler;
	bool pci_register_again;
	int modem_current_status;
} *penv;

static int cnss_wlan_vreg_set(struct cnss_wlan_vreg_info *vreg_info, bool state)
@@ -491,6 +492,9 @@ int cnss_wlan_register_driver(struct cnss_wlan_driver *driver)
		}
	}

	if (pdev && wdrv->modem_status)
		wdrv->modem_status(pdev, penv->modem_current_status);

	return ret;

err_wlan_probe:
@@ -876,16 +880,20 @@ static int cnss_modem_notifier_nb(struct notifier_block *this,
	if (!penv)
		return NOTIFY_DONE;

	if (SUBSYS_AFTER_POWERUP == code)
		penv->modem_current_status = 1;
	else if (SUBSYS_BEFORE_SHUTDOWN == code)
		penv->modem_current_status = 0;
	else
		return NOTIFY_DONE;

	wdrv = penv->driver;
	pdev = penv->pdev;

	if (!wdrv || !pdev || !wdrv->modem_status)
		return NOTIFY_DONE;

	if (SUBSYS_AFTER_POWERUP == code)
		wdrv->modem_status(pdev, 1);
	else if (SUBSYS_BEFORE_SHUTDOWN == code)
		wdrv->modem_status(pdev, 0);
	wdrv->modem_status(pdev, penv->modem_current_status);

	return NOTIFY_OK;
}
@@ -920,6 +928,7 @@ static int cnss_probe(struct platform_device *pdev)
		goto err_subsys_reg;
	}

	penv->modem_current_status = 0;
	penv->modem_notify_handler =
		subsys_notif_register_notifier(MODEM_NAME, &mnb);
	if (IS_ERR(penv->modem_notify_handler)) {