18c2ecf20Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0-only */
28c2ecf20Sopenharmony_ci/*
38c2ecf20Sopenharmony_ci * Mac80211 power management interface for ST-Ericsson CW1200 mac80211 drivers
48c2ecf20Sopenharmony_ci *
58c2ecf20Sopenharmony_ci * Copyright (c) 2011, ST-Ericsson
68c2ecf20Sopenharmony_ci * Author: Dmitry Tarnyagin <dmitry.tarnyagin@lockless.no>
78c2ecf20Sopenharmony_ci */
88c2ecf20Sopenharmony_ci
98c2ecf20Sopenharmony_ci#ifndef PM_H_INCLUDED
108c2ecf20Sopenharmony_ci#define PM_H_INCLUDED
118c2ecf20Sopenharmony_ci
128c2ecf20Sopenharmony_ci/* ******************************************************************** */
138c2ecf20Sopenharmony_ci/* mac80211 API								*/
148c2ecf20Sopenharmony_ci
158c2ecf20Sopenharmony_ci/* extern */  struct cw1200_common;
168c2ecf20Sopenharmony_ci/* private */ struct cw1200_suspend_state;
178c2ecf20Sopenharmony_ci
188c2ecf20Sopenharmony_cistruct cw1200_pm_state {
198c2ecf20Sopenharmony_ci	struct cw1200_suspend_state *suspend_state;
208c2ecf20Sopenharmony_ci	struct timer_list stay_awake;
218c2ecf20Sopenharmony_ci	struct platform_device *pm_dev;
228c2ecf20Sopenharmony_ci	spinlock_t lock; /* Protect access */
238c2ecf20Sopenharmony_ci};
248c2ecf20Sopenharmony_ci
258c2ecf20Sopenharmony_ci#ifdef CONFIG_PM
268c2ecf20Sopenharmony_ciint cw1200_pm_init(struct cw1200_pm_state *pm,
278c2ecf20Sopenharmony_ci		    struct cw1200_common *priv);
288c2ecf20Sopenharmony_civoid cw1200_pm_deinit(struct cw1200_pm_state *pm);
298c2ecf20Sopenharmony_ciint cw1200_wow_suspend(struct ieee80211_hw *hw,
308c2ecf20Sopenharmony_ci		       struct cfg80211_wowlan *wowlan);
318c2ecf20Sopenharmony_ciint cw1200_can_suspend(struct cw1200_common *priv);
328c2ecf20Sopenharmony_ciint cw1200_wow_resume(struct ieee80211_hw *hw);
338c2ecf20Sopenharmony_civoid cw1200_pm_stay_awake(struct cw1200_pm_state *pm,
348c2ecf20Sopenharmony_ci			  unsigned long tmo);
358c2ecf20Sopenharmony_ci#else
368c2ecf20Sopenharmony_cistatic inline void cw1200_pm_stay_awake(struct cw1200_pm_state *pm,
378c2ecf20Sopenharmony_ci					unsigned long tmo)
388c2ecf20Sopenharmony_ci{
398c2ecf20Sopenharmony_ci}
408c2ecf20Sopenharmony_cistatic inline int cw1200_can_suspend(struct cw1200_common *priv)
418c2ecf20Sopenharmony_ci{
428c2ecf20Sopenharmony_ci	return 0;
438c2ecf20Sopenharmony_ci}
448c2ecf20Sopenharmony_ci#endif
458c2ecf20Sopenharmony_ci#endif
46