diff options
Diffstat (limited to 'cnss2/pci_platform_google.c')
-rw-r--r-- | cnss2/pci_platform_google.c | 48 |
1 files changed, 48 insertions, 0 deletions
diff --git a/cnss2/pci_platform_google.c b/cnss2/pci_platform_google.c index 44d0638..0585ceb 100644 --- a/cnss2/pci_platform_google.c +++ b/cnss2/pci_platform_google.c @@ -269,3 +269,51 @@ void crash_info_handler(u8 *info) strncpy(crash_info, info, string_len); crash_info[string_len] = '\0'; } + +int exynos_pci_prevent_l1(struct device *dev) +{ + struct pci_dev *pci_dev = to_pci_dev(dev); + struct cnss_pci_data *pci_priv = cnss_get_pci_priv(pci_dev); + int ret; + + if (!pci_priv) { + cnss_pr_err("pci_priv is NULL\n"); + return -ENODEV; + } + + if (pci_priv->pci_link_state == PCI_LINK_DOWN) { + cnss_pr_err("PCIe link is in suspend state\n"); + return -EIO; + } + + if (pci_priv->pci_link_down_ind) { + cnss_pr_err("PCIe link is down\n"); + return -EIO; + } + + ret = exynos_pcie_rc_l1ss_ctrl(0, PCIE_L1SS_CTRL_WIFI, pci_priv->plat_priv->rc_num); + return ret; +} + +void exynos_pci_allow_l1(struct device *dev) +{ + struct pci_dev *pci_dev = to_pci_dev(dev); + struct cnss_pci_data *pci_priv = cnss_get_pci_priv(pci_dev); + + if (!pci_priv) { + cnss_pr_err("pci_priv is NULL\n"); + return; + } + + if (pci_priv->pci_link_state == PCI_LINK_DOWN) { + cnss_pr_dbg("PCIe link is in suspend state\n"); + return; + } + + if (pci_priv->pci_link_down_ind) { + cnss_pr_err("PCIe link is down\n"); + return; + } + + exynos_pcie_rc_l1ss_ctrl(1, PCIE_L1SS_CTRL_WIFI, pci_priv->plat_priv->rc_num); +} |