.. | .. |
---|
128 | 128 | |
---|
129 | 129 | /* Wakelocks */ |
---|
130 | 130 | #if defined(CONFIG_HAS_WAKELOCK) |
---|
131 | | - struct wakeup_source wl_wifi; /* Wifi wakelock */ |
---|
132 | | - struct wakeup_source wl_rxwake; /* Wifi rx wakelock */ |
---|
133 | | - struct wakeup_source wl_ctrlwake; /* Wifi ctrl wakelock */ |
---|
134 | | - struct wakeup_source wl_wdwake; /* Wifi wd wakelock */ |
---|
135 | | - struct wakeup_source wl_evtwake; /* Wifi event wakelock */ |
---|
136 | | - struct wakeup_source wl_pmwake; /* Wifi pm handler wakelock */ |
---|
137 | | - struct wakeup_source wl_txflwake; /* Wifi tx flow wakelock */ |
---|
| 131 | + struct wakeup_source *wl_wifi; /* Wifi wakelock */ |
---|
| 132 | + struct wakeup_source *wl_rxwake; /* Wifi rx wakelock */ |
---|
| 133 | + struct wakeup_source *wl_ctrlwake; /* Wifi ctrl wakelock */ |
---|
| 134 | + struct wakeup_source *wl_wdwake; /* Wifi wd wakelock */ |
---|
| 135 | + struct wakeup_source *wl_evtwake; /* Wifi event wakelock */ |
---|
| 136 | + struct wakeup_source *wl_pmwake; /* Wifi pm handler wakelock */ |
---|
| 137 | + struct wakeup_source *wl_txflwake; /* Wifi tx flow wakelock */ |
---|
138 | 138 | #ifdef BCMPCIE_OOB_HOST_WAKE |
---|
139 | | - struct wakeup_source wl_intrwake; /* Host wakeup wakelock */ |
---|
| 139 | + struct wakeup_source *wl_intrwake; /* Host wakeup wakelock */ |
---|
140 | 140 | #endif /* BCMPCIE_OOB_HOST_WAKE */ |
---|
141 | 141 | #ifdef DHD_USE_SCAN_WAKELOCK |
---|
142 | | - struct wakeup_source wl_scanwake; /* Wifi scan wakelock */ |
---|
| 142 | + struct wakeup_source *wl_scanwake; /* Wifi scan wakelock */ |
---|
143 | 143 | #endif /* DHD_USE_SCAN_WAKELOCK */ |
---|
144 | | - struct wakeup_source wl_nanwake; /* NAN wakelock */ |
---|
| 144 | + struct wakeup_source *wl_nanwake; /* NAN wakelock */ |
---|
145 | 145 | #endif /* CONFIG_HAS_WAKELOCK */ |
---|
146 | 146 | |
---|
147 | 147 | #if defined(OEM_ANDROID) |
---|
.. | .. |
---|
501 | 501 | extern uint fis_enab; |
---|
502 | 502 | #endif /* DHD_SSSR_DUMP */ |
---|
503 | 503 | |
---|
| 504 | +#if defined(ANDROID_VERSION) && (LINUX_VERSION_CODE >= KERNEL_VERSION(4, 19, 0)) |
---|
| 505 | +#define WAKELOCK_BACKPORT |
---|
| 506 | +#endif |
---|
| 507 | + |
---|
504 | 508 | #ifdef CONFIG_HAS_WAKELOCK |
---|
505 | | -enum { |
---|
506 | | - WAKE_LOCK_SUSPEND, /* Prevent suspend */ |
---|
507 | | - WAKE_LOCK_TYPE_COUNT |
---|
508 | | -}; |
---|
509 | | -#define dhd_wake_lock_init(wakeup_source, type, name) wakeup_source_add(wakeup_source) |
---|
510 | | -#define dhd_wake_lock_destroy(wakeup_source) wakeup_source_remove(wakeup_source) |
---|
| 509 | +#if ((LINUX_VERSION_CODE >= KERNEL_VERSION(5, 4, 0)) || defined(WAKELOCK_BACKPORT)) |
---|
| 510 | +#define dhd_wake_lock_init(wakeup_source, dev, name) \ |
---|
| 511 | +do { \ |
---|
| 512 | + wakeup_source = wakeup_source_register(dev, name); \ |
---|
| 513 | +} while (0); |
---|
| 514 | +#else |
---|
| 515 | +#define dhd_wake_lock_init(wakeup_source, dev, name) \ |
---|
| 516 | +do { \ |
---|
| 517 | + wakeup_source = wakeup_source_register(name); \ |
---|
| 518 | +} while (0); |
---|
| 519 | +#endif /* LINUX_VERSION >= 5.4.0 */ |
---|
| 520 | +#define dhd_wake_lock_destroy(wakeup_source) \ |
---|
| 521 | +do { \ |
---|
| 522 | + wakeup_source_unregister(wakeup_source); \ |
---|
| 523 | +} while (0); |
---|
511 | 524 | #define dhd_wake_lock(wakeup_source) __pm_stay_awake(wakeup_source) |
---|
512 | 525 | #define dhd_wake_unlock(wakeup_source) __pm_relax(wakeup_source) |
---|
513 | | -#define dhd_wake_lock_active(wakeup_source) ((wakeup_source)->active) |
---|
| 526 | +#define dhd_wake_lock_active(wakeup_source) ((wakeup_source)?((wakeup_source)->active):0) |
---|
514 | 527 | #define dhd_wake_lock_timeout(wakeup_source, timeout) \ |
---|
515 | 528 | __pm_wakeup_event(wakeup_source, jiffies_to_msecs(timeout)) |
---|
516 | 529 | #endif /* CONFIG_HAS_WAKELOCK */ |
---|