diff options
author | Victor Hsu <hsuvictor@google.com> | 2022-04-09 06:47:14 +0000 |
---|---|---|
committer | Victor Hsu <hsuvictor@google.com> | 2022-04-09 15:08:18 +0000 |
commit | 88f2e5ee91325812e4afed47005830105531d47b (patch) | |
tree | 4027c025186bf8fc851b399bee4a1987f3b0c02b | |
parent | 3042f9ced742e22d4167635a394360b6cd46716e (diff) | |
download | cnss2-88f2e5ee91325812e4afed47005830105531d47b.tar.gz |
wlan: Enable and disable L1SS during suspend/resume
exynos_pcie_rc_l1ss_ctrl() is called to control
the L1SS disabled or enabled during suspend and resume.
Bug: 228662944
Test: Ensure L1SS disabled and enabled st suspend/resume
Signed-off-by: Victor Hsu <hsuvictor@google.com>
Change-Id: Iddc4b9c18f9d8f83b8c3c3fbaa91bbcfc4dc4752
-rw-r--r-- | cnss2/pci.c | 17 | ||||
-rw-r--r-- | cnss2/pci_platform_google.c | 48 |
2 files changed, 56 insertions, 9 deletions
diff --git a/cnss2/pci.c b/cnss2/pci.c index ba82855..48d6d50 100644 --- a/cnss2/pci.c +++ b/cnss2/pci.c @@ -555,6 +555,8 @@ static struct cnss_misc_reg syspm_reg_access_seq[] = { #if IS_ENABLED(CONFIG_WCN_GOOGLE) extern void crash_info_handler(u8 *info); +extern int exynos_pci_prevent_l1(struct device *dev); +extern void exynos_pci_allow_l1(struct device *dev); #endif //CONFIG_WCN_GOOGLE #if IS_ENABLED(CONFIG_MHI_BUS_MISC) @@ -3057,8 +3059,8 @@ static int cnss_pci_suspend(struct device *dev) } } -#if CONFIG_WCN_GOOGLE - //exynos_pcie_rc_l1ss_ctrl(0, PCIE_L1SS_CTRL_WIFI, GOOGLE_RC_ID); +#if IS_ENABLED(CONFIG_WCN_GOOGLE) + exynos_pci_prevent_l1(dev); #endif set_bit(CNSS_IN_SUSPEND_RESUME, &plat_priv->driver_state); @@ -3084,8 +3086,8 @@ resume_driver: clear_flag: pci_priv->drv_connected_last = 0; clear_bit(CNSS_IN_SUSPEND_RESUME, &plat_priv->driver_state); -#if CONFIG_WCN_GOOGLE - //exynos_pcie_rc_l1ss_ctrl(1, PCIE_L1SS_CTRL_WIFI, GOOGLE_RC_ID); +#if IS_ENABLED(CONFIG_WCN_GOOGLE) + exynos_pci_allow_l1(dev); #endif out: return ret; @@ -3121,8 +3123,8 @@ static int cnss_pci_resume(struct device *dev) pci_priv->drv_connected_last = 0; clear_bit(CNSS_IN_SUSPEND_RESUME, &plat_priv->driver_state); -#if CONFIG_WCN_GOOGLE - //exynos_pcie_rc_l1ss_ctrl(1, PCIE_L1SS_CTRL_WIFI, GOOGLE_RC_ID); +#if IS_ENABLED(CONFIG_WCN_GOOGLE) + exynos_pci_allow_l1(dev); #endif out: @@ -5443,9 +5445,6 @@ static int cnss_pci_probe(struct pci_dev *pci_dev, cnss_pr_dbg("PCI is probing, vendor ID: 0x%x, device ID: 0x%x\n", id->vendor, pci_dev->device); -#if CONFIG_WCN_GOOGLE - //exynos_pcie_rc_l1ss_ctrl(0, PCIE_L1SS_CTRL_WIFI, GOOGLE_RC_ID); -#endif pci_priv = devm_kzalloc(dev, sizeof(*pci_priv), GFP_KERNEL); if (!pci_priv) { 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); +} |