1 /* SPDX-License-Identifier: GPL-2.0-only */
2 /*
3 * Rockchip PCIe Apis For WIFI
4 *
5 * Copyright (c) 2022, Rockchip Electronics Co., Ltd.
6 */
7
8 #ifndef __RK_DHD_PCIE_LINUX_H__
9 #define __RK_DHD_PCIE_LINUX_H__
10
11 #include <typedefs.h>
12 #include <sbchipc.h>
13 #include <pcie_core.h>
14 #include <dhd_pcie.h>
15 #include <linux/aspm_ext.h>
16
17 static inline void
rk_dhd_bus_l1ss_enable_rc_ep(dhd_bus_t * bus,bool enable)18 rk_dhd_bus_l1ss_enable_rc_ep(dhd_bus_t *bus, bool enable)
19 {
20 if (!bus->rc_ep_aspm_cap || !bus->rc_ep_l1ss_cap) {
21 pr_err("%s: NOT L1SS CAPABLE rc_ep_aspm_cap: %d rc_ep_l1ss_cap: %d\n",
22 __func__, bus->rc_ep_aspm_cap, bus->rc_ep_l1ss_cap);
23 return;
24 }
25
26 /* Disable ASPM of RC and EP */
27 pcie_aspm_ext_l1ss_enable(bus->dev, bus->rc_dev, enable);
28 }
29
30 static inline bool
rk_dhd_bus_is_rc_ep_l1ss_capable(dhd_bus_t * bus)31 rk_dhd_bus_is_rc_ep_l1ss_capable(dhd_bus_t *bus)
32 {
33 return pcie_aspm_ext_is_rc_ep_l1ss_capable(bus->dev, bus->rc_dev);
34 }
35
36 #endif /* __RK_DHD_PCIE_LINUX_H__ */
37