|
@@ -5789,6 +5789,48 @@ static struct dev_pm_domain cnss_pm_domain = {
|
|
|
}
|
|
|
};
|
|
|
|
|
|
+#ifdef CONFIG_CNSS2_CONDITIONAL_POWEROFF
|
|
|
+static bool cnss_should_suspend_pwroff(struct pci_dev *pci_dev)
|
|
|
+{
|
|
|
+ bool suspend_pwroff;
|
|
|
+
|
|
|
+ switch (pci_dev->device) {
|
|
|
+ case QCA6390_DEVICE_ID:
|
|
|
+ case QCA6490_DEVICE_ID:
|
|
|
+ suspend_pwroff = false;
|
|
|
+ break;
|
|
|
+ default:
|
|
|
+ suspend_pwroff = true;
|
|
|
+ }
|
|
|
+
|
|
|
+ return suspend_pwroff;
|
|
|
+}
|
|
|
+#else
|
|
|
+static bool cnss_should_suspend_pwroff(struct pci_dev *pci_dev)
|
|
|
+{
|
|
|
+ return true;
|
|
|
+}
|
|
|
+#endif
|
|
|
+
|
|
|
+static void cnss_pci_suspend_pwroff(struct pci_dev *pci_dev)
|
|
|
+{
|
|
|
+ struct cnss_pci_data *pci_priv = cnss_get_pci_priv(pci_dev);
|
|
|
+ struct cnss_plat_data *plat_priv = cnss_bus_dev_to_plat_priv(NULL);
|
|
|
+ int ret = 0;
|
|
|
+ bool suspend_pwroff = cnss_should_suspend_pwroff(pci_dev);
|
|
|
+
|
|
|
+ if (suspend_pwroff) {
|
|
|
+ ret = cnss_suspend_pci_link(pci_priv);
|
|
|
+ if (ret)
|
|
|
+ cnss_pr_err("Failed to suspend PCI link, err = %d\n",
|
|
|
+ ret);
|
|
|
+ cnss_power_off_device(plat_priv);
|
|
|
+ } else {
|
|
|
+ cnss_pr_dbg("bus suspend and dev power off disabled for device [0x%x]\n",
|
|
|
+ pci_dev->device);
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
static int cnss_pci_probe(struct pci_dev *pci_dev,
|
|
|
const struct pci_device_id *id)
|
|
|
{
|
|
@@ -5881,10 +5923,7 @@ static int cnss_pci_probe(struct pci_dev *pci_dev,
|
|
|
cnss_pci_config_regs(pci_priv);
|
|
|
if (EMULATION_HW)
|
|
|
goto out;
|
|
|
- ret = cnss_suspend_pci_link(pci_priv);
|
|
|
- if (ret)
|
|
|
- cnss_pr_err("Failed to suspend PCI link, err = %d\n", ret);
|
|
|
- cnss_power_off_device(plat_priv);
|
|
|
+ cnss_pci_suspend_pwroff(pci_dev);
|
|
|
set_bit(CNSS_PCI_PROBE_DONE, &plat_priv->driver_state);
|
|
|
|
|
|
return 0;
|