#ifndef INTEL_WAKEREF_H
#define INTEL_WAKEREF_H
#include <drm/drm_print.h>
#include <linux/atomic.h>
#include <linux/bitfield.h>
#include <linux/bits.h>
#include <linux/lockdep.h>
#include <linux/mutex.h>
#include <linux/refcount.h>
#include <linux/ref_tracker.h>
#include <linux/slab.h>
#include <linux/stackdepot.h>
#include <linux/timer.h>
#include <linux/workqueue.h>
intel_wakeref_t;
#define INTEL_REFTRACK_DEAD_COUNT …
#define INTEL_REFTRACK_PRINT_LIMIT …
#if IS_ENABLED(CONFIG_DRM_I915_DEBUG)
#define INTEL_WAKEREF_BUG_ON …
#else
#define INTEL_WAKEREF_BUG_ON(expr) …
#endif
struct intel_runtime_pm;
struct intel_wakeref;
struct intel_wakeref_ops { … };
struct intel_wakeref { … };
struct intel_wakeref_lockclass { … };
void __intel_wakeref_init(struct intel_wakeref *wf,
struct drm_i915_private *i915,
const struct intel_wakeref_ops *ops,
struct intel_wakeref_lockclass *key,
const char *name);
#define intel_wakeref_init(wf, i915, ops, name) …
int __intel_wakeref_get_first(struct intel_wakeref *wf);
void __intel_wakeref_put_last(struct intel_wakeref *wf, unsigned long flags);
static inline int
intel_wakeref_get(struct intel_wakeref *wf)
{ … }
static inline void
__intel_wakeref_get(struct intel_wakeref *wf)
{ … }
static inline bool
intel_wakeref_get_if_active(struct intel_wakeref *wf)
{ … }
enum { … };
static inline void
intel_wakeref_might_get(struct intel_wakeref *wf)
{ … }
static inline void
__intel_wakeref_put(struct intel_wakeref *wf, unsigned long flags)
#define INTEL_WAKEREF_PUT_ASYNC BIT(INTEL_WAKEREF_PUT_ASYNC_BIT)
#define INTEL_WAKEREF_PUT_DELAY \
GENMASK(BITS_PER_LONG - 1, __INTEL_WAKEREF_PUT_LAST_BIT__)
{ … }
static inline void
intel_wakeref_put(struct intel_wakeref *wf)
{ … }
static inline void
intel_wakeref_put_async(struct intel_wakeref *wf)
{ … }
static inline void
intel_wakeref_put_delay(struct intel_wakeref *wf, unsigned long delay)
{ … }
static inline void
intel_wakeref_might_put(struct intel_wakeref *wf)
{ … }
static inline void
intel_wakeref_lock(struct intel_wakeref *wf)
__acquires(wf->mutex)
{ … }
static inline void
intel_wakeref_unlock(struct intel_wakeref *wf)
__releases(wf->mutex)
{ … }
static inline void
intel_wakeref_unlock_wait(struct intel_wakeref *wf)
{ … }
static inline bool
intel_wakeref_is_active(const struct intel_wakeref *wf)
{ … }
static inline void
__intel_wakeref_defer_park(struct intel_wakeref *wf)
{ … }
int intel_wakeref_wait_for_idle(struct intel_wakeref *wf);
#define INTEL_WAKEREF_DEF …
static inline intel_wakeref_t intel_ref_tracker_alloc(struct ref_tracker_dir *dir)
{ … }
static inline void intel_ref_tracker_free(struct ref_tracker_dir *dir,
intel_wakeref_t handle)
{ … }
void intel_ref_tracker_show(struct ref_tracker_dir *dir,
struct drm_printer *p);
#if IS_ENABLED(CONFIG_DRM_I915_DEBUG_WAKEREF)
static inline intel_wakeref_t intel_wakeref_track(struct intel_wakeref *wf)
{ … }
static inline void intel_wakeref_untrack(struct intel_wakeref *wf,
intel_wakeref_t handle)
{ … }
#else
static inline intel_wakeref_t intel_wakeref_track(struct intel_wakeref *wf)
{
return -1;
}
static inline void intel_wakeref_untrack(struct intel_wakeref *wf,
intel_wakeref_t handle)
{
}
#endif
struct intel_wakeref_auto { … };
void intel_wakeref_auto(struct intel_wakeref_auto *wf, unsigned long timeout);
void intel_wakeref_auto_init(struct intel_wakeref_auto *wf,
struct drm_i915_private *i915);
void intel_wakeref_auto_fini(struct intel_wakeref_auto *wf);
#endif