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

Commit ccc80175 authored by Linux Build Service Account's avatar Linux Build Service Account Committed by Gerrit - the friendly Code Review server
Browse files

Merge "cnss: Add support to synchronize request_firmware() with suspend/resume"

parents 9f80a737 176a6ced
Loading
Loading
Loading
Loading
+40 −0
Original line number Diff line number Diff line
@@ -32,6 +32,8 @@
#include <soc/qcom/ramdump.h>
#include <linux/msm-bus.h>
#include <linux/msm-bus-board.h>
#include <linux/suspend.h>
#include <linux/rwsem.h>
#ifdef CONFIG_PCI_MSM
#include <linux/msm_pcie.h>
#else
@@ -715,6 +717,28 @@ out:
	return ret;
}

static DECLARE_RWSEM(cnss_pm_sem);

static int cnss_pm_notify(struct notifier_block *b,
			unsigned long event, void *p)
{
	switch (event) {
	case PM_SUSPEND_PREPARE:
		down_write(&cnss_pm_sem);
		break;

	case PM_POST_SUSPEND:
		up_write(&cnss_pm_sem);
		break;
	}

	return NOTIFY_DONE;
}

static struct notifier_block cnss_pm_notifier = {
	.notifier_call = cnss_pm_notify,
};

static DEFINE_PCI_DEVICE_TABLE(cnss_wlan_pci_id_table) = {
	{ QCA6174_VENDOR_ID, QCA6174_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID },
	{ 0 }
@@ -1087,6 +1111,18 @@ int cnss_wlan_pm_control(bool vote)
EXPORT_SYMBOL(cnss_wlan_pm_control);
#endif

void cnss_lock_pm_sem(void)
{
	down_read(&cnss_pm_sem);
}
EXPORT_SYMBOL(cnss_lock_pm_sem);

void cnss_release_pm_sem(void)
{
	up_read(&cnss_pm_sem);
}
EXPORT_SYMBOL(cnss_release_pm_sem);

void cnss_flush_work(void *work)
{
	struct work_struct *cnss_work = work;
@@ -1541,6 +1577,8 @@ static int cnss_probe(struct platform_device *pdev)
	}
	cnss_pm_wake_lock_init(&penv->ws, "cnss_wlock");

	register_pm_notifier(&cnss_pm_notifier);

#ifdef CONFIG_CNSS_MAC_BUG
	/* 0-4K memory is reserved for QCA6174 to address a MAC HW bug.
	 * MAC would do an invalid pointer fetch based on the data
@@ -1591,6 +1629,8 @@ static int cnss_remove(struct platform_device *pdev)
	struct cnss_wlan_vreg_info *vreg_info = &penv->vreg_info;
	struct cnss_wlan_gpio_info *gpio_info = &penv->gpio_info;

	unregister_pm_notifier(&cnss_pm_notifier);

	cnss_pm_wake_lock_destroy(&penv->ws);

	kfree(penv->dfs_nol_info);
+2 −0
Original line number Diff line number Diff line
@@ -99,6 +99,8 @@ extern void cnss_pm_wake_lock_destroy(struct wakeup_source *ws);
#ifdef CONFIG_PCI_MSM
extern int cnss_wlan_pm_control(bool vote);
#endif
extern void cnss_lock_pm_sem(void);
extern void cnss_release_pm_sem(void);

extern int cnss_set_cpus_allowed_ptr(struct task_struct *task, ulong cpu);
extern void cnss_request_pm_qos(u32 qos_val);